diff --git a/include/ImageManager.h b/include/ImageManager.h index 4e7daca0dd..509a25f7d2 100644 --- a/include/ImageManager.h +++ b/include/ImageManager.h @@ -96,6 +96,27 @@ public: void release_image(const string& iid, const string& disk_path, int disk_num, + const string& saveid) + { + int image_id; + istringstream iss; + + iss.str(iid); + iss >> image_id; + + release_image(image_id, disk_path, disk_num, saveid); + }; + + /** + * Releases an image and triggers any needed operations in the repo + * @param iid image id of the image to be released + * @param disk_path base path for disk location + * @param disk number for this image in the VM + * @param saveid id of image to save the current image + */ + void release_image(int iid, + const string& disk_path, + int disk_num, const string& saveid); /** diff --git a/include/ImagePool.h b/include/ImagePool.h index d69a2f3a60..78052d7349 100644 --- a/include/ImagePool.h +++ b/include/ImagePool.h @@ -130,6 +130,7 @@ public: * automatically increased. * @param img_type will be set to the used image's type * @param uid of VM owner (to look for the image id within its images) + * @param image_id on success returns the acquired image id * @return 0 on success, * -1 error, * -2 not using the pool, @@ -139,7 +140,8 @@ public: int disk_id, int * index, Image::ImageType * img_type, - int uid); + int uid, + int& image_id); /** * Generates an Authorization token for the DISK attribute * @param disk the disk to be authorized diff --git a/include/Nebula.h b/include/Nebula.h index 0f7e4de8e7..c242e56644 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -449,8 +449,9 @@ private: void bootstrap(); /** - * Callback function to TODO - * @param _loaded_db_version TODO + * Callback function for the check_db_version method. Stores the read + * version in loaded_db_version + * @param _loaded_db_version returned columns * @param num the number of columns read from the DB * @param names the column names * @param vaues the column values @@ -459,9 +460,12 @@ private: int select_cb(void *_loaded_db_version, int num, char **values, char **names); - /* - * TODO - * @return 0 ok, -1 version mismatch, -2 needs bootstrap + /** + * Reads the current DB version. + * + * @return 0 on success, + * -1 if there is a version mismatch, + * -2 if the DB needs a bootstrap */ int check_db_version(); }; diff --git a/include/RequestManagerChown.h b/include/RequestManagerChown.h index 6632900d97..5dff310e4e 100644 --- a/include/RequestManagerChown.h +++ b/include/RequestManagerChown.h @@ -35,12 +35,21 @@ protected: :Request(method_name,params,help) { auth_op = AuthRequest::CHOWN; + + Nebula& nd = Nebula::instance(); + gpool = nd.get_gpool(); + upool = nd.get_upool(); }; ~RequestManagerChown(){}; /* -------------------------------------------------------------------- */ + GroupPool * gpool; + UserPool * upool; + + /* -------------------------------------------------------------------- */ + virtual void request_execute(xmlrpc_c::paramList const& _paramList, RequestAttributes& att); }; diff --git a/install.sh b/install.sh index 8a28e0d9cd..a0706fea87 100755 --- a/install.sh +++ b/install.sh @@ -185,7 +185,7 @@ ETC_DIRS="$ETC_LOCATION/im_kvm \ $ETC_LOCATION/im_ec2 \ $ETC_LOCATION/vmm_ec2 \ $ETC_LOCATION/vmm_exec \ - $ETC_LOCATION/tm_nfs \ + $ETC_LOCATION/tm_shared \ $ETC_LOCATION/tm_ssh \ $ETC_LOCATION/tm_dummy \ $ETC_LOCATION/tm_lvm \ @@ -204,7 +204,7 @@ LIB_DIRS="$LIB_LOCATION/ruby \ $LIB_LOCATION/ruby/cloud/occi \ $LIB_LOCATION/ruby/onedb \ $LIB_LOCATION/tm_commands \ - $LIB_LOCATION/tm_commands/nfs \ + $LIB_LOCATION/tm_commands/shared \ $LIB_LOCATION/tm_commands/ssh \ $LIB_LOCATION/tm_commands/dummy \ $LIB_LOCATION/tm_commands/lvm \ @@ -332,11 +332,7 @@ INSTALL_FILES=( AUTH_QUOTA_FILES:$VAR_LOCATION/remotes/auth/quota VMM_EXEC_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm VMM_EXEC_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen - VMM_EXEC_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll - VMM_EXEC_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/xen/poll - VMM_EXEC_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll_local - VMM_EXEC_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/xen/poll_local - NFS_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/nfs + SHARED_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/shared SSH_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/ssh DUMMY_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/dummy LVM_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/lvm @@ -445,7 +441,7 @@ INSTALL_ETC_FILES=( VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2 VMM_EXEC_ETC_FILES:$ETC_LOCATION/vmm_exec IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2 - TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs + TM_SHARED_ETC_FILES:$ETC_LOCATION/tm_shared TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy TM_LVM_ETC_FILES:$ETC_LOCATION/tm_lvm @@ -552,6 +548,8 @@ VMM_EXEC_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \ src/vmm_mad/remotes/kvm/migrate_local \ src/vmm_mad/remotes/kvm/restore \ src/vmm_mad/remotes/kvm/save \ + src/vmm_mad/remotes/kvm/poll \ + src/vmm_mad/remotes/kvm/poll_ganglia \ src/vmm_mad/remotes/kvm/shutdown" #------------------------------------------------------------------------------- @@ -564,15 +562,10 @@ VMM_EXEC_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ src/vmm_mad/remotes/xen/migrate \ src/vmm_mad/remotes/xen/restore \ src/vmm_mad/remotes/xen/save \ + src/vmm_mad/remotes/xen/poll \ + src/vmm_mad/remotes/xen/poll_ganglia \ src/vmm_mad/remotes/xen/shutdown" -#----------------------------------------------------------------------------- -# VMM SH Driver xen/kvm scripts, to be installed under $REMOTES_LOCATION/vmm/* -#----------------------------------------------------------------------------- - -VMM_EXEC_XEN_KVM_POLL="src/vmm_mad/remotes/poll_xen_kvm.rb" -VMM_EXEC_GANGLIA_POLL="src/vmm_mad/remotes/poll_ganglia.rb" - #------------------------------------------------------------------------------- # Information Manager Probes, to be installed under $REMOTES_LOCATION/im #------------------------------------------------------------------------------- @@ -609,19 +602,19 @@ AUTH_QUOTA_FILES="src/authm_mad/remotes/quota/authorize" #------------------------------------------------------------------------------- # Transfer Manager commands, to be installed under $LIB_LOCATION/tm_commands -# - NFS TM, $LIB_LOCATION/tm_commands/nfs +# - SHARED TM, $LIB_LOCATION/tm_commands/shared # - SSH TM, $LIB_LOCATION/tm_commands/ssh # - dummy TM, $LIB_LOCATION/tm_commands/dummy # - LVM TM, $LIB_LOCATION/tm_commands/lvm #------------------------------------------------------------------------------- -NFS_TM_COMMANDS_LIB_FILES="src/tm_mad/nfs/tm_clone.sh \ - src/tm_mad/nfs/tm_delete.sh \ - src/tm_mad/nfs/tm_ln.sh \ - src/tm_mad/nfs/tm_mkswap.sh \ - src/tm_mad/nfs/tm_mkimage.sh \ - src/tm_mad/nfs/tm_mv.sh \ - src/tm_mad/nfs/tm_context.sh" +SHARED_TM_COMMANDS_LIB_FILES="src/tm_mad/shared/tm_clone.sh \ + src/tm_mad/shared/tm_delete.sh \ + src/tm_mad/shared/tm_ln.sh \ + src/tm_mad/shared/tm_mkswap.sh \ + src/tm_mad/shared/tm_mkimage.sh \ + src/tm_mad/shared/tm_mv.sh \ + src/tm_mad/shared/tm_context.sh" SSH_TM_COMMANDS_LIB_FILES="src/tm_mad/ssh/tm_clone.sh \ src/tm_mad/ssh/tm_delete.sh \ @@ -691,14 +684,14 @@ IM_EC2_ETC_FILES="src/im_mad/ec2/im_ec2rc \ #------------------------------------------------------------------------------- # Storage drivers config. files, to be installed under $ETC_LOCATION -# - nfs, $ETC_LOCATION/tm_nfs +# - shared, $ETC_LOCATION/tm_shared # - ssh, $ETC_LOCATION/tm_ssh # - dummy, $ETC_LOCATION/tm_dummy # - lvm, $ETC_LOCATION/tm_lvm #------------------------------------------------------------------------------- -TM_NFS_ETC_FILES="src/tm_mad/nfs/tm_nfs.conf \ - src/tm_mad/nfs/tm_nfsrc" +TM_SHARED_ETC_FILES="src/tm_mad/shared/tm_shared.conf \ + src/tm_mad/shared/tm_sharedrc" TM_SSH_ETC_FILES="src/tm_mad/ssh/tm_ssh.conf \ src/tm_mad/ssh/tm_sshrc" diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 1f110b3b6d..762465c9df 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -254,12 +254,12 @@ VM_MAD = [ #******************************************************************************* #------------------------------------------------------------------------------- -# NFS Transfer Manager Driver Configuration +# SHARED Transfer Manager Driver Configuration #------------------------------------------------------------------------------- TM_MAD = [ - name = "tm_nfs", + name = "tm_shared", executable = "one_tm", - arguments = "tm_nfs/tm_nfs.conf" ] + arguments = "tm_shared/tm_shared.conf" ] #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- diff --git a/share/install_gems/install_gems b/share/install_gems/install_gems index 8b6758a803..bbdf2c3a6e 100755 --- a/share/install_gems/install_gems +++ b/share/install_gems/install_gems @@ -165,7 +165,8 @@ def install_dependencies(gems, distro) documentation. Press enter to continue... - EOT + EOT + STDIN.readline else puts "Distribution \"#{distro.first}\" detected." deps=get_dependencies(gems, distro.last[:dependencies]) @@ -240,7 +241,7 @@ packages_string=gems_list.join(' ') prefix="" -if dist.last[:gem_env] +if dist && dist.last[:gem_env] prefix=dist.last[:gem_env].collect do |name, value| "#{name}=\"#{value}\"" end.join(' ')+' ' diff --git a/src/authm/AuthManager.cc b/src/authm/AuthManager.cc index 8ed3a16b9b..384e6d4272 100644 --- a/src/authm/AuthManager.cc +++ b/src/authm/AuthManager.cc @@ -358,7 +358,7 @@ void AuthManager::timer_action() while ( it !=auth_requests.end()) { - if (the_time > it->second->time_out) + if ((it->second->time_out != 0) && (the_time > it->second->time_out)) { AuthRequest * ar = it->second; auth_requests.erase(it++); diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index f1ce493baa..8bd8d69115 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -398,7 +398,8 @@ EOT editor_path = ENV["EDITOR"] ? ENV["EDITOR"] : EDITOR_PATH system("#{editor_path} #{path}") - unless $?==0 + + unless $?.exitstatus == 0 puts "Editor not defined" exit -1 end diff --git a/src/cloud/occi/lib/OCCIServer.rb b/src/cloud/occi/lib/OCCIServer.rb index f86f90dda5..ce24fc93b3 100755 --- a/src/cloud/occi/lib/OCCIServer.rb +++ b/src/cloud/occi/lib/OCCIServer.rb @@ -325,20 +325,7 @@ class OCCIServer < CloudServer return OpenNebula::Error.new(error_msg), 400 end - # Create a new Image to save the disk - template = "NAME=\"#{image_name}\"\n" - if image_type - template << "TYPE=\"#{image_type}\"\n" - else - template << "TYPE=\"OS\"\n" - end - - image = Image.new(Image.build_xml, one_client) - - rc = image.allocate(template) - return rc, 400 if OpenNebula.is_error?(rc) - - rc = vm.save_as(disk_id, image.id) + rc = vm.save_as(disk_id, image_name) if OpenNebula.is_error?(rc) image.delete return rc, 400 @@ -563,7 +550,7 @@ class OCCIServer < CloudServer return rc, 404 if OpenNebula::is_error?(rc) # --- Delete the Image --- - rc = @img_repo.delete(image) + rc = image.delete return rc, 500 if OpenNebula::is_error?(rc) return "", 204 diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc index 93d95a4ab1..37189b4a81 100644 --- a/src/dm/DispatchManagerActions.cc +++ b/src/dm/DispatchManagerActions.cc @@ -565,6 +565,7 @@ int DispatchManager::finalize( switch (state) { case VirtualMachine::SUSPENDED: + case VirtualMachine::FAILED: tm->trigger(TransferManager::EPILOG_DELETE,vid); case VirtualMachine::INIT: @@ -573,7 +574,6 @@ int DispatchManager::finalize( case VirtualMachine::STOPPED: vm->set_exit_time(time(0)); - case VirtualMachine::FAILED: vm->set_state(VirtualMachine::LCM_INIT); vm->set_state(VirtualMachine::DONE); vmpool->update(vm); @@ -608,6 +608,7 @@ int DispatchManager::resubmit(int vid) Nebula& nd = Nebula::instance(); LifeCycleManager * lcm = nd.get_lcm(); + TransferManager * tm = nd.get_tm(); vm = vmpool->get(vid,true); @@ -628,9 +629,10 @@ int DispatchManager::resubmit(int vid) case VirtualMachine::PENDING: break; + case VirtualMachine::FAILED: //Cleanup VM host files + tm->trigger(TransferManager::EPILOG_DELETE,vid); case VirtualMachine::HOLD: // Move the VM to PENDING in any of these case VirtualMachine::STOPPED: - case VirtualMachine::FAILED: vm->set_state(VirtualMachine::LCM_INIT); vm->set_state(VirtualMachine::PENDING); vmpool->update(vm); diff --git a/src/im_mad/remotes/kvm.d/kvm.rb b/src/im_mad/remotes/kvm.d/kvm.rb index ec857ccfd2..9fd51c7eb6 100755 --- a/src/im_mad/remotes/kvm.d/kvm.rb +++ b/src/im_mad/remotes/kvm.d/kvm.rb @@ -27,7 +27,7 @@ end ###### nodeinfo_text = `virsh -c qemu:///system nodeinfo` -exit(-1) if $?!=0 +exit(-1) if $?.exitstatus != 0 nodeinfo_text.split(/\n/).each{|line| if line.match('^CPU\(s\)') @@ -46,7 +46,7 @@ nodeinfo_text.split(/\n/).each{|line| NETINTERFACE = "eth1" top_text=`top -bin2` -exit(-1) if $?!=0 +exit(-1) if $?.exitstatus != 0 top_text.gsub!(/^top.*^top.*?$/m, "") # Strip first top output @@ -72,7 +72,7 @@ $used_memory=tmp[0] $free_memory=tmp[1] net_text=`cat /proc/net/dev` -exit(-1) if $?!=0 +exit(-1) if $?.exitstatus != 0 net_text.split(/\n/).each{|line| if line.match("^ *#{NETINTERFACE}") diff --git a/src/im_mad/remotes/xen.d/xen.rb b/src/im_mad/remotes/xen.d/xen.rb index 0fe19b7673..c979907522 100755 --- a/src/im_mad/remotes/xen.d/xen.rb +++ b/src/im_mad/remotes/xen.d/xen.rb @@ -27,10 +27,10 @@ def print_info(name, value) end xentop_text=`sudo #{XENTOP_PATH} -bi2` -exit(-1) if $?!=0 +exit(-1) if $?.exitstatus != 0 xm_text=`sudo #{XM_PATH} info` -exit(-1) if $?!=0 +exit(-1) if $?.exitstatus != 0 #xentop_text.gsub!(/^xentop.*^xentop.*?$/m, "") # Strip first top output xentop_text.gsub!("no limit", "no_limit") diff --git a/src/image/Image.cc b/src/image/Image.cc index a66af4935c..ace9db96ba 100644 --- a/src/image/Image.cc +++ b/src/image/Image.cc @@ -433,6 +433,11 @@ int Image::disk_attribute( VectorAttribute * disk, get_template_attribute("DEV_PREFIX", prefix); + if (prefix.empty())//Removed from image template, get it again from defaults + { + prefix = ImagePool::default_dev_prefix(); + } + //--------------------------------------------------------------------------- // BASE DISK ATTRIBUTES //--------------------------------------------------------------------------- diff --git a/src/image/ImageManagerActions.cc b/src/image/ImageManagerActions.cc index 9d88e98ea1..769c8dffbf 100644 --- a/src/image/ImageManagerActions.cc +++ b/src/image/ImageManagerActions.cc @@ -141,14 +141,13 @@ void ImageManager::disk_to_image(const string& disk_path, /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -void ImageManager::release_image(const string& image_id, +void ImageManager::release_image(int iid, const string& disk_path, int disk_num, const string& save_id) { int rvms; - int iid; int sid = -1; istringstream iss; @@ -156,13 +155,8 @@ void ImageManager::release_image(const string& image_id, ostringstream disk_file; - iss.str(image_id); - - iss >> iid; - if ( save_id.empty() == false ) { - iss.clear(); iss.str(save_id); iss >> sid; @@ -180,7 +174,7 @@ void ImageManager::release_image(const string& image_id, case Image::USED: rvms = img->dec_running(); - if ( img->isPersistent() ) + if ( img->isPersistent() && !disk_path.empty() ) { disk_file << disk_path << "/disk." << disk_num; @@ -382,11 +376,16 @@ int ImageManager::register_image(int iid) } else { - img->set_state(Image::READY); - ipool->update(img); + string source = img->get_source(); - oss << "Using source " << img->get_source() - << " from template for image " << img->get_name(); + if (source != "-") //SAVE_AS IMAGE DO NOT ENABLE THE IMAGE + { + img->set_state(Image::READY); + ipool->update(img); + + oss << "Using source " << img->get_source() + << " from template for image " << img->get_name(); + } } } else //PATH -> COPY TO REPOSITORY AS SOURCE diff --git a/src/image/ImagePool.cc b/src/image/ImagePool.cc index 69931e6798..f64a0bb386 100644 --- a/src/image/ImagePool.cc +++ b/src/image/ImagePool.cc @@ -131,7 +131,8 @@ int ImagePool::disk_attribute(VectorAttribute * disk, int disk_id, int * index, Image::ImageType * img_type, - int uid) + int uid, + int& image_id) { string source; Image * img = 0; @@ -143,7 +144,6 @@ int ImagePool::disk_attribute(VectorAttribute * disk, ImageManager * imagem = nd.get_imagem(); istringstream is; - int image_id; source = disk->vector_value("IMAGE"); diff --git a/src/image/test/ImagePoolTest.cc b/src/image/test/ImagePoolTest.cc index 6ec2480186..1b61ff193a 100644 --- a/src/image/test/ImagePoolTest.cc +++ b/src/image/test/ImagePoolTest.cc @@ -589,7 +589,7 @@ public: Image * img; VectorAttribute * disk; - int oid_0, oid_1, index; + int oid_0, oid_1, index, img_id; string value; Image::ImageType img_type; @@ -625,7 +625,7 @@ public: disk = new VectorAttribute("DISK"); disk->replace("IMAGE_ID", "0"); - ((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0); + ((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0, img_id); value = ""; value = disk->vector_value("TARGET"); @@ -639,7 +639,7 @@ public: disk = new VectorAttribute("DISK"); disk->replace("IMAGE_ID", "1"); - ((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0); + ((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0, img_id); value = ""; value = disk->vector_value("TARGET"); diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 03683a2473..c415692bed 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -500,8 +500,7 @@ void LifeCycleManager::delete_action(int vid) VirtualMachine::LcmState state = vm->get_lcm_state(); if ((state == VirtualMachine::LCM_INIT) || - (state == VirtualMachine::CLEANUP) || - (state == VirtualMachine::FAILURE)) + (state == VirtualMachine::CLEANUP)) { vm->unlock(); return; @@ -535,8 +534,7 @@ void LifeCycleManager::clean_action(int vid) VirtualMachine::LcmState state = vm->get_lcm_state(); if ((state == VirtualMachine::LCM_INIT) || - (state == VirtualMachine::CLEANUP) || - (state == VirtualMachine::FAILURE)) + (state == VirtualMachine::CLEANUP)) { vm->unlock(); return; @@ -664,7 +662,11 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm) tm->trigger(TransferManager::EPILOG_DELETE,vid); break; - default: //FAILURE,LCM_INIT,CLEANUP + case VirtualMachine::FAILURE: + tm->trigger(TransferManager::EPILOG_DELETE,vid); + break; + + default: //LCM_INIT,CLEANUP break; } diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index ac01274093..5d9eb8dc61 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -778,7 +778,6 @@ void LifeCycleManager::monitor_done_action(int vid) void LifeCycleManager::failure_action(VirtualMachine * vm) { Nebula& nd = Nebula::instance(); - TransferManager * tm = nd.get_tm(); DispatchManager * dm = nd.get_dm(); time_t the_time = time(0); @@ -802,11 +801,9 @@ void LifeCycleManager::failure_action(VirtualMachine * vm) hpool->del_capacity(vm->get_hid(),cpu,mem,disk); - //------------- Clean up remote files ---------------- + //--- VM to FAILED. Remote host cleanup upon VM deletion --- dm->trigger(DispatchManager::FAILED,vm->get_oid()); - - tm->trigger(TransferManager::EPILOG_DELETE,vm->get_oid()); } /* -------------------------------------------------------------------------- */ diff --git a/src/mad/ruby/scripts_common.rb b/src/mad/ruby/scripts_common.rb index c5a7119b79..ba24205e20 100644 --- a/src/mad/ruby/scripts_common.rb +++ b/src/mad/ruby/scripts_common.rb @@ -53,7 +53,8 @@ module OpenNebula # the command fails def self.exec_and_log(command, message=nil) output=`#{command} 2>&1 1>/dev/null` - code=$? + code=$?.exitstatus + if code!=0 log_error "Command \"#{command}\" failed." log_error output diff --git a/src/mad/ruby/test/fixtures/var/config b/src/mad/ruby/test/fixtures/var/config index bc785fa891..58ddb96adf 100644 --- a/src/mad/ruby/test/fixtures/var/config +++ b/src/mad/ruby/test/fixtures/var/config @@ -12,7 +12,7 @@ MANAGER_TIMER=15 NETWORK_SIZE=254 PORT=2633 SCRIPTS_REMOTE_DIR=/var/tmp/one -TM_MAD=ARGUMENTS=tm_nfs/tm_nfs.conf,EXECUTABLE=one_tm,NAME=tm_nfs +TM_MAD=ARGUMENTS=tm_shared/tm_shared.conf,EXECUTABLE=one_tm,NAME=tm_shared VM_DIR=/Users/jfontan/tmp/borrar/git/one/install/var/ VM_MAD=ARGUMENTS=-t 15 -r 0 kvm,DEFAULT=vmm_ssh/vmm_ssh_kvm.conf,EXECUTABLE=one_vmm_ssh,NAME=vmm_kvm,TYPE=kvm VM_POLLING_INTERVAL=600 diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index 61ba330d0d..5730e0b99c 100755 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -15,25 +15,26 @@ #--------------------------------------------------------------------------- # # Paths for utilities +export PATH=/bin:/sbin:/usr/bin:$PATH AWK=awk -BASH=/bin/bash +BASH=bash CUT=cut -DATE=/bin/date -DD=/bin/dd -DU=/usr/bin/du -LVCREATE=/sbin/lvcreate -LVREMOVE=/sbin/lvremove -LVS=/sbin/lvs -MD5SUM=/usr/bin/md5sum -MKFS=/sbin/mkfs -MKISOFS=/usr/bin/mkisofs -MKSWAP=/sbin/mkswap -SCP=/usr/bin/scp -SED=/bin/sed -SSH=/usr/bin/ssh -SUDO=/usr/bin/sudo -WGET=/usr/bin/wget -READLINK=/bin/readlink +DATE=date +DD=dd +DU=du +LVCREATE=lvcreate +LVREMOVE=lvremove +LVS=lvs +MD5SUM=md5sum +MKFS=mkfs +MKISOFS=mkisofs +MKSWAP=mkswap +SCP=scp +SED=sed +SSH=ssh +SUDO=sudo +WGET=wget +READLINK=readlink # Used for log messages SCRIPT_NAME=`basename $0` diff --git a/src/oca/java/test/oned.conf b/src/oca/java/test/oned.conf index cc7eb53924..4a82a75f18 100644 --- a/src/oca/java/test/oned.conf +++ b/src/oca/java/test/oned.conf @@ -250,12 +250,12 @@ VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ] #******************************************************************************* #------------------------------------------------------------------------------- -# NFS Transfer Manager Driver Configuration +# SHARED Transfer Manager Driver Configuration #------------------------------------------------------------------------------- TM_MAD = [ - name = "tm_nfs", + name = "tm_shared", executable = "one_tm", - arguments = "tm_nfs/tm_nfs.conf" ] + arguments = "tm_shared/tm_shared.conf" ] #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- diff --git a/src/onedb/2.0_to_2.9.80.rb b/src/onedb/2.0_to_2.9.80.rb index 20d47aeb62..a3e9afe400 100644 --- a/src/onedb/2.0_to_2.9.80.rb +++ b/src/onedb/2.0_to_2.9.80.rb @@ -257,8 +257,8 @@ module Migrator public = row[:public] total_leases = 0 - @db.fetch("SELECT COUNT (ip) FROM old_leases WHERE (oid=#{oid} AND used=1)") do |r| - total_leases = r[:"COUNT (ip)"] + @db.fetch("SELECT COUNT(ip) FROM old_leases WHERE (oid=#{oid} AND used=1)") do |r| + total_leases = r[:"COUNT(ip)"] end diff --git a/src/onedb/onedb_backend.rb b/src/onedb/onedb_backend.rb index cfe079052d..71cbda3324 100644 --- a/src/onedb/onedb_backend.rb +++ b/src/onedb/onedb_backend.rb @@ -177,7 +177,7 @@ class BackEndMySQL < OneDBBacKEnd end create_cmd = mysql_cmd+"-e 'CREATE DATABASE IF NOT EXISTS #{@db_name};'" - rc = system(create_cnd) + rc = system(create_cmd) if !rc raise "Error creating MySQL DB #{@db_name} at #{@server}." end diff --git a/src/onedb/test/2.2/mysqldb.sql b/src/onedb/test/2.2/mysqldb.sql new file mode 100644 index 0000000000..16fb92e86c --- /dev/null +++ b/src/onedb/test/2.2/mysqldb.sql @@ -0,0 +1,314 @@ +-- MySQL dump 10.13 Distrib 5.1.41, for debian-linux-gnu (i486) +-- +-- Host: localhost Database: onedb_test +-- ------------------------------------------------------ +-- Server version 5.1.41-3ubuntu12.10 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `cluster_pool` +-- + +DROP TABLE IF EXISTS `cluster_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cluster_pool` ( + `oid` int(11) NOT NULL, + `cluster_name` varchar(128) DEFAULT NULL, + PRIMARY KEY (`oid`), + UNIQUE KEY `cluster_name` (`cluster_name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cluster_pool` +-- + +LOCK TABLES `cluster_pool` WRITE; +/*!40000 ALTER TABLE `cluster_pool` DISABLE KEYS */; +INSERT INTO `cluster_pool` VALUES (0,'default'); +/*!40000 ALTER TABLE `cluster_pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `history` +-- + +DROP TABLE IF EXISTS `history`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `history` ( + `vid` int(11) NOT NULL DEFAULT '0', + `seq` int(11) NOT NULL DEFAULT '0', + `host_name` text, + `vm_dir` text, + `hid` int(11) DEFAULT NULL, + `vm_mad` text, + `tm_mad` text, + `stime` int(11) DEFAULT NULL, + `etime` int(11) DEFAULT NULL, + `pstime` int(11) DEFAULT NULL, + `petime` int(11) DEFAULT NULL, + `rstime` int(11) DEFAULT NULL, + `retime` int(11) DEFAULT NULL, + `estime` int(11) DEFAULT NULL, + `eetime` int(11) DEFAULT NULL, + `reason` int(11) DEFAULT NULL, + PRIMARY KEY (`vid`,`seq`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `history` +-- + +LOCK TABLES `history` WRITE; +/*!40000 ALTER TABLE `history` DISABLE KEYS */; +INSERT INTO `history` VALUES (0,0,'host_0','/home/cmartin/trabajo/opennebula/install/var/',0,'vmm_dummy','tm_dummy',1316187929,1316187934,1316187929,1316187929,1316187929,1316187934,0,0,3),(1,0,'host_1','/home/cmartin/trabajo/opennebula/install/var/',1,'vmm_dummy','tm_dummy',1316187929,1316187935,1316187929,1316187929,1316187929,1316187935,0,0,3),(2,0,'host_2','/home/cmartin/trabajo/opennebula/install/var/',2,'vmm_dummy','tm_dummy',1316187930,1316187940,1316187930,1316187930,1316187930,1316187940,1316187940,1316187940,0),(3,0,'host_3','/home/cmartin/trabajo/opennebula/install/var/',3,'vmm_dummy','tm_dummy',1316187930,1316187941,1316187930,1316187930,1316187930,1316187941,0,0,3),(0,1,'host_1','/home/cmartin/trabajo/opennebula/install/var/',1,'vmm_dummy','tm_dummy',1316187934,0,1316187934,1316187934,1316187934,0,0,0,0),(1,1,'host_2','/home/cmartin/trabajo/opennebula/install/var/',2,'vmm_dummy','tm_dummy',1316187935,1316187936,0,0,1316187935,1316187936,1316187936,1316187936,2),(1,2,'host_0','/home/cmartin/trabajo/opennebula/install/var/',0,'vmm_dummy','tm_dummy',1316187937,1316187938,1316187937,1316187937,1316187937,1316187938,0,0,3),(1,3,'host_3','/home/cmartin/trabajo/opennebula/install/var/',3,'vmm_dummy','tm_dummy',1316187938,1316187939,1316187938,1316187938,1316187938,1316187939,1316187939,1316187939,0); +/*!40000 ALTER TABLE `history` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `host_pool` +-- + +DROP TABLE IF EXISTS `host_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `host_pool` ( + `oid` int(11) NOT NULL, + `host_name` varchar(256) DEFAULT NULL, + `state` int(11) DEFAULT NULL, + `im_mad` varchar(128) DEFAULT NULL, + `vm_mad` varchar(128) DEFAULT NULL, + `tm_mad` varchar(128) DEFAULT NULL, + `last_mon_time` int(11) DEFAULT NULL, + `cluster` varchar(128) DEFAULT NULL, + `template` text, + PRIMARY KEY (`oid`), + UNIQUE KEY `host_name` (`host_name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `host_pool` +-- + +LOCK TABLES `host_pool` WRITE; +/*!40000 ALTER TABLE `host_pool` DISABLE KEYS */; +INSERT INTO `host_pool` VALUES (1,'host_1',2,'im_dummy','vmm_dummy','tm_dummy',1316187946,'default',''),(3,'host_3',4,'im_dummy','vmm_dummy','tm_dummy',1316187931,'default',''),(4,'host_4',2,'im_dummy','vmm_dummy','tm_dummy',1316187946,'default',''),(0,'host_0',2,'im_dummy','vmm_dummy','tm_dummy',1316187946,'default',''),(2,'host_2',2,'im_dummy','vmm_dummy','tm_dummy',1316187946,'default',''); +/*!40000 ALTER TABLE `host_pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `host_shares` +-- + +DROP TABLE IF EXISTS `host_shares`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `host_shares` ( + `hid` int(11) NOT NULL, + `disk_usage` int(11) DEFAULT NULL, + `mem_usage` int(11) DEFAULT NULL, + `cpu_usage` int(11) DEFAULT NULL, + `max_disk` int(11) DEFAULT NULL, + `max_mem` int(11) DEFAULT NULL, + `max_cpu` int(11) DEFAULT NULL, + `free_disk` int(11) DEFAULT NULL, + `free_mem` int(11) DEFAULT NULL, + `free_cpu` int(11) DEFAULT NULL, + `used_disk` int(11) DEFAULT NULL, + `used_mem` int(11) DEFAULT NULL, + `used_cpu` int(11) DEFAULT NULL, + `running_vms` int(11) DEFAULT NULL, + PRIMARY KEY (`hid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `host_shares` +-- + +LOCK TABLES `host_shares` WRITE; +/*!40000 ALTER TABLE `host_shares` DISABLE KEYS */; +INSERT INTO `host_shares` VALUES (0,0,0,0,0,16777216,800,0,16777216,800,0,0,0,0),(1,0,524288,0,0,16777216,800,0,16777216,800,0,0,0,1),(2,0,0,0,0,16777216,800,0,16777216,800,0,0,0,0),(3,0,0,0,0,16777216,800,0,16777216,800,0,0,0,0),(4,0,0,0,0,16777216,800,0,16777216,800,0,0,0,0); +/*!40000 ALTER TABLE `host_shares` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `image_pool` +-- + +DROP TABLE IF EXISTS `image_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `image_pool` ( + `oid` int(11) NOT NULL, + `uid` int(11) DEFAULT NULL, + `name` varchar(128) DEFAULT NULL, + `type` int(11) DEFAULT NULL, + `public` int(11) DEFAULT NULL, + `persistent` int(11) DEFAULT NULL, + `regtime` int(11) DEFAULT NULL, + `source` text, + `state` int(11) DEFAULT NULL, + `running_vms` int(11) DEFAULT NULL, + `template` text, + PRIMARY KEY (`oid`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `image_pool` +-- + +LOCK TABLES `image_pool` WRITE; +/*!40000 ALTER TABLE `image_pool` DISABLE KEYS */; +INSERT INTO `image_pool` VALUES (0,1,'image_0',2,0,0,1316187925,'/home/cmartin/trabajo/opennebula/install/var//images/f4f08f2ad6fcb19432db9da3161d144aa2d5e730',2,1,''),(3,4,'image_3',2,0,1,1316187926,'/home/cmartin/trabajo/opennebula/install/var//images/01a1e990037cabc5419076c78e21f96b8c889dbf',1,0,''),(4,5,'image_4',2,0,0,1316187926,'/home/cmartin/trabajo/opennebula/install/var//images/df76114f6749fb9ef6674649c809f28054c0d125',2,1,''),(1,2,'image_1',2,0,0,1316187925,'/home/cmartin/trabajo/opennebula/install/var//images/1dbcefd204efa3c32280d2c56a2d499f89790bae',1,0,''),(2,3,'image_2',2,0,0,1316187925,'/home/cmartin/trabajo/opennebula/install/var//images/a42e387dcd957218a4f5c86f1b586631ab769c17',1,0,''); +/*!40000 ALTER TABLE `image_pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `leases` +-- + +DROP TABLE IF EXISTS `leases`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `leases` ( + `oid` int(11) NOT NULL DEFAULT '0', + `ip` bigint(20) NOT NULL DEFAULT '0', + `mac_prefix` bigint(20) DEFAULT NULL, + `mac_suffix` bigint(20) DEFAULT NULL, + `vid` int(11) DEFAULT NULL, + `used` int(11) DEFAULT NULL, + PRIMARY KEY (`oid`,`ip`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `leases` +-- + +LOCK TABLES `leases` WRITE; +/*!40000 ALTER TABLE `leases` DISABLE KEYS */; +INSERT INTO `leases` VALUES (0,3232235521,512,3232235521,0,1),(0,3232235522,512,3232235522,-1,0),(0,3232235523,512,3232235523,-1,0),(0,3232235524,512,3232235524,-1,0),(0,3232235525,512,3232235525,-1,0),(1,3232235777,512,3232235777,-1,0),(1,3232235778,512,3232235778,-1,0),(1,3232235779,512,3232235779,-1,0),(1,3232235780,512,3232235780,-1,0),(1,3232235781,512,3232235781,-1,0),(2,3232236033,512,3232236033,-1,0),(2,3232236034,512,3232236034,-1,0),(2,3232236035,512,3232236035,-1,0),(2,3232236036,512,3232236036,-1,0),(2,3232236037,512,3232236037,-1,0),(4,3232236545,512,3232236545,4,1); +/*!40000 ALTER TABLE `leases` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `network_pool` +-- + +DROP TABLE IF EXISTS `network_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `network_pool` ( + `oid` int(11) NOT NULL, + `uid` int(11) DEFAULT NULL, + `name` varchar(256) DEFAULT NULL, + `type` int(11) DEFAULT NULL, + `bridge` text, + `public` int(11) DEFAULT NULL, + `template` text, + PRIMARY KEY (`oid`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `network_pool` +-- + +LOCK TABLES `network_pool` WRITE; +/*!40000 ALTER TABLE `network_pool` DISABLE KEYS */; +INSERT INTO `network_pool` VALUES (0,1,'vnet_fixed_0',1,'vbr1',0,''),(1,2,'vnet_fixed_1',1,'vbr1',0,''),(2,3,'vnet_fixed_2',1,'vbr1',1,''),(3,4,'vnet_ranged_3',0,'vbr0',0,''),(4,5,'vnet_ranged_4',0,'vbr0',1,''); +/*!40000 ALTER TABLE `network_pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_pool` +-- + +DROP TABLE IF EXISTS `user_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_pool` ( + `oid` int(11) NOT NULL, + `user_name` varchar(256) DEFAULT NULL, + `password` text, + `enabled` int(11) DEFAULT NULL, + PRIMARY KEY (`oid`), + UNIQUE KEY `user_name` (`user_name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_pool` +-- + +LOCK TABLES `user_pool` WRITE; +/*!40000 ALTER TABLE `user_pool` DISABLE KEYS */; +INSERT INTO `user_pool` VALUES (0,'oneadmin','7bc8559a8fe509e680562b85c337f170956fcb06',1),(1,'user_0','90e3707afc67a2038d1088761fea5cd50bbd08bb',1),(2,'user_1','681aae69de00c2df72381c3e5f9d77e70e7e384c',1),(3,'user_2','a195b95bf777854dfe566d1ffef1b76a34dc15a1',1),(4,'user_3','05bf903dc5ff0f2f69f630d9a59bc0b6df8c1cff',1),(5,'user_4','1a6f9b4e378ab45beee6cde9396df5c6ea9863b8',1); +/*!40000 ALTER TABLE `user_pool` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `vm_pool` +-- + +DROP TABLE IF EXISTS `vm_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vm_pool` ( + `oid` int(11) NOT NULL, + `uid` int(11) DEFAULT NULL, + `name` text, + `last_poll` int(11) DEFAULT NULL, + `state` int(11) DEFAULT NULL, + `lcm_state` int(11) DEFAULT NULL, + `stime` int(11) DEFAULT NULL, + `etime` int(11) DEFAULT NULL, + `deploy_id` text, + `memory` int(11) DEFAULT NULL, + `cpu` int(11) DEFAULT NULL, + `net_tx` int(11) DEFAULT NULL, + `net_rx` int(11) DEFAULT NULL, + `last_seq` int(11) DEFAULT NULL, + `template` text, + PRIMARY KEY (`oid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `vm_pool` +-- + +LOCK TABLES `vm_pool` WRITE; +/*!40000 ALTER TABLE `vm_pool` DISABLE KEYS */; +INSERT INTO `vm_pool` VALUES (0,1,'one-0',1316187945,3,3,1316187927,0,'dummy',0,0,12345,0,1,''),(1,2,'one-1',1316187930,6,0,1316187927,1316187939,'dummy',0,0,0,0,3,''),(2,3,'one-2',1316187930,6,0,1316187928,1316187940,'dummy',0,0,0,0,0,''),(3,4,'one-3',1316187930,6,0,1316187928,1316187941,'dummy',0,0,0,0,0,''),(4,5,'one-4',0,1,0,1316187928,0,'',0,0,0,0,-1,''); +/*!40000 ALTER TABLE `vm_pool` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2011-09-16 8:45:58 diff --git a/src/onedb/test/create.sh b/src/onedb/test/create.sh index 6a49a6b070..836229780e 100755 --- a/src/onedb/test/create.sh +++ b/src/onedb/test/create.sh @@ -182,17 +182,27 @@ sleep 3s mkdir -p results/xml_files -for obj in host vnet image vm user; do +for obj in vnet image vm; do one$obj list a -x > results/xml_files/$obj-pool.xml +done +for obj in host user; do + one$obj list -x > results/xml_files/$obj-pool.xml +done + +for obj in host vnet image vm user; do for i in 0 1 2 3 4; do one$obj show -x $i > results/xml_files/$obj-$i.xml done done if [ $TWO_SERIES == "no" ]; then - oneacl list a -x > results/xml_files/acl-pool.xml - onegroup list a -x > results/xml_files/group-pool.xml + oneacl list -x > results/xml_files/acl-pool.xml + onegroup list -x > results/xml_files/group-pool.xml + + for i in 0 1; do + onegroup show -x $i > results/xml_files/group-$i.xml + done fi # Clean one auth files diff --git a/src/onedb/test/oned_mysql.conf b/src/onedb/test/oned_mysql.conf new file mode 100644 index 0000000000..164abeaf5d --- /dev/null +++ b/src/onedb/test/oned_mysql.conf @@ -0,0 +1,433 @@ +#******************************************************************************* +# OpenNebula Configuration file +#******************************************************************************* + +#******************************************************************************* +# Daemon configuration attributes +#------------------------------------------------------------------------------- +# MANAGER_TIMER: Time in seconds the core uses to evaluate periodical functions. +# HOST_MONITORING_INTERVAL and VM_POLLING_INTERVAL can not have smaller values +# than MANAGER_TIMER. +# +# 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. VM_DIR IS ONLY FOR THE NODES AND *NOT* THE +# FRONT-END +# +# SCRIPTS_REMOTE_DIR: Remote path to store the monitoring and VM management +# scripts. +# +# 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 +# port : (mysql) port for the connection to the server. +# If set to 0, the default port is used. +# 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 +#******************************************************************************* + +#MANAGER_TIMER=30 + +HOST_MONITORING_INTERVAL = 1 + +VM_POLLING_INTERVAL = 1 + +#VM_DIR=/srv/cloud/one/var + +SCRIPTS_REMOTE_DIR=/var/tmp/one + +PORT=2889 + +#DB = [ backend = "sqlite" ] + +# Sample configuration for MySQL +DB = [ backend = "mysql", + server = "localhost", + port = 0, + user = "oneadmin", + passwd = "oneadmin", + db_name = "onedb_test" ] + +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 +#******************************************************************************* +# 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 +#******************************************************************************* +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 +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_kvm", +# executable = "one_im_ssh", +# arguments = "-r 0 -t 15 kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#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" ] +#------------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Ganglia Information Driver Manager Configuration +#----------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_ganglia", +# executable = "one_im_sh", +# arguments = "ganglia" ] +#----------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# 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 +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -p name of the poll probe (executed locally) +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "vmm_kvm", +# executable = "one_vmm_ssh", +# arguments = "-t 15 -r 0 kvm", +# default = "vmm_ssh/vmm_ssh_kvm.conf", +# type = "kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -l do not perform the VM polling in the node +# -p name of the poll probe (executed locally) +#------------------------------------------------------------------------------- +#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 /) +#******************************************************************************* + +#------------------------------------------------------------------------------- +# SHARED Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +#TM_MAD = [ +# name = "tm_shared", +# executable = "one_tm", +# arguments = "tm_shared/tm_shared.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" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Image Manager Driver Configuration +#******************************************************************************* +# Drivers to manage the image repository, specialized for the storage backend +# 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 +#******************************************************************************* +#------------------------------------------------------------------------------- +# FS based Image Manager Driver Configuration +# -t number of threads, i.e. number of repo operations at the same time +#------------------------------------------------------------------------------- +IMAGE_MAD = [ + executable = "one_image", + arguments = "fs -t 15" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# 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 +# - FAILED, when the VM enters the failed state +# 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 information with $ +# - $VMID, the ID of the virtual machine +# - $TEMPLATE, the VM template in xml and base64 encoded +# 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) +# +# +# Host Hooks (HOST_HOOK) defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the Host is created (onehost create) +# - ERROR, when the Host enters the error state +# - DISABLE, when the Host is disabled +# 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 use the following Host information: +# - $HID, the ID of the host +# - $TEMPLATE, the Host template in xml and base64 encoded +# remote : values, +# - YES, The hook is executed in the host +# - NO, The hook is executed in the OpenNebula server (default) +#------------------------------------------------------------------------------- + +HM_MAD = [ + executable = "one_hm" ] + +#------------------------------------------------------------------------------- + +#------------------------------ Fault Tolerance Hooks -------------------------- +# This hook is used to perform recovery actions when a host fails. The VMs +# running in the host can be deleted (use -d option) or resubmitted (-r) in +# other host +# Last argument (force) can be "y", so suspended VMs in the host will be +# resubmitted/deleted, or "n", so suspended VMs in the host will be ignored +# +#HOST_HOOK = [ +# name = "error", +# on = "ERROR", +# command = "host_error.rb", +# arguments = "$HID -r n", +# remote = "no" ] +#------------------------------------------------------------------------------- +# This two hooks can be used to automatically delete or resubmit VMs that reach +# the "failed" state. This way, the administrator doesn't have to interact +# manually to release its resources or retry the deployment. +# +# Only one of them should be uncommented. +#------------------------------------------------------------------------------- +# +#VM_HOOK = [ +# name = "on_failure_delete", +# on = "FAILED", +# command = "/usr/bin/env onevm delete", +# arguments = "$VMID" ] +# +#VM_HOOK = [ +# name = "on_failure_resubmit", +# on = "FAILED", +# command = "/usr/bin/env onevm resubmit", +# arguments = "$VMID" ] +#------------------------------------------------------------------------------- + +#-------------------------------- ebtables Hook--------------------------------- +# You can use these two hooks to isolate networks at the ethernet level so the +# traffic generated in different virtual networks can not be seen in others. +# +# All the network configuration will be done in the cluster nodes, these are the +# additional requisites: +# - ebtables package installed +# - sudoers configured so oneadmin can execute ebtables without password +# +# NOTE: Change the first command for ebtables-xen if you are using Xen +# +#VM_HOOK = [ +# name = "ebtables-start", +# on = "running", +# command = "ebtables-kvm", # or ebtables-xen +# arguments = "one-$VMID", +# remote = "yes" ] +# +#VM_HOOK = [ +# name = "ebtables-flush", +# on = "done", +# command = "ebtables-flush", +# arguments = "", +# remote = "yes" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# 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/onedb/test/oned.conf b/src/onedb/test/oned_sqlite.conf similarity index 99% rename from src/onedb/test/oned.conf rename to src/onedb/test/oned_sqlite.conf index 1394fcdd2a..e8a6aca4f9 100644 --- a/src/onedb/test/oned.conf +++ b/src/onedb/test/oned_sqlite.conf @@ -245,12 +245,12 @@ VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ] #******************************************************************************* #------------------------------------------------------------------------------- -# NFS Transfer Manager Driver Configuration +# SHARED Transfer Manager Driver Configuration #------------------------------------------------------------------------------- #TM_MAD = [ -# name = "tm_nfs", +# name = "tm_shared", # executable = "one_tm", -# arguments = "tm_nfs/tm_nfs.conf" ] +# arguments = "tm_shared/tm_shared.conf" ] #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- diff --git a/src/onedb/test/test_mysql.sh b/src/onedb/test/test_mysql.sh new file mode 100755 index 0000000000..8b07053057 --- /dev/null +++ b/src/onedb/test/test_mysql.sh @@ -0,0 +1,204 @@ +#!/bin/bash + +################################################################################ +# Initialization +################################################################################ + +if [ -z $ONE_LOCATION ]; then + echo "ONE_LOCATION not defined." + exit -1 +fi + +ONEDCONF_LOCATION="$ONE_LOCATION/etc/oned.conf" + +if [ -f $ONEDCONF_LOCATION ]; then + echo "$ONEDCONF_LOCATION has to be overwritten, move it to a safe place." + exit -1 +fi + +VAR_LOCATION="$ONE_LOCATION/var" + + +# Clean DB +mysql -u oneadmin -poneadmin -h localhost -P 0 -e "DROP DATABASE IF EXISTS onedb_test;" + +cp oned_mysql.conf $ONEDCONF_LOCATION + + +echo "oneadmin:oneadmin" > oneadmin_auth +export ONE_XMLRPC=http://localhost:2889/RPC2 +export PATH=$ONE_LOCATION/bin:$PATH +export ONE_AUTH="`pwd`/oneadmin_auth" + + +PID=$$ + +mkdir results + +################################################################################ +# Start OpenNebula and populate a DB +################################################################################ + +echo "Starting oned, some resources will be created" + +oned -f & +sleep 2s; + +./create.sh + +pkill -P $PID oned +sleep 2s; +pkill -9 -P $PID oned + +################################################################################ +# Upgrade the 2.2 sample DB, and compare schemas +################################################################################ + +echo "All resources created, now 2.2 DB will be upgraded." + +# dump current DB and schema +onedb backup results/mysqldb.3.0 -v +if [ $? -ne 0 ]; then + exit -1 +fi + +mysqldump -u oneadmin -poneadmin -h localhost -P 0 --no-data onedb_test > results/mysqldb.3.0.tmpschema +if [ $? -ne 0 ]; then + exit -1 +fi + +# restore 2.2 +onedb restore -v -f 2.2/mysqldb.sql +if [ $? -ne 0 ]; then + exit -1 +fi + +# upgrade +onedb upgrade -v --backup results/mysqldb.backup +if [ $? -ne 0 ]; then + exit -1 +fi + +# dump upgraded DB schema +mysqldump -u oneadmin -poneadmin -h localhost -P 0 --no-data onedb_test > results/mysqldb.upgraded.tmpschema + +echo "Done. Upgraded DB and the one just created will be compared." + +# Sort the files contents, to avoid false diff errors +sort results/mysqldb.upgraded.tmpschema > results/mysqldb.upgraded.schema +sort results/mysqldb.3.0.tmpschema > results/mysqldb.3.0.schema + +rm results/mysqldb.upgraded.tmpschema +rm results/mysqldb.3.0.tmpschema + + + +# Perform a diff +FILE=results/schema.diff +diff <(grep -v -e "Dump completed on" results/mysqldb.upgraded.schema) <(grep -v -e "Dump completed on" results/mysqldb.3.0.schema) > $FILE + + +if [[ -s $FILE ]] ; then + echo "Error: Schemas do not match. Check file $FILE" + exit -1 +fi + + +################################################################################ +# Start oned using the upgraded DB and compare objects XMLs +################################################################################ + +echo "Schemas match. OpenNebula 3.0 will be started with the upgraded 2.2 DB." + +oned -f & +sleep 2s; + +for obj in host vnet image vm user; do + for i in 0 1 2 3 4; do + one$obj show -x $i > results/xml_files/$obj-$i-upgraded.xml + done +done + +for i in 0 1; do + onegroup show -x $i > results/xml_files/group-$i-upgraded.xml +done + + +for obj in vnet image vm; do + one$obj list a -x > results/xml_files/$obj-pool-upgraded.xml +done + +for obj in host acl group user; do + one$obj list -x > results/xml_files/$obj-pool-upgraded.xml +done + +pkill -P $PID oned +sleep 2s; +pkill -9 -P $PID oned + +echo "XML output collected. A diff will be performed." + +mkdir results/diff_files + +# TODO: fix. The pool elements are returned in different order. +#diff <(grep -v -e "" -e "" -e "NAME>" results/xml_files/host-pool.xml) <(grep -v -e "" -e "" -e "NAME>" results/xml_files/host-pool-upgraded.xml) > results/diff_files/host-pool.diff +#diff <(grep -v -e "" -e "" -e "" results/xml_files/image-pool.xml) <(grep -v -e "" -e "" -e "" results/xml_files/image-pool-upgraded.xml) > results/diff_files/image-pool.diff + +diff <(grep -v -e "" -e "TIME>" -e "" -e "" -e "" results/xml_files/vm-pool.xml) <(grep -v -e "" -e "TIME>" -e "" -e "" -e "" results/xml_files/vm-pool-upgraded.xml) > results/diff_files/vm-pool.diff + +for obj in vnet acl group user; do + diff <(cat results/xml_files/$obj-pool.xml) <(cat results/xml_files/$obj-pool-upgraded.xml) > results/diff_files/$obj-pool.diff +done + +for i in 0 1 2 3 4; do + diff <(grep -v -e "" -e "" -e "NAME>" results/xml_files/host-$i.xml) <(grep -v -e "" -e "" -e "NAME>" results/xml_files/host-$i-upgraded.xml) > results/diff_files/host-$i.diff + + diff <(cat results/xml_files/vnet-$i.xml) <(cat results/xml_files/vnet-$i-upgraded.xml) > results/diff_files/vnet-$i.diff + + diff <(grep -v -e "" -e "" -e "" results/xml_files/image-$i.xml) <(grep -v -e "" -e "" -e "" results/xml_files/image-$i-upgraded.xml) > results/diff_files/image-$i.diff + + diff <(grep -v -e "" -e "TIME>" -e "" -e "" -e "" -e "" results/xml_files/vm-$i.xml) <(grep -v -e "" -e "TIME>" -e "" -e "" -e "" -e "" results/xml_files/vm-$i-upgraded.xml) > results/diff_files/vm-$i.diff + + diff <(cat results/xml_files/user-$i.xml) <(cat results/xml_files/user-$i-upgraded.xml) > results/diff_files/user-$i.diff +done + +for i in 0 1; do + diff <(cat results/xml_files/group-$i.xml) <(cat results/xml_files/group-$i-upgraded.xml) > results/diff_files/group-$i.diff +done + +CODE=0 + +for obj in host vnet image vm user; do + for i in 0 1 2 3 4; do + FILE=results/diff_files/$obj-$i.diff + if [[ -s $FILE ]] ; then + echo "Error: diff file $FILE is not empty." + CODE=-1 + fi + done +done + +for i in 0 1; do + FILE=results/diff_files/group-$i.diff + if [[ -s $FILE ]] ; then + echo "Error: diff file $FILE is not empty." + CODE=-1 + fi +done + +for obj in host vnet image vm acl group user; do + FILE=results/diff_files/$obj-pool.diff + if [[ -s $FILE ]] ; then + echo "Error: diff file $FILE is not empty." + CODE=-1 + fi +done + + +if [ $CODE -eq 0 ]; then + echo "Done, all tests passed." +fi + +rm oneadmin_auth + +exit $CODE diff --git a/src/onedb/test/test.sh b/src/onedb/test/test_sqlite.sh similarity index 89% rename from src/onedb/test/test.sh rename to src/onedb/test/test_sqlite.sh index 5253b93cee..08255d13a0 100755 --- a/src/onedb/test/test.sh +++ b/src/onedb/test/test_sqlite.sh @@ -24,7 +24,7 @@ if [ -f $VAR_LOCATION/one.db ]; then fi -cp oned.conf $ONEDCONF_LOCATION +cp oned_sqlite.conf $ONEDCONF_LOCATION echo "oneadmin:oneadmin" > oneadmin_auth @@ -63,6 +63,10 @@ cp 2.2/one.db results/one.db.upgraded onedb upgrade -v --sqlite results/one.db.upgraded --backup results/one.db.backup +if [ $? -ne 0 ]; then + exit -1 +fi + echo "Done. Upgraded DB and the one just created will be compared." # Dump both DB schemas @@ -106,10 +110,18 @@ for obj in host vnet image vm user; do done done -for obj in host vnet image vm acl group user; do +for i in 0 1; do + onegroup show -x $i > results/xml_files/group-$i-upgraded.xml +done + + +for obj in vnet image vm; do one$obj list a -x > results/xml_files/$obj-pool-upgraded.xml done +for obj in host acl group user; do + one$obj list -x > results/xml_files/$obj-pool-upgraded.xml +done pkill -P $PID oned sleep 2s; @@ -139,6 +151,9 @@ for i in 0 1 2 3 4; do diff <(cat results/xml_files/user-$i.xml) <(cat results/xml_files/user-$i-upgraded.xml) > results/diff_files/user-$i.diff done +for i in 0 1; do + diff <(cat results/xml_files/group-$i.xml) <(cat results/xml_files/group-$i-upgraded.xml) > results/diff_files/group-$i.diff +done CODE=0 @@ -152,6 +167,14 @@ for obj in host vnet image vm user; do done done +for i in 0 1; do + FILE=results/diff_files/group-$i.diff + if [[ -s $FILE ]] ; then + echo "Error: diff file $FILE is not empty." + CODE=-1 + fi +done + for obj in host vnet image vm acl group user; do FILE=results/diff_files/$obj-pool.diff if [[ -s $FILE ]] ; then diff --git a/src/ozones/Server/bin/ozones-server b/src/ozones/Server/bin/ozones-server index ac76d2f6c3..4da44f11e0 100755 --- a/src/ozones/Server/bin/ozones-server +++ b/src/ozones/Server/bin/ozones-server @@ -27,7 +27,7 @@ else OZONES_PID=$ONE_LOCATION/var/ozones.pid OZONES_LOCATION=$ONE_LOCATION/lib/ozones OZONES_SERVER=$OZONES_LOCATION/config.ru - OZONES_LOCK_FILE=$ONE_LOCATION/var/.lock + OZONES_LOCK_FILE=$ONE_LOCATION/var/.ozones.lock OZONES_LOG=$ONE_LOCATION/var/ozones-server.log OZONES_CONF=$ONE_LOCATION/etc/ozones-server.conf fi diff --git a/src/ozones/Server/models/OzonesServer.rb b/src/ozones/Server/models/OzonesServer.rb index 4fdac56b3e..ce085b2054 100644 --- a/src/ozones/Server/models/OzonesServer.rb +++ b/src/ozones/Server/models/OzonesServer.rb @@ -19,8 +19,7 @@ require 'JSONUtils' class OzonesServer - - include JSONUtils + include OpenNebulaJSON::JSONUtils def initialize @ocaInt = OCAInteraction.new diff --git a/src/pool/PoolSQL.cc b/src/pool/PoolSQL.cc index 175db7be9f..d615d9dce0 100644 --- a/src/pool/PoolSQL.cc +++ b/src/pool/PoolSQL.cc @@ -122,10 +122,9 @@ int PoolSQL::allocate( else { rc = lastOID; + do_hooks(objsql, Hook::ALLOCATE); } - do_hooks(objsql, Hook::ALLOCATE); - objsql->unlock(); delete objsql; diff --git a/src/rm/RequestManagerChown.cc b/src/rm/RequestManagerChown.cc index 6f311dffb3..0364ea0bc3 100644 --- a/src/rm/RequestManagerChown.cc +++ b/src/rm/RequestManagerChown.cc @@ -32,11 +32,6 @@ void RequestManagerChown::request_execute(xmlrpc_c::paramList const& paramList, string nuname; string ngname; - // TODO: Move these to constructor? - Nebula& nd = Nebula::instance(); - GroupPool * gpool = nd.get_gpool(); - UserPool * upool = nd.get_upool(); - PoolObjectSQL * object; if ( basic_authorization(oid, att) == false ) @@ -123,10 +118,6 @@ void UserChown::request_execute(xmlrpc_c::paramList const& paramList, string ngname; - Nebula& nd = Nebula::instance(); - GroupPool * gpool = nd.get_gpool(); - UserPool * upool = static_cast(pool); - User * user; Group * group; diff --git a/src/scheduler/src/pool/test/HostXMLTest.cc b/src/scheduler/src/pool/test/HostXMLTest.cc index 2d47c9e5e4..b928f52679 100644 --- a/src/scheduler/src/pool/test/HostXMLTest.cc +++ b/src/scheduler/src/pool/test/HostXMLTest.cc @@ -266,7 +266,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107238\ \ 1\ @@ -307,7 +307,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107299\ \ 2\ @@ -350,7 +350,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107328\ \ 4\ @@ -391,7 +391,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107300\ \ 5\ @@ -428,6 +428,6 @@ const string FriendHostPool::xmls[] = }; const string FriendHostPool::host_dump = -" 1 ursa12 2 im_kvm vmm_kvm tm_nfs 1274107145 1 0 0 0 0 8194368 800 0 7955180 800 0 535848 0 0 2 ursa 2 im_kvm vmm_kvm tm_nfs 1274107206 2 0 4280320 700 0 16468252 800 0 9109156 628 0 13891232 172 7 4 ursa11 2 im_kvm vmm_kvm tm_nfs 1274107145 4 0 0 0 0 8194368 800 0 7958684 800 0 621616 0 0 5 ursa10 2 im_kvm vmm_kvm tm_nfs 1274107207 5 0 0 0 0 8194368 800 0 7870776 796 0 2192424 4 0 6 ursa08 3 im_kvm vmm_kvm tm_nfs 1274107176 6 0 0 0 0 0 0 0 6585200 0 0 1132608 0 0 7 ursa09 3 im_kvm vmm_kvm tm_nfs 1274107146 7 0 524288 100 0 8194368 800 0 7286128 798 0 8011908 1 1 "; +" 1 ursa12 2 im_kvm vmm_kvm tm_shared 1274107145 1 0 0 0 0 8194368 800 0 7955180 800 0 535848 0 0 2 ursa 2 im_kvm vmm_kvm tm_shared 1274107206 2 0 4280320 700 0 16468252 800 0 9109156 628 0 13891232 172 7 4 ursa11 2 im_kvm vmm_kvm tm_shared 1274107145 4 0 0 0 0 8194368 800 0 7958684 800 0 621616 0 0 5 ursa10 2 im_kvm vmm_kvm tm_shared 1274107207 5 0 0 0 0 8194368 800 0 7870776 796 0 2192424 4 0 6 ursa08 3 im_kvm vmm_kvm tm_shared 1274107176 6 0 0 0 0 0 0 0 6585200 0 0 1132608 0 0 7 ursa09 3 im_kvm vmm_kvm tm_shared 1274107146 7 0 524288 100 0 8194368 800 0 7286128 798 0 8011908 1 1 "; diff --git a/src/scheduler/src/pool/test/VirtualMachineXMLTest.cc b/src/scheduler/src/pool/test/VirtualMachineXMLTest.cc index d28823a547..5780793a7c 100644 --- a/src/scheduler/src/pool/test/VirtualMachineXMLTest.cc +++ b/src/scheduler/src/pool/test/VirtualMachineXMLTest.cc @@ -333,7 +333,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107238\ \ 1\ @@ -374,7 +374,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107299\ \ 2\ @@ -417,7 +417,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107328\ \ 4\ @@ -458,7 +458,7 @@ const string FriendHostPool::xmls[] = 2\ im_kvm\ vmm_kvm\ - tm_nfs\ + tm_shared\ 1274107300\ \ 5\ @@ -495,6 +495,6 @@ const string FriendHostPool::xmls[] = }; const string FriendHostPool::host_dump = -" 1 ursa12 2 im_kvm vmm_kvm tm_nfs 1274107145 1 0 0 0 0 8194368 800 0 7955180 800 0 535848 0 0 2 ursa 2 im_kvm vmm_kvm tm_nfs 1274107206 2 0 4280320 700 0 16468252 800 0 9109156 628 0 13891232 172 7 4 ursa11 2 im_kvm vmm_kvm tm_nfs 1274107145 4 0 0 0 0 8194368 800 0 7958684 800 0 621616 0 0 5 ursa10 2 im_kvm vmm_kvm tm_nfs 1274107207 5 0 0 0 0 8194368 800 0 7870776 796 0 2192424 4 0 6 ursa08 3 im_kvm vmm_kvm tm_nfs 1274107176 6 0 0 0 0 0 0 0 6585200 0 0 1132608 0 0 7 ursa09 3 im_kvm vmm_kvm tm_nfs 1274107146 7 0 524288 100 0 8194368 800 0 7286128 798 0 8011908 1 1 "; +" 1 ursa12 2 im_kvm vmm_kvm tm_shared 1274107145 1 0 0 0 0 8194368 800 0 7955180 800 0 535848 0 0 2 ursa 2 im_kvm vmm_kvm tm_shared 1274107206 2 0 4280320 700 0 16468252 800 0 9109156 628 0 13891232 172 7 4 ursa11 2 im_kvm vmm_kvm tm_shared 1274107145 4 0 0 0 0 8194368 800 0 7958684 800 0 621616 0 0 5 ursa10 2 im_kvm vmm_kvm tm_shared 1274107207 5 0 0 0 0 8194368 800 0 7870776 796 0 2192424 4 0 6 ursa08 3 im_kvm vmm_kvm tm_shared 1274107176 6 0 0 0 0 0 0 0 6585200 0 0 1132608 0 0 7 ursa09 3 im_kvm vmm_kvm tm_shared 1274107146 7 0 524288 100 0 8194368 800 0 7286128 798 0 8011908 1 1 "; diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 497e585f61..d3a09a0be7 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -83,7 +83,7 @@ var create_host_tmpl =
\ \ \ diff --git a/src/tm_mad/nfs/tm_clone.sh b/src/tm_mad/shared/tm_clone.sh similarity index 100% rename from src/tm_mad/nfs/tm_clone.sh rename to src/tm_mad/shared/tm_clone.sh diff --git a/src/tm_mad/nfs/tm_context.sh b/src/tm_mad/shared/tm_context.sh similarity index 100% rename from src/tm_mad/nfs/tm_context.sh rename to src/tm_mad/shared/tm_context.sh diff --git a/src/tm_mad/nfs/tm_delete.sh b/src/tm_mad/shared/tm_delete.sh similarity index 100% rename from src/tm_mad/nfs/tm_delete.sh rename to src/tm_mad/shared/tm_delete.sh diff --git a/src/tm_mad/nfs/tm_ln.sh b/src/tm_mad/shared/tm_ln.sh similarity index 100% rename from src/tm_mad/nfs/tm_ln.sh rename to src/tm_mad/shared/tm_ln.sh diff --git a/src/tm_mad/nfs/tm_mkimage.sh b/src/tm_mad/shared/tm_mkimage.sh similarity index 100% rename from src/tm_mad/nfs/tm_mkimage.sh rename to src/tm_mad/shared/tm_mkimage.sh diff --git a/src/tm_mad/nfs/tm_mkswap.sh b/src/tm_mad/shared/tm_mkswap.sh similarity index 100% rename from src/tm_mad/nfs/tm_mkswap.sh rename to src/tm_mad/shared/tm_mkswap.sh diff --git a/src/tm_mad/nfs/tm_mv.sh b/src/tm_mad/shared/tm_mv.sh similarity index 100% rename from src/tm_mad/nfs/tm_mv.sh rename to src/tm_mad/shared/tm_mv.sh diff --git a/src/tm_mad/nfs/tm_nfs.conf b/src/tm_mad/shared/tm_shared.conf similarity index 85% rename from src/tm_mad/nfs/tm_nfs.conf rename to src/tm_mad/shared/tm_shared.conf index bb980d7e48..1e09c41cff 100644 --- a/src/tm_mad/nfs/tm_nfs.conf +++ b/src/tm_mad/shared/tm_shared.conf @@ -14,10 +14,10 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -CLONE = nfs/tm_clone.sh -LN = nfs/tm_ln.sh -MKSWAP = nfs/tm_mkswap.sh -MKIMAGE = nfs/tm_mkimage.sh -DELETE = nfs/tm_delete.sh -MV = nfs/tm_mv.sh -CONTEXT = nfs/tm_context.sh +CLONE = shared/tm_clone.sh +LN = shared/tm_ln.sh +MKSWAP = shared/tm_mkswap.sh +MKIMAGE = shared/tm_mkimage.sh +DELETE = shared/tm_delete.sh +MV = shared/tm_mv.sh +CONTEXT = shared/tm_context.sh diff --git a/src/tm_mad/nfs/tm_nfsrc b/src/tm_mad/shared/tm_sharedrc similarity index 100% rename from src/tm_mad/nfs/tm_nfsrc rename to src/tm_mad/shared/tm_sharedrc diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 99a082ca9c..b7dbc1b66a 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -220,7 +220,7 @@ int VirtualMachine::insert(SqlDB * db, string& error_str) if ( rc != 0 ) { - goto error_leases; + goto error_leases_rollback; } // ------------------------------------------------------------------------ @@ -231,7 +231,9 @@ int VirtualMachine::insert(SqlDB * db, string& error_str) if ( rc != 0 ) { - goto error_images; + // The get_disk_images method has an internal rollback for + // the acquired images, release_disk_images() would release all disks + goto error_leases_rollback; } // ------------------------------------------------------------------------- @@ -269,26 +271,24 @@ int VirtualMachine::insert(SqlDB * db, string& error_str) error_update: error_str = "Can not insert VM in the database."; - goto error_common; - -error_leases: - NebulaLog::log("ONE",Log::ERROR, error_str); - release_network_leases(); - return -1; - -error_images: - goto error_common; + goto error_rollback; error_context: - goto error_common; + goto error_rollback; error_requirements: - goto error_common; + goto error_rollback; + +error_rollback: + release_disk_images(); + +error_leases_rollback: + release_network_leases(); + goto error_common; // just to avoid compilation warnings error_common: NebulaLog::log("ONE",Log::ERROR, error_str); - release_network_leases(); - release_disk_images(); + return -1; } @@ -663,11 +663,13 @@ int VirtualMachine::get_disk_images(string& error_str) vector disks; ImagePool * ipool; VectorAttribute * disk; + vector acquired_images; int n_os = 0; // Number of OS images int n_cd = 0; // Number of CDROMS int n_db = 0; // Number of DATABLOCKS string type; + int image_id; ostringstream oss; Image::ImageType img_type; @@ -686,10 +688,12 @@ int VirtualMachine::get_disk_images(string& error_str) continue; } - rc = ipool->disk_attribute(disk, i, &index, &img_type, uid); + rc = ipool->disk_attribute(disk, i, &index, &img_type, uid, image_id); if (rc == 0 ) { + acquired_images.push_back(image_id); + switch(img_type) { case Image::OS: @@ -728,6 +732,10 @@ int VirtualMachine::get_disk_images(string& error_str) { goto error_name; } + else if ( rc != -2 ) // The only known code left + { + goto error_unknown; + } } return 0; @@ -750,8 +758,23 @@ error_image: error_name: error_str = "IMAGE is not supported for DISK. Use IMAGE_ID instead."; + goto error_common; + +error_unknown: + error_str = "Unknown error code."; error_common: + ImageManager * imagem = nd.get_imagem(); + + vector::iterator it; + + for ( it=acquired_images.begin() ; it < acquired_images.end(); it++ ) + { + // Set disk_path and save_id to empty string, this way the image manager + // won't try to move any files + imagem->release_image(*it,"",-1,""); + } + return -1; } diff --git a/src/vmm_mad/remotes/kvm/migrate_local b/src/vmm_mad/remotes/kvm/migrate_local old mode 100644 new mode 100755 diff --git a/src/vmm_mad/remotes/kvm/poll b/src/vmm_mad/remotes/kvm/poll new file mode 120000 index 0000000000..fb5e9b8f73 --- /dev/null +++ b/src/vmm_mad/remotes/kvm/poll @@ -0,0 +1 @@ +../poll_xen_kvm.rb \ No newline at end of file diff --git a/src/vmm_mad/remotes/kvm/poll_ganglia b/src/vmm_mad/remotes/kvm/poll_ganglia new file mode 120000 index 0000000000..ca1f0231c9 --- /dev/null +++ b/src/vmm_mad/remotes/kvm/poll_ganglia @@ -0,0 +1 @@ +../poll_ganglia.rb \ No newline at end of file diff --git a/src/vmm_mad/remotes/xen/poll b/src/vmm_mad/remotes/xen/poll new file mode 120000 index 0000000000..fb5e9b8f73 --- /dev/null +++ b/src/vmm_mad/remotes/xen/poll @@ -0,0 +1 @@ +../poll_xen_kvm.rb \ No newline at end of file diff --git a/src/vmm_mad/remotes/xen/poll_ganglia b/src/vmm_mad/remotes/xen/poll_ganglia new file mode 120000 index 0000000000..ca1f0231c9 --- /dev/null +++ b/src/vmm_mad/remotes/xen/poll_ganglia @@ -0,0 +1 @@ +../poll_ganglia.rb \ No newline at end of file diff --git a/src/vnm_mad/test/output/onevm_show b/src/vnm_mad/test/output/onevm_show index a64d22fa1b..ec56cbf225 100644 --- a/src/vnm_mad/test/output/onevm_show +++ b/src/vnm_mad/test/output/onevm_show @@ -62,7 +62,7 @@ 1304502543 0 vmm_kvm - tm_nfs + tm_shared 1304502543 1304502544 1304502544 diff --git a/src/xml/test/ObjectXMLTest.cc b/src/xml/test/ObjectXMLTest.cc index fd538203d3..977189c35b 100644 --- a/src/xml/test/ObjectXMLTest.cc +++ b/src/xml/test/ObjectXMLTest.cc @@ -434,7 +434,7 @@ const string ObjectXMLTest::host = "2" "im_kvm" "vmm_kvm" - "tm_nfs" + "tm_shared" "1273799044" "cluster A" ""