admin.vm.Start: report libvirt errors to caller

Convert them to QubesException for that.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-17 01:35:00 +02:00
parent 207d497bfe
commit d57aef96e5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

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