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 3C0EDAB3C for ; Mon, 21 Nov 2022 13:45:03 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 16C812C67B for ; Mon, 21 Nov 2022 13:44:33 +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 ; Mon, 21 Nov 2022 13:44:32 +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 E929844C30 for ; Mon, 21 Nov 2022 13:44:31 +0100 (CET) Date: Mon, 21 Nov 2022 13:44:24 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20221121122938.249764-1-s.hanreich@proxmox.com> In-Reply-To: <20221121122938.249764-1-s.hanreich@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1669034564.kkh92yecnq.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.136 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH 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: Mon, 21 Nov 2022 12:45:03 -0000 On November 21, 2022 1:29 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. >=20 > Additionally documented this behaviour in the description of the --start > parameter >=20 > Signed-off-by: Stefan Hanreich > --- > PVE/API2/Qemu.pm | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm > index 6bdcce2..7263a1a 100644 > --- a/PVE/API2/Qemu.pm > +++ b/PVE/API2/Qemu.pm > @@ -5064,7 +5064,8 @@ __PACKAGE__->register_method({ > snapname =3D> get_standard_option('pve-snapshot-name'), > start =3D> { > type =3D> 'boolean', > - description =3D> "Whether the VM should get started after rolling back= successfully", > + description =3D> "Whether the VM should get started after rolling back= successfully." > + . " A VM will always be started when rollbacking a snapshot with R= AM included, regardless of this parameter.", > optional =3D> 1, > default =3D> 0, > }, > @@ -5092,7 +5093,13 @@ __PACKAGE__->register_method({ > PVE::QemuConfig->snapshot_rollback($vmid, $snapname); > =20 > if ($param->{start}) { > - PVE::API2::Qemu->vm_start({ vmid =3D> $vmid, node =3D> $node }); > + my $conf =3D PVE::QemuConfig->load_config($vmid); > + my $snap =3D $conf->{snapshots}->{$snapname}; > + die "snapshot '$snapname' does not exist\n" if !defined($snap); > + > + if (!$snap->{vmstate}) { > + PVE::API2::Qemu->vm_start({ vmid =3D> $vmid, node =3D> $node }); > + } this could also just call check_running, and skip the start call if it retu= rns true. if ($param_start && !check_running(..)) { .. } > } > }; > =20 > --=20 > 2.30.2 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20