We print a message when the config says that we should issue a
guest-fsfreeze-freeze command but we can't because the agent is not
running or vise versa.

Signed-off-by: Maximiliano Sandoval <[email protected]>
---
 src/PVE/QemuServer/BlockJob.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm
index b25dcf9a..313918e3 100644
--- a/src/PVE/QemuServer/BlockJob.pm
+++ b/src/PVE/QemuServer/BlockJob.pm
@@ -162,11 +162,17 @@ sub qemu_drive_mirror_monitor {
                 last if $completion eq 'skip' || $completion eq 'auto';
 
                 if ($vmiddst && $vmiddst != $vmid) {
-                    my $agent_running = $qga && qga_check_running($vmid);
-                    if ($agent_running) {
+                    my $agent_running = qga_check_running($vmid);
+                    my $should_fsfreeze = $qga && $agent_running;
+                    if ($should_fsfreeze) {
                         print "freeze filesystem\n";
                         eval { PVE::QemuServer::Agent::guest_fsfreeze($vmid); 
};
                         warn $@ if $@;
+                    } elsif ($agent_running && !$qga) {
+                        print "skipping guest-agent 'guest-fsfreeze-freeze', 
disabled in VM options\n";
+                    } elsif (!$agent_running && $qga) {
+                        print
+                            "skipping guest agent 'guest-fsfreeze-freeze' 
command: the agent is not running inside of the guest\n";
                     } else {
                         print "suspend vm\n";
                         eval { PVE::QemuServer::RunState::vm_suspend($vmid, 
1); };
@@ -176,7 +182,7 @@ sub qemu_drive_mirror_monitor {
                     # if we clone a disk for a new target vm, we don't switch 
the disk
                     qemu_blockjobs_cancel($vmid, $jobs);
 
-                    if ($agent_running) {
+                    if ($should_fsfreeze) {
                         print "unfreeze filesystem\n";
                         eval { PVE::QemuServer::Agent::guest_fsthaw($vmid); };
                         warn $@ if $@;
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to