diff --git a/devstack/components/nova.py b/devstack/components/nova.py index 58d572e8..e8b687e1 100644 --- a/devstack/components/nova.py +++ b/devstack/components/nova.py @@ -413,11 +413,14 @@ class NovaRuntime(comp.PythonRuntime): # should come from the persona. virt_type = lv.canon_libvirt_type(self.cfg.get('nova', 'libvirt_type')) LOG.info("Checking that your selected libvirt virtualization type %r is working and running." % (virt_type)) - if not self.virsh.check_virt(virt_type): + try: + self.virsh.check_virt(virt_type) + self.virsh.restart_service() + except exceptions.ProcessExecutionError as e: msg = ("Libvirt type %r does not seem to be active or configured correctly, " - "perhaps you should be using %r instead." % (virt_type, lv.DEF_VIRT_TYPE)) + "perhaps you should be using %r instead: %s" % + (virt_type, lv.DEF_VIRT_TYPE, e)) raise exceptions.StartException(msg) - self.virsh.restart_service() def _get_param_map(self, app_name): params = comp.PythonRuntime._get_param_map(self, app_name) diff --git a/devstack/libvirt.py b/devstack/libvirt.py index 4753363b..2f7361e1 100644 --- a/devstack/libvirt.py +++ b/devstack/libvirt.py @@ -91,26 +91,16 @@ class Virsh(object): def check_virt(self, virt_type): virt_protocol = LIBVIRT_PROTOCOL_MAP.get(virt_type) - if not virt_protocol: - return False - try: - self.restart_service() - except excp.ProcessExecutionError, e: - LOG.warn("Could not restart libvirt due to: %s" % (e)) - return False - try: - cmds = list() - cmds.append({ - 'cmd': self.distro.get_command('libvirt', 'verify'), - 'run_as_root': True, - }) - mp = dict() - mp['VIRT_PROTOCOL'] = virt_protocol - utils.execute_template(*cmds, params=mp) - return True - except excp.ProcessExecutionError as e: - LOG.warn("Could check if libvirt was ok for protocol %r due to: %s" % (virt_protocol, e)) - return False + self.restart_service() + cmds = list() + cmds.append({ + 'cmd': self.distro.get_command('libvirt', 'verify'), + 'run_as_root': True, + }) + mp = dict() + mp['VIRT_PROTOCOL'] = virt_protocol + mp['VIRT_TYPE'] = virt_type + utils.execute_template(*cmds, params=mp) def clear_domains(self, virt_type, inst_prefix): libvirt = _get_virt_lib()