Merge lp:~zulcss/nova/nova-fix-lxc-shutdown into lp:~hudson-openstack/nova/milestone-proposed

Proposed by Vish Ishaya
Status: Merged
Approved by: Vish Ishaya
Approved revision: 1533
Merged at revision: 1162
Proposed branch: lp:~zulcss/nova/nova-fix-lxc-shutdown
Merge into: lp:~hudson-openstack/nova/milestone-proposed
Diff against target: 28 lines (+8/-7)
1 file modified
nova/virt/disk.py (+8/-7)
To merge this branch: bzr merge lp:~zulcss/nova/nova-fix-lxc-shutdown
Reviewer Review Type Date Requested Status
OpenStack release team Pending
Review via email: mp+75006@code.launchpad.net

Description of the change

Fixes shutdown of lxc containers.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/virt/disk.py'
2--- nova/virt/disk.py 2011-09-02 20:30:52 +0000
3+++ nova/virt/disk.py 2011-09-12 14:02:28 +0000
4@@ -148,16 +148,17 @@
5
6 LXC does not support qcow2 images yet.
7 """
8+ out, err = utils.execute('mount', run_as_root=True)
9+ for loop in out.splitlines():
10+ if instance['name'] in loop:
11+ device = loop.split()[0]
12+
13 try:
14 container_dir = '%s/rootfs' % target
15 utils.execute('umount', container_dir, run_as_root=True)
16- finally:
17- out, err = utils.execute('losetup', '-a', run_as_root=True)
18- for loop in out.splitlines():
19- if instance['name'] in loop:
20- device = loop.split(loop, ':')
21- _unlink_device(device, nbd)
22-
23+ _unlink_device(device, nbd)
24+ except Exception, exn:
25+ LOG.exception(_('Failed to remove container: %s'), exn)
26
27 def _link_device(image, nbd):
28 """Link image to device using loopback or nbd"""

Subscribers

People subscribed via source and target branches