libvirt: Fix LXC container creation

Recent changes to the blockdev creation introduced in
7be531fe9462f2b07d4a1abf6687f649d1dfbb89 caused a regression
when LXC containers were being created.

When the image is being fetched from glance, the disk mappings
for the disk bus, disk information, etc is checked before being
copied. However since LXC does not understand this concept it was
not passing any information, so the image was never being copied.

Send some basic information about the disk when the instance is being
created in order for the image to begin. Fixes LP: #1126348

Change-Id: I90daf853903737013be0cd23f78c7f61e4e15a77
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short
2013-02-15 14:07:03 -06:00
parent 953db96f7a
commit e668ebf2ef

View File

@@ -178,6 +178,21 @@ class LibvirtBlockInfoTest(test.TestCase):
}
self.assertEqual(mapping, expect)
def test_get_disk_mapping_lxc(self):
# A simple disk mapping setup, but for lxc
user_context = context.RequestContext(self.user_id, self.project_id)
instance_ref = db.instance_create(user_context, self.test_instance)
mapping = blockinfo.get_disk_mapping("lxc", instance_ref,
"lxc", "lxc",
None)
expect = {
'disk': {'bus': 'lxc', 'dev': None, 'type': 'disk'},
'root': {'bus': 'lxc', 'dev': None, 'type': 'disk'}
}
self.assertEqual(mapping, expect)
def test_get_disk_mapping_simple_iso(self):
# A simple disk mapping setup, but with a ISO for root device