1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Fix problem with VM saved stated.

This commit is contained in:
grossmj 2018-04-06 13:19:54 +07:00
parent 7622c10cc9
commit 22a71b0e8c

View File

@ -1847,6 +1847,8 @@ class QemuVM(BaseNode):
disk = os.path.join(self.working_dir, "hd{}_disk.qcow2".format(drive)) disk = os.path.join(self.working_dir, "hd{}_disk.qcow2".format(drive))
else: else:
disk = disk_image disk = disk_image
if not os.path.exists(disk):
continue
command = [qemu_img_path, "snapshot", "-c", snapshot_name, disk] command = [qemu_img_path, "snapshot", "-c", snapshot_name, disk]
retcode = yield from self._qemu_img_exec(command) retcode = yield from self._qemu_img_exec(command)
if retcode: if retcode:
@ -1871,6 +1873,8 @@ class QemuVM(BaseNode):
disk = os.path.join(self.working_dir, "hd{}_disk.qcow2".format(drive)) disk = os.path.join(self.working_dir, "hd{}_disk.qcow2".format(drive))
else: else:
disk = disk_image disk = disk_image
if not os.path.exists(disk):
continue
output = yield from subprocess_check_output(qemu_img_path, "info", "--output=json", disk) output = yield from subprocess_check_output(qemu_img_path, "info", "--output=json", disk)
json_data = json.loads(output) json_data = json.loads(output)
if "snapshots" in json_data: if "snapshots" in json_data: