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 B7A3792265 for ; Tue, 21 Mar 2023 10:18:32 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 94B61DD2D for ; Tue, 21 Mar 2023 10:18:02 +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 ; Tue, 21 Mar 2023 10:18:01 +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 A4CD945B53 for ; Tue, 21 Mar 2023 10:18:01 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Tue, 21 Mar 2023 10:17:58 +0100 Message-Id: <20230321091758.17604-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.002 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: [pve-devel] [PATCH qemu-server] avoid list context for volume_size_info calls 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, 21 Mar 2023 09:18:32 -0000 With the recent pve-storage commit d70d814 ("api: fix get content call response type for RBD/ZFS/iSCSI volumes"), the volume_size_info call for RBD in list context is much slower than before (from a quick test, about twice as long without snapshots, even longer with snapshots and untested, but when using an external cluster with image not having the fast-diff feature, it should be worse still) and thus increases the likelihood to run into timeouts here. None of the callers here actually need the more expensive call, so just avoid calling in list context. Signed-off-by: Fiona Ebner --- PVE/QemuServer.pm | 6 +++--- PVE/VZDump/QemuServer.pm | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index b5836f7a..c1d0fd2d 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -8077,7 +8077,7 @@ sub clone_disk { } else { clone_disk_check_io_uring($drive, $storecfg, $src_storeid, $storeid, $use_drive_mirror); - ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 10); + $size = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 10); } $newvolid = PVE::Storage::vdisk_alloc( $storecfg, $storeid, $newvmid, $dst_format, $name, ($size/1024) @@ -8129,7 +8129,7 @@ sub clone_disk { } no_data_clone: - my ($size) = eval { PVE::Storage::volume_size_info($storecfg, $newvolid, 10) }; + my $size = eval { PVE::Storage::volume_size_info($storecfg, $newvolid, 10) }; my $disk = dclone($drive); delete $disk->{format}; @@ -8208,7 +8208,7 @@ sub create_efidisk($$$$$$$) { PVE::Storage::activate_volumes($storecfg, [$volid]); qemu_img_convert($ovmf_vars, $volid, $vars_size_b, undef, 0); - my ($size) = PVE::Storage::volume_size_info($storecfg, $volid, 3); + my $size = PVE::Storage::volume_size_info($storecfg, $volid, 3); return ($volid, $size/1024); } diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm index 30baa464..add26ad6 100644 --- a/PVE/VZDump/QemuServer.pm +++ b/PVE/VZDump/QemuServer.pm @@ -119,9 +119,12 @@ sub prepare { } next if !$path; - my ($size, $format) = eval { PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5) }; + my $size = eval { PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5) }; die "no such volume '$volid'\n" if $@; + my $scfg = PVE::Storage::storage_config($self->{storecfg}, $storeid); + my $format = PVE::QemuServer::qemu_img_format($scfg, $volname); + my $diskinfo = { path => $path, volid => $volid, -- 2.30.2