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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id E293260FEE for ; Tue, 8 Feb 2022 09:37:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CFC182BDED for ; Tue, 8 Feb 2022 09:36:43 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id F3CC12BDE3 for ; Tue, 8 Feb 2022 09:36:42 +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 9F9994612D for ; Tue, 8 Feb 2022 09:36:36 +0100 (CET) Date: Tue, 08 Feb 2022 09:36:30 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20220127140155.66141-1-f.ebner@proxmox.com> In-Reply-To: <20220127140155.66141-1-f.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1644309293.4sgyoi996y.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.205 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 T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, qemu.pm, qemuserver.pm] Subject: [pve-devel] applied-series: [PATCH-SERIES qemu-server] clone_disk-related improvments 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: Tue, 08 Feb 2022 08:37:13 -0000 with following addition on top (shown here with `-w`), to repeat even=20 more of the checks after forking/locking: diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 59e083eb..a359d096 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -3046,7 +3046,6 @@ __PACKAGE__->register_method({ my $vmid =3D extract_param($param, 'vmid'); my $newid =3D extract_param($param, 'newid'); my $pool =3D extract_param($param, 'pool'); - $rpcenv->check_pool_exist($pool) if defined($pool); =20 my $snapname =3D extract_param($param, 'snapname'); my $storage =3D extract_param($param, 'storage'); @@ -3059,6 +3058,10 @@ __PACKAGE__->register_method({ undef $target; } =20 + my $running =3D PVE::QemuServer::check_running($vmid) || 0; + + my $load_and_check =3D sub { + $rpcenv->check_pool_exist($pool) if defined($pool); PVE::Cluster::check_node_exists($target) if $target; =20 my $storecfg =3D PVE::Storage::config(); @@ -3071,15 +3074,13 @@ __PACKAGE__->register_method({ PVE::Storage::storage_check_enabled($storecfg, $storage, $target); # clone only works if target storage is shared my $scfg =3D PVE::Storage::storage_config($storecfg, $storage); - die "can't clone to non-shared storage '$storage'\n" if !$scfg->{shared}= ; + die "can't clone to non-shared storage '$storage'\n" + if !$scfg->{shared}; } } =20 PVE::Cluster::check_cfs_quorum(); =20 - my $running =3D PVE::QemuServer::check_running($vmid) || 0; - - my $load_and_check =3D sub { my $conf =3D PVE::QemuConfig->load_config($vmid); PVE::QemuConfig->check_lock($conf); =20 @@ -3159,6 +3160,7 @@ __PACKAGE__->register_method({ =20 my $clonefn =3D sub { my ($conffile, $newconf, $oldconf, $vollist, $drives, $fullclone) =3D= $load_and_check->(); + my $storecfg =3D PVE::Storage::config(); =20 # auto generate a new uuid my $smbios1 =3D PVE::QemuServer::parse_smbios1($newconf->{smbios1} ||= ''); On January 27, 2022 3:01 pm, Fabian Ebner wrote: > The second patch is fixing a concrete bug with vm_{resume,suspend} not be= ing > issued for a full clone of a running VM without guest agent. Other patche= s are > minor improvements, mostly trying to prevent future bugs. >=20 > Fabian Ebner (4): > drive mirror monitor: warn when suspend/resume/freeze/thaw calls fail > api: clone: fork before locking > api: move disk: fork before locking > clone disk: don't modify drive parameter >=20 > PVE/API2/Qemu.pm | 382 ++++++++++++++++++++++++---------------------- > PVE/QemuServer.pm | 10 +- > 2 files changed, 205 insertions(+), 187 deletions(-) >=20 > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20