mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
XMLBuilder: Provide default fget and fset impls
This is the first step towards unifying the XML handling split between parsing and creating from scratch. Demonstrate it with VirtualDisk.iotune bits.
This commit is contained in:
@@ -43,11 +43,21 @@
|
||||
</disk>
|
||||
<disk type="block" device="floppy">
|
||||
<target dev="fda" bus="fdc"/>
|
||||
<iotune>
|
||||
<total_bytes_sec>1</total_bytes_sec>
|
||||
<total_iops_sec>2</total_iops_sec>
|
||||
</iotune>
|
||||
</disk>
|
||||
<disk type="block" device="floppy">
|
||||
<driver name="phy" cache="none"/>
|
||||
<source dev="/dev/loop0"/>
|
||||
<target dev="fdb" bus="fdc"/>
|
||||
<iotune>
|
||||
<read_bytes_sec>5555</read_bytes_sec>
|
||||
<read_iops_sec>1234</read_iops_sec>
|
||||
<write_bytes_sec>3</write_bytes_sec>
|
||||
<write_iops_sec>4</write_iops_sec>
|
||||
</iotune>
|
||||
</disk>
|
||||
<disk type="block" device="disk">
|
||||
<driver name="qemu" type="qcow2" cache="none" io="threads"/>
|
||||
|
||||
@@ -550,19 +550,28 @@ class TestXMLConfig(unittest.TestCase):
|
||||
g.add_device(VirtualDisk(g.conn, path=None,
|
||||
device=VirtualDisk.DEVICE_CDROM,
|
||||
bus="scsi"))
|
||||
g.add_device(VirtualDisk(g.conn, path=None,
|
||||
device=VirtualDisk.DEVICE_FLOPPY))
|
||||
d1 = VirtualDisk(g.conn, path="/dev/loop0",
|
||||
device=VirtualDisk.DEVICE_FLOPPY,
|
||||
driverName="phy")
|
||||
d1.driver_cache = "none"
|
||||
g.add_device(d1)
|
||||
d2 = VirtualDisk(g.conn, path="/dev/loop0",
|
||||
bus="virtio", driverName="qemu",
|
||||
driverType="qcow2")
|
||||
d2.driver_cache = "none"
|
||||
d2.driver_io = "threads"
|
||||
g.add_device(d2)
|
||||
d = VirtualDisk(g.conn, path=None,
|
||||
device=VirtualDisk.DEVICE_FLOPPY)
|
||||
d.iotune_tbs = 1
|
||||
d.iotune_tis = 2
|
||||
g.add_device(d)
|
||||
|
||||
d = VirtualDisk(g.conn, path="/dev/loop0",
|
||||
device=VirtualDisk.DEVICE_FLOPPY,
|
||||
driverName="phy")
|
||||
d.driver_cache = "none"
|
||||
d.iotune_rbs = 5555
|
||||
d.iotune_ris = 1234
|
||||
d.iotune_wbs = 3
|
||||
d.iotune_wis = 4
|
||||
g.add_device(d)
|
||||
|
||||
d = VirtualDisk(g.conn, path="/dev/loop0",
|
||||
bus="virtio", driverName="qemu",
|
||||
driverType="qcow2")
|
||||
d.driver_cache = "none"
|
||||
d.driver_io = "threads"
|
||||
g.add_device(d)
|
||||
|
||||
self._compare(g, "boot-many-disks2", False)
|
||||
|
||||
|
||||
@@ -45,6 +45,12 @@
|
||||
</disk>
|
||||
<disk type="block" device="floppy">
|
||||
<target dev="fda" bus="fdc"/>
|
||||
<iotune>
|
||||
<read_iops_sec>1</read_iops_sec>
|
||||
<read_bytes_sec>2</read_bytes_sec>
|
||||
<write_iops_sec>3</write_iops_sec>
|
||||
<write_bytes_sec>4</write_bytes_sec>
|
||||
</iotune>
|
||||
</disk>
|
||||
<disk type="block" device="floppy">
|
||||
<driver name="phy" cache="none"/>
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
</disk>
|
||||
<disk type="file" device="floppy">
|
||||
<target dev="fda" bus="fdc"/>
|
||||
<iotune>
|
||||
<total_iops_sec>5</total_iops_sec>
|
||||
<total_bytes_sec>6</total_bytes_sec>
|
||||
</iotune>
|
||||
<source file="/default-pool/default-vol"/>
|
||||
<shareable/>
|
||||
<driver cache="writeback" io="native"/>
|
||||
|
||||
@@ -249,10 +249,10 @@ class XMLParseTest(unittest.TestCase):
|
||||
disks = guest.get_devices("disk")
|
||||
disk1 = disks[0]
|
||||
disk1.size = 1
|
||||
disk2 = disks[2]
|
||||
disk2.size = 1
|
||||
disk3 = disks[5]
|
||||
disk3 = disks[2]
|
||||
disk3.size = 1
|
||||
disk6 = disks[5]
|
||||
disk6.size = 1
|
||||
|
||||
check = self._make_checker(disk1)
|
||||
check("path", "/tmp/test.img", "/dev/loop0")
|
||||
@@ -260,7 +260,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("driver_type", None, "raw")
|
||||
check("serial", "WD-WMAP9A966149", "frob")
|
||||
|
||||
check = self._make_checker(disk2)
|
||||
check = self._make_checker(disk3)
|
||||
check("path", "/dev/loop0", None)
|
||||
check("device", "cdrom", "floppy")
|
||||
check("read_only", True, False)
|
||||
@@ -268,12 +268,19 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("bus", None, "fdc")
|
||||
check("error_policy", "stop", None)
|
||||
|
||||
check = self._make_checker(disk3)
|
||||
check = self._make_checker(disk6)
|
||||
check("path", None, "/default-pool/default-vol")
|
||||
check("shareable", False, True)
|
||||
check("driver_cache", None, "writeback")
|
||||
check("driver_io", None, "threads")
|
||||
check("driver_io", "threads", "native")
|
||||
check("iotune_ris", 1, 0)
|
||||
check("iotune_rbs", 2, 0)
|
||||
check("iotune_wis", 3, 0)
|
||||
check("iotune_wbs", 4, 0)
|
||||
check("iotune_tis", 0, 5)
|
||||
check("iotune_tbs", 0, 6)
|
||||
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user