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 6BC4690A8B for ; Thu, 25 Jan 2024 13:33:19 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4C90418C33 for ; Thu, 25 Jan 2024 13:33:19 +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 for ; Thu, 25 Jan 2024 13:33:18 +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 649D44929A for ; Thu, 25 Jan 2024 13:33:18 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Thu, 25 Jan 2024 13:33:12 +0100 Message-Id: <20240125123312.363853-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.39.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.064 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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. [cloudinit.pm] Subject: [pve-devel] [PATCH qemu-server] fix #4085: properly 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: Thu, 25 Jan 2024 12:33:19 -0000 PVE::Storage::path() neither activates the storage of the passed-in volume, nor does it ensure that the returned value is actually a file or block device, so this actually fixes two issues. PVE::Storage::abs_filesystem_path() actually takes care of both, while still calling path() under the hood (since $volid here is always a proper volid, unless we change the cicustom schema at some point in the future). Signed-off-by: Fabian Grünbichler --- Tested by forcefully de-activating a storage only used for cicustom volumes right before starting the VM in question PVE/QemuServer/Cloudinit.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm index 7449993a..9a500f8a 100644 --- a/PVE/QemuServer/Cloudinit.pm +++ b/PVE/QemuServer/Cloudinit.pm @@ -550,8 +550,11 @@ sub get_custom_cloudinit_files { sub read_cloudinit_snippets_file { my ($storage_conf, $volid) = @_; - my ($full_path, undef, $type) = PVE::Storage::path($storage_conf, $volid); - die "$volid is not in the snippets directory\n" if $type ne 'snippets'; + my ($vtype, undef, undef, undef, undef, undef, undef) = PVE::Storage::parse_volname($storage_conf, $volid); + + die "$volid is not in the snippets directory\n" if $vtype ne 'snippets'; + + my $full_path = PVE::Storage::abs_filesystem_path($storage_conf, $volid, 1); return PVE::Tools::file_get_contents($full_path, 1 * 1024 * 1024); } -- 2.39.2