From b9e6b0a076595b14c45930d1233af8d59bb85357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 25 Sep 2015 22:21:10 +0200 Subject: [PATCH] core/hvm: fix error message when creating HVM while not supported by the hardware libvirt reports such errors at domain definition, not startup (as was in libxl). QubesOS/qubes-issues#1198 --- core-modules/000QubesVm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index 1cc8d212..038623b7 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -711,7 +711,15 @@ class QubesVm(object): def _update_libvirt_domain(self): domain_config = self.create_config_file() - self._libvirt_domain = vmm.libvirt_conn.defineXML(domain_config) + try: + self._libvirt_domain = vmm.libvirt_conn.defineXML(domain_config) + except libvirt.libvirtError as e: + # shouldn't this be in QubesHVm implementation? + if e.get_error_code() == libvirt.VIR_ERR_OS_TYPE and \ + e.get_str2() == 'hvm': + raise QubesException("HVM domains not supported on this " + "machine. Check BIOS settings for " + "VT-x/AMD-V extensions.") self.uuid = uuid.UUID(bytes=self._libvirt_domain.UUID()) @property