From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C38441FF173 for ; Mon, 11 Nov 2024 14:55:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 58638C402; Mon, 11 Nov 2024 14:55:13 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 11 Nov 2024 14:54:30 +0100 Message-Id: <20241111135436.82773-4-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241111135436.82773-1-f.ebner@proxmox.com> References: <20241111135436.82773-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.057 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v4 qemu-server 3/9] backup: prepare: factor out getting running status X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" In preparation to use it to conditionally issue a QMP 'backup-cancel' should a previous backup still be running. While at it, avoid using the compat-only check_running() helper. Signed-off-by: Fiona Ebner --- New in v4. PVE/VZDump/QemuServer.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm index 012c9210..bd4795ca 100644 --- a/PVE/VZDump/QemuServer.pm +++ b/PVE/VZDump/QemuServer.pm @@ -57,6 +57,8 @@ sub vmlist { sub prepare { my ($self, $task, $vmid, $mode) = @_; + my $running = PVE::QemuServer::Helpers::vm_running_locally($vmid); + $task->{disks} = []; my $conf = $self->{vmlist}->{$vmid} = PVE::QemuConfig->load_config($vmid); @@ -64,11 +66,9 @@ sub prepare { $self->loginfo("VM Name: $conf->{name}") if defined($conf->{name}); - $self->{vm_was_running} = 1; + $self->{vm_was_running} = $running ? 1 : 0; $self->{vm_was_paused} = 0; - if (!PVE::QemuServer::check_running($vmid)) { - $self->{vm_was_running} = 0; - } elsif (PVE::QemuServer::vm_is_paused($vmid, 0)) { + if ($running && PVE::QemuServer::vm_is_paused($vmid, 0)) { # Do not treat a suspended VM as paused, as it would cause us to skip # fs-freeze even if the VM wakes up before we reach qga_fs_freeze. $self->{vm_was_paused} = 1; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel