Merge "Add support for cloud-init on LXC instances"

This commit is contained in:
Zuul 2019-10-20 00:12:22 +00:00 committed by Gerrit Code Review
commit c323178536
3 changed files with 8 additions and 0 deletions

View File

@ -2637,6 +2637,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
self.assertEqual("/sbin/init", cfg.os_init_path)
self.assertEqual("console=tty0 console=ttyS0 console=hvc0",
cfg.os_cmdline)
self.assertEqual("OpenStack Nova", cfg.os_init_env['product_name'])
self.assertIsNone(cfg.os_root)
self.assertEqual(3, len(cfg.devices))
self.assertIsInstance(cfg.devices[0],
@ -9505,6 +9506,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
check = [
(lambda t: t.find('.').get('type'), 'lxc'),
(lambda t: t.find('./os/type').text, 'exe'),
(lambda t: t.find("./os/initenv[@name='product_name']").text,
'OpenStack Nova'),
(lambda t: t.find('./devices/filesystem/target').get('dir'), '/')]
for i, (check, expected_result) in enumerate(check):

View File

@ -5350,6 +5350,7 @@ class LibvirtDriver(driver.ComputeDriver):
elif virt_type == "lxc":
guest.os_init_path = "/sbin/init"
guest.os_cmdline = CONSOLE
guest.os_init_env["product_name"] = "OpenStack Nova"
elif virt_type == "uml":
guest.os_kernel = "/usr/bin/linux"
guest.os_root = root_device_name

View File

@ -0,0 +1,4 @@
---
features:
- |
LXC instances now support cloud-init.