[pve-devel] [PATCH qemu-server] set resume parameter for vm_start_nolock if there is a vmstate

Fabian Ebner f.ebner at proxmox.com
Tue Jul 7 10:20:03 CEST 2020


In config_to_command, '-loadstate' will be added whenever there is a
vmstate in the config. But in vm_start_nolock, the resume parameter
is used to calculate the appropriate timeout and to remove the vmstate
after the start. The resume parameter was only set if there is a
'suspended' lock, but apparently [0] we cannot rely on the lock to be
set if and only if there is a vmstate.

[0]: https://forum.proxmox.com/threads/task-error-start-failed.72450

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 6872e06..d937025 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4782,10 +4782,12 @@ sub vm_start {
 
 	die "you can't start a vm if it's a template\n" if PVE::QemuConfig->is_template($conf);
 
-	$params->{resume} = PVE::QemuConfig->has_lock($conf, 'suspended');
+	my $has_suspended_lock = PVE::QemuConfig->has_lock($conf, 'suspended');
 
 	PVE::QemuConfig->check_lock($conf)
-	    if !($params->{skiplock} || $params->{resume});
+	    if !($params->{skiplock} || $has_suspended_lock);
+
+	$params->{resume} = $has_suspended_lock || defined($conf->{vmstate});
 
 	die "VM $vmid already running\n" if check_running($vmid, undef, $migrate_opts->{migratedfrom});
 
-- 
2.20.1





More information about the pve-devel mailing list