Add more information when qemu-img fails.

pull/1188/head
grossmj 7 years ago
parent 2a4ed9ba89
commit 7269285b0f

@ -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:

@ -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

Loading…
Cancel
Save