delete file after resume
This commit is contained in:
11
VMHelper.py
11
VMHelper.py
@@ -76,7 +76,7 @@ class VMHelper:
|
|||||||
else:
|
else:
|
||||||
raise Exception("Missing VMs config section!")
|
raise Exception("Missing VMs config section!")
|
||||||
|
|
||||||
def startVM(self, vmid, managerpath):
|
def startVM(self, vmid, managerpath, hibernate_ignore=False):
|
||||||
self.setupNetwork(vmid)
|
self.setupNetwork(vmid)
|
||||||
cmd = []
|
cmd = []
|
||||||
|
|
||||||
@@ -88,13 +88,20 @@ class VMHelper:
|
|||||||
cmd.append(managerpath)
|
cmd.append(managerpath)
|
||||||
cmd.append(self.config['kvm']['executable'])
|
cmd.append(self.config['kvm']['executable'])
|
||||||
cmd.append(vmid)
|
cmd.append(vmid)
|
||||||
|
|
||||||
cmd.append("-pidfile")
|
cmd.append("-pidfile")
|
||||||
cmd.append(self.config['kvm']['pidfile'].replace("$VMID", vmid))
|
cmd.append(self.config['kvm']['pidfile'].replace("$VMID", vmid))
|
||||||
|
|
||||||
cmd.append("-qmp")
|
cmd.append("-qmp")
|
||||||
cmd.append("unix:" + self.config['kvm']['qmpsocket'].replace("$VMID", vmid) + ",server,nowait")
|
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 \'{}\' && rm \'{}\'".format(hibernate_file, hibernate_file))
|
||||||
|
|
||||||
if "runas" in self.config["kvm"]:
|
if "runas" in self.config["kvm"]:
|
||||||
cmd.append("-runas")
|
cmd.append("-runas")
|
||||||
cmd.append(self.config["kvm"]["runas"])
|
cmd.append(self.config["kvm"]["runas"])
|
||||||
|
|||||||
Reference in New Issue
Block a user