From d57aef96e5f1f854376da003bc5163df3ac814b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 17 May 2017 01:35:00 +0200 Subject: [PATCH] admin.vm.Start: report libvirt errors to caller Convert them to QubesException for that. --- qubes/api/admin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qubes/api/admin.py b/qubes/api/admin.py index 33f1a161..67203a37 100644 --- a/qubes/api/admin.py +++ b/qubes/api/admin.py @@ -24,9 +24,9 @@ Qubes OS Management API import asyncio import string - import itertools import pkg_resources +import libvirt import qubes.api import qubes.devices @@ -486,7 +486,12 @@ class QubesAdminAPI(qubes.api.AbstractQubesAPI): def vm_start(self): assert not self.arg self.fire_event_for_permission() - yield from self.dest.start() + try: + yield from self.dest.start() + except libvirt.libvirtError as e: + # change to QubesException, so will be reported to the user + raise qubes.exc.QubesException('Start failed: ' + str(e)) + @qubes.api.method('admin.vm.Shutdown', no_payload=True) @asyncio.coroutine