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 14E8491CCB for ; Wed, 31 Jan 2024 12:29:38 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F046E39CD4 for ; Wed, 31 Jan 2024 12:29:37 +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 ; Wed, 31 Jan 2024 12:29:37 +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 0DED34936C for ; Wed, 31 Jan 2024 12:29:37 +0100 (CET) Date: Wed, 31 Jan 2024 12:29:30 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Fiona Ebner , Proxmox VE development discussion References: <20240125123312.363853-1-f.gruenbichler@proxmox.com> In-Reply-To: MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1706700551.gmodouf3pq.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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] applied: [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: Wed, 31 Jan 2024 11:29:38 -0000 On January 30, 2024 3:34 pm, Fiona Ebner wrote: > Am 25.01.24 um 13:33 schrieb Fabian Gr=C3=BCnbichler: >> PVE::Storage::path() neither activates the storage of the passed-in volu= me, nor >> does it ensure that the returned value is actually a file or block devic= e, so >> this actually fixes two issues. PVE::Storage::abs_filesystem_path() actu= ally >> takes care of both, while still calling path() under the hood (since $vo= lid >> here is always a proper volid, unless we change the cicustom schema at s= ome >> point in the future). >>=20 >> Signed-off-by: Fabian Gr=C3=BCnbichler >=20 > Reviewed-by: Fiona Ebner with this added >=20 >> --- >> Tested by forcefully de-activating a storage only used for cicustom volu= mes >> right before starting the VM in question >>=20 >> PVE/QemuServer/Cloudinit.pm | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >>=20 >> 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) =3D @_; >> =20 >> - my ($full_path, undef, $type) =3D PVE::Storage::path($storage_conf,= $volid); >> - die "$volid is not in the snippets directory\n" if $type ne 'snippe= ts'; >> + my ($vtype, undef, undef, undef, undef, undef, undef) =3D PVE::Stor= age::parse_volname($storage_conf, $volid); >=20 > Style nit: line too long. Could be just > my ($vtype) =3D ... and this addressed as well ;) thanks! >=20 >> + >> + die "$volid is not in the snippets directory\n" if $vtype ne 'snipp= ets'; >> + >> + my $full_path =3D PVE::Storage::abs_filesystem_path($storage_conf, = $volid, 1); >> return PVE::Tools::file_get_contents($full_path, 1 * 1024 * 1024); >> } >> =20 >=20