Dougs recommended fixups. Thx Doug.
This commit is contained in:
parent
3903e1aa82
commit
d2eeea4d32
@ -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)
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user