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 7864673F0F for ; Tue, 31 May 2022 09:20:37 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6DC2D556B for ; Tue, 31 May 2022 09:20:37 +0200 (CEST) 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 5700C5561 for ; Tue, 31 May 2022 09:20:33 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 56202429B2 for ; Tue, 31 May 2022 09:20:32 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Tue, 31 May 2022 09:20:23 +0200 Message-Id: <20220531072023.2907276-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.172 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 - Subject: [pve-devel] [PATCH qemu-server] partially-fix: #4085: activate cicustom storage(s) 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, 31 May 2022 07:20:37 -0000 else we might attempt to read from a path that is not valid, because the underlying storage hasn't been activated (yet). Signed-off-by: Fabian Grünbichler --- PVE/QemuServer/Cloudinit.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm index b7daa2a5..87a0b983 100644 --- a/PVE/QemuServer/Cloudinit.pm +++ b/PVE/QemuServer/Cloudinit.pm @@ -519,32 +519,36 @@ sub get_custom_cloudinit_files { my $vendor_volid = $files->{vendor}; my $storage_conf = PVE::Storage::config(); + my $scache = {}; my $network_data; if ($network_volid) { - $network_data = read_cloudinit_snippets_file($storage_conf, $network_volid); + $network_data = read_cloudinit_snippets_file($storage_conf, $network_volid, $scache); } my $user_data; if ($user_volid) { - $user_data = read_cloudinit_snippets_file($storage_conf, $user_volid); + $user_data = read_cloudinit_snippets_file($storage_conf, $user_volid, $scache); } my $meta_data; if ($meta_volid) { - $meta_data = read_cloudinit_snippets_file($storage_conf, $meta_volid); + $meta_data = read_cloudinit_snippets_file($storage_conf, $meta_volid, $scache); } my $vendor_data; if ($vendor_volid) { - $vendor_data = read_cloudinit_snippets_file($storage_conf, $vendor_volid); + $vendor_data = read_cloudinit_snippets_file($storage_conf, $vendor_volid, $scache); } return ($user_data, $network_data, $meta_data, $vendor_data); } sub read_cloudinit_snippets_file { - my ($storage_conf, $volid) = @_; + my ($storage_conf, $volid, $scache) = @_; + + my ($storeid, undef) = parse_volume_id($volid); + activate_storage($storage_conf, $storeid, $scache); my ($full_path, undef, $type) = PVE::Storage::path($storage_conf, $volid); die "$volid is not in the snippets directory\n" if $type ne 'snippets'; -- 2.30.2