[pve-devel] [PATCH qemu-server v2 16/32] vm start: move config_to_command() call further down
Fiona Ebner
f.ebner at proxmox.com
Wed Jun 18 15:01:53 CEST 2025
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.ebner at 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
More information about the pve-devel
mailing list