Example #1
0
 def test_console_file_allows_update(self):
     lxml = libvirt.LibvirtXml(grizzly_xml)
     self.assertIsInstance(lxml.console_file, str)
     self.assertEqual('/var/lib/nova/instances/7f9cfeab-05c6-4dcc/'
                      'console.log', lxml.console_file)
     expected = "new value"
     lxml.console_file = expected
     self.assertEqual(lxml.console_file, expected)
Example #2
0
    def test_updating_object_generates_correct_xml(self):
        src_vm_xml = libvirt.LibvirtXml(grizzly_xml)
        dst_vm_xml = libvirt.LibvirtXml(icehouse_xml)

        src_vm_xml.disk_file = dst_vm_xml.disk_file
        src_vm_xml.serial_file = dst_vm_xml.serial_file
        src_vm_xml.console_file = dst_vm_xml.console_file
        src_vm_xml.interfaces = dst_vm_xml.interfaces

        src_raw_xml = src_vm_xml.dump()

        lxml = libvirt.LibvirtXml(src_raw_xml)

        self.assertEqual(len(lxml.interfaces), len(dst_vm_xml.interfaces))
        for i in xrange(len(dst_vm_xml.interfaces)):
            self.assertEqual(lxml.interfaces[i], dst_vm_xml.interfaces[i])

        self.assertEqual(lxml.disk_file, dst_vm_xml.disk_file)
        self.assertEqual(lxml.serial_file, dst_vm_xml.serial_file)
        self.assertEqual(lxml.console_file, dst_vm_xml.console_file)
Example #3
0
    def test_serial_file_allows_update(self):
        lxml = libvirt.LibvirtXml(grizzly_xml)
        expected = "new value"
        old_value = ("/var/lib/nova/instances/"
                     "7f9cfeab-05c6-4dcc/console.log")

        self.assertIsInstance(lxml.serial_file, str)
        self.assertEqual(lxml.serial_file, old_value)

        lxml.serial_file = expected
        self.assertIsInstance(lxml.serial_file, str)
        self.assertEqual(lxml.serial_file, expected)
Example #4
0
 def test_interfaces_return_list(self):
     lxml = libvirt.LibvirtXml(grizzly_xml)
     self.assertIsInstance(lxml.interfaces, list)
Example #5
0
 def test_updates_disk_file(self):
     lxml = libvirt.LibvirtXml(grizzly_xml)
     expected = "new value"
     lxml.disk_file = expected
     self.assertEqual(lxml.disk_file, expected)
Example #6
0
 def test_returns_disk_file_from_xml(self):
     expected = ("/var/lib/nova/instances/"
                 "7f9cfeab-05c6-4dcc/disk")
     lxml = libvirt.LibvirtXml(grizzly_xml)
     self.assertIsInstance(lxml.disk_file, str)
     self.assertEqual(expected, lxml.disk_file)