1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #1224: Accept empty names for new snapshots

This commit is contained in:
Carlos Martín 2013-02-20 17:25:48 +01:00
parent 1f6ed22d49
commit ddcc7dc655
2 changed files with 12 additions and 3 deletions

View File

@ -1067,8 +1067,8 @@ void VirtualMachineSnapshotCreate::request_execute(
int rc;
string error_str;
int id = xmlrpc_c::value_int(paramList.getInt(1));
string str = xmlrpc_c::value_string(paramList.getString(2));
int id = xmlrpc_c::value_int(paramList.getInt(1));
string name = xmlrpc_c::value_string(paramList.getString(2));
// -------------------------------------------------------------------------
// Authorize the operation
@ -1079,7 +1079,7 @@ void VirtualMachineSnapshotCreate::request_execute(
return;
}
rc = dm->snapshot_create(id, str, error_str);
rc = dm->snapshot_create(id, name, error_str);
if ( rc != 0 )
{

View File

@ -1831,6 +1831,15 @@ int VirtualMachine::new_snapshot(string& name)
}
}
if (name.empty())
{
ostringstream oss;
oss << "snapshot-" << max_id+1;
name = oss.str();
}
snap = new VectorAttribute("SNAPSHOT");
snap->replace("SNAPSHOT_ID", max_id+1);
snap->replace("NAME", name);