mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-27 01:55:20 +03:00
Add and fix test cases for cpu mode attribute
This patch adds and fixes test cases for cpu mode attribute. Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> (crobinso: Minor rebase tweaks)
This commit is contained in:
parent
2a72d50477
commit
ee7168e6f9
@ -13,7 +13,7 @@
|
|||||||
<features>
|
<features>
|
||||||
<acpi/><apic/><pae/>
|
<acpi/><apic/><pae/>
|
||||||
</features>
|
</features>
|
||||||
<cpu match='exact'>
|
<cpu mode='custom' match='exact'>
|
||||||
<model>core2duo</model>
|
<model>core2duo</model>
|
||||||
<vendor>Intel</vendor>
|
<vendor>Intel</vendor>
|
||||||
<feature policy='require' name='pbe'/>
|
<feature policy='require' name='pbe'/>
|
||||||
@ -67,7 +67,7 @@
|
|||||||
<features>
|
<features>
|
||||||
<acpi/><apic/><pae/>
|
<acpi/><apic/><pae/>
|
||||||
</features>
|
</features>
|
||||||
<cpu match='exact'>
|
<cpu mode='custom' match='exact'>
|
||||||
<model>core2duo</model>
|
<model>core2duo</model>
|
||||||
<vendor>Intel</vendor>
|
<vendor>Intel</vendor>
|
||||||
<feature policy='require' name='pbe'/>
|
<feature policy='require' name='pbe'/>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<features>
|
<features>
|
||||||
<acpi/><apic/><pae/>
|
<acpi/><apic/><pae/>
|
||||||
</features>
|
</features>
|
||||||
<cpu match='exact'>
|
<cpu mode='custom' match='exact'>
|
||||||
<model>Penryn</model>
|
<model>Penryn</model>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset="utc"/>
|
<clock offset="utc"/>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<features>
|
<features>
|
||||||
<acpi/><apic/><pae/>
|
<acpi/><apic/><pae/>
|
||||||
</features>
|
</features>
|
||||||
<cpu>
|
<cpu mode='custom'>
|
||||||
<topology sockets='1' cores='4' threads='1'/>
|
<topology sockets='1' cores='4' threads='1'/>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset="localtime"/>
|
<clock offset="localtime"/>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
<features>
|
<features>
|
||||||
<acpi/><apic/><pae/>
|
<acpi/><apic/><pae/>
|
||||||
</features>
|
</features>
|
||||||
<cpu>
|
<cpu mode='custom'>
|
||||||
<topology sockets='1' cores='4' threads='1'/>
|
<topology sockets='1' cores='4' threads='1'/>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset="localtime"/>
|
<clock offset="localtime"/>
|
||||||
@ -88,7 +88,7 @@
|
|||||||
<features>
|
<features>
|
||||||
<acpi/><apic/><pae/>
|
<acpi/><apic/><pae/>
|
||||||
</features>
|
</features>
|
||||||
<cpu>
|
<cpu mode='custom'>
|
||||||
<topology sockets='1' cores='4' threads='1'/>
|
<topology sockets='1' cores='4' threads='1'/>
|
||||||
</cpu>
|
</cpu>
|
||||||
<clock offset="localtime"/>
|
<clock offset="localtime"/>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<features>
|
<features>
|
||||||
<acpi/><apic/>
|
<acpi/><apic/>
|
||||||
</features>
|
</features>
|
||||||
<cpu match='minimum'>
|
<cpu mode='custom' match='minimum'>
|
||||||
<model>footest</model>
|
<model>footest</model>
|
||||||
<vendor>Intel</vendor>
|
<vendor>Intel</vendor>
|
||||||
<topology sockets='4' cores='5' threads='2'/>
|
<topology sockets='4' cores='5' threads='2'/>
|
||||||
|
19
tests/xmlparse-xml/change-cpumode-in.xml
Normal file
19
tests/xmlparse-xml/change-cpumode-in.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<domain type="kvm">
|
||||||
|
<name>TestGuest</name>
|
||||||
|
<currentMemory>204800</currentMemory>
|
||||||
|
<memory>409600</memory>
|
||||||
|
<uuid>12345678-1234-1234-1234-123456789012</uuid>
|
||||||
|
<os>
|
||||||
|
<type arch="i686">hvm</type>
|
||||||
|
<boot dev="hd"/>
|
||||||
|
</os>
|
||||||
|
<vcpu cpuset="1-3">4</vcpu>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
|
||||||
|
<disk type="block" device="cdrom">
|
||||||
|
<target dev="hdc" bus="ide"/>
|
||||||
|
<readonly/>
|
||||||
|
</disk>
|
||||||
|
</devices>
|
||||||
|
<cpu mode="host-passthrough"/>
|
||||||
|
</domain>
|
21
tests/xmlparse-xml/change-cpumode-out.xml
Normal file
21
tests/xmlparse-xml/change-cpumode-out.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<domain type="kvm">
|
||||||
|
<name>TestGuest</name>
|
||||||
|
<currentMemory>204800</currentMemory>
|
||||||
|
<memory>409600</memory>
|
||||||
|
<uuid>12345678-1234-1234-1234-123456789012</uuid>
|
||||||
|
<os>
|
||||||
|
<type arch="i686">hvm</type>
|
||||||
|
<boot dev="hd"/>
|
||||||
|
</os>
|
||||||
|
<vcpu cpuset="1-3">4</vcpu>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
|
||||||
|
<disk type="block" device="cdrom">
|
||||||
|
<target dev="hdc" bus="ide"/>
|
||||||
|
<readonly/>
|
||||||
|
</disk>
|
||||||
|
</devices>
|
||||||
|
<cpu mode="custom" match="exact">
|
||||||
|
<model>qemu64</model>
|
||||||
|
</cpu>
|
||||||
|
</domain>
|
@ -16,7 +16,7 @@
|
|||||||
<numatune>
|
<numatune>
|
||||||
<memory nodeset="2,4,6"/>
|
<memory nodeset="2,4,6"/>
|
||||||
</numatune>
|
</numatune>
|
||||||
<cpu match="strict">
|
<cpu match="strict" mode="custom">
|
||||||
<model>qemu64</model>
|
<model>qemu64</model>
|
||||||
<vendor>qemuvendor</vendor>
|
<vendor>qemuvendor</vendor>
|
||||||
<topology sockets="4" cores="3" threads="1"/>
|
<topology sockets="4" cores="3" threads="1"/>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<seclabel model="testSecurity" type="static">
|
<seclabel model="testSecurity" type="static">
|
||||||
<label>frob</label>
|
<label>frob</label>
|
||||||
</seclabel>
|
</seclabel>
|
||||||
<cpu match="exact">
|
<cpu mode="custom" match="exact">
|
||||||
<model>foobar</model>
|
<model>foobar</model>
|
||||||
<topology cores="4" sockets="1" threads="1"/>
|
<topology cores="4" sockets="1" threads="1"/>
|
||||||
<feature policy="forbid" name="x2apic"/>
|
<feature policy="forbid" name="x2apic"/>
|
||||||
|
@ -232,6 +232,20 @@ class XMLParseTest(unittest.TestCase):
|
|||||||
|
|
||||||
self._alter_compare(guest.get_xml_config(), outfile)
|
self._alter_compare(guest.get_xml_config(), outfile)
|
||||||
|
|
||||||
|
def testAlterCpuMode(self):
|
||||||
|
infile = "tests/xmlparse-xml/change-cpumode-in.xml"
|
||||||
|
outfile = "tests/xmlparse-xml/change-cpumode-out.xml"
|
||||||
|
guest = virtinst.Guest(conn=conn,
|
||||||
|
parsexml=file(infile).read())
|
||||||
|
|
||||||
|
check = self._make_checker(guest.cpu)
|
||||||
|
check("mode", "host-passthrough", "custom")
|
||||||
|
check("mode", "custom", "host-model")
|
||||||
|
# mode will be "custom"
|
||||||
|
check("model", None, "qemu64")
|
||||||
|
|
||||||
|
self._alter_compare(guest.get_xml_config(), outfile)
|
||||||
|
|
||||||
def testAlterDisk(self):
|
def testAlterDisk(self):
|
||||||
"""
|
"""
|
||||||
Test changing VirtualDisk() parameters after parsing
|
Test changing VirtualDisk() parameters after parsing
|
||||||
|
Loading…
Reference in New Issue
Block a user