From 84e51477e4a5df6a1e5fa3572fd3643d5f0b0930 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Sun, 1 Aug 2010 17:54:46 +0200 Subject: [PATCH] feature #295: Only overwritten images are disabled --- src/oca/ruby/OpenNebula/ImageRepository.rb | 3 -- src/vm/VirtualMachine.cc | 38 ++-------------------- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/src/oca/ruby/OpenNebula/ImageRepository.rb b/src/oca/ruby/OpenNebula/ImageRepository.rb index d731c79ef6..f80638cc83 100644 --- a/src/oca/ruby/OpenNebula/ImageRepository.rb +++ b/src/oca/ruby/OpenNebula/ImageRepository.rb @@ -88,9 +88,6 @@ module OpenNebula result = image.info if !OpenNebula.is_error?(result) - # Disable the Image for a safe overwriting - image.disable - result = move(source, image['SOURCE']) image.enable diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index f9e8e88153..72cc62a610 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -905,7 +905,6 @@ void VirtualMachine::release_disk_images() { string iid; string saveas; - int saveas_id; int num_disks; vector disks; @@ -943,47 +942,16 @@ void VirtualMachine::release_disk_images() img->release_image(); + saveas = disk->vector_value("SAVE_AS"); - // -------------- DISABLE THIS IMAGE IF OVERWRITTEN -------------------- - saveas = disk->vector_value("SAVE_AS"); - saveas_id = -1; - - if ( !saveas.empty() ) + if ( !saveas.empty() && saveas == iid ) { - if (saveas == id) - { - img->enable(false); - } - else - { - saveas_id = atoi(saveas.c_str()) - } + img->enable(false); } - // ----------------------- UPDATE IMAGE -------------------------------- - ipool->update(img); img->unlock(); - - // ------------------- DISABLE IMAGE TO BE SAVED ----------------------- - - if (saveas_id != -1) - { - img = ipool->get(saveas_id,true); - - if ( img == 0 ) - { - continue; - } - - img->enable(false); - - ipool->update(img); - - img->unlock(); - } - } }