From 6cb3520587d0d6b95f0672e6200276bb26dcf9d3 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 16 Aug 2012 10:58:33 -0700 Subject: [PATCH] Adds support for serial to libvirt config disks. In order for users to find a volume that they have attached to a vm, it is valuable to be able to find it in a consistent location. A following patch wil accomplish this by setting the serial number of the device to the uuid of the volume. This patch prepares for that change by allowing serial numbers to be set in the libvirt config disk object. Prepares to fix bug 1004328 Change-Id: Iecdfc17b45e1c38df50f844f127c0e95558ab22c --- nova/tests/test_libvirt_config.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nova/tests/test_libvirt_config.py b/nova/tests/test_libvirt_config.py index e270ca2a..a00d5b57 100644 --- a/nova/tests/test_libvirt_config.py +++ b/nova/tests/test_libvirt_config.py @@ -319,6 +319,22 @@ class LibvirtConfigGuestDiskTest(LibvirtConfigBaseTest): """) + def test_config_file_serial(self): + obj = config.LibvirtConfigGuestDisk() + obj.source_type = "file" + obj.source_path = "/tmp/hello" + obj.target_dev = "/dev/hda" + obj.target_bus = "ide" + obj.serial = "7a97c4a3-6f59-41d4-bf47-191d7f97f8e9" + + xml = obj.to_xml() + self.assertXmlEqual(xml, """ + + + + 7a97c4a3-6f59-41d4-bf47-191d7f97f8e9 + """) + def test_config_block(self): obj = config.LibvirtConfigGuestDisk() obj.source_type = "block"