[pve-devel] [PATCH qemu-server 15/22] vm start/commandline: activate volumes before config_to_command()

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Jun 13 12:25:05 CEST 2025


On June 12, 2025 4:02 pm, Fiona Ebner wrote:
> With '-blockdev', it is necessary to activate the volumes to generate
> the command line, because it can be necessary to check whether the
> volume is a block device or a regular file.
> 
> Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
> ---
>  PVE/QemuServer.pm                | 61 +++++++++++++++++++++++---------
>  test/run_config2command_tests.pl | 10 ++++++
>  2 files changed, 55 insertions(+), 16 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 934adf60..82304096 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm

[..]

> @@ -6030,6 +6038,27 @@ sub get_vm_volumes {
>      return $vollist;
>  }
>  
> +# Get volumes defined in the current VM configuration, including the VM state file.
> +sub get_current_vm_volumes {
> +    my ($storecfg, $conf) = @_;
> +
> +    my $volumes = [];
> +
> +    PVE::QemuConfig->foreach_volume($conf, sub {
> +	my ($ds, $drive) = @_;
> +
> +	if (PVE::Storage::parse_volume_id($drive->{file}, 1)) {
> +	    check_volume_storage_type($storecfg, $drive->{file});
> +	    push $volumes->@*, $drive->{file};
> +	}
> +    });
> +    if (my $vmstate = $conf->{vmstate}) {
> +	push $volumes->@*, $vmstate;

could be handled with `extra_keys => ['vmstate']` and switching to
`foreach_volume_full`, like we do in `foreach_volid`?

> +    }
> +
> +    return $volumes;
> +}
> +




More information about the pve-devel mailing list