diff options
| author | Chuck Short <zulcss@ubuntu.com> | 2011-09-12 13:52:04 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-09-12 13:52:04 +0000 |
| commit | 8e4cb45399ea4203bcc81d5c67e8197b482a1f8a (patch) | |
| tree | 6e56304cac5799aefe5c56fc470d008ee27ae764 /nova | |
| parent | 66dd77887641f9db5f690f871b0cfb4d381d6a3e (diff) | |
| parent | 212ec3af4b11a770d7e4cf7869b1865b0f067e5c (diff) | |
Fixes shutdown of lxc containers.
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/virt/disk.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/nova/virt/disk.py b/nova/virt/disk.py index 50c7c40e9..12a2cea45 100644 --- a/nova/virt/disk.py +++ b/nova/virt/disk.py @@ -148,16 +148,17 @@ def destroy_container(target, instance, nbd=False): LXC does not support qcow2 images yet. """ + out, err = utils.execute('mount', run_as_root=True) + for loop in out.splitlines(): + if instance['name'] in loop: + device = loop.split()[0] + try: container_dir = '%s/rootfs' % target utils.execute('umount', container_dir, run_as_root=True) - finally: - out, err = utils.execute('losetup', '-a', run_as_root=True) - for loop in out.splitlines(): - if instance['name'] in loop: - device = loop.split(loop, ':') - _unlink_device(device, nbd) - + _unlink_device(device, nbd) + except Exception, exn: + LOG.exception(_('Failed to remove container: %s'), exn) def _link_device(image, nbd): """Link image to device using loopback or nbd""" |
