From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 71516917C5 for ; Wed, 21 Dec 2022 16:17:56 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 516979E63 for ; Wed, 21 Dec 2022 16:17:56 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 21 Dec 2022 16:17:55 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1CAA344F54 for ; Wed, 21 Dec 2022 16:17:55 +0100 (CET) Message-ID: <6dd3a01c-43ac-5bac-c6b3-90512486a735@proxmox.com> Date: Wed, 21 Dec 2022 16:17:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Content-Language: en-US To: Proxmox VE development discussion , =?UTF-8?Q?Fabian_Gr=c3=bcnbichler?= References: <20221121131303.268816-1-s.hanreich@proxmox.com> <1671634557.1x9i16kwe4.astroid@yuna.none> From: Stefan Hanreich In-Reply-To: <1671634557.1x9i16kwe4.astroid@yuna.none> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.724 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_ASCII_DIVIDERS 0.8 Email that uses ascii formatting dividers and possible spam tricks KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -1.161 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemu.pm, proxmox.com] Subject: Re: [pve-devel] [PATCH v2 qemu-server 1/1] Do not start VM twice when rollbacking with --start 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: , X-List-Received-Date: Wed, 21 Dec 2022 15:17:56 -0000 On 12/21/22 16:02, Fabian Grünbichler wrote: > On November 21, 2022 2:13 pm, Stefan Hanreich wrote: >> When rollbacking to the snapshot of a VM that includes RAM, the VM >> gets started by the rollback task anyway, so no additional start task is >> needed. Previously, when running rollback with the --start parameter >> and the VM snapshot includes RAM, a start task was created. That task >> failed because the VM had already been started by the rollback task. >> >> Additionally documented this behaviour in the description of the --start >> parameter >> >> Signed-off-by: Stefan Hanreich >> --- >> >> Changes v1 -> v2: >> Do not parse config for checking type of snapshot but rather directly check >> whether VM is running or not via check_running() >> >> PVE/API2/Qemu.pm | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm >> index 6bdcce2..691202d 100644 >> --- a/PVE/API2/Qemu.pm >> +++ b/PVE/API2/Qemu.pm >> @@ -5064,7 +5064,8 @@ __PACKAGE__->register_method({ >> snapname => get_standard_option('pve-snapshot-name'), >> start => { >> type => 'boolean', >> - description => "Whether the VM should get started after rolling back successfully", >> + description => "Whether the VM should get started after rolling back successfully." >> + . " A VM will always be started when rollbacking a snapshot with RAM included, regardless of this parameter.", > > this is worded a bit weird (I don't think that "rollbacking" is a word ;)), how about: > > . "(Note: VMs will be automatically started if the snapshot includes RAM.)", > sounds way better! will also improve the commit message ;) >> optional => 1, >> default => 0, >> }, >> @@ -5091,7 +5092,7 @@ __PACKAGE__->register_method({ >> PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname"); >> PVE::QemuConfig->snapshot_rollback($vmid, $snapname); >> >> - if ($param->{start}) { >> + if ($param->{start} && !PVE::QemuServer::check_running($vmid)) { > > unless I am missing something, this should use > > PVE::QemuServer::Helpers::vm_running_locally($vmid) > > we are holding the guest migration lock for the whole rollback worker, and > snapshot_rollback loads the config, so we know it is on the current node at this > point and just checking whether a matching qemu process is running after the > rollback is enough. will do > >> PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node }); >> } >> }; >> -- >> 2.30.2 >> >> >> _______________________________________________ >> pve-devel mailing list >> pve-devel@lists.proxmox.com >> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >> >> >> > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > >