]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/QemuConfig.pm
rollback: vmgenid: comment why we regenerate vmgenid
[qemu-server.git] / PVE / QemuConfig.pm
index de564b760278ee03d9e80139d450fa61d123a58a..c2192cf181313e4a28c63a816f04c547ddba655d 100644 (file)
@@ -286,9 +286,8 @@ sub __snapshot_rollback_hook {
        # we save the machine of the current config
        $data->{oldmachine} = $conf->{machine};
     } else {
-       # if we have a 'runningmachine' entry in the snapshot
-       # we use that for the forcemachine parameter,
-       # else we use the old logic
+       # if we have a 'runningmachine' entry in the snapshot we use that
+       # for the forcemachine parameter, else we use the old logic
        if (defined($conf->{runningmachine})) {
            $data->{forcemachine} = $conf->{runningmachine};
            delete $conf->{runningmachine};
@@ -301,6 +300,13 @@ sub __snapshot_rollback_hook {
            # in the original config.
            delete $conf->{machine} if $snap->{vmstate} && !defined($data->{oldmachine});
        }
+
+       if ($conf->{vmgenid}) {
+           # tell the VM that it's another generation, so it can react
+           # appropriately, e.g. dirty-mark copies of distributed databases or
+           # re-initializing its random number generator
+           $conf->{vmgenid} = PVE::QemuServer::generate_uuid();
+       }
     }
 
     return;