diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 31aef2ebd380..3b4cde600cea 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -2414,6 +2414,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], @@ -8665,6 +8666,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): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 5be7a172af8f..b1f2427462d2 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -5068,6 +5068,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 diff --git a/releasenotes/notes/bug-1834506-7c6875bbdc32ab0b.yaml b/releasenotes/notes/bug-1834506-7c6875bbdc32ab0b.yaml new file mode 100644 index 000000000000..716cc954ac9c --- /dev/null +++ b/releasenotes/notes/bug-1834506-7c6875bbdc32ab0b.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + LXC instances now support cloud-init.