diff --git a/NOTICE b/NOTICE index 212910e936..39e1fb5a94 100644 --- a/NOTICE +++ b/NOTICE @@ -3,16 +3,18 @@ Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) ----------------------------------------- You can find more information about the project, release notes and -documentation at www.OpenNebula.org +documentation at www.OpenNebula.org AUTHORS - Ruben Santiago Montero (rubensm@dacya.ucm.es) -- Ignacio Martín Llorente (llorente@dacya.ucm.es) +- Ignacio Martin Llorente (llorente@dacya.ucm.es) ACKNOWLEDGEMENTS The following people have contributed to the development of the technology -- Javier Fontán Muiños (jfontan@fdi.ucm.es) -- Constantino Vázquez Blanco (tinova@fdi.ucm.es) +- Javier Fontan Muiños (jfontan@fdi.ucm.es) +- Constantino Vazquez Blanco (tinova@fdi.ucm.es) - Jaime Melis Bayo (j.melis@fdi.ucm.es) +- Carlos Martin Sanchez (cmartins@fdi.ucm.es) +- Daniel Molina Aranda (danmolin@pdi.ucm.es) diff --git a/README b/README index 20db33daaf..2701cce474 100644 --- a/README +++ b/README @@ -109,6 +109,11 @@ where **install_options** can be one or more of: -h prints installer help +## CONFIGURATION + +Information on how to configure OpenNebula is located at http://opennebula.org/documentation:rel2.0 + + ## CONTACT OpenNebula web page: http://opennebula.org diff --git a/include/Hook.h b/include/Hook.h index 99ed350328..6d01c7a09e 100644 --- a/include/Hook.h +++ b/include/Hook.h @@ -51,7 +51,7 @@ public: Hook(const string &_name, const string &_cmd, const string &_args, - HookType _ht, + int _ht, bool _remote): name(_name), cmd(_cmd), args(_args), hook_type(_ht), remote(_remote){}; @@ -63,7 +63,7 @@ public: /** * Returns the hook_type */ - HookType type() const + int type() const { return hook_type; } @@ -93,7 +93,7 @@ protected: /** * The Hook Type */ - HookType hook_type; + int hook_type; /** * True if the command is to be executed remotely diff --git a/include/Mad.h b/include/Mad.h index ae3c093c9e..7ec5f4dd19 100644 --- a/include/Mad.h +++ b/include/Mad.h @@ -68,11 +68,12 @@ protected: { string str; const char * cstr; + size_t retval; str = os.str(); cstr = str.c_str(); - ::write(nebula_mad_pipe, cstr, str.size()); + retval = ::write(nebula_mad_pipe, cstr, str.size()); }; /** diff --git a/include/Nebula.h b/include/Nebula.h index c0b5850af1..15e5268775 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -203,7 +203,7 @@ public: static string version() { - return "OpenNebula 1.9.85"; + return "OpenNebula 2.0.0"; }; void start(); diff --git a/include/VirtualMachineHook.h b/include/VirtualMachineHook.h index 3a9fcca190..7ccdf1862a 100644 --- a/include/VirtualMachineHook.h +++ b/include/VirtualMachineHook.h @@ -68,7 +68,7 @@ protected: const string& cmd, const string& args, bool remote): - Hook(name, cmd, args, Hook::UPDATE, remote){}; + Hook(name, cmd, args, Hook::UPDATE | Hook::ALLOCATE, remote){}; virtual ~VirtualMachineStateMapHook(){}; diff --git a/install.sh b/install.sh index 9ea116bf62..819e31f269 100755 --- a/install.sh +++ b/install.sh @@ -602,7 +602,16 @@ MAN_FILES="share/man/oneauth.8.gz \ share/man/oneimage.8.gz \ share/man/oneuser.8.gz \ share/man/onevm.8.gz \ - share/man/onevnet.8.gz" + share/man/onevnet.8.gz \ + share/man/econe-describe-images.8.gz \ + share/man/econe-describe-instances.8.gz \ + share/man/econe-register.8.gz \ + share/man/econe-run-instances.8.gz \ + share/man/econe-terminate-instances.8.gz \ + share/man/econe-upload.8.gz \ + share/man/occi-compute.8.gz \ + share/man/occi-network.8.gz \ + share/man/occi-storage.8.gz" #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 68902b2916..35dfd523e1 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -35,7 +35,7 @@ VM_POLLING_INTERVAL = 600 #VM_DIR=/srv/cloud/one/var -SCRIPTS_REMOTE_DIR=/tmp/one +SCRIPTS_REMOTE_DIR=/var/tmp/one PORT=2633 diff --git a/share/man/econe-describe-images.8.gz b/share/man/econe-describe-images.8.gz new file mode 100644 index 0000000000..c0aa5db454 Binary files /dev/null and b/share/man/econe-describe-images.8.gz differ diff --git a/share/man/econe-describe-instances.8.gz b/share/man/econe-describe-instances.8.gz new file mode 100644 index 0000000000..143bb28a5f Binary files /dev/null and b/share/man/econe-describe-instances.8.gz differ diff --git a/share/man/econe-register.8.gz b/share/man/econe-register.8.gz new file mode 100644 index 0000000000..bc5e8b13f3 Binary files /dev/null and b/share/man/econe-register.8.gz differ diff --git a/share/man/econe-run-instances.8.gz b/share/man/econe-run-instances.8.gz new file mode 100644 index 0000000000..22e1d8d65b Binary files /dev/null and b/share/man/econe-run-instances.8.gz differ diff --git a/share/man/econe-terminate-instances.8.gz b/share/man/econe-terminate-instances.8.gz new file mode 100644 index 0000000000..ba19ff45c7 Binary files /dev/null and b/share/man/econe-terminate-instances.8.gz differ diff --git a/share/man/econe-upload.8.gz b/share/man/econe-upload.8.gz new file mode 100644 index 0000000000..fb0704f662 Binary files /dev/null and b/share/man/econe-upload.8.gz differ diff --git a/share/man/occi-compute.8.gz b/share/man/occi-compute.8.gz new file mode 100644 index 0000000000..11842ea221 Binary files /dev/null and b/share/man/occi-compute.8.gz differ diff --git a/share/man/occi-network.8.gz b/share/man/occi-network.8.gz new file mode 100644 index 0000000000..35e512a6fd Binary files /dev/null and b/share/man/occi-network.8.gz differ diff --git a/share/man/occi-storage.8.gz b/share/man/occi-storage.8.gz new file mode 100644 index 0000000000..2cdb242469 Binary files /dev/null and b/share/man/occi-storage.8.gz differ diff --git a/share/man/oneauth.8.gz b/share/man/oneauth.8.gz index 82e9a396f0..95554bb729 100644 Binary files a/share/man/oneauth.8.gz and b/share/man/oneauth.8.gz differ diff --git a/share/man/onecluster.8.gz b/share/man/onecluster.8.gz index dfdf2ef1bd..69544f59c9 100644 Binary files a/share/man/onecluster.8.gz and b/share/man/onecluster.8.gz differ diff --git a/share/man/onehost.8.gz b/share/man/onehost.8.gz index 417ea78895..fcecb4540e 100644 Binary files a/share/man/onehost.8.gz and b/share/man/onehost.8.gz differ diff --git a/share/man/oneimage.8.gz b/share/man/oneimage.8.gz index ab7dcd0355..ea2abbb5fb 100644 Binary files a/share/man/oneimage.8.gz and b/share/man/oneimage.8.gz differ diff --git a/share/man/oneuser.8.gz b/share/man/oneuser.8.gz index f216029883..73e54fb803 100644 Binary files a/share/man/oneuser.8.gz and b/share/man/oneuser.8.gz differ diff --git a/share/man/onevm.8.gz b/share/man/onevm.8.gz index bdbf313fe2..80943fde9b 100644 Binary files a/share/man/onevm.8.gz and b/share/man/onevm.8.gz differ diff --git a/share/man/onevnet.8.gz b/share/man/onevnet.8.gz index 9ce807284b..6d4825c056 100644 Binary files a/share/man/onevnet.8.gz and b/share/man/onevnet.8.gz differ diff --git a/src/authm_mad/oneauth b/src/authm_mad/oneauth index 435c0aac38..3f5581620c 100755 --- a/src/authm_mad/oneauth +++ b/src/authm_mad/oneauth @@ -45,6 +45,12 @@ COMMANDS_HELP=<<-EOT Usage: oneauth [] + +Description: + +This command contains a set of utilities to manage authorization module. + + Commands: * quota set (sets quota for a user) diff --git a/src/cli/command_parse.rb b/src/cli/command_parse.rb index 935d3f81b5..e1c406e147 100644 --- a/src/cli/command_parse.rb +++ b/src/cli/command_parse.rb @@ -31,7 +31,7 @@ Options: EOT ONE_VERSION=<<-EOT -OpenNebula 1.9.85 +OpenNebula 2.0.0 Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/src/cli/onecluster b/src/cli/onecluster index 933073bb4f..e5128e2614 100755 --- a/src/cli/onecluster +++ b/src/cli/onecluster @@ -88,6 +88,14 @@ end class OneUPParse < CommandParse COMMANDS_HELP=<<-EOT + +Description: + +This command enables the OpenNebula administrator to manage clusters. The +administrator can create, delete, as well as add and remove hosts from them. +Any user can list available clusters. + + Commands: * create (Creates a new user) diff --git a/src/cli/onehost b/src/cli/onehost index c05c18fd32..2bf1ec1eb3 100755 --- a/src/cli/onehost +++ b/src/cli/onehost @@ -166,6 +166,14 @@ end class OnehostParse < CommandParse COMMANDS_HELP=<<-EOT + +Description: + +This command enables the user to manage hosts in the Open Nebula server. It +provides functionality to allocate, get information and delete a particular +host or to list all the available hosts. + + Commands: * create (Adds a new machine to the pool) @@ -191,6 +199,20 @@ Commands: * sync (synchronizes probes with remote hosts) onehost sync + + +Information Columns: + +* HID Host ID +* NAME Host name +* RVM Number of running VMs +* TCPU Total CPU (percentage) +* FCPU Free CPU (percentage) +* ACPU Available CPU (not allocated by VMs) +* TMEM Total memory +* FMEM Free memory +* STAT Host status + EOT diff --git a/src/cli/oneimage b/src/cli/oneimage index 7b06df07b9..c1a7564fb0 100755 --- a/src/cli/oneimage +++ b/src/cli/oneimage @@ -199,6 +199,12 @@ end class OneImageParse < CommandParse COMMANDS_HELP=<<-EOT + +Description: + +This command enables the user to manage images. + + Commands: * register (Registers an image, copying it to the repository if it applies) diff --git a/src/cli/oneuser b/src/cli/oneuser index 710c7ed1af..0ca2ad1a59 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -92,6 +92,16 @@ end class OneUPParse < CommandParse COMMANDS_HELP=<<-EOT + +Description: + +This command enables the OpenNebula administrator to manage users, adding, +listing and deleting them. + +The create and passwd commands accept the [-r, –read-file] option. Use this +option to store the contents of a file (without hashing it) as the password. + + Commands: * create (Creates a new user) @@ -106,6 +116,15 @@ Commands: * passwd (Changes the given user's password) oneuser passwd password + +Information Columns: + +* UID User ID +* NAME Name of the user +* PASSWORD SHA1 encrypted password +* ENABLE Whether the user is enabled or not + + EOT def text_commands diff --git a/src/cli/onevm b/src/cli/onevm index c813fa2b3a..e454e20cc5 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -307,6 +307,14 @@ end class OnevmParse < CommandParse COMMANDS_HELP=<<-EOT + +Description: + +This command enables the user to manage virtual machines in the ONE server. +The user can allocate, deploy, migrate, suspend, resume and shutdown a virtual +machine with the functionality present in onevm. + + Commands: * create (Submits a new virtual machine, adding it to the ONE VM pool) @@ -363,7 +371,7 @@ Commands: a, all --> all the known VMs m, mine --> the VMs belonging to the user in ONE_AUTH uid --> VMs of the user identified by this uid - user--> VMs of the user identified by the username + user --> VMs of the user identified by the username * show (Gets information about a specific VM) onevm show @@ -376,6 +384,35 @@ Commands: if no vm_id is provided it will list history for all known VMs + +Information Columns: + +* ID ONE VM identifier +* USER Username of the VM owner +* NAME Name of the ONE +* STAT Status of the VM +* CPU CPU percentage used by the VM +* MEM Memory used by the VM +* HOSTNAME Host where the VM is being or was run +* TIME Time since the submission of the VM (days hours:minutes:seconds) + + +VM States: + +* pend pending +* hold VM on hold (not runnable) +* stop stopped +* susp suspended +* done finished +* prol prolog +* boot booting +* runn running +* migr migrating +* save saving the VM to disk +* epil epilog +* shut shutting down +* fail failed + EOT def text_commands diff --git a/src/cli/onevnet b/src/cli/onevnet index 4f7a7d9c92..c8abec8361 100755 --- a/src/cli/onevnet +++ b/src/cli/onevnet @@ -137,6 +137,14 @@ end class OneVNParse < CommandParse COMMANDS_HELP=<<-EOT + +Description: + +This command enables the user to manage virtual networks in the OpenNebula +server. It provides functionality to create, get information and delete a +particular network or to list available and used IP's. + + Commands: * create (Creates a new virtual network) @@ -159,11 +167,21 @@ Commands: * list (Lists virtual networks in the pool) onevnet list where filter_flag can be - a, all --> all the known VNs - m, mine --> the VNs belonging to the user in ONE_AUTH - and all the Public VNs - uid --> VNs of the user identified by this uid - user --> VNs of the user identified by the username + a, all : all the known VNs + m, mine : the VNs belonging to the user in ONE_AUTH + and all the Public VNs + uid : VNs of the user identified by this uid + user : VNs of the user identified by the username + + +Information columns: + +* NID Network ID +* NAME Name of the virtual network +* TYPE Type of virtual network (0=ranged, 1=fixed) +* BRIDGE Bridge associated to the virtual network +* LEASES Number of leases used from this virtual network + EOT def text_commands diff --git a/src/cloud/common/CloudClient.rb b/src/cloud/common/CloudClient.rb index abbafd27ec..8f725b509d 100644 --- a/src/cloud/common/CloudClient.rb +++ b/src/cloud/common/CloudClient.rb @@ -135,4 +135,15 @@ module CloudCLI def cmd_name File.basename($0) end + + def version_text + version=<, -K : + --access-key , -K The username of the user - --secret-key , -S : + --secret-key , -S The password of the user - --url , -U : + --url , -U Set url as the web service url to use - --headers, -H: + --headers, -H Display column headers EOT @@ -65,6 +63,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--access-key', '-K',GetoptLong::REQUIRED_ARGUMENT], ['--secret-key', '-S',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-U',GetoptLong::REQUIRED_ARGUMENT], @@ -83,6 +82,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--access-key' access = arg when '--secret-key' diff --git a/src/cloud/ec2/bin/econe-describe-instances b/src/cloud/ec2/bin/econe-describe-instances index 05f5605c13..66c2d9830b 100755 --- a/src/cloud/ec2/bin/econe-describe-instances +++ b/src/cloud/ec2/bin/econe-describe-instances @@ -27,29 +27,28 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT - ** Synopsis - ----------- - econe-describe-instances - - List and describe running instances +econe-describe-instances - ** Usage - -------- +List and describe running instances + +Usage: econe-describe-instances [OPTIONS] + +Options: - --help, -h: + --help, -h Show help - --access-key , -K : + --access-key , -K The username of the user - --secret-key , -S : + --secret-key , -S The password of the user - --url , -U : + --url , -U Set url as the web service url to use - --headers, -H: + --headers, -H Display column headers EOT @@ -62,6 +61,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--access-key', '-K',GetoptLong::REQUIRED_ARGUMENT], ['--secret-key', '-S',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-U',GetoptLong::REQUIRED_ARGUMENT], @@ -80,6 +80,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--access-key' access = arg when '--secret-key' diff --git a/src/cloud/ec2/bin/econe-register b/src/cloud/ec2/bin/econe-register index 917bc49abf..3cdd7b556e 100755 --- a/src/cloud/ec2/bin/econe-register +++ b/src/cloud/ec2/bin/econe-register @@ -27,34 +27,33 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT - ** Synopsis - ----------- - econe-register - - Register a previously uploaded image for use with an - OpenNebula Cloud. +econe-register - ** Usage - -------- +Register a previously uploaded image for use with an +OpenNebula Cloud. + +Usage: econe-register [OPTIONS] IMAGE-ID - --help, -h: +Options: + + --help, -h Show help - --access-key , -K : + --access-key , -K The username of the user - --secret-key , -S : + --secret-key , -S The password of the user - --url , -U : + --url , -U Set url as the web service url to use - --headers, -H: + --headers, -H Display column headers - IMAGE-ID: The image identification as returned by - the econe-upload command +IMAGE-ID: The image identification as returned by +the econe-upload command EOT @@ -66,6 +65,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--access-key', '-K',GetoptLong::REQUIRED_ARGUMENT], ['--secret-key', '-S',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-U',GetoptLong::REQUIRED_ARGUMENT], @@ -84,6 +84,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--access-key' access = arg when '--secret-key' diff --git a/src/cloud/ec2/bin/econe-run-instances b/src/cloud/ec2/bin/econe-run-instances index cfa51b3e7d..6633bf8092 100755 --- a/src/cloud/ec2/bin/econe-run-instances +++ b/src/cloud/ec2/bin/econe-run-instances @@ -28,40 +28,39 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT - ** Synopsis - ----------- - econe-run-instances - - Runs an instance of a particular image +econe-run-instances - ** Usage - -------- +Runs an instance of a particular image + +Usage: econe-run-instances [OPTIONS] IMAGE-ID - --help, -h: +Options: + + --help, -h Show help - --access-key , -K : + --access-key , -K The username of the user - --secret-key , -S : + --secret-key , -S The password of the user - --url , -U : + --url , -U Set url as the web service url to use - --type , -t : + --type , -t OpenNebula template in which is based this instance - -–user-data, -d: + --user-data, -d Specifies Base64-encoded MIME user data to be made available to the instance - --headers, -H: + --headers, -H Display column headers - IMAGE-ID: The image identification as returned by - the econe-upload command +IMAGE-ID: The image identification as returned by +the econe-upload command EOT @@ -73,6 +72,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--access-key', '-K',GetoptLong::REQUIRED_ARGUMENT], ['--secret-key', '-S',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-U',GetoptLong::REQUIRED_ARGUMENT], @@ -95,6 +95,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--access-key' access = arg when '--secret-key' diff --git a/src/cloud/ec2/bin/econe-terminate-instances b/src/cloud/ec2/bin/econe-terminate-instances index cc613980fe..f361fc5ca2 100755 --- a/src/cloud/ec2/bin/econe-terminate-instances +++ b/src/cloud/ec2/bin/econe-terminate-instances @@ -28,30 +28,29 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT - ** Synopsis - ----------- - econe-terminate-instances - - Terminate the selected running instance +econe-terminate-instances - ** Usage - -------- +Terminate the selected running instance + +Usage: econe-register [OPTIONS] INSTANCE-ID - --help, -h: +Options: + + --help, -h Show help - --access-key , -K : + --access-key , -K The username of the user - --secret-key , -S : + --secret-key , -S The password of the user - --url , -U : + --url , -U Set url as the web service url to use - INSTANCE-ID: The instance identification as returned by - the econe-run-instances command +INSTANCE-ID: The instance identification as returned by +the econe-run-instances command EOT @@ -63,6 +62,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--access-key', '-K',GetoptLong::REQUIRED_ARGUMENT], ['--secret-key', '-S',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-U',GetoptLong::REQUIRED_ARGUMENT] @@ -79,6 +79,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--access-key' access = arg when '--secret-key' diff --git a/src/cloud/ec2/bin/econe-upload b/src/cloud/ec2/bin/econe-upload index 2455b91fa6..ab81f5d6d2 100755 --- a/src/cloud/ec2/bin/econe-upload +++ b/src/cloud/ec2/bin/econe-upload @@ -27,33 +27,32 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT - ** Synopsis - ----------- - econe-upload - - Uploads an image for use with an OpenNebula Cloud. This image should - be later register with econe-register using the returned ImageId +econe-upload - ** Usage - -------- +Uploads an image for use with an OpenNebula Cloud. This image should +be later register with econe-register using the returned ImageId + +Usage: econe-upload [OPTIONS] IMAGE-PATH - --help, -h: +Options: + + --help, -h Show help - --access-key , -K : + --access-key , -K The username of the user - --secret-key , -S : + --secret-key , -S The password of the user - --url , -U : + --url , -U Set url as the web service url to use - --multipart, -M: + --multipart, -M Use 'multipart-post' library instead of Curb/Curl - IMAGE-PATH: Path to the image to upload +IMAGE-PATH: Path to the image to upload EOT @@ -65,6 +64,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--access-key', '-K',GetoptLong::REQUIRED_ARGUMENT], ['--secret-key', '-S',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-U',GetoptLong::REQUIRED_ARGUMENT], @@ -83,6 +83,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--access-key' access = arg when '--secret-key' diff --git a/src/cloud/occi/bin/occi-compute b/src/cloud/occi/bin/occi-compute index 76018c5448..0332e48c48 100755 --- a/src/cloud/occi/bin/occi-compute +++ b/src/cloud/occi/bin/occi-compute @@ -29,51 +29,48 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT -** Synopsis -occi-compute +occi-compute - Manages compute resources -Manages compute resources +Usage: + occi-compute [OPTIONS] [ARGUMENTS] -** Usage -occi-compute [OPTIONS] [ARGUMENTS] +Commands: -COMMANDS - -create +* create creates a new compute resource described by the provided -list +* list lists available compute resources -show +* show retrieves the OCCI XML representation of the compute resource identified by -update +* update updates the representation of the compute resource represented by the provided -delete +* delete deletes the compute resource idenfitied by -OPTIONS +Options: ---help, -h: +--help, -h Show help ---username , -U : +--username , -U The username of the user ---password , -P : +--password , -P The password of the user ---url , -R : +--url , -R Set url as the web service url to use --timeout , -T - Sets a timeout for the http connection + Sets a timeout for the http connection --debug, -D Enables verbosity @@ -88,6 +85,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--username', '-U',GetoptLong::REQUIRED_ARGUMENT], ['--password', '-P',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-R',GetoptLong::REQUIRED_ARGUMENT], @@ -108,6 +106,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--username' username = arg when '--password' diff --git a/src/cloud/occi/bin/occi-network b/src/cloud/occi/bin/occi-network index 42b8d6eaf9..2d1387ed79 100755 --- a/src/cloud/occi/bin/occi-network +++ b/src/cloud/occi/bin/occi-network @@ -29,15 +29,12 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT -** Synopsis -occi-network +occi-network - Manages virtual networks -Manages virtual networks +Usage: + occi-network [OPTIONS] [ARGUMENTS] -** Usage -occi-network [OPTIONS] [ARGUMENTS] - -COMMANDS +Commands: create creates a new virtual network described by the provided @@ -55,18 +52,18 @@ delete -OPTIONS +Options: ---help, -h: +--help, -h Show help ---username , -U : +--username , -U The username of the user ---password , -P : +--password , -P The password of the user ---url , -R : +--url , -R Set url as the web service url to use --timeout , -T @@ -75,7 +72,7 @@ OPTIONS --debug, -D Enables verbosity ---multipart, -M: +--multipart, -M Use 'multipart-post' library instead of Curb/Curl EOT @@ -89,6 +86,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--username', '-U',GetoptLong::REQUIRED_ARGUMENT], ['--password', '-P',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-R',GetoptLong::REQUIRED_ARGUMENT], @@ -109,6 +107,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--username' username = arg when '--password' diff --git a/src/cloud/occi/bin/occi-storage b/src/cloud/occi/bin/occi-storage index 4387b2ab27..5085656090 100755 --- a/src/cloud/occi/bin/occi-storage +++ b/src/cloud/occi/bin/occi-storage @@ -29,15 +29,12 @@ $: << RUBY_LIB_LOCATION $: << RUBY_LIB_LOCATION+"/cloud" COMMANDS_HELP=<<-EOT -** Synopsis -occi-storage +occi-storage - Manages OCCI storage resource -Manages OCCI storage resource +Usage: + occi-storage [OPTIONS] [PARAMETERS] -** Usage -occi-storage [OPTIONS] [PARAMETERS] - -COMMANDS +Commands: create creates a new storage resource described by the provided @@ -54,17 +51,18 @@ delete deletes the storage resource idenfitied by -OPTIONS ---help, -h: +Options: + +--help, -h Show help ---username , -U : +--username , -U The username of the user ---password , -P : +--password , -P The password of the user ---url , -R : +--url , -R Set url as the web service url to use --timeout , -T @@ -73,7 +71,7 @@ OPTIONS --debug, -D Enables verbosity ---multipart, -M: +--multipart, -M Use 'multipart-post' library instead of Curb/Curl EOT @@ -87,6 +85,7 @@ include CloudCLI opts = GetoptLong.new( ['--help', '-h',GetoptLong::NO_ARGUMENT], + ['--version', '-v',GetoptLong::NO_ARGUMENT], ['--username', '-U',GetoptLong::REQUIRED_ARGUMENT], ['--password', '-P',GetoptLong::REQUIRED_ARGUMENT], ['--url', '-R',GetoptLong::REQUIRED_ARGUMENT], @@ -109,6 +108,9 @@ begin when '--help' puts COMMANDS_HELP return + when '--version' + puts CloudCLI.version_text + exit 0 when '--username' username = arg when '--password' diff --git a/src/cloud/occi/etc/templates/common.erb b/src/cloud/occi/etc/templates/common.erb new file mode 100644 index 0000000000..0a2756e5b3 --- /dev/null +++ b/src/cloud/occi/etc/templates/common.erb @@ -0,0 +1,42 @@ +# +# This template is processed by the OCCI Server to include specific data for the +# instance, you should not need to modify the <% ... %> compounds. +# You can add common attributes for your cloud templates (e.g. OS) +# + +NAME = "<%= @vm_info['NAME'] %>" + +<% @vm_info.each('DISK') do |disk| %> + <% if disk.attr('STORAGE','href') %> + DISK = [ IMAGE_ID = <%= disk.attr('STORAGE','href').split('/').last %> + ] + <% end %> +<% end %> + +<% @vm_info.each('NIC') do |nic| %> + <% if nic.attr('NETWORK','href') %> + NIC = [ NETWORK_ID = <%= nic.attr('NETWORK','href').split('/').last %> + <% if nic['IP'] %> + ,IP = <%= nic['IP'] %> + <% end %> + ] + <% end %> +<% end %> + +<% if @vm_info.has_elements?('CONTEXT') %> + CONTEXT = [ + <% first = true %> + <% @vm_info.each('CONTEXT/*') do |cont| %> + <% if cont.text %> + <% if first %> + <%= cont.name %> = "<%= cont.text %>" + <% first = false %> + <% else %> + ,<%= cont.name %> = "<%= cont.text %>" + <% end %> + <% end %> + <% end %> + ] +<% end %> + +INSTANCE_TYPE = <%= @vm_info['INSTANCE_TYPE']%> \ No newline at end of file diff --git a/src/cloud/occi/etc/templates/large.erb b/src/cloud/occi/etc/templates/large.erb index cc1cc7a98f..0af7a6ce14 100644 --- a/src/cloud/occi/etc/templates/large.erb +++ b/src/cloud/occi/etc/templates/large.erb @@ -1,34 +1,8 @@ # # Virtual Machine Template generated for large instance types. Adjust this # by setting the desired capacity (CPU,MEMORY) or adding specific -# attributes for your cloud (e.g. OS). You should not need to change the DISK -# and NIC sections +# attributes for your cloud (e.g. OS). # CPU = 8 MEMORY = 8192 - -NAME = "<%= @vm_info['NAME'] %>" - -<% if @vm_info['DISK'] %> - <% @vm_info.each('DISK') do |disk| %> - <% if disk['STORAGE'] && disk.attr('STORAGE','href') %> - DISK = [ IMAGE_ID = <%= disk.attr('STORAGE','href').split('/').last %> - ] - <% end %> - <% end %> -<% end %> - -<% if @vm_info['NIC'] %> - <% @vm_info.each('NIC') do |nic| %> - <% if nic['NETWORK'] && nic.attr('NETWORK','href') %> - NIC = [ NETWORK_ID = <%= nic.attr('NETWORK','href').split('/').last %> - <% if nic['IP'] %> - ,IP = <%= nic['IP'] %> - <% end %> - ] - <% end %> - <% end %> -<% end %> - -INSTANCE_TYPE = <%= @vm_info['INSTANCE_TYPE']%> \ No newline at end of file diff --git a/src/cloud/occi/etc/templates/medium.erb b/src/cloud/occi/etc/templates/medium.erb index 074f5d31fd..873a0a3d19 100644 --- a/src/cloud/occi/etc/templates/medium.erb +++ b/src/cloud/occi/etc/templates/medium.erb @@ -1,35 +1,9 @@ # # Virtual Machine Template generated for medium instance types. Adjust this # by setting the desired capacity (CPU,MEMORY) or adding specific -# attributes for your cloud (e.g. OS). You should not need to change the DISK -# and NIC sections +# attributes for your cloud (e.g. OS). # CPU = 4 MEMORY = 4096 -NAME = "<%= @vm_info['NAME'] %>" - -<% if @vm_info['DISK'] %> - <% @vm_info.each('DISK') do |disk| %> - <% if disk['STORAGE'] && disk.attr('STORAGE','href') %> - DISK = [ IMAGE_ID = <%= disk.attr('STORAGE','href').split('/').last %> - ] - <% end %> - <% end %> -<% end %> - -<% if @vm_info['NIC'] %> - <% @vm_info.each('NIC') do |nic| %> - <% if nic['NETWORK'] && nic.attr('NETWORK','href') %> - NIC = [ NETWORK_ID = <%= nic.attr('NETWORK','href').split('/').last %> - <% if nic['IP'] %> - ,IP = <%= nic['IP'] %> - <% end %> - ] - <% end %> - <% end %> -<% end %> - -INSTANCE_TYPE = <%= @vm_info['INSTANCE_TYPE']%> - diff --git a/src/cloud/occi/etc/templates/small.erb b/src/cloud/occi/etc/templates/small.erb index 65f8100f86..7320831643 100644 --- a/src/cloud/occi/etc/templates/small.erb +++ b/src/cloud/occi/etc/templates/small.erb @@ -1,35 +1,9 @@ # # Virtual Machine Template generated for small instance types. Adjust this # by setting the desired capacity (CPU,MEMORY) or adding specific -# attributes for your cloud (e.g. OS). You should not need to change the DISK -# and NIC sections +# attributes for your cloud (e.g. OS). # CPU = 1 MEMORY = 1024 -NAME = "<%= @vm_info['NAME'] %>" - -<% if @vm_info['DISK'] %> - <% @vm_info.each('DISK') do |disk| %> - <% if disk['STORAGE'] && disk.attr('STORAGE','href') %> - DISK = [ IMAGE_ID = <%= disk.attr('STORAGE','href').split('/').last %> - ] - <% end %> - <% end %> -<% end %> - -<% if @vm_info['NIC'] %> - <% @vm_info.each('NIC') do |nic| %> - <% if nic['NETWORK'] && nic.attr('NETWORK','href') %> - NIC = [ NETWORK_ID = <%= nic.attr('NETWORK','href').split('/').last %> - <% if nic['IP'] %> - ,IP = <%= nic['IP'] %> - <% end %> - ] - <% end %> - <% end %> -<% end %> - -INSTANCE_TYPE = <%= @vm_info['INSTANCE_TYPE']%> - diff --git a/src/cloud/occi/lib/VirtualMachineOCCI.rb b/src/cloud/occi/lib/VirtualMachineOCCI.rb index 1568f9ea7c..c72c645525 100755 --- a/src/cloud/occi/lib/VirtualMachineOCCI.rb +++ b/src/cloud/occi/lib/VirtualMachineOCCI.rb @@ -27,17 +27,14 @@ class VirtualMachineOCCI < VirtualMachine <%= self['TEMPLATE/INSTANCE_TYPE'] %> <% end %> <%= self.state_str %> - <% if self['TEMPLATE/DISK'] %> - <% self.each('TEMPLATE/DISK') do |disk| %> + <% self.each('TEMPLATE/DISK') do |disk| %> <%= disk['TYPE'] %> <%= disk['TARGET'] %> - <% end %> <% end %> - <% if self['TEMPLATE/NIC'] %> - <% self.each('TEMPLATE/NIC') do |nic| %> + <% self.each('TEMPLATE/NIC') do |nic| %> <% if nic['IP'] %> @@ -47,32 +44,41 @@ class VirtualMachineOCCI < VirtualMachine <%= nic['MAC'] %> <% end %> + <% end %> + <% if self['TEMPLATE/CONTEXT'] %> + + <% self.each('TEMPLATE/CONTEXT/*') do |cont| %> + <% if cont.text %> + <<%= cont.name %>><%= cont.text %>> <% end %> <% end %> + + <% end %> } - + # Class constructor - def initialize(xml, client, xml_info = nil, types=nil, base=nil) + def initialize(xml, client, xml_info=nil, types=nil, base=nil) super(xml, client) @vm_info = nil @template = nil - + @common_template = base + '/common.erb' if base + if xml_info != nil xmldoc = XMLElement.build_xml(xml_info, 'COMPUTE') @vm_info = XMLElement.new(xmldoc) if xmldoc != nil end - + if @vm_info != nil itype = @vm_info['INSTANCE_TYPE'] - + if itype != nil and types[itype] != nil @template = base + "/#{types[itype]['TEMPLATE']}" end end - + end - + def mk_action(action_str) case action_str.downcase when "stopped" @@ -92,31 +98,31 @@ class VirtualMachineOCCI < VirtualMachine error = OpenNebula::Error.new(error_msg) return error end - + return rc end - + def to_one_template() if @vm_info == nil error_msg = "Missing COMPUTE section in the XML body" return OpenNebula::Error.new(error_msg), 400 end - + if @template == nil return OpenNebula::Error.new("Bad instance type"), 500 end - + begin - template = ERB.new(File.read(@template)) - template_text = template.result(binding) + template = ERB.new(File.read(@common_template)).result(binding) + template << ERB.new(File.read(@template)).result(binding) rescue Exception => e error = OpenNebula::Error.new(e.message) return error end - - return template_text + + return template end - + # Creates the VMI representation of a Virtual Machine def to_occi(base_url) begin @@ -127,6 +133,7 @@ class VirtualMachineOCCI < VirtualMachine return error end + return occi_vm_text.gsub(/\n\s*/,'') end end diff --git a/src/mad/Mad.cc b/src/mad/Mad.cc index ab564a7f95..f86859fac5 100644 --- a/src/mad/Mad.cc +++ b/src/mad/Mad.cc @@ -39,6 +39,7 @@ Mad::~Mad() char buf[]="FINALIZE\n"; int status; pid_t rp; + size_t retval; if ( pid==-1) { @@ -46,7 +47,7 @@ Mad::~Mad() } // Finish the driver - ::write(nebula_mad_pipe, buf, strlen(buf)); + retval = ::write(nebula_mad_pipe, buf, strlen(buf)); close(mad_nebula_pipe); close(nebula_mad_pipe); @@ -67,6 +68,7 @@ int Mad::start() { int ne_mad_pipe[2]; int mad_ne_pipe[2]; + size_t retval; map::iterator it; @@ -189,7 +191,7 @@ int Mad::start() fcntl(nebula_mad_pipe, F_SETFD, FD_CLOEXEC); fcntl(mad_nebula_pipe, F_SETFD, FD_CLOEXEC); - ::write(nebula_mad_pipe, buf, strlen(buf)); + retval = ::write(nebula_mad_pipe, buf, strlen(buf)); do { @@ -289,10 +291,11 @@ int Mad::reload() int status; int rc; pid_t rp; + size_t retval; // Finish the driver - ::write(nebula_mad_pipe, buf, strlen(buf)); + retval = ::write(nebula_mad_pipe, buf, strlen(buf)); close(nebula_mad_pipe); close(mad_nebula_pipe); diff --git a/src/mad/MadManager.cc b/src/mad/MadManager.cc index 862fcc9724..c5b44125c0 100644 --- a/src/mad/MadManager.cc +++ b/src/mad/MadManager.cc @@ -147,6 +147,7 @@ int MadManager::add(Mad *mad) { char buf = 'A'; int rc; + size_t retval; if ( mad == 0 ) { @@ -166,7 +167,7 @@ int MadManager::add(Mad *mad) mads.push_back(mad); - write(pipe_w, &buf, sizeof(char)); + retval = write(pipe_w, &buf, sizeof(char)); unlock(); @@ -215,6 +216,7 @@ void MadManager::listener() int greater; unsigned int i,j; int rc,mrc; + size_t retval; char c; @@ -262,7 +264,7 @@ void MadManager::listener() { if ( fd == pipe_r ) // Driver added, update the fd vector { - read(fd, (void *) &c, sizeof(char)); + retval = read(fd, (void *) &c, sizeof(char)); lock(); diff --git a/src/oca/java/test/oned.conf b/src/oca/java/test/oned.conf new file mode 100644 index 0000000000..d433ee488f --- /dev/null +++ b/src/oca/java/test/oned.conf @@ -0,0 +1,343 @@ +#******************************************************************************* +# OpenNebula Configuration file +#******************************************************************************* + +#******************************************************************************* +# Daemon configuration attributes +#------------------------------------------------------------------------------- +# HOST_MONITORING_INTERVAL: Time in seconds between host monitorization +# +# VM_POLLING_INTERVAL: Time in seconds between virtual machine monitorization. +# (use 0 to disable VM monitoring). +# +# VM_DIR: Remote path to store the VM images, it should be shared between all +# the cluster nodes to perform live migrations. This variable is the default +# for all the hosts in the cluster. +# +# PORT: Port where oned will listen for xmlrpc calls. +# +# DB: Configuration attributes for the database backend +# backend : can be sqlite or mysql (default is sqlite) +# server : (mysql) host name or an IP address for the MySQL server +# user : (mysql) user's MySQL login ID +# passwd : (mysql) the password for user +# db_name : (mysql) the database name +# +# VNC_BASE_PORT: VNC ports for VMs can be automatically set to VNC_BASE_PORT + +# VMID +# +# DEBUG_LEVEL: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG +#******************************************************************************* + +HOST_MONITORING_INTERVAL = 600 + +VM_POLLING_INTERVAL = 600 + +#VM_DIR=/srv/cloud/one/var + +SCRIPTS_REMOTE_DIR=/tmp/one + +PORT=2666 + +DB = [ backend = "sqlite" ] + +# Sample configuration for MySQL +# DB = [ backend = "mysql", +# server = "localhost", +# user = "oneadmin", +# passwd = "oneadmin", +# db_name = "opennebula" ] + +VNC_BASE_PORT = 5900 + +DEBUG_LEVEL=3 + +#******************************************************************************* +# Physical Networks configuration +#******************************************************************************* +# NETWORK_SIZE: Here you can define the default size for the virtual networks +# +# MAC_PREFIX: Default MAC prefix to be used to create the auto-generated MAC +# addresses is defined here (this can be overrided by the Virtual Network +# template) +#******************************************************************************* + +NETWORK_SIZE = 254 + +MAC_PREFIX = "02:00" + +#******************************************************************************* +# Image Repository Configuration +#******************************************************************************* +# IMAGE_REPOSITORY_PATH: Define the path to the image repository, by default +# is set to $ONE_LOCATION/var +# +# DEFAULT_IMAGE_TYPE: This can take values +# OS Image file holding an operating system +# CDROM Image file holding a CDROM +# DATABLOCK Image file holding a datablock, +# always created as an empty block +# DEFAULT_DEVICE_PREFIX: This can be set to +# hd IDE prefix +# sd SCSI +# xvd XEN Virtual Disk +# vd KVM virtual disk +#******************************************************************************* + +#IMAGE_REPOSITORY_PATH = /srv/cloud/var/images +DEFAULT_IMAGE_TYPE = "OS" +DEFAULT_DEVICE_PREFIX = "hd" + +#******************************************************************************* +# Information Driver Configuration +#******************************************************************************* +# You can add more information managers with different configurations but make +# sure it has different names. +# +# name : name for this information manager +# +# executable: path of the information driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, usually a probe configuration file, +# can be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Information Driver Manager Configuration +#------------------------------------------------------------------------------- +IM_MAD = [ + name = "im_kvm", + executable = "one_im_ssh", + arguments = "kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Information Driver Manager Configuration +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_xen", +# executable = "one_im_ssh", +# arguments = "xen" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Information Driver Manager Configuration +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_ec2", +# executable = "one_im_ec2", +# arguments = "im_ec2/im_ec2.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Information Driver Manager Configuration +#------------------------------------------------------------------------------- +IM_MAD = [ name="im_dummy", executable="one_im_dummy"] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Virtualization Driver Configuration +#******************************************************************************* +# You can add more virtualization managers with different configurations but +# make sure it has different names. +# +# name : name of the virtual machine manager driver +# +# executable: path of the virtualization driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable +# +# default : default values and configuration parameters for the driver, can +# be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +# +# type : driver type, supported drivers: xen, kvm, xml +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Virtualization Driver Manager Configuration +#------------------------------------------------------------------------------- +VM_MAD = [ + name = "vmm_kvm", + executable = "one_vmm_ssh", + arguments = "kvm", + default = "vmm_ssh/vmm_ssh_kvm.conf", + type = "kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Virtualization Driver Manager Configuration +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "vmm_xen", +# executable = "one_vmm_ssh", +# arguments = "xen", +# default = "vmm_ssh/vmm_ssh_xen.conf", +# type = "xen" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Virtualization Driver Manager Configuration +# arguments: default values for the EC2 driver, can be an absolute path or +# relative to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was +# installed in /). +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "vmm_ec2", +# executable = "one_vmm_ec2", +# arguments = "vmm_ec2/vmm_ec2.conf", +# type = "xml" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Virtualization Driver Configuration +#------------------------------------------------------------------------------- +VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Transfer Manager Driver Configuration +#******************************************************************************* +# You can add more transfer managers with different configurations but make +# sure it has different names. +# name : name for this transfer driver +# +# executable: path of the transfer driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, usually a commands configuration file +# , can be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +#******************************************************************************* + +#------------------------------------------------------------------------------- +# NFS Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +TM_MAD = [ + name = "tm_nfs", + executable = "one_tm", + arguments = "tm_nfs/tm_nfs.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# SSH Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +#TM_MAD = [ +# name = "tm_ssh", +# executable = "one_tm", +# arguments = "tm_ssh/tm_ssh.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +TM_MAD = [ + name = "tm_dummy", + executable = "one_tm", + arguments = "tm_dummy/tm_dummy.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# LVM Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +#TM_MAD = [ +# name = "tm_lvm", +# executable = "one_tm", +# arguments = "tm_lvm/tm_lvm.conf" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Hook Manager Configuration +#******************************************************************************* +# The Driver (HM_MAD), used to execute the Hooks +# executable: path of the hook driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, can be an absolute path or relative +# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed +# in /) +# +# Virtual Machine Hooks (VM_HOOK) defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the VM is created (onevm create) +# - RUNNING, after the VM is successfully booted +# - SHUTDOWN, after the VM is shutdown +# - STOP, after the VM is stopped (including VM image transfers) +# - DONE, after the VM is deleted or shutdown +# command : path can be absolute or relative to $ONE_LOCATION/share/hooks +# case of self-contained installation or relative to +# /usr/share/one/hooks in case of system-wide installation +# arguments : for the hook. You can access to VM template variables with $ +# - $ATTR, the value of an attribute e.g. $NAME or $VMID +# - $ATTR[VAR], the value of a vector e.g. $NIC[MAC] +# - $ATTR[VAR, COND], same of previous but COND select between +# multiple ATTRs e.g. $NIC[MAC, NETWORK="Public"] +# remote : values, +# - YES, The hook is executed in the host where the VM was +# allocated +# - NO, The hook is executed in the OpenNebula server (default) +#------------------------------------------------------------------------------- + +HM_MAD = [ + executable = "one_hm" ] + +#-------------------------------- Image Hook ----------------------------------- +# This hook is used to handle image saving and overwriting when virtual machines +# reach the DONE state after being shutdown. + +VM_HOOK = [ + name = "image", + on = "DONE", + command = "image.rb", + arguments = "$VMID" ] + +#------------------------------------------------------------------------------- + +#-------------------------------- Hook Examples -------------------------------- +#VM_HOOK = [ +# name = "dhcp", +# on = "create", +# command = "/bin/echo", +# arguments = "$NAME > /tmp/test.$VMID" ] +#------------------------------------------------------------------------------- +#VM_HOOK = [ +# name = "ebtables", +# on = "running", +# command = "/usr/local/one/bin/set_net", +# arguments = '$NIC[MAC, Network = "Private"]', +# remote = "yes" ] +#------------------------------------------------------------------------------- +#VM_HOOK = [ +# name = "mail", +# on = "running", +# command = "/usr/local/one/bin/send_mail", +# arguments = "$VMID $NAME", +# remote = "no" ] +#------------------------------------------------------------------------------ + +#******************************************************************************* +# Auth Manager Configuration +#******************************************************************************* +# The Driver (AUTHM_MAD) that will be used to authenticate and authorize +# OpenNebula requests. If not defined OpenNebula will use the built-in auth +# policies +# executable: path of the auth driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, can be an absolute path or relative +# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed +# in /) +#------------------------------------------------------------------------------- + +#AUTH_MAD = [ +# executable = "one_auth_mad" ] + diff --git a/src/oca/java/test/test.sh b/src/oca/java/test/test.sh index 849649fefd..22f418cad0 100755 --- a/src/oca/java/test/test.sh +++ b/src/oca/java/test/test.sh @@ -5,13 +5,19 @@ JUNIT_JAR="/usr/share/java/junit4.jar" ONEDB="$ONE_LOCATION/var/one.db" +PID=$$ + +oned -f & -oned sleep 4s; java -cp ../lib/*:../jar/*:$JUNIT_JAR:. org.junit.runner.JUnitCore $1 -pkill oned; +CODE=$? + +pkill -P $PID oned sleep 4s; -pkill -9 oned; +pkill -9 -P $PID oned rm $ONEDB + +exit $CODE \ No newline at end of file diff --git a/src/oca/ruby/OpenNebula/ImageRepository.rb b/src/oca/ruby/OpenNebula/ImageRepository.rb index cd297d78a4..a3fcb4cfd0 100644 --- a/src/oca/ruby/OpenNebula/ImageRepository.rb +++ b/src/oca/ruby/OpenNebula/ImageRepository.rb @@ -154,9 +154,7 @@ module OpenNebula # ######################################################################## def move(path, source) - if source.nil? or path.nil? - return OpenNebula::Error.new("copy Image: missing parameters.") - elsif File.identical?(path,source) + if source.nil? || path.nil? || File.identical?(path,source) return nil end @@ -217,23 +215,21 @@ module OpenNebula # ######################################################################## def remove(source) - if File.exists?(source) + if !File.exists?(source) + return nil + end + + begin if File.directory?(source) - begin - FileUtils.rmdir(source) - rescue Exception => e - return OpenNebula::Error.new(e.message) - end + FileUtils.rmdir(source) else - begin - FileUtils.rm(source) - rescue Exception => e - return OpenNebula::Error.new(e.message) - end + FileUtils.rm(source) end + rescue Exception => e + return OpenNebula::Error.new(e.message) end return nil end end -end \ No newline at end of file +end diff --git a/src/oca/ruby/OpenNebula/XMLUtils.rb b/src/oca/ruby/OpenNebula/XMLUtils.rb index 4ff16187e2..48bb2fd373 100644 --- a/src/oca/ruby/OpenNebula/XMLUtils.rb +++ b/src/oca/ruby/OpenNebula/XMLUtils.rb @@ -8,7 +8,6 @@ module OpenNebula NOKOGIRI=false end - ########################################################################### # The XMLElement class provides an abstraction of the underlying # XML parser engine. It provides XML-related methods for the Pool and @@ -112,6 +111,28 @@ module OpenNebula end end + def name + @xml.name + end + + def text + if NOKOGIRI + @xml.content + else + @xml.text + end + end + + def has_elements?(xpath_str) + if NOKOGIRI + element = @xml.xpath(xpath_str.to_s.upcase) + return element != nil && element.children.size > 0 + else + element = @xml.elements[xpath_str.to_s] + return element != nil && element.has_elements? + end + end + def template_str(indent=true) template_like_str('TEMPLATE', indent) end @@ -199,5 +220,3 @@ module OpenNebula end end - - diff --git a/src/oca/ruby/test/UserPool_spec.rb b/src/oca/ruby/test/UserPool_spec.rb index 765603a422..7465cfc485 100644 --- a/src/oca/ruby/test/UserPool_spec.rb +++ b/src/oca/ruby/test/UserPool_spec.rb @@ -24,11 +24,11 @@ module OpenNebula if user.id == 0 user.name.should eql('oneadmin') user['PASSWORD'].should eql('f13a1234833436f71ab846572d251c0d40391e72') - user['ENABLED'].should eql('True') + user['ENABLED'].should eql('1') elsif user.id == 1 user.name.should eql('dan') user['PASSWORD'].should eql('d22a12348334v33f71ba846572d25250d40701e72') - user['ENABLED'].should eql('False') + user['ENABLED'].should eql('0') end } end @@ -53,11 +53,11 @@ module OpenNebula if user.id == 0 user.name.should eql('oneadmin') user['PASSWORD'].should eql('f13a1234833436f71ab846572d251c0d40391e72') - user['ENABLED'].should eql('True') + user['ENABLED'].should eql('1') elsif user.id == 1 user.name.should eql('dan') user['PASSWORD'].should eql('d22a12348334v33f71ba846572d25250d40701e72') - user['ENABLED'].should eql('False') + user['ENABLED'].should eql('0') end } end diff --git a/src/oca/ruby/test/fixtures/userpool.xml b/src/oca/ruby/test/fixtures/userpool.xml index 1f61bcfb96..d369d1bd11 100644 --- a/src/oca/ruby/test/fixtures/userpool.xml +++ b/src/oca/ruby/test/fixtures/userpool.xml @@ -3,7 +3,7 @@ 0 oneadmin f13a1234833436f71ab846572d251c0d40391e72 - 0 + 1 1 diff --git a/src/rm/RequestManagerPoolInfo.cc b/src/rm/RequestManagerPoolInfo.cc index f52ee541fe..700ebdd4c5 100644 --- a/src/rm/RequestManagerPoolInfo.cc +++ b/src/rm/RequestManagerPoolInfo.cc @@ -57,6 +57,7 @@ void RequestManager::VirtualMachinePoolInfo::execute( break; default: paramList.verifyEnd(4); + return; } // Get the parameters diff --git a/src/rm/RequestManagerSaveDisk.cc b/src/rm/RequestManagerSaveDisk.cc index 15daa0eb15..8392de1794 100644 --- a/src/rm/RequestManagerSaveDisk.cc +++ b/src/rm/RequestManagerSaveDisk.cc @@ -149,14 +149,11 @@ error_vm_get_disk_id: error_authenticate: oss.str(authenticate_error(method_name)); - goto error_common_lock; + goto error_common; error_authorize: oss.str(authorization_error(method_name, "MANAGE", "VM/IMAGE", rc, vm_id)); - goto error_common_lock; - -error_common_lock: - vm->unlock(); + goto error_common; error_common: arrayData.push_back(xmlrpc_c::value_boolean(false)); diff --git a/src/tm_mad/nfs/tm_clone.sh b/src/tm_mad/nfs/tm_clone.sh index f1a904ab6c..7ee131ce12 100755 --- a/src/tm_mad/nfs/tm_clone.sh +++ b/src/tm_mad/nfs/tm_clone.sh @@ -55,5 +55,5 @@ http://*) ;; esac -exec_and_log "chmod a+w $DST_PATH" +exec_and_log "chmod a+rw $DST_PATH" diff --git a/src/vmm/VirtualMachineManager.cc b/src/vmm/VirtualMachineManager.cc index b06b4ecfc5..7ef025c797 100644 --- a/src/vmm/VirtualMachineManager.cc +++ b/src/vmm/VirtualMachineManager.cc @@ -171,7 +171,11 @@ void VirtualMachineManager::do_action(const string &action, void * arg) if ( arg == 0) { if ( action != ACTION_TIMER && action != ACTION_FINALIZE ) + { return; + } + + vid = -1; } else {