* [pve-devel] [PATCH qemu-server] partially-fix: #4085: activate cicustom storage(s)
@ 2022-05-31 7:20 Fabian Grünbichler
0 siblings, 0 replies; only message in thread
From: Fabian Grünbichler @ 2022-05-31 7:20 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-31 7:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 7:20 [pve-devel] [PATCH qemu-server] partially-fix: #4085: activate cicustom storage(s) Fabian Grünbichler
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.