mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Remove default FLASH when no hda disk for Qemu VMs. Fixes #535.
This commit is contained in:
parent
8cc46f66c6
commit
f0649b4ac3
@ -1011,7 +1011,6 @@ class QemuVM(BaseVM):
|
||||
if not qemu_img_path:
|
||||
raise QemuError("Could not find qemu-img in {}".format(qemu_path_dir))
|
||||
|
||||
try:
|
||||
if self._hda_disk_image:
|
||||
if not os.path.isfile(self._hda_disk_image) or not os.path.exists(self._hda_disk_image):
|
||||
if os.path.islink(self._hda_disk_image):
|
||||
@ -1020,19 +1019,12 @@ class QemuVM(BaseVM):
|
||||
raise QemuError("hda disk image '{}' is not accessible".format(self._hda_disk_image))
|
||||
hda_disk = os.path.join(self.working_dir, "hda_disk.qcow2")
|
||||
if not os.path.exists(hda_disk):
|
||||
try:
|
||||
process = yield from asyncio.create_subprocess_exec(qemu_img_path, "create", "-o",
|
||||
"backing_file={}".format(self._hda_disk_image),
|
||||
"-f", "qcow2", hda_disk)
|
||||
retcode = yield from process.wait()
|
||||
log.info("{} returned with {}".format(qemu_img_path, retcode))
|
||||
else:
|
||||
# create a "FLASH" with 256MB if no disk image has been specified
|
||||
hda_disk = os.path.join(self.working_dir, "flash.qcow2")
|
||||
if not os.path.exists(hda_disk):
|
||||
process = yield from asyncio.create_subprocess_exec(qemu_img_path, "create", "-f", "qcow2", hda_disk, "256M")
|
||||
retcode = yield from process.wait()
|
||||
log.info("{} returned with {}".format(qemu_img_path, retcode))
|
||||
|
||||
except (OSError, subprocess.SubprocessError) as e:
|
||||
raise QemuError("Could not create hda disk image {}".format(e))
|
||||
options.extend(["-hda", hda_disk])
|
||||
|
Loading…
Reference in New Issue
Block a user