libvirt: add debug logging for lxc teardown paths

There are races to setup and teardown lxc-backed instances using nbd
mounts when running tempest which result in mount failing.

This change adds some debug logging to help figure out what's going on
to see where the race is happening.

Related-Bug: #1491563

Change-Id: Ief8edef0df8da1a6ee94aafa9ceaf96da5e3211b
This commit is contained in:
Matt Riedemann 2015-09-02 12:46:13 -07:00 committed by Mark Doffman
parent 69f1a7a1fa
commit b9e997617f
2 changed files with 8 additions and 0 deletions

View File

@ -307,6 +307,8 @@ class _DiskImage(object):
device = self._device_for_path(mount_dir)
if device:
self._reset(device)
else:
LOG.debug('No device found for path: %s', mount_dir)
@staticmethod
def _device_for_path(path):

View File

@ -688,6 +688,10 @@ class LibvirtDriver(driver.ComputeDriver):
inst_path = libvirt_utils.get_instance_path(instance)
container_dir = os.path.join(inst_path, 'rootfs')
rootfs_dev = instance.system_metadata.get('rootfs_device_name')
LOG.debug('Attempting to teardown container at path %(dir)s with '
'root device: %(rootfs_dev)s',
{'dir': container_dir, 'rootfs_dev': rootfs_dev},
instance=instance)
disk.teardown_container(container_dir, rootfs_dev)
def _destroy(self, instance, attempt=1):
@ -4405,6 +4409,8 @@ class LibvirtDriver(driver.ComputeDriver):
# NOTE(uni): Now the container is running with its own private
# mount namespace and so there is no need to keep the container
# rootfs mounted in the host namespace
LOG.debug('Attempting to unmount container filesystem: %s',
container_dir, instance=instance)
disk.clean_lxc_namespace(container_dir=container_dir)
else:
disk.teardown_container(container_dir=container_dir)