[pve-devel] [PATCH qemu-server v2 18/32] vm start/commandline: activate volumes before config_to_command()

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Jun 20 13:33:53 CEST 2025


On June 18, 2025 3:01 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.
> 
> Do not deactivate after commandline generation for 'qm showcmd',
> because there can be concurrent operations acting on the volumes.
> 
> Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
> ---
> 
> Changes in v2:
> * Do not deactivate after showcmd, because it might not be safe.
> 
>  src/PVE/QemuServer.pm                | 60 +++++++++++++++++++++-------
>  src/test/run_config2command_tests.pl | 10 +++++
>  2 files changed, 55 insertions(+), 15 deletions(-)
> 
> diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl
> index 590f80f5..cbd8cd8b 100755
> --- a/src/test/run_config2command_tests.pl
> +++ b/src/test/run_config2command_tests.pl
> @@ -256,6 +256,16 @@ $qemu_server_module->mock(
>      },
>  );
>  
> +my $storage_module = Test::MockModule->new("PVE::Storage");
> +$storage_module->mock(
> +    activate_volumes => sub {
> +        return;
> +    },
> +    deactivate_volumes => sub {
> +        return;
> +    },
> +);
> +

potential for some follow ups here - we could actually track what the
tests trigger here, and thus that
- only actively referenced volumes are activated, and unused volumes for
  example are not
- backing chains are properly activated (once those are a thing)
- showcmd doesn't deactivate
- ..?

>  my $zfsplugin_module = Test::MockModule->new("PVE::Storage::ZFSPlugin");
>  $zfsplugin_module->mock(
>      zfs_get_lu_name => sub {
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




More information about the pve-devel mailing list