1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 02:08:10 +00:00

Add more information when qemu-img fails.

This commit is contained in:
grossmj 2017-10-02 00:47:16 +08:00
parent 2a4ed9ba89
commit 7269285b0f
2 changed files with 8 additions and 6 deletions

View File

@ -1386,15 +1386,17 @@ class QemuVM(BaseNode):
if not os.path.exists(disk):
# create the disk
try:
process = yield from asyncio.create_subprocess_exec(qemu_img_path, "create", "-o",
"backing_file={}".format(disk_image),
"-f", "qcow2", disk)
command = [qemu_img_path, "create", "-o", "backing_file={}".format(disk_image), "-f", "qcow2", disk]
command_string = " ".join(shlex.quote(s) for s in command)
log.info("Executing qemu-img with: {}".format(command_string))
process = yield from asyncio.create_subprocess_exec(*command)
retcode = yield from process.wait()
if retcode is not None and retcode != 0:
raise QemuError("Could not create {} disk image".format(disk_name))
raise QemuError("Could not create {} disk image: qemu-img returned with {}".format(disk_name,
retcode))
log.info("{} returned with {}".format(qemu_img_path, retcode))
except (OSError, subprocess.SubprocessError) as e:
raise QemuError("Could not create {} disk image {}".format(disk_name, e))
raise QemuError("Could not create {} disk image: {}".format(disk_name, e))
else:
# The disk exists we check if the clone work
try:

View File

@ -79,7 +79,7 @@ class WebServer:
try:
srv = self._loop.create_server(handler, self._host, self._port, ssl=ssl_context)
self._server, startup_res = self._loop.run_until_complete(asyncio.gather(srv, self._app.startup(), loop=self._loop))
except (OSError, asyncio.CancelledError) as e:
except (RuntimeError, OSError, asyncio.CancelledError) as e:
log.critical("Could not start the server: {}".format(e))
return False
return True