1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

B #2189: Store NEXT_SNAPSHOT id in the snapshot metadata to not reuse ID's

This commit is contained in:
Ruben S. Montero 2018-06-26 10:05:33 +02:00
parent 5ba5fad974
commit fbb1ba8d18
2 changed files with 6 additions and 6 deletions

View File

@ -106,7 +106,6 @@ public:
*/
void clear()
{
next_snapshot = 0;
active = -1;
disk_id = -1;

View File

@ -33,6 +33,8 @@ Snapshots::Snapshots(int _disk_id, bool _orphans):
}
snapshot_template.add("ALLOW_ORPHANS", _orphans);
snapshot_template.add("NEXT_SNAPSHOT", 0);
};
Snapshots::Snapshots(const Snapshots& s):
@ -105,11 +107,6 @@ void Snapshots::init()
active = id;
}
if (id >= next_snapshot)
{
next_snapshot = id + 1;
}
snapshot_pool.insert(pair<int, VectorAttribute *>(id, snap[i]));
}
@ -120,6 +117,8 @@ void Snapshots::init()
disk_id = did;
}
snapshot_template.get("NEXT_SNAPSHOT", next_snapshot);
if ( snapshot_template.get("ALLOW_ORPHANS", orphans) == false )
{
orphans = false;
@ -177,6 +176,8 @@ int Snapshots::create_snapshot(const string& name, long long size_mb)
snapshot->replace("PARENT", "-1");
}
snapshot_template.replace("NEXT_SNAPSHOST", next_snapshot + 1);
snapshot_template.set(snapshot);
snapshot_pool.insert(