For command line generation of '-blockdev', it will be necessary to activate the VM's volumes before calling config_to_command() and thus also deactivate in an error scenario. Avoid the need to put more code than necessary into the resulting eval.
Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- Changes in v2: * For templates, keep using minimized config for timeout calculation. src/PVE/QemuServer.pm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 442adde6..4ddab4c1 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -5994,18 +5994,6 @@ sub vm_start_nolock { print "Resuming suspended VM\n"; } - # Note that for certain cases like templates, the configuration is minimized, so need to ensure - # the rest of the function here uses the same configuration that was used to build the command - (my $cmd, my $vollist, my $spice_port, my $pci_devices, $conf) = config_to_command( - $storecfg, - $vmid, - $conf, - $defaults, - $forcemachine, - $forcecpu, - $params->{'live-restore-backing'}, - ); - my $migration_ip; if ( ($statefile && $statefile eq 'tcp' && $migration_type eq 'insecure') @@ -6025,12 +6013,24 @@ sub vm_start_nolock { PVE::QemuServer::StateFile::statefile_cmdline_option( $storecfg, $vmid, $statefile, $migration_type, $migration_ip, ); - push @$vollist, $statefile if $statefile_is_a_volume; } elsif ($params->{paused}) { $state_cmdline = ['-S']; } + # Note that for certain cases like templates, the configuration is minimized, so need to ensure + # the rest of the function here uses the same configuration that was used to build the command + (my $cmd, my $vollist, my $spice_port, my $pci_devices, $conf) = config_to_command( + $storecfg, + $vmid, + $conf, + $defaults, + $forcemachine, + $forcecpu, + $params->{'live-restore-backing'}, + ); + push $cmd->@*, $state_cmdline->@*; + push @$vollist, $statefile if $statefile_is_a_volume; my $memory = get_current_memory($conf->{memory}); my $start_timeout = $params->{timeout} // config_aware_timeout($conf, $memory, $resume); -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel