Ensuring libvirt is restarted before cleanout.

This commit is contained in:
Joshua Harlow 2012-02-09 18:03:28 -08:00
parent d4fcdd0282
commit 1e52286079
2 changed files with 3 additions and 2 deletions

View File

@ -204,7 +204,7 @@ class NovaUninstaller(comp.PythonUninstallComponent):
if virt_driver == virsh.VIRT_TYPE:
inst_prefix = self.cfg.get('nova', 'instance_name_prefix')
libvirt_type = virsh.default(self.cfg.get('nova', 'libvirt_type'))
virsh.clear_libvirt_domains(libvirt_type, inst_prefix)
virsh.clear_libvirt_domains(self.distro, libvirt_type, inst_prefix)
class NovaInstaller(comp.PythonInstallComponent):

View File

@ -143,7 +143,7 @@ def virt_ok(virt_type, distro):
return False
def clear_libvirt_domains(virt_type, inst_prefix):
def clear_libvirt_domains(distro, virt_type, inst_prefix):
libvirt = _get_virt_lib()
if not libvirt:
LOG.warn("Could not clear out libvirt domains, libvirt not available for python.")
@ -154,6 +154,7 @@ def clear_libvirt_domains(virt_type, inst_prefix):
return
with sh.Rooted(True):
LOG.info("Attempting to clear out leftover libvirt domains using protocol %s" % (virt_protocol))
restart(distro)
conn = None
try:
conn = libvirt.open(virt_protocol)