mirror of
https://github.com/OpenNebula/one.git
synced 2025-04-02 10:50:07 +03:00
parent
e692b9ecdd
commit
68a76aa9ba
@ -245,6 +245,17 @@ public:
|
||||
return (snapshots != 0);
|
||||
}
|
||||
|
||||
bool has_snapshot(int snap_id)
|
||||
{
|
||||
if (!has_snapshots())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return snapshots->exists(snap_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renames a snapshot
|
||||
*
|
||||
|
@ -2071,6 +2071,12 @@ int DispatchManager::disk_snapshot_revert(int vid, int did, int snap_id,
|
||||
|
||||
if (vm->set_snapshot_disk(did, snap_id) == -1)
|
||||
{
|
||||
oss << "Disk id (" << did << ") or snapshot id ("
|
||||
<< snap_id << ") is not invalid.";
|
||||
|
||||
error_str = oss.str();
|
||||
|
||||
NebulaLog::log("DiM", Log::ERROR, error_str);
|
||||
vm->unlock();
|
||||
return -1;
|
||||
}
|
||||
|
@ -1270,6 +1270,11 @@ int VirtualMachineDisks::set_active_snapshot(int id, int snap_id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!disk->has_snapshot(snap_id))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
disk->set_active_snapshot();
|
||||
disk->replace("DISK_SNAPSHOT_ID", snap_id);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user