1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-04-01 06:50:25 +03:00

F #4763: Do not allow to make snapshots to readonly disks

This commit is contained in:
Ruben S. Montero 2017-07-05 19:02:27 +02:00
parent b79285437a
commit 8576ae69fd
2 changed files with 9 additions and 0 deletions

View File

@ -1055,6 +1055,7 @@ INHERIT_VNET_ATTR = "VCENTER_INSTANCE_ID"
# among the different hosts or not. Valid values: "yes" or "no"
# ds_migrate : The driver allows migrations across datastores. Valid values:
# "yes" or "no". Note: THIS ONLY APPLIES TO SYSTEM DS.
# allow_orphans: Snapshots can live without parents
#*******************************************************************************
TM_MAD_CONF = [

View File

@ -202,6 +202,8 @@ int VirtualMachineDisk::create_snapshot(const string& name, string& error)
long long size_mb, snap_size;
int snap_id;
bool ro;
if (is_volatile())
{
error = "Cannot make snapshots on volatile disks";
@ -214,6 +216,12 @@ int VirtualMachineDisk::create_snapshot(const string& name, string& error)
return -1;
}
if ((vector_value("READONLY", ro) == 0) && ro == true )
{
error = "Cannot make snapshots on readonly disks";
return -1;
}
if ( snapshots == 0 )
{
snapshots = new Snapshots(get_id(), allow_orphans());