mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-29 12:38:19 +00:00
fix #4085: properly activate cicustom storage(s)
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). Reviewed-by: Fiona Ebner <f.ebner@proxmox.com> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
629923d025
commit
9946d6fa57
@ -550,8 +550,11 @@ sub get_custom_cloudinit_files {
|
|||||||
sub read_cloudinit_snippets_file {
|
sub read_cloudinit_snippets_file {
|
||||||
my ($storage_conf, $volid) = @_;
|
my ($storage_conf, $volid) = @_;
|
||||||
|
|
||||||
my ($full_path, undef, $type) = PVE::Storage::path($storage_conf, $volid);
|
my ($vtype, undef) = PVE::Storage::parse_volname($storage_conf, $volid);
|
||||||
die "$volid is not in the snippets directory\n" if $type ne 'snippets';
|
|
||||||
|
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);
|
return PVE::Tools::file_get_contents($full_path, 1 * 1024 * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user