]> git.proxmox.com Git - qemu-server.git/commitdiff
add timeout parameter to vm_start api endpoint
authorTim Marx <t.marx@proxmox.com>
Tue, 14 Jan 2020 13:30:37 +0000 (14:30 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 15 Jan 2020 16:36:16 +0000 (17:36 +0100)
Signed-off-by: Tim Marx <t.marx@proxmox.com>
PVE/API2/Qemu.pm
PVE/QemuServer.pm

index 0d543ff4c0e3ed96cc985e7f37ff64ee456d720c..6ddedd2b1d16f438d3e2aa1ff4b95ef35e4ca28f 100644 (file)
@@ -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;
            };
 
index 0f8fe96a45d45a084910cf3cf0ffd77d3b5174fd..6cdf3cc6232b8204f06251136fd843585dbf91e6 100644 (file)
@@ -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,