[pve-devel] [PATCH] If we freeze the fs with the Qemu-Guest-Agent test if QGA is running.

Wolfgang Link w.link at proxmox.com
Mon Feb 15 11:45:56 CET 2016


---
 PVE/QemuServer.pm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1139438..e97fcd1 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6120,6 +6120,19 @@ sub do_snapshots_with_qemu {
     return undef;
 }
 
+sub qga_check_running {
+    my ($vmid) = @_;
+
+    my %params = (timeout => 1);
+
+    eval { vm_mon_cmd($vmid, "guest-ping", %params); };
+    if ($@) {
+	warn "Qemu Guest Agent are not running - $@";
+	return 0;
+    }
+    return 1;
+}
+
 sub snapshot_create {
     my ($vmid, $snapname, $save_vmstate, $comment) = @_;
 
@@ -6131,7 +6144,7 @@ sub snapshot_create {
 
     my $running = check_running($vmid);
 
-    my $freezefs = $running && $config->{agent};
+    my $freezefs = $running && $config->{agent} && qga_check_running($vmid);
     $freezefs = 0 if $snap->{vmstate}; # not needed if we save RAM
 
     my $drivehash = {};
-- 
2.1.4





More information about the pve-devel mailing list