public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] partially-fix: #4085: activate cicustom storage(s)
Date: Tue, 31 May 2022 09:20:23 +0200	[thread overview]
Message-ID: <20220531072023.2907276-1-f.gruenbichler@proxmox.com> (raw)

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 <f.gruenbichler@proxmox.com>
---
 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





                 reply	other threads:[~2022-05-31  7:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220531072023.2907276-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal