mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
xmlbuilder: Rename get_xml_config -> get_xml
The config part is redundant. Should have done this a long time ago
This commit is contained in:
parent
2b41e130d8
commit
ea413be214
@ -93,7 +93,7 @@ class TestClone(unittest.TestCase):
|
||||
if clone_disks_file:
|
||||
xml_clone_disks = ""
|
||||
for i in cloneobj.clone_disks:
|
||||
xml_clone_disks += i.get_vol_install().get_xml_config()
|
||||
xml_clone_disks += i.get_vol_install().get_xml()
|
||||
utils.diff_compare(xml_clone_disks, clone_disks_file)
|
||||
|
||||
def _clone_define(self, filebase):
|
||||
|
@ -51,7 +51,7 @@ class TestInterfaces(unittest.TestCase):
|
||||
def define_xml(self, obj, compare=True):
|
||||
obj.validate()
|
||||
|
||||
xml = obj.get_xml_config()
|
||||
xml = obj.get_xml()
|
||||
logging.debug("Defining interface XML:\n%s", xml)
|
||||
|
||||
if compare:
|
||||
|
@ -85,7 +85,7 @@ class TestNodeDev(unittest.TestCase):
|
||||
|
||||
dev = DeviceHostdev(self.conn)
|
||||
dev.set_from_nodedev(nodedev)
|
||||
utils.diff_compare(dev.get_xml_config() + "\n", devfile)
|
||||
utils.diff_compare(dev.get_xml() + "\n", devfile)
|
||||
|
||||
def testSystemDevice(self):
|
||||
devname = "computer"
|
||||
|
@ -52,7 +52,7 @@ def removePool(poolobj):
|
||||
|
||||
def poolCompare(pool_inst):
|
||||
filename = os.path.join(basepath, pool_inst.name + ".xml")
|
||||
out_expect = pool_inst.get_xml_config()
|
||||
out_expect = pool_inst.get_xml()
|
||||
|
||||
if not os.path.exists(filename):
|
||||
open(filename, "w").write(out_expect)
|
||||
@ -93,7 +93,7 @@ def createVol(conn, poolobj, volname=None, input_vol=None, clone_vol=None):
|
||||
|
||||
vol_inst.validate()
|
||||
filename = os.path.join(basepath, vol_inst.name + ".xml")
|
||||
utils.diff_compare(vol_inst.get_xml_config(), filename)
|
||||
utils.diff_compare(vol_inst.get_xml(), filename)
|
||||
return vol_inst.install(meter=False)
|
||||
|
||||
|
||||
|
@ -132,27 +132,27 @@ class TestXMLMisc(unittest.TestCase):
|
||||
dev1.macaddr = "22:22:33:44:55:66"
|
||||
|
||||
dev2 = virtinst.DeviceInterface(self.conn,
|
||||
parsexml=dev1.get_xml_config())
|
||||
parsexml=dev1.get_xml())
|
||||
dev2.source = None
|
||||
dev2.source = "foobr0"
|
||||
dev2.macaddr = "22:22:33:44:55:67"
|
||||
|
||||
dev3 = virtinst.DeviceInterface(self.conn,
|
||||
parsexml=dev1.get_xml_config())
|
||||
parsexml=dev1.get_xml())
|
||||
dev3.source = None
|
||||
dev3.macaddr = "22:22:33:44:55:68"
|
||||
|
||||
utils.diff_compare(dev1.get_xml_config(), None,
|
||||
utils.diff_compare(dev1.get_xml(), None,
|
||||
"<interface type=\"bridge\">\n"
|
||||
" <source bridge=\"bzz0\"/>\n"
|
||||
" <mac address=\"22:22:33:44:55:66\"/>\n"
|
||||
"</interface>\n")
|
||||
utils.diff_compare(dev2.get_xml_config(), None,
|
||||
utils.diff_compare(dev2.get_xml(), None,
|
||||
"<interface type=\"bridge\">\n"
|
||||
" <source bridge=\"foobr0\"/>\n"
|
||||
" <mac address=\"22:22:33:44:55:67\"/>\n"
|
||||
"</interface>\n")
|
||||
utils.diff_compare(dev3.get_xml_config(), None,
|
||||
utils.diff_compare(dev3.get_xml(), None,
|
||||
"<interface type=\"bridge\">\n"
|
||||
" <mac address=\"22:22:33:44:55:68\"/>\n"
|
||||
"</interface>\n")
|
||||
|
@ -34,7 +34,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
def _roundtrip_compare(self, filename):
|
||||
expectXML = sanitize_file_xml(open(filename).read())
|
||||
guest = virtinst.Guest(self.conn, parsexml=expectXML)
|
||||
actualXML = guest.get_xml_config()
|
||||
actualXML = guest.get_xml()
|
||||
utils.diff_compare(actualXML, expect_out=expectXML)
|
||||
|
||||
def _alter_compare(self, actualXML, outfile, support_check=None):
|
||||
@ -179,7 +179,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("policy", "force", "disable")
|
||||
rmfeat = guest.cpu.features[3]
|
||||
guest.cpu.remove_child(rmfeat)
|
||||
self.assertEqual(rmfeat.get_xml_config(),
|
||||
self.assertEqual(rmfeat.get_xml(),
|
||||
"""<feature name="foo" policy="bar"/>\n""")
|
||||
guest.cpu.add_feature("addfeature")
|
||||
|
||||
@ -220,7 +220,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("nosharepages", False, True)
|
||||
check("locked", False, True)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile,
|
||||
self._alter_compare(guest.get_xml(), outfile,
|
||||
support_check=[self.conn.SUPPORT_CONN_VMPORT,
|
||||
self.conn.SUPPORT_CONN_VMCOREINFO])
|
||||
|
||||
@ -237,7 +237,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
|
||||
guest.remove_child(guest.seclabels[1])
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterMinimalGuest(self):
|
||||
guest, outfile = self._get_test_content("change-minimal-guest")
|
||||
@ -246,11 +246,11 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("acpi", False, True)
|
||||
check("pae", False)
|
||||
self.assertTrue(
|
||||
guest.features.get_xml_config().startswith("<features"))
|
||||
guest.features.get_xml().startswith("<features"))
|
||||
|
||||
check = self._make_checker(guest.clock)
|
||||
check("offset", None, "utc")
|
||||
self.assertTrue(guest.clock.get_xml_config().startswith("<clock"))
|
||||
self.assertTrue(guest.clock.get_xml().startswith("<clock"))
|
||||
|
||||
seclabel = virtinst.DomainSeclabel(guest.conn)
|
||||
guest.add_child(seclabel)
|
||||
@ -258,7 +258,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
seclabel.type = "static"
|
||||
seclabel.label = "frob"
|
||||
self.assertTrue(
|
||||
guest.seclabels[0].get_xml_config().startswith("<seclabel"))
|
||||
guest.seclabels[0].get_xml().startswith("<seclabel"))
|
||||
|
||||
check = self._make_checker(guest.cpu)
|
||||
check("model", None, "foobar")
|
||||
@ -266,15 +266,15 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("cores", None, 4)
|
||||
guest.cpu.add_feature("x2apic", "forbid")
|
||||
guest.cpu.set_topology_defaults(guest.vcpus)
|
||||
self.assertTrue(guest.cpu.get_xml_config().startswith("<cpu"))
|
||||
self.assertTrue(guest.cpu.get_xml().startswith("<cpu"))
|
||||
self.assertEqual(guest.cpu.get_xml_id(), "./cpu")
|
||||
self.assertEqual(guest.cpu.get_xml_idx(), 0)
|
||||
self.assertEqual(guest.get_xml_id(), ".")
|
||||
self.assertEqual(guest.get_xml_idx(), 0)
|
||||
|
||||
self.assertTrue(guest.os.get_xml_config().startswith("<os"))
|
||||
self.assertTrue(guest.os.get_xml().startswith("<os"))
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterBootMulti(self):
|
||||
guest, outfile = self._get_test_content("change-boot-multi")
|
||||
@ -287,7 +287,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("dtb", None, "/baz.dtb")
|
||||
check("kernel_args", None, "ks=foo.ks")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterBootKernel(self):
|
||||
guest, outfile = self._get_test_content("change-boot-kernel")
|
||||
@ -300,7 +300,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("initrd", "/boot/initrd", None)
|
||||
check("kernel_args", "location", None)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterBootUEFI(self):
|
||||
guest, outfile = self._get_test_content("change-boot-uefi")
|
||||
@ -318,7 +318,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("initrd", "/boot/initrd", None)
|
||||
check("kernel_args", "location", None)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterCpuMode(self):
|
||||
guest, outfile = self._get_test_content("change-cpumode")
|
||||
@ -329,7 +329,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
# mode will be "custom"
|
||||
check("model", None, "qemu64")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterDisk(self):
|
||||
"""
|
||||
@ -419,14 +419,14 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("source_host_socket", "/var/run/nbdsock")
|
||||
check("path", "nbd+unix:///var/run/nbdsock")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testSingleDisk(self):
|
||||
xml = ("""<disk type="file" device="disk"><source file="/a.img"/>\n"""
|
||||
"""<target dev="hda" bus="ide"/></disk>\n""")
|
||||
d = virtinst.DeviceDisk(self.conn, parsexml=xml)
|
||||
self._set_and_check(d, "target", "hda", "hdb")
|
||||
self.assertEqual(xml.replace("hda", "hdb"), d.get_xml_config())
|
||||
self.assertEqual(xml.replace("hda", "hdb"), d.get_xml())
|
||||
|
||||
def testAlterChars(self):
|
||||
guest, outfile = self._get_test_content("change-chars")
|
||||
@ -495,7 +495,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
self.assertEqual(channel3.get_xml_id(), "./devices/channel[3]")
|
||||
self.assertEqual(channel3.get_xml_idx(), 2)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterControllers(self):
|
||||
guest, outfile = self._get_test_content("change-controllers")
|
||||
@ -525,7 +525,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("model", "ich9-ehci1", "ich9-uhci1")
|
||||
check("master_startport", 4, 2)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterNics(self):
|
||||
guest, outfile = self._get_test_content("change-nics")
|
||||
@ -577,7 +577,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("instanceid", "09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b",
|
||||
"09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterInputs(self):
|
||||
guest, outfile = self._get_test_content("change-inputs")
|
||||
@ -594,7 +594,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("bus", "usb", "xen")
|
||||
check("bus", "xen", "usb")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterGraphics(self):
|
||||
guest, outfile = self._get_test_content("change-graphics")
|
||||
@ -659,7 +659,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("gl", None, True)
|
||||
check("rendernode", None, "/dev/dri/foo")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterVideos(self):
|
||||
guest, outfile = self._get_test_content("change-videos")
|
||||
@ -684,7 +684,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("vgamem", None, 8192)
|
||||
check("accel3d", None, True)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterHostdevs(self):
|
||||
infile = "tests/xmlparse-xml/change-hostdevs-in.xml"
|
||||
@ -745,7 +745,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(dev7)
|
||||
check("type", "storage")
|
||||
check("storage_block", "/dev/sdf", "/dev/fd0")
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterWatchdogs(self):
|
||||
guest, outfile = self._get_test_content("change-watchdogs")
|
||||
@ -755,7 +755,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("model", "ib700", "i6300esb")
|
||||
check("action", "none", "poweroff")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterFilesystems(self):
|
||||
guest, outfile = self._get_test_content("change-filesystems")
|
||||
@ -814,7 +814,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("source", "/foo/bar.img", "/foo/bar.raw")
|
||||
check("readonly", False, True)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterSounds(self):
|
||||
infile = "tests/xmlparse-xml/change-sounds-in.xml"
|
||||
@ -835,7 +835,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(dev3)
|
||||
check("model", "ac97", "sb16")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterAddr(self):
|
||||
guest, outfile = self._get_test_content("change-addr")
|
||||
@ -885,7 +885,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
# memory devices?
|
||||
guest.remove_device(dev5)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterSmartCard(self):
|
||||
guest, outfile = self._get_test_content("change-smartcard")
|
||||
@ -900,7 +900,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("mode", "passthrough", "host")
|
||||
check("type", "spicevmc", None)
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterRedirdev(self):
|
||||
guest, outfile = self._get_test_content("change-redirdev")
|
||||
@ -916,7 +916,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(dev2)
|
||||
check("type", "tcp", "spicevmc")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterTPM(self):
|
||||
guest, outfile = self._get_test_content("change-tpm")
|
||||
@ -928,7 +928,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("model", "tpm-tis", "tpm-crb", "tpm-tis")
|
||||
check("device_path", "/dev/tpm0", "frob")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterRNG_EGD(self):
|
||||
guest, outfile = self._get_test_content("change-rng-egd")
|
||||
@ -947,7 +947,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("rate_bytes", "1234", "4321")
|
||||
check("rate_period", "2000", "2001")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAlterRNG_Random(self):
|
||||
guest, outfile = self._get_test_content("change-rng-random")
|
||||
@ -959,7 +959,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("model", "virtio", "virtio")
|
||||
check("device", "/dev/random", "/dev/hwrng")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testConsoleCompat(self):
|
||||
guest, outfile = self._get_test_content("console-compat")
|
||||
@ -969,7 +969,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("source_path", "/dev/pts/4")
|
||||
check("_tty", "/dev/pts/4", "foo", "/dev/pts/4")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testPanicDevice(self):
|
||||
guest, outfile = self._get_test_content("change-panic-device")
|
||||
@ -979,7 +979,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(dev1)
|
||||
check("type", "isa", None, "isa")
|
||||
check("iobase", "0x505", None, "0x506")
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testQEMUXMLNS(self):
|
||||
basename = "change-xmlns-qemu"
|
||||
@ -994,7 +994,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
guest.xmlns_qemu.args.add_new().value = "additional-arg"
|
||||
arg0 = guest.xmlns_qemu.args[0]
|
||||
guest.xmlns_qemu.remove_child(guest.xmlns_qemu.args[0])
|
||||
self.assertEqual(arg0.get_xml_config(),
|
||||
self.assertEqual(arg0.get_xml(),
|
||||
"<qemu:arg xmlns:qemu=\"http://libvirt.org/schemas/domain/qemu/1.0\" value=\"-somenewarg\"/>\n")
|
||||
|
||||
check = self._make_checker(guest.xmlns_qemu.envs[0])
|
||||
@ -1004,7 +1004,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
env.name = "DISPLAY"
|
||||
env.value = "1:2"
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testAddRemoveDevices(self):
|
||||
guest, outfile = self._get_test_content("add-devices")
|
||||
@ -1032,7 +1032,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
guest.add_device(virtinst.DeviceSound(self.conn,
|
||||
parsexml="""<sound model='pcspk'/>"""))
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testChangeKVMMedia(self):
|
||||
guest, outfile = self._get_test_content("change-media", kvm=True)
|
||||
@ -1063,7 +1063,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("path", None, "/dev/disk-pool/diskvol1")
|
||||
disk.sync_path_props()
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
self._alter_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testChangeSnapshot(self):
|
||||
basename = "change-snapshot"
|
||||
@ -1083,7 +1083,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("name", "hda", "hdb")
|
||||
check("snapshot", "internal", "no")
|
||||
|
||||
utils.diff_compare(snap.get_xml_config(), outfile)
|
||||
utils.diff_compare(snap.get_xml(), outfile)
|
||||
|
||||
|
||||
###################
|
||||
@ -1127,8 +1127,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("name", "bond-brbond")
|
||||
self.assertEqual(len(child_iface.interfaces), 2)
|
||||
|
||||
utils.diff_compare(iface.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml_config(), "interfaceDefineXML")
|
||||
utils.diff_compare(iface.get_xml(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml(), "interfaceDefineXML")
|
||||
|
||||
def testInterfaceBondArp(self):
|
||||
basename = "test-bond-arp"
|
||||
@ -1146,8 +1146,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("arp_target", "192.168.100.200", "1.2.3.4")
|
||||
check("arp_validate_mode", "backup", "active")
|
||||
|
||||
utils.diff_compare(iface.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml_config(), "interfaceDefineXML")
|
||||
utils.diff_compare(iface.get_xml(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml(), "interfaceDefineXML")
|
||||
|
||||
def testInterfaceBondMii(self):
|
||||
basename = "test-bond-mii"
|
||||
@ -1161,8 +1161,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("mii_updelay", 12, 33)
|
||||
check("mii_carrier_mode", "netif", "ioctl")
|
||||
|
||||
utils.diff_compare(iface.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml_config(), "interfaceDefineXML")
|
||||
utils.diff_compare(iface.get_xml(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml(), "interfaceDefineXML")
|
||||
|
||||
def testInterfaceVLAN(self):
|
||||
basename = "test-vlan"
|
||||
@ -1174,8 +1174,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("tag", 123, 456)
|
||||
check("parent_interface", "eth2", "foonew")
|
||||
|
||||
utils.diff_compare(iface.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml_config(), "interfaceDefineXML")
|
||||
utils.diff_compare(iface.get_xml(), outfile)
|
||||
utils.test_create(self.conn, iface.get_xml(), "interfaceDefineXML")
|
||||
|
||||
|
||||
#################
|
||||
@ -1202,8 +1202,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("target_path", "/some/target/path", "/mnt/my/foo")
|
||||
check("source_name", None, "fooname")
|
||||
|
||||
utils.diff_compare(pool.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml_config(), "storagePoolDefineXML")
|
||||
utils.diff_compare(pool.get_xml(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml(), "storagePoolDefineXML")
|
||||
|
||||
def testISCSIPool(self):
|
||||
basename = "pool-iscsi"
|
||||
@ -1216,8 +1216,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(pool.hosts[0])
|
||||
check("name", "some.random.hostname", "my.host")
|
||||
|
||||
utils.diff_compare(pool.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml_config(), "storagePoolDefineXML")
|
||||
utils.diff_compare(pool.get_xml(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml(), "storagePoolDefineXML")
|
||||
|
||||
def testGlusterPool(self):
|
||||
if not self.conn.check_support(self.conn.SUPPORT_CONN_POOL_GLUSTERFS):
|
||||
@ -1234,8 +1234,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(pool.hosts[0])
|
||||
check("name", "some.random.hostname", "my.host")
|
||||
|
||||
utils.diff_compare(pool.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml_config(), "storagePoolDefineXML")
|
||||
utils.diff_compare(pool.get_xml(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml(), "storagePoolDefineXML")
|
||||
|
||||
def testRBDPool(self):
|
||||
basename = "pool-rbd"
|
||||
@ -1256,8 +1256,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
hostobj.name = "frobber"
|
||||
hostobj.port = "5555"
|
||||
|
||||
utils.diff_compare(pool.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml_config(), "storagePoolDefineXML")
|
||||
utils.diff_compare(pool.get_xml(), outfile)
|
||||
utils.test_create(self.conn, pool.get_xml(), "storagePoolDefineXML")
|
||||
|
||||
def testVol(self):
|
||||
basename = "pool-dir-vol"
|
||||
@ -1281,7 +1281,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("group", "10736", "10000")
|
||||
check("label", None, "foo.label")
|
||||
|
||||
utils.diff_compare(vol.get_xml_config(), outfile)
|
||||
utils.diff_compare(vol.get_xml(), outfile)
|
||||
|
||||
|
||||
###################
|
||||
@ -1353,8 +1353,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(r)
|
||||
check("netmask", None, "foo", None)
|
||||
|
||||
utils.diff_compare(net.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, net.get_xml_config(), "networkDefineXML")
|
||||
utils.diff_compare(net.get_xml(), outfile)
|
||||
utils.test_create(self.conn, net.get_xml(), "networkDefineXML")
|
||||
|
||||
def testNetOpen(self):
|
||||
basename = "network-open"
|
||||
@ -1379,8 +1379,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("start", "192.168.100.128", "192.168.101.128")
|
||||
check("end", "192.168.100.254", "192.168.101.254")
|
||||
|
||||
utils.diff_compare(net.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, net.get_xml_config(), "networkDefineXML")
|
||||
utils.diff_compare(net.get_xml(), outfile)
|
||||
utils.test_create(self.conn, net.get_xml(), "networkDefineXML")
|
||||
|
||||
def testNetVfPool(self):
|
||||
basename = "network-vf-pool"
|
||||
@ -1405,8 +1405,8 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("slot", 0x10)
|
||||
check("function", 0x0)
|
||||
|
||||
utils.diff_compare(net.get_xml_config(), outfile)
|
||||
utils.test_create(self.conn, net.get_xml_config(), "networkDefineXML")
|
||||
utils.diff_compare(net.get_xml(), outfile)
|
||||
utils.test_create(self.conn, net.get_xml(), "networkDefineXML")
|
||||
|
||||
|
||||
##############
|
||||
@ -1422,7 +1422,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
|
||||
guest.cpu.copy_host_cpu()
|
||||
guest.cpu.clear()
|
||||
utils.diff_compare(guest.get_xml_config(), outfile)
|
||||
utils.diff_compare(guest.get_xml(), outfile)
|
||||
|
||||
def testDomainRoundtrip(self):
|
||||
# Make sure our XML engine doesn't mangle non-libvirt XML bits
|
||||
@ -1430,4 +1430,4 @@ class XMLParseTest(unittest.TestCase):
|
||||
outfile = "tests/xmlparse-xml/domain-roundtrip.xml"
|
||||
guest = virtinst.Guest(self.conn, parsexml=open(infile).read())
|
||||
|
||||
utils.diff_compare(guest.get_xml_config(), outfile)
|
||||
utils.diff_compare(guest.get_xml(), outfile)
|
||||
|
10
virt-xml
10
virt-xml
@ -235,14 +235,14 @@ def define_changes(conn, inactive_xmlobj, devs, action, confirm):
|
||||
for dev in devs:
|
||||
setup_device(dev)
|
||||
|
||||
conn.defineXML(inactive_xmlobj.get_xml_config())
|
||||
conn.defineXML(inactive_xmlobj.get_xml())
|
||||
print_stdout(_("Domain '%s' defined successfully.") % inactive_xmlobj.name)
|
||||
return True
|
||||
|
||||
|
||||
def update_changes(domain, devs, action, confirm):
|
||||
for dev in devs:
|
||||
xml = dev.get_xml_config()
|
||||
xml = dev.get_xml()
|
||||
|
||||
if confirm:
|
||||
if action == "hotplug":
|
||||
@ -276,7 +276,7 @@ def update_changes(domain, devs, action, confirm):
|
||||
|
||||
|
||||
def prepare_changes(xmlobj, options, parserclass):
|
||||
origxml = xmlobj.get_xml_config()
|
||||
origxml = xmlobj.get_xml()
|
||||
|
||||
if options.edit != -1:
|
||||
devs = action_edit(xmlobj, options, parserclass)
|
||||
@ -290,7 +290,7 @@ def prepare_changes(xmlobj, options, parserclass):
|
||||
devs = action_remove_device(xmlobj, options, parserclass)
|
||||
action = "hotunplug"
|
||||
|
||||
newxml = xmlobj.get_xml_config()
|
||||
newxml = xmlobj.get_xml()
|
||||
diff = get_diff(origxml, newxml)
|
||||
|
||||
if options.print_diff:
|
||||
@ -427,7 +427,7 @@ def main(conn=None):
|
||||
devs = action_build_xml(conn, options, parserclass)
|
||||
for dev in devs:
|
||||
# pylint: disable=no-member
|
||||
print_stdout(dev.get_xml_config())
|
||||
print_stdout(dev.get_xml())
|
||||
return 0
|
||||
|
||||
if options.update:
|
||||
|
@ -1071,7 +1071,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
|
||||
def _add_device(self):
|
||||
xml = self._dev.get_xml_config()
|
||||
xml = self._dev.get_xml()
|
||||
logging.debug("Adding device:\n%s", xml)
|
||||
|
||||
if self._remove_usb_controller:
|
||||
@ -1090,7 +1090,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
controller = getattr(self._dev, "vmm_controller", None)
|
||||
if controller is not None:
|
||||
logging.debug("Adding controller:\n%s",
|
||||
controller.get_xml_config())
|
||||
controller.get_xml())
|
||||
# Hotplug device
|
||||
attach_err = False
|
||||
try:
|
||||
@ -1443,7 +1443,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
setattr(self._dev, param_name, val)
|
||||
|
||||
# Dump XML for sanity checking
|
||||
self._dev.get_xml_config()
|
||||
self._dev.get_xml()
|
||||
|
||||
def _validate_page_video(self):
|
||||
model = uiutil.get_list_selection(self.widget("video-model"))
|
||||
|
@ -1061,7 +1061,7 @@ class vmmConnection(vmmGObject):
|
||||
self._backend.daemon_version())
|
||||
logging.debug("conn version=%s", self._backend.conn_version())
|
||||
logging.debug("%s capabilities:\n%s",
|
||||
self.get_uri(), self.caps.get_xml_config())
|
||||
self.get_uri(), self.caps.get_xml())
|
||||
|
||||
# Try to create the default storage pool
|
||||
# We want this before events setup to save some needless polling
|
||||
|
@ -930,9 +930,9 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
# elements that might cause netcf to choke on
|
||||
# for a sub-interface
|
||||
xml = vmmiface.get_xmlobj(
|
||||
inactive=True).get_xml_config()
|
||||
inactive=True).get_xml()
|
||||
else:
|
||||
xml = row[INTERFACE_ROW_KEY].get_xml_config()
|
||||
xml = row[INTERFACE_ROW_KEY].get_xml()
|
||||
|
||||
child = Interface(self.conn.get_backend(), parsexml=xml)
|
||||
iobj.add_interface(child)
|
||||
@ -979,7 +979,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
for proto in proto_xml:
|
||||
iobj.add_protocol(InterfaceProtocol(
|
||||
self.conn.get_backend(),
|
||||
parsexml=proto.get_xml_config()))
|
||||
parsexml=proto.get_xml()))
|
||||
|
||||
if itype == Interface.INTERFACE_TYPE_BRIDGE:
|
||||
ret = self.validate_bridge(iobj)
|
||||
@ -993,7 +993,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
if not ret:
|
||||
return ret
|
||||
|
||||
iobj.get_xml_config()
|
||||
iobj.get_xml()
|
||||
iobj.validate()
|
||||
|
||||
self.interface = iobj
|
||||
|
@ -50,7 +50,7 @@ class vmmCreateVolume(vmmGObjectUI):
|
||||
|
||||
def show(self, parent):
|
||||
try:
|
||||
parent_xml = self.parent_pool.xmlobj.get_xml_config()
|
||||
parent_xml = self.parent_pool.xmlobj.get_xml()
|
||||
except Exception:
|
||||
logging.debug("Error getting parent_pool xml", exc_info=True)
|
||||
parent_xml = None
|
||||
|
@ -1011,7 +1011,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
if not self.is_active():
|
||||
return
|
||||
|
||||
devxml = devobj.get_xml_config()
|
||||
devxml = devobj.get_xml()
|
||||
logging.debug("attach_device with xml=\n%s", devxml)
|
||||
self._backend.attachDevice(devxml)
|
||||
|
||||
@ -1022,7 +1022,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
if not self.is_active():
|
||||
return
|
||||
|
||||
devxml = devobj.get_xml_config()
|
||||
devxml = devobj.get_xml()
|
||||
logging.debug("detach_device with xml=\n%s", devxml)
|
||||
self._backend.detachDevice(devxml)
|
||||
|
||||
@ -1030,7 +1030,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
if flags is None:
|
||||
flags = getattr(libvirt, "VIR_DOMAIN_DEVICE_MODIFY_LIVE", 1)
|
||||
|
||||
xml = devobj.get_xml_config()
|
||||
xml = devobj.get_xml()
|
||||
logging.debug("update_device with xml=\n%s", xml)
|
||||
self._backend.updateDeviceFlags(xml, flags)
|
||||
|
||||
@ -1965,7 +1965,7 @@ class vmmDomainVirtinst(vmmDomain):
|
||||
|
||||
def _XMLDesc(self, flags):
|
||||
ignore = flags
|
||||
return self._backend.get_xml_config()
|
||||
return self._backend.get_xml()
|
||||
|
||||
def _define(self, xml):
|
||||
ignore = xml
|
||||
@ -1977,7 +1977,7 @@ class vmmDomainVirtinst(vmmDomain):
|
||||
|
||||
def _make_xmlobj_to_define(self):
|
||||
if not self._orig_xml:
|
||||
self._orig_xml = self._backend.get_xml_config()
|
||||
self._orig_xml = self._backend.get_xml()
|
||||
return self._backend
|
||||
|
||||
def _redefine_xmlobj(self, xmlobj, origxml=None):
|
||||
|
@ -112,9 +112,9 @@ class vmmLibvirtObject(vmmGObject):
|
||||
|
||||
logging.debug("Changing %s name from %s to %s",
|
||||
self, oldname, newname)
|
||||
origxml = xmlobj.get_xml_config()
|
||||
origxml = xmlobj.get_xml()
|
||||
xmlobj.name = newname
|
||||
newxml = xmlobj.get_xml_config()
|
||||
newxml = xmlobj.get_xml()
|
||||
|
||||
try:
|
||||
self._key = newname
|
||||
@ -293,7 +293,7 @@ class vmmLibvirtObject(vmmGObject):
|
||||
"""
|
||||
origxml = None
|
||||
if self._xmlobj:
|
||||
origxml = self._xmlobj.get_xml_config()
|
||||
origxml = self._xmlobj.get_xml()
|
||||
|
||||
self._invalidate_xml()
|
||||
active_xml = self._XMLDesc(self._active_xml_flags)
|
||||
@ -371,9 +371,9 @@ class vmmLibvirtObject(vmmGObject):
|
||||
we detect the actual XML change and log it correctly.
|
||||
"""
|
||||
if not origxml:
|
||||
origxml = self._make_xmlobj_to_define().get_xml_config()
|
||||
origxml = self._make_xmlobj_to_define().get_xml()
|
||||
|
||||
newxml = xmlobj.get_xml_config()
|
||||
newxml = xmlobj.get_xml()
|
||||
self.log_redefine_xml_diff(self, origxml, newxml)
|
||||
|
||||
if origxml != newxml:
|
||||
|
@ -466,7 +466,7 @@ class vmmSnapshotPage(vmmGObjectUI):
|
||||
newsnap.name = name
|
||||
newsnap.description = desc or None
|
||||
newsnap.validate()
|
||||
newsnap.get_xml_config()
|
||||
newsnap.get_xml()
|
||||
return newsnap
|
||||
except Exception as e:
|
||||
return self.err.val_err(_("Error validating snapshot: %s") % e)
|
||||
@ -513,7 +513,7 @@ class vmmSnapshotPage(vmmGObjectUI):
|
||||
if not snap:
|
||||
return
|
||||
|
||||
xml = snap.get_xml_config()
|
||||
xml = snap.get_xml()
|
||||
name = snap.name
|
||||
mime, sndata = self._get_screenshot_data_for_save()
|
||||
self._snapshot_new_close()
|
||||
@ -537,9 +537,9 @@ class vmmSnapshotPage(vmmGObjectUI):
|
||||
desc = desc_widget.get_buffer().get_property("text") or ""
|
||||
|
||||
xmlobj = snap.get_xmlobj()
|
||||
origxml = xmlobj.get_xml_config()
|
||||
origxml = xmlobj.get_xml()
|
||||
xmlobj.description = desc
|
||||
newxml = xmlobj.get_xml_config()
|
||||
newxml = xmlobj.get_xml()
|
||||
|
||||
self.vm.log_redefine_xml_diff(snap, origxml, newxml)
|
||||
if newxml == origxml:
|
||||
|
@ -121,7 +121,7 @@ class vmmStorageBrowser(vmmGObjectUI):
|
||||
|
||||
def _volume_chosen(self, src, volume):
|
||||
ignore = src
|
||||
logging.debug("Chosen volume XML:\n%s", volume.xmlobj.get_xml_config())
|
||||
logging.debug("Chosen volume XML:\n%s", volume.xmlobj.get_xml())
|
||||
self._finish(volume.get_target_path())
|
||||
|
||||
def _vol_sensitive_cb(self, fmt):
|
||||
|
@ -436,7 +436,7 @@ class Cloner(object):
|
||||
self._prepare_nvram()
|
||||
|
||||
# Save altered clone xml
|
||||
self._clone_xml = self._guest.get_xml_config()
|
||||
self._clone_xml = self._guest.get_xml()
|
||||
logging.debug("Clone guest xml is\n%s", self._clone_xml)
|
||||
|
||||
def start_duplicate(self, meter=None):
|
||||
|
@ -325,7 +325,7 @@ class Guest(XMLBuilder):
|
||||
self.on_reboot = "destroy"
|
||||
|
||||
self._set_osxml_defaults()
|
||||
return self.get_xml_config()
|
||||
return self.get_xml()
|
||||
|
||||
|
||||
###########################
|
||||
@ -867,7 +867,7 @@ class Guest(XMLBuilder):
|
||||
|
||||
if not self.conn.is_test() and not self.conn.is_qemu():
|
||||
return
|
||||
if (self.cpu.get_xml_config().strip() or
|
||||
if (self.cpu.get_xml().strip() or
|
||||
self.cpu.special_mode_was_set):
|
||||
# User already configured CPU
|
||||
return
|
||||
|
@ -238,7 +238,7 @@ class Interface(XMLBuilder):
|
||||
Install network interface xml.
|
||||
"""
|
||||
ignore = meter
|
||||
xml = self.get_xml_config()
|
||||
xml = self.get_xml()
|
||||
logging.debug("Creating interface '%s' with xml:\n%s",
|
||||
self.name, xml)
|
||||
|
||||
|
@ -234,7 +234,7 @@ class Network(XMLBuilder):
|
||||
##################
|
||||
|
||||
def install(self, start=True, autostart=True):
|
||||
xml = self.get_xml_config()
|
||||
xml = self.get_xml()
|
||||
logging.debug("Creating virtual network '%s' with xml:\n%s",
|
||||
self.name, xml)
|
||||
|
||||
|
@ -163,7 +163,7 @@ class StoragePool(_StorageObject):
|
||||
ret = []
|
||||
sources = _EnumerateSources(conn, xml)
|
||||
for source in sources.sources:
|
||||
source_xml = source.get_xml_config()
|
||||
source_xml = source.get_xml()
|
||||
|
||||
pool_xml = "<pool>\n%s\n</pool>" % (
|
||||
util.xml_indent(source_xml, 2))
|
||||
@ -495,7 +495,7 @@ class StoragePool(_StorageObject):
|
||||
raise ValueError(_("Must explicitly specify disk format if "
|
||||
"formatting disk device."))
|
||||
|
||||
xml = self.get_xml_config()
|
||||
xml = self.get_xml()
|
||||
logging.debug("Creating storage pool '%s' with xml:\n%s",
|
||||
self.name, xml)
|
||||
|
||||
@ -713,7 +713,7 @@ class StorageVolume(_StorageObject):
|
||||
volxml = StorageVolume(self.conn, vol.XMLDesc(0))
|
||||
volxml.pool = pool
|
||||
logging.debug("Found backing store volume XML:\n%s",
|
||||
volxml.get_xml_config())
|
||||
volxml.get_xml())
|
||||
|
||||
if volxml.supports_property("format"):
|
||||
logging.debug("Returning format=%s", volxml.format)
|
||||
@ -775,7 +775,7 @@ class StorageVolume(_StorageObject):
|
||||
if self.backing_store and not self.backing_format:
|
||||
self.backing_format = self._detect_backing_store_format()
|
||||
|
||||
xml = self.get_xml_config()
|
||||
xml = self.get_xml()
|
||||
logging.debug("Creating storage volume '%s' with xml:\n%s",
|
||||
self.name, xml)
|
||||
|
||||
|
@ -302,7 +302,7 @@ class XMLProperty(_XMLPropertyBase):
|
||||
only if a default is registered, and only if the property was
|
||||
not already explicitly set by the API user.
|
||||
|
||||
This is called during the get_xml_config process and shouldn't
|
||||
This is called during the get_xml process and shouldn't
|
||||
be called from outside this file.
|
||||
"""
|
||||
candefault, val = self._default_get_value(xmlbuilder)
|
||||
@ -376,7 +376,7 @@ class XMLProperty(_XMLPropertyBase):
|
||||
"""
|
||||
Set the value at user request. This just stores the value
|
||||
in propstore. Setting the actual XML is only done at
|
||||
get_xml_config time.
|
||||
get_xml time.
|
||||
"""
|
||||
if _trackprops and not self._is_tracked:
|
||||
_seenprops.append(self)
|
||||
@ -572,7 +572,7 @@ class XMLBuilder(object):
|
||||
# Public XML managing APIs #
|
||||
############################
|
||||
|
||||
def get_xml_config(self):
|
||||
def get_xml(self):
|
||||
"""
|
||||
Return XML string of the object
|
||||
"""
|
||||
@ -718,7 +718,7 @@ class XMLBuilder(object):
|
||||
object needs to have an associated mapping via XMLChildProperty
|
||||
"""
|
||||
xmlprop = self._find_child_prop(obj.__class__)
|
||||
xml = obj.get_xml_config()
|
||||
xml = obj.get_xml()
|
||||
xmlprop.append(self, obj)
|
||||
self._set_child_xpaths()
|
||||
|
||||
@ -738,7 +738,7 @@ class XMLBuilder(object):
|
||||
xmlprop.remove(self, obj)
|
||||
|
||||
xpath = obj._xmlstate.abs_xpath()
|
||||
xml = obj.get_xml_config()
|
||||
xml = obj.get_xml()
|
||||
obj._set_xpaths(None, None)
|
||||
obj._parse_with_children(xml, None)
|
||||
self._xmlstate.xmlapi.node_force_remove(xpath)
|
||||
|
Loading…
Reference in New Issue
Block a user