add untested code to allow resuming of a hibernated VM

This commit is contained in:
Markus Hauschild
2013-12-15 16:38:55 +01:00
parent 680c56eebd
commit eb356897bb
2 changed files with 16 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ class VMHelper:
else:
raise Exception("Missing VMs config section!")
def startVM(self, vmid, managerpath):
def startVM(self, vmid, managerpath, hibernate_ignore=False):
self.setupNetwork(vmid)
cmd = []
@@ -88,13 +88,20 @@ class VMHelper:
cmd.append(managerpath)
cmd.append(self.config['kvm']['executable'])
cmd.append(vmid)
cmd.append("-pidfile")
cmd.append(self.config['kvm']['pidfile'].replace("$VMID", vmid))
cmd.append("-qmp")
cmd.append("unix:" + self.config['kvm']['qmpsocket'].replace("$VMID", vmid) + ",server,nowait")
hibernate_file = self.config['kvm']['hibernatefile'].replace("$VMID", vmid)
# check if ignore hibernate file flag is set
if (not hibernate_ignore):
if (os.path.isfile(hibernate_file)):
cmd.append("-incoming")
cmd.append("\"exec: cat " + hibernate_file + "\"")
if "runas" in self.config["kvm"]:
cmd.append("-runas")
cmd.append(self.config["kvm"]["runas"])