try{300,301,400}: fix

This commit is contained in:
Jörg Thalheim
2025-08-26 15:14:23 +02:00
parent 0a1802c341
commit cb9c8e5b5a
9 changed files with 30 additions and 33 deletions

View File

@@ -340,11 +340,9 @@ class VMObject(GObject.Object):
# Try to shutdown the VM gracefully using QMP
try:
if self.qmp_wrap is None:
msg = "QMP wrapper is not available"
raise ClanError(msg)
with self.qmp_wrap.qmp_ctx() as qmp:
qmp.command("system_powerdown")
if self.qmp_wrap is not None:
with self.qmp_wrap.qmp_ctx() as qmp:
qmp.command("system_powerdown")
except (ClanError, OSError, ConnectionError) as ex:
log.debug(f"QMP command 'system_powerdown' ignored. Error: {ex}")