mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-01-20 14:03:50 +03: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> (cherry picked from commit 9946d6fa576cc33ab979005c79d692a0724a60e1) Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
878be3a1f0
commit
260100ed33
@ -548,8 +548,11 @@ sub get_custom_cloudinit_files {
|
||||
sub read_cloudinit_snippets_file {
|
||||
my ($storage_conf, $volid) = @_;
|
||||
|
||||
my ($full_path, undef, $type) = PVE::Storage::path($storage_conf, $volid);
|
||||
die "$volid is not in the snippets directory\n" if $type ne 'snippets';
|
||||
my ($vtype, undef) = PVE::Storage::parse_volname($storage_conf, $volid);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user