diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 0d543ff4..6ddedd2b 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1989,7 +1989,13 @@ __PACKAGE__->register_method({ description => "Target storage for the migration. (Can be '1' to use the same storage id as on the source node.)", type => 'string', optional => 1 - } + }, + timeout => { + description => "Wait maximal timeout seconds.", + type => 'integer', + minimum => 0, + optional => 1, + }, }, }, returns => { @@ -2003,6 +2009,7 @@ __PACKAGE__->register_method({ my $node = extract_param($param, 'node'); my $vmid = extract_param($param, 'vmid'); + my $timeout = extract_param($param, 'timeout'); my $machine = extract_param($param, 'machine'); @@ -2056,8 +2063,8 @@ __PACKAGE__->register_method({ syslog('info', "start VM $vmid: $upid\n"); - PVE::QemuServer::vm_start($storecfg, $vmid, $stateuri, $skiplock, $migratedfrom, undef, - $machine, $spice_ticket, $migration_network, $migration_type, $targetstorage); + PVE::QemuServer::vm_start($storecfg, $vmid, $stateuri, $skiplock, $migratedfrom, undef, $machine, + $spice_ticket, $migration_network, $migration_type, $targetstorage, $timeout); return; }; diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 0f8fe96a..6cdf3cc6 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5338,7 +5338,7 @@ sub vmconfig_update_disk { sub vm_start { my ($storecfg, $vmid, $statefile, $skiplock, $migratedfrom, $paused, - $forcemachine, $spice_ticket, $migration_network, $migration_type, $targetstorage) = @_; + $forcemachine, $spice_ticket, $migration_network, $migration_type, $targetstorage, $timeout) = @_; PVE::QemuConfig->lock_config($vmid, sub { my $conf = PVE::QemuConfig->load_config($vmid, $migratedfrom); @@ -5541,7 +5541,7 @@ sub vm_start { my $cpuunits = defined($conf->{cpuunits}) ? $conf->{cpuunits} : $defaults->{cpuunits}; - my $start_timeout = config_aware_timeout($conf, $is_suspended); + my $start_timeout = $timeout // config_aware_timeout($conf, $is_suspended); my %run_params = ( timeout => $statefile ? undef : $start_timeout, umask => 0077,