Teardown container rootfs in host namespace for lxc
Unlike other hypervisor to directly using image for VM, rootfs need to be mounted in setup_container() for lxc before launching the domain. However, this leads to several problems: * previously spawned container polluted later spawned container, which in turn causing lvm device refused to be removed, as bug descirbes * container rootfs not mounted after nova stop/start sequence This commit addresses above two issues. Fixes bug 1091639 Change-Id: I718baa6e46cf07a5458a5b80d42139dd353ae51c
This commit is contained in:
@@ -4229,7 +4229,7 @@ class LibvirtDriverTestCase(test.TestCase):
|
||||
block_device_info=None):
|
||||
pass
|
||||
|
||||
def fake_create_domain(xml):
|
||||
def fake_create_domain(xml, inst_name=''):
|
||||
return None
|
||||
|
||||
def fake_enable_hairpin(instance):
|
||||
@@ -4275,7 +4275,7 @@ class LibvirtDriverTestCase(test.TestCase):
|
||||
def fake_plug_vifs(instance, network_info):
|
||||
pass
|
||||
|
||||
def fake_create_domain(xml):
|
||||
def fake_create_domain(xml, inst_name=''):
|
||||
return None
|
||||
|
||||
def fake_enable_hairpin(instance):
|
||||
|
@@ -95,7 +95,7 @@ class TestVirtDisk(test.TestCase):
|
||||
|
||||
self.stubs.Set(utils, 'execute', fake_execute)
|
||||
|
||||
def test_lxc_destroy_container(self):
|
||||
def test_lxc_teardown_container(self):
|
||||
|
||||
def proc_mounts(self, mount_point):
|
||||
mount_points = {
|
||||
@@ -110,26 +110,26 @@ class TestVirtDisk(test.TestCase):
|
||||
self.stubs.Set(disk_api._DiskImage, '_device_for_path', proc_mounts)
|
||||
expected_commands = []
|
||||
|
||||
disk_api.destroy_container('/mnt/loop/nopart')
|
||||
disk_api.teardown_container('/mnt/loop/nopart')
|
||||
expected_commands += [
|
||||
('umount', '/dev/loop0'),
|
||||
('losetup', '--detach', '/dev/loop0'),
|
||||
]
|
||||
|
||||
disk_api.destroy_container('/mnt/loop/part')
|
||||
disk_api.teardown_container('/mnt/loop/part')
|
||||
expected_commands += [
|
||||
('umount', '/dev/mapper/loop0p1'),
|
||||
('kpartx', '-d', '/dev/loop0'),
|
||||
('losetup', '--detach', '/dev/loop0'),
|
||||
]
|
||||
|
||||
disk_api.destroy_container('/mnt/nbd/nopart')
|
||||
disk_api.teardown_container('/mnt/nbd/nopart')
|
||||
expected_commands += [
|
||||
('umount', '/dev/nbd15'),
|
||||
('qemu-nbd', '-d', '/dev/nbd15'),
|
||||
]
|
||||
|
||||
disk_api.destroy_container('/mnt/nbd/part')
|
||||
disk_api.teardown_container('/mnt/nbd/part')
|
||||
expected_commands += [
|
||||
('umount', '/dev/mapper/nbd15p1'),
|
||||
('kpartx', '-d', '/dev/nbd15'),
|
||||
|
Reference in New Issue
Block a user