[pve-devel] [PATCH] savevm-end : wait that savevm is finished
Alexandre Derumier
aderumier at odiso.com
Thu Nov 20 14:54:10 CET 2014
savevm-end is async, we need to wait that savevm is finished, before continue.
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuServer.pm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2970598..f8f38f0 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4935,6 +4935,20 @@ sub snapshot_create {
eval { vm_mon_cmd($vmid, "savevm-end") if $running; };
warn $@ if $@;
+ #savevm-end is async, we need to wait
+ if($running) {
+ for(;;) {
+ my $stat = vm_mon_cmd_nocheck($vmid, "query-savevm");
+ if (!$stat->{bytes}) {
+ last;
+ } else {
+ print "savevm not yet finished\n";
+ sleep(1);
+ next;
+ }
+ }
+ }
+
if ($err) {
warn "snapshot create failed: starting cleanup\n";
eval { snapshot_delete($vmid, $snapname, 0, $drivehash); };
--
1.7.10.4
More information about the pve-devel
mailing list