node => get_standard_option('pve-node'),
vmid => get_standard_option('pve-vmid'),
skiplock => get_standard_option('skiplock'),
+ timeout => {
+ description => "Wait maximal timeout seconds.",
+ type => 'integer',
+ minimum => 0,
+ optional => 1,
+ }
},
},
returns => {
PVE::QemuServer::vm_stop($vmid, $skiplock);
+ my $pid = PVE::QemuServer::check_running ($vmid);
+
+ if ($pid && $param->{timeout}) {
+ print "waiting until VM $vmid stopps (PID $pid)\n";
+
+ my $count = 0;
+ while (($count < $param->{timeout}) &&
+ PVE::QemuServer::check_running($vmid)) {
+ $count++;
+ sleep 1;
+ }
+
+ die "wait failed - got timeout\n" if PVE::QemuServer::check_running($vmid);
+ }
+
return;
};
node => get_standard_option('pve-node'),
vmid => get_standard_option('pve-vmid'),
skiplock => get_standard_option('skiplock'),
+ timeout => {
+ description => "Wait maximal timeout seconds.",
+ type => 'integer',
+ minimum => 0,
+ optional => 1,
+ }
},
},
returns => {
PVE::QemuServer::vm_shutdown($vmid, $skiplock);
+ my $pid = PVE::QemuServer::check_running ($vmid);
+
+ if ($pid && $param->{timeout}) {
+ print "waiting until VM $vmid stopps (PID $pid)\n";
+
+ my $count = 0;
+ while (($count < $param->{timeout}) &&
+ PVE::QemuServer::check_running($vmid)) {
+ $count++;
+ sleep 1;
+ }
+
+ die "wait failed - got timeout\n" if PVE::QemuServer::check_running($vmid);
+ }
+
return;
};