[pve-devel] [PATCH qemu-server] partially-fix: #4085: activate cicustom storage(s)
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue May 31 09:20:23 CEST 2022
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 at 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
More information about the pve-devel
mailing list