[pve-devel] [PATCH qemu-server 1/1] Mount storage for VM states before starting VMs from a snapshot

Katie Holly uz4rlcxy at meo.ws
Mon Oct 23 02:32:19 CEST 2017


I noticed that when storing VMs and VM snapshot states on a Ceph RBD pool,
Proxmox does not map the volume for the VM state file when restoring from this
snapshot. This patch tries to fix this behavior by mapping the volume for the
VM state files before, and unmapping the file afterwards.

Signed-off-by: Katie Holly <uz4rlcxy at meo.ws>
---
 PVE/QemuConfig.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 9a29b53..1866989 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -313,7 +313,9 @@ sub __snapshot_rollback_vm_start {

     my $storecfg = PVE::Storage::config();
     my $statefile = PVE::Storage::path($storecfg, $vmstate);
+    PVE::Storage::activate_volumes($storecfg, [$vmstate]);
     PVE::QemuServer::vm_start($storecfg, $vmid, $statefile, undef, undef, undef, $forcemachine);
+    PVE::Storage::deactivate_volumes($storecfg, [$vmstate]);
 }

 sub __snapshot_rollback_get_unused {
--
2.14.1



More information about the pve-devel mailing list