[pve-devel] [PATCH qemu-server] fix #4085: properly activate cicustom storage(s)
Fiona Ebner
f.ebner at proxmox.com
Tue Jan 30 15:34:59 CET 2024
Am 25.01.24 um 13:33 schrieb Fabian Grünbichler:
> 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).
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner at proxmox.com>
> ---
> Tested by forcefully de-activating a storage only used for cicustom volumes
> right before starting the VM in question
>
> PVE/QemuServer/Cloudinit.pm | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
> index 7449993a..9a500f8a 100644
> --- a/PVE/QemuServer/Cloudinit.pm
> +++ b/PVE/QemuServer/Cloudinit.pm
> @@ -550,8 +550,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, undef, undef, undef, undef, undef) = PVE::Storage::parse_volname($storage_conf, $volid);
Style nit: line too long. Could be just
my ($vtype) = ...
> +
> + 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);
> }
>
More information about the pve-devel
mailing list