[pve-devel] [PATCH v2 qemu-server 2/2] Rename vm_is_paused to vm_is_frozen

Filip Schauer f.schauer at proxmox.com
Fri Aug 25 14:18:51 CEST 2023


Rename vm_is_paused to vm_is_frozen to avoid confusion with the "paused"
runstate.

Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
---
 PVE/API2/Qemu.pm         |  8 ++++----
 PVE/QemuMigrate.pm       |  8 ++++----
 PVE/QemuServer.pm        |  2 +-
 PVE/VZDump/QemuServer.pm | 14 +++++++-------
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 9606e72..35060e1 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3086,12 +3086,12 @@ __PACKAGE__->register_method({
 	#
 	# checking the qmp status here to get feedback to the gui/cli/api
 	# and the status query should not take too long
-	if (PVE::QemuServer::vm_is_paused($vmid)) {
+	if (PVE::QemuServer::vm_is_frozen($vmid)) {
 	    if ($param->{forceStop}) {
-		warn "VM is paused - stop instead of shutdown\n";
+		warn "VM is frozen - stop instead of shutdown\n";
 		$shutdown = 0;
 	    } else {
-		die "VM is paused - cannot shutdown\n";
+		die "VM is frozen - cannot shutdown\n";
 	    }
 	}
 
@@ -3162,7 +3162,7 @@ __PACKAGE__->register_method({
 	my $node = extract_param($param, 'node');
 	my $vmid = extract_param($param, 'vmid');
 
-	die "VM is paused - cannot shutdown\n" if PVE::QemuServer::vm_is_paused($vmid);
+	die "VM is frozen - cannot shutdown\n" if PVE::QemuServer::vm_is_frozen($vmid);
 
 	die "VM $vmid not running\n" if !PVE::QemuServer::check_running($vmid);
 
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 506911e..5bf273a 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -223,7 +223,7 @@ sub prepare {
 	    }
 	}
 
-	$self->{vm_was_paused} = 1 if PVE::QemuServer::vm_is_paused($vmid);
+	$self->{vm_was_frozen} = 1 if PVE::QemuServer::vm_is_frozen($vmid);
     }
 
     my ($loc_res, $mapped_res, $missing_mappings_by_node) = PVE::QemuServer::check_local_resources($conf, 1);
@@ -1375,7 +1375,7 @@ sub phase2_cleanup {
     # Can end up in POSTMIGRATE state if failure occurred after convergence. Try going back to
     # original state. Unfortunately, direct transition from POSTMIGRATE to PAUSED is not possible.
     if ($vm_status && $vm_status eq 'postmigrate') {
-	if (!$self->{vm_was_paused}) {
+	if (!$self->{vm_was_frozen}) {
 	    eval { mon_cmd($vmid, 'cont'); };
 	    $self->log('err', "resuming VM failed: $@") if $@;
 	} else {
@@ -1488,7 +1488,7 @@ sub phase3_cleanup {
 	# deletes local FDB entries if learning is disabled, they'll be re-added on target on resume
 	PVE::QemuServer::del_nets_bridge_fdb($conf, $vmid);
 
-	if (!$self->{vm_was_paused}) {
+	if (!$self->{vm_was_frozen}) {
 	    # config moved and nbd server stopped - now we can resume vm on target
 	    if ($tunnel && $tunnel->{version} && $tunnel->{version} >= 1) {
 		my $cmd = $tunnel->{version} == 1 ? "resume $vmid" : "resume";
@@ -1519,7 +1519,7 @@ sub phase3_cleanup {
 	    && PVE::QemuServer::parse_guest_agent($conf)->{fstrim_cloned_disks}
 	    && $self->{running}
 	) {
-	    if (!$self->{vm_was_paused}) {
+	    if (!$self->{vm_was_frozen}) {
 		$self->log('info', "issuing guest fstrim");
 		if ($self->{opts}->{remote}) {
 		    PVE::Tunnel::write_tunnel($self->{tunnel}, 600, 'fstrim');
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 954fed7..60b3541 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -8589,7 +8589,7 @@ sub complete_migration_storage {
     return $res;
 }
 
-sub vm_is_paused {
+sub vm_is_frozen {
     my ($vmid) = @_;
     my $qmpstatus = eval {
 	PVE::QemuConfig::assert_config_exists_on_node($vmid);
diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index b38d7e7..8ec322d 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -64,11 +64,11 @@ sub prepare {
 	if defined($conf->{name});
 
     $self->{vm_was_running} = 1;
-    $self->{vm_was_paused} = 0;
+    $self->{vm_was_frozen} = 0;
     if (!PVE::QemuServer::check_running($vmid)) {
 	$self->{vm_was_running} = 0;
-    } elsif (PVE::QemuServer::vm_is_paused($vmid)) {
-	$self->{vm_was_paused} = 1;
+    } elsif (PVE::QemuServer::vm_is_frozen($vmid)) {
+	$self->{vm_was_frozen} = 1;
     }
 
     $task->{hostname} = $conf->{name};
@@ -198,7 +198,7 @@ sub start_vm {
 sub suspend_vm {
     my ($self, $task, $vmid) = @_;
 
-    return if $self->{vm_was_paused};
+    return if $self->{vm_was_frozen};
 
     $self->cmd ("qm suspend $vmid --skiplock");
 }
@@ -206,7 +206,7 @@ sub suspend_vm {
 sub resume_vm {
     my ($self, $task, $vmid) = @_;
 
-    return if $self->{vm_was_paused};
+    return if $self->{vm_was_frozen};
 
     $self->cmd ("qm resume $vmid --skiplock");
 }
@@ -888,7 +888,7 @@ sub _get_task_devlist {
 
 sub qga_fs_freeze {
     my ($self, $task, $vmid) = @_;
-    return if !$self->{vmlist}->{$vmid}->{agent} || $task->{mode} eq 'stop' || !$self->{vm_was_running} || $self->{vm_was_paused};
+    return if !$self->{vmlist}->{$vmid}->{agent} || $task->{mode} eq 'stop' || !$self->{vm_was_running} || $self->{vm_was_frozen};
 
     if (!PVE::QemuServer::qga_check_running($vmid, 1)) {
 	$self->loginfo("skipping guest-agent 'fs-freeze', agent configured but not running?");
@@ -944,7 +944,7 @@ sub enforce_vm_running_for_backup {
 sub resume_vm_after_job_start {
     my ($self, $task, $vmid) = @_;
 
-    return if !$self->{vm_was_running} || $self->{vm_was_paused};
+    return if !$self->{vm_was_running} || $self->{vm_was_frozen};
 
     if (my $stoptime = $task->{vmstoptime}) {
 	my $delay = time() - $task->{vmstoptime};
-- 
2.39.2






More information about the pve-devel mailing list