From 1114fcce4e4eb434c5944e7f4aa438305473abc6 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 27 Jul 2010 12:46:33 +0200 Subject: [PATCH 1/6] Changed software version to 1.9.80 --- include/Nebula.h | 2 +- src/cli/command_parse.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Nebula.h b/include/Nebula.h index d3baf79f70..e44038cef8 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -203,7 +203,7 @@ public: static string version() { - return "OpenNebula 1.5.0"; + return "OpenNebula 1.9.80"; }; void start(); diff --git a/src/cli/command_parse.rb b/src/cli/command_parse.rb index f3f55ee4cd..67bc4c1d91 100644 --- a/src/cli/command_parse.rb +++ b/src/cli/command_parse.rb @@ -31,7 +31,7 @@ Options: EOT ONE_VERSION=<<-EOT -OpenNebula 1.5.0 +OpenNebula 1.9.80 Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) EOT From 77167a11df24ab91d75d1b809334b86eb3580827 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 27 Jul 2010 15:02:41 +0200 Subject: [PATCH 2/6] Delete duplicated functionality from oneauth --- src/authm_mad/oneauth | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/authm_mad/oneauth b/src/authm_mad/oneauth index b01875aa55..1f3d39c6f3 100755 --- a/src/authm_mad/oneauth +++ b/src/authm_mad/oneauth @@ -46,9 +46,6 @@ Usage: Commands: -* create (Creates a new user) - oneauth create - * quota set (sets quota for a user) oneauth quota set @@ -116,17 +113,6 @@ when "login" ssh=SshAuth.new ssh.login(user, time) -when "create" - user=OpenNebula::User.new( - OpenNebula::User.build_xml, OpenNebula::Client.new) - password = ARGV[1] - - result=user.allocate(ARGV[0], password) - if !OpenNebula.is_error?(result) - puts "ID: " + user.id.to_s - exit 0 - end - when "key" ssh=SshAuth.new puts ssh.extract_public_key From d95647fbe604b370a8aebf5eaa710480edcf06d5 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 27 Jul 2010 15:44:05 +0200 Subject: [PATCH 3/6] Code documentation(cherry picked from commit 95743329837537136f45f0c8ab666ce2b3d060bd) --- src/authm_mad/one_auth_mad.rb | 1 + src/authm_mad/simple_auth.rb | 2 +- src/authm_mad/simple_permissions.rb | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/authm_mad/one_auth_mad.rb b/src/authm_mad/one_auth_mad.rb index 1c936ca0d2..6832e7cafc 100755 --- a/src/authm_mad/one_auth_mad.rb +++ b/src/authm_mad/one_auth_mad.rb @@ -51,6 +51,7 @@ class AuthorizationManager < OpenNebulaDriver database_url=@config[:database] @db=Sequel.connect(database_url) + # Get authentication driver begin driver_prefix=@config[:authentication].capitalize driver_name="#{driver_prefix}Auth" diff --git a/src/authm_mad/simple_auth.rb b/src/authm_mad/simple_auth.rb index 4a07db3014..00bec0b3f5 100644 --- a/src/authm_mad/simple_auth.rb +++ b/src/authm_mad/simple_auth.rb @@ -19,7 +19,7 @@ class SimpleAuth # Method called by authentication driver. It should awnser true if # successful or a string with the error message if failure. All - # parameters are string extracted from the authorization message. + # parameters are strings extracted from the authorization message. # # * user_id: OpenNebula user identifier # * user: user name diff --git a/src/authm_mad/simple_permissions.rb b/src/authm_mad/simple_permissions.rb index 81862e302f..b055779230 100644 --- a/src/authm_mad/simple_permissions.rb +++ b/src/authm_mad/simple_permissions.rb @@ -9,10 +9,13 @@ class SimplePermissions @quota_enabled=conf[:quota][:enabled] end + # Returns message if result is false, true otherwise def auth_message(result, message) result ? true : message end + # Extracts cpu and memory resources from the VM template sent in + # authorization message def get_vm_usage(data) vm_xml=Base64::decode64(data) vm=OpenNebula::VirtualMachine.new( @@ -31,6 +34,7 @@ class SimplePermissions VmUsage.new(cpu, memory) end + # Method called by authorization driver def auth(uid, tokens) result=true @@ -43,6 +47,8 @@ class SimplePermissions result end + # Authorizes each of the tokens. All parameters are strings. Pub + # means public when "1" and private when "0" def auth_object(uid, object, id, action, owner, pub) return true if uid=='0' From 322e67df44a8df13da4fe5f8e8f3ecd33273538d Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Tue, 27 Jul 2010 15:46:40 +0200 Subject: [PATCH 4/6] fixed bugs in install.sh to improve package integration --- share/etc/{oned.conf => oned.conf.template} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename share/etc/{oned.conf => oned.conf.template} (100%) diff --git a/share/etc/oned.conf b/share/etc/oned.conf.template similarity index 100% rename from share/etc/oned.conf rename to share/etc/oned.conf.template From 2889bb48b274f2ecad8341b17e8ffe6c5b5a5956 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Tue, 27 Jul 2010 15:51:05 +0200 Subject: [PATCH 5/6] fixed more bugs for package integration --- install.sh | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/install.sh b/install.sh index 8dcd2a4298..a9172bdba4 100755 --- a/install.sh +++ b/install.sh @@ -35,7 +35,8 @@ usage() { echo "-g: group of the user that will run opennebula, defults to user" echo " executing install.sh" echo "-k: keep current configuration files, useful when upgrading" - echo "-d: target installation directory, if not defined it'd be root" + echo "-d: target installation directory, if not defined it'd be root. Must be" + echo " an absolute path." echo "-c: install only 'occi' or 'ec2' client files" echo "-r: remove Opennebula, only useful if -d was not specified, otherwise" echo " rm -rf \$ONE_LOCATION would do the job" @@ -578,6 +579,19 @@ if [ "$UNINSTALL" = "no" ] ; then done fi +# --- Prepare oned.conf --- + +if [ "$UNINSTALL" = "no" -a "$CLIENT" = "no" ]; then + TEMPLATE=share/etc/oned.conf.template + SOURCE=share/etc/oned.conf + cp $TEMPLATE $SOURCE + HOOKS_LOCATION=$SHARE_LOCATION/hooks + sed -i -e "s%\[HOOKS_LOCATION\]%$HOOKS_LOCATION%" \ + $SOURCE + sed -i -e "s%\[IMAGES_LOCATION\]%$IMAGES_LOCATION%" \ + $SOURCE +fi + # --- Install/Uninstall files --- do_file() { @@ -636,22 +650,14 @@ if [ "$UNINSTALL" = "no" ] ; then for d in $CHOWN_DIRS; do chown -R $ONEADMIN_USER:$ONEADMIN_GROUP $DESTDIR$d done + + # --- Set correct permissions for Image Repository --- + + if [ -d "$IMAGES_LOCATION" ]; then + chmod 3770 $IMAGES_LOCATION + fi else for d in `echo $DELETE_DIRS | awk '{for (i=NF;i>=1;i--) printf $i" "}'`; do rmdir $d done fi - -# --- Set correct permissions for Image Repository --- - -IMAGES_LOCATION=$(cd $IMAGES_LOCATION;pwd) -chmod 3770 $IMAGES_LOCATION - -# --- Substitute variables --- - -if [ "$CLIENT" = "no" -a $INSTALL_ETC="yes" ]; then - HOOKS_LOCATION=$(cd $SHARE_LOCATION/hooks;pwd) - sed -i -e "s%\[HOOKS_LOCATION\]%$HOOKS_LOCATION%" $ETC_LOCATION/oned.conf - sed -i -e "s%\[IMAGES_LOCATION\]%$IMAGES_LOCATION%" $ETC_LOCATION/oned.conf -fi - From d136f2626b18e500ea40ecb5970f1fdfc894aaf3 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 27 Jul 2010 16:29:27 +0200 Subject: [PATCH 6/6] Added OCA API Documentation (cherry picked from commit 4b298efd7dea137048124b8f57f93f894b67bed6) --- src/oca/ruby/OpenNebula/Cluster.rb | 12 ++++++++ src/oca/ruby/OpenNebula/ClusterPool.rb | 3 +- src/oca/ruby/OpenNebula/Host.rb | 14 +++++++++ src/oca/ruby/OpenNebula/HostPool.rb | 1 + src/oca/ruby/OpenNebula/Image.rb | 17 +++++++++++ src/oca/ruby/OpenNebula/ImagePool.rb | 1 + src/oca/ruby/OpenNebula/User.rb | 11 +++++++ src/oca/ruby/OpenNebula/UserPool.rb | 1 + src/oca/ruby/OpenNebula/VirtualMachine.rb | 29 +++++++++++++++++-- src/oca/ruby/OpenNebula/VirtualMachinePool.rb | 3 +- src/oca/ruby/OpenNebula/VirtualNetwork.rb | 9 +++++- src/oca/ruby/OpenNebula/VirtualNetworkPool.rb | 1 + 12 files changed, 97 insertions(+), 5 deletions(-) diff --git a/src/oca/ruby/OpenNebula/Cluster.rb b/src/oca/ruby/OpenNebula/Cluster.rb index 19a069b7f9..408e90afe8 100644 --- a/src/oca/ruby/OpenNebula/Cluster.rb +++ b/src/oca/ruby/OpenNebula/Cluster.rb @@ -42,18 +42,27 @@ module OpenNebula # --------------------------------------------------------------------- # XML-RPC Methods for the User Object # --------------------------------------------------------------------- + + # Retrieves the information of the given Cluster. def info() super(CLUSTER_METHODS[:info], 'CLUSTER') end + # Allocates a new Cluster in OpenNebula + # + # +clustername+ A string containing the name of the Cluster. def allocate(clustername) super(CLUSTER_METHODS[:allocate], clustername) end + # Deletes the Cluster def delete() super(CLUSTER_METHODS[:delete]) end + # Add a host to the cluster + # + # +host_id+ ID of the Host to be added to the Cluster def add_host(host_id) return Error.new('ID not defined') if !@pe_id @@ -63,6 +72,9 @@ module OpenNebula return rc end + # Remove a host from the cluster + # + # +host_id+ ID of the Host to be removed from the Cluster def remove_host(host_id) return Error.new('ID not defined') if !@pe_id diff --git a/src/oca/ruby/OpenNebula/ClusterPool.rb b/src/oca/ruby/OpenNebula/ClusterPool.rb index a1078c7875..561d84d0bc 100644 --- a/src/oca/ruby/OpenNebula/ClusterPool.rb +++ b/src/oca/ruby/OpenNebula/ClusterPool.rb @@ -27,7 +27,8 @@ module OpenNebula # --------------------------------------------------------------------- # XML-RPC Methods for the User Object # --------------------------------------------------------------------- - + + # Retrieves all the Clusters in the pool. def info() super(CLUSTER_POOL_METHODS[:info]) end diff --git a/src/oca/ruby/OpenNebula/Host.rb b/src/oca/ruby/OpenNebula/Host.rb index 50130d008a..1af58430db 100644 --- a/src/oca/ruby/OpenNebula/Host.rb +++ b/src/oca/ruby/OpenNebula/Host.rb @@ -52,22 +52,36 @@ module OpenNebula ####################################################################### # XML-RPC Methods for the Host ####################################################################### + + # Retrieves the information of the given Host. def info() super(HOST_METHODS[:info], 'HOST') end + # Allocates a new Host in OpenNebula + # + # +hostname+ A string containing the name of the new Host. + # + # +im+ A string containing the name of the im_driver + # + # +vmm+ A string containing the name of the vmm_driver + # + # +tm+ A string containing the name of the tm_driver def allocate(hostname,im,vmm,tm) super(HOST_METHODS[:allocate],hostname,im,vmm,tm) end + # Deletes the Host def delete() super(HOST_METHODS[:delete]) end + # Enables the Host def enable() set_enabled(true) end + # Disables the Host def disable() set_enabled(false) end diff --git a/src/oca/ruby/OpenNebula/HostPool.rb b/src/oca/ruby/OpenNebula/HostPool.rb index 2231b5b1f2..6e4d03da84 100644 --- a/src/oca/ruby/OpenNebula/HostPool.rb +++ b/src/oca/ruby/OpenNebula/HostPool.rb @@ -28,6 +28,7 @@ module OpenNebula # XML-RPC Methods for the Host Pool ####################################################################### + # Retrieves all the Hosts in the pool. def info() super(HOST_POOL_METHODS[:info]) end diff --git a/src/oca/ruby/OpenNebula/Image.rb b/src/oca/ruby/OpenNebula/Image.rb index 3942e8fbc8..74840da8ab 100644 --- a/src/oca/ruby/OpenNebula/Image.rb +++ b/src/oca/ruby/OpenNebula/Image.rb @@ -62,38 +62,55 @@ module OpenNebula # XML-RPC Methods for the Image Object ####################################################################### + # Retrieves the information of the given Image. def info() super(IMAGE_METHODS[:info], 'IMAGE') end + # Allocates a new Image in OpenNebula + # + # +description+ A string containing the template of the Image. def allocate(description) super(IMAGE_METHODS[:allocate],description) end + # Modifies an image attribute + # + # +name+ Name of the attribute to be changed + # + # +value+ New value for the attribute def update(name, value) super(IMAGE_METHODS[:update], name, value) end + # Deletes an Image attribute + # + # +name+ Name of the attribute to be deleted def remove_attr(name) do_rm_attr(name) end + # Enables an Image def enable set_enabled(true) end + # Disables an Image def disable set_enabled(false) end + # Publishes the Image, to be used by other users def publish set_publish(true) end + # Unplubishes the Image def unpublish set_publish(false) end + # Deletes the Image def delete() super(IMAGE_METHODS[:delete]) end diff --git a/src/oca/ruby/OpenNebula/ImagePool.rb b/src/oca/ruby/OpenNebula/ImagePool.rb index baa9127a62..58c962a701 100644 --- a/src/oca/ruby/OpenNebula/ImagePool.rb +++ b/src/oca/ruby/OpenNebula/ImagePool.rb @@ -31,6 +31,7 @@ module OpenNebula # XML-RPC Methods for the Image Object ####################################################################### + # Retrieves all or part of the Images in the pool. def info() super(IMAGE_POOL_METHODS[:info],@user_id) end diff --git a/src/oca/ruby/OpenNebula/User.rb b/src/oca/ruby/OpenNebula/User.rb index 17885ca16a..a444117498 100644 --- a/src/oca/ruby/OpenNebula/User.rb +++ b/src/oca/ruby/OpenNebula/User.rb @@ -41,18 +41,29 @@ module OpenNebula # --------------------------------------------------------------------- # XML-RPC Methods for the User Object # --------------------------------------------------------------------- + + # Retrieves the information of the given User. def info() super(USER_METHODS[:info], 'USER') end + # Allocates a new User in OpenNebula + # + # +username+ Name of the new user. + # + # +password+ Password for the new user def allocate(username, password) super(USER_METHODS[:allocate], username, password) end + # Deletes the User def delete() super(USER_METHODS[:delete]) end + # Changes the password of the given User + # + # +password+ String containing the new password def passwd(password) return Error.new('ID not defined') if !@pe_id diff --git a/src/oca/ruby/OpenNebula/UserPool.rb b/src/oca/ruby/OpenNebula/UserPool.rb index 1d84904c16..58bce9b618 100644 --- a/src/oca/ruby/OpenNebula/UserPool.rb +++ b/src/oca/ruby/OpenNebula/UserPool.rb @@ -28,6 +28,7 @@ module OpenNebula # XML-RPC Methods for the User Object # --------------------------------------------------------------------- + # Retrieves all the Users in the pool. def info() super(USER_POOL_METHODS[:info]) end diff --git a/src/oca/ruby/OpenNebula/VirtualMachine.rb b/src/oca/ruby/OpenNebula/VirtualMachine.rb index 1378cb50a7..e9dc245ff0 100644 --- a/src/oca/ruby/OpenNebula/VirtualMachine.rb +++ b/src/oca/ruby/OpenNebula/VirtualMachine.rb @@ -98,14 +98,22 @@ module OpenNebula # XML-RPC Methods for the Virtual Machine Object ####################################################################### + # Retrieves the information of the given VirtualMachine. def info() super(VM_METHODS[:info], 'VM') end - + + # Allocates a new VirtualMachine in OpenNebula + # + # +description+ A string containing the template of the VirtualMachine. def allocate(description) super(VM_METHODS[:allocate],description) end - + + # Initiates the instance of the VM on the target host. + # + # +host_id+ The host id (hid) of the target host where + # the VM will be instantiated. def deploy(host_id) return Error.new('ID not defined') if !@pe_id @@ -115,42 +123,52 @@ module OpenNebula return rc end + # Shutdowns an already deployed VM def shutdown action('shutdown') end + # Cancels a running VM def cancel action('cancel') end + # Sets a VM to hold state, scheduler will not deploy it def hold action('hold') end + # Releases a VM from hold state def release action('release') end + # Stops a running VM def stop action('stop') end + # Saves a running VM def suspend action('suspend') end + # Resumes the execution of a saved VM def resume action('resume') end + # Deletes a VM from the pool and DB def finalize action('finalize') end + # Resubmits the VM after failure def restart action('restart') end + # Saves a running VM and starts it again in the specified host def migrate(host_id) return Error.new('ID not defined') if !@pe_id @@ -160,6 +178,7 @@ module OpenNebula return rc end + # Migrates a running VM to another host without downtime def live_migrate(host_id) return Error.new('ID not defined') if !@pe_id @@ -169,6 +188,12 @@ module OpenNebula return rc end + # Set the specified vm's disk to be saved in a new image + # when the VirtualMachine shutdowns + # + # +disk_id+ ID of the disk to be saved + # + # +image_id+ ID of the new image where the disk will be saved def save_as(disk_id, image_id) return Error.new('ID not defined') if !@pe_id diff --git a/src/oca/ruby/OpenNebula/VirtualMachinePool.rb b/src/oca/ruby/OpenNebula/VirtualMachinePool.rb index 8649c17659..0649f258ab 100644 --- a/src/oca/ruby/OpenNebula/VirtualMachinePool.rb +++ b/src/oca/ruby/OpenNebula/VirtualMachinePool.rb @@ -30,7 +30,8 @@ module OpenNebula ####################################################################### # XML-RPC Methods for the Virtual Network Object ####################################################################### - + + # Retrieves all or part of the VirtualMachines in the pool. def info() super(VM_POOL_METHODS[:info],@user_id) end diff --git a/src/oca/ruby/OpenNebula/VirtualNetwork.rb b/src/oca/ruby/OpenNebula/VirtualNetwork.rb index 2f46d6a48a..4e10ebd7d6 100644 --- a/src/oca/ruby/OpenNebula/VirtualNetwork.rb +++ b/src/oca/ruby/OpenNebula/VirtualNetwork.rb @@ -40,22 +40,29 @@ module OpenNebula # XML-RPC Methods for the Virtual Network Object ####################################################################### + # Retrieves the information of the given VirtualNetwork. def info() super(VN_METHODS[:info], 'VNET') end + # Allocates a new VirtualNetwork in OpenNebula + # + # +description+ A string containing the template of the VirtualNetwork. def allocate(description) super(VN_METHODS[:allocate],description) end - + + # Publishes the VirtualNetwork, to be used by other users def publish set_publish(true) end + # Unplubishes the VirtualNetwork def unpublish set_publish(false) end + # Deletes the VirtualNetwork def delete() super(VN_METHODS[:delete]) end diff --git a/src/oca/ruby/OpenNebula/VirtualNetworkPool.rb b/src/oca/ruby/OpenNebula/VirtualNetworkPool.rb index 6ce370bd1d..1e66d33a6a 100644 --- a/src/oca/ruby/OpenNebula/VirtualNetworkPool.rb +++ b/src/oca/ruby/OpenNebula/VirtualNetworkPool.rb @@ -31,6 +31,7 @@ module OpenNebula # XML-RPC Methods for the Virtual Network Object ####################################################################### + # Retrieves all or part of the VirtualNetwork in the pool. def info() super(VN_POOL_METHODS[:info],@user_id) end