mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-03 13:47:01 +03:00
bug #295: Images are disabled if have to be written in the repo
This commit is contained in:
parent
42bf46e21a
commit
971031f326
@ -89,11 +89,11 @@ module OpenNebula
|
|||||||
|
|
||||||
if !OpenNebula.is_error?(result)
|
if !OpenNebula.is_error?(result)
|
||||||
# Disable the Image for a safe overwriting
|
# Disable the Image for a safe overwriting
|
||||||
# image.disable
|
image.disable
|
||||||
|
|
||||||
result = move(source, image['SOURCE'])
|
result = move(source, image['SOURCE'])
|
||||||
|
|
||||||
# image.enable
|
image.enable
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -904,6 +904,8 @@ error_common:
|
|||||||
void VirtualMachine::release_disk_images()
|
void VirtualMachine::release_disk_images()
|
||||||
{
|
{
|
||||||
string iid;
|
string iid;
|
||||||
|
string saveas;
|
||||||
|
int saveas_id;
|
||||||
int num_disks;
|
int num_disks;
|
||||||
|
|
||||||
vector<Attribute const * > disks;
|
vector<Attribute const * > disks;
|
||||||
@ -939,12 +941,49 @@ void VirtualMachine::release_disk_images()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (img->release_image() == true)
|
img->release_image();
|
||||||
|
|
||||||
|
|
||||||
|
// -------------- DISABLE THIS IMAGE IF OVERWRITTEN --------------------
|
||||||
|
saveas = disk->vector_value("SAVE_AS");
|
||||||
|
saveas_id = -1;
|
||||||
|
|
||||||
|
if ( !saveas.empty() )
|
||||||
{
|
{
|
||||||
ipool->update(img);
|
if (saveas == id)
|
||||||
|
{
|
||||||
|
img->enable(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
saveas_id = atoi(saveas.c_str())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------- UPDATE IMAGE --------------------------------
|
||||||
|
|
||||||
|
ipool->update(img);
|
||||||
|
|
||||||
img->unlock();
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user