From: Filip Schauer <f.schauer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu-server 2/2] Rename vm_is_paused to vm_is_frozen
Date: Fri, 25 Aug 2023 14:18:51 +0200 [thread overview]
Message-ID: <20230825121851.103307-3-f.schauer@proxmox.com> (raw)
In-Reply-To: <20230825121851.103307-1-f.schauer@proxmox.com>
Rename vm_is_paused to vm_is_frozen to avoid confusion with the "paused"
runstate.
Signed-off-by: Filip Schauer <f.schauer@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
next prev parent reply other threads:[~2023-08-25 12:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 12:18 [pve-devel] [PATCH v2 qemu-server 0/2] Fix ACPI-suspended VMs resuming after migration Filip Schauer
2023-08-25 12:18 ` [pve-devel] [PATCH v2 qemu-server 1/2] Add missing checks for paused runstates Filip Schauer
2023-10-09 11:11 ` Fiona Ebner
2023-08-25 12:18 ` Filip Schauer [this message]
2023-10-09 11:11 ` [pve-devel] [PATCH v2 qemu-server 2/2] Rename vm_is_paused to vm_is_frozen Fiona Ebner
2023-10-09 13:27 ` [pve-devel] [PATCH v2 qemu-server 0/2] Fix ACPI-suspended VMs resuming after migration Filip Schauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230825121851.103307-3-f.schauer@proxmox.com \
--to=f.schauer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal