guest: Default to cpu mode=host-model if libvirt is new enough
We check whether host-model is exposed in domcapabilities, which indicates host-model is using the smarter new safer method in cooperation with qemu
This commit is contained in:
parent
76334bfabd
commit
469fed08a0
|
@ -14,9 +14,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<smm state="on"/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact"/>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -88,9 +86,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
<domain type="kvm">
|
||||
<name>foobar</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<metadata>
|
||||
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||
<libosinfo:os id="http://redhat.com/rhel/7.0"/>
|
||||
</libosinfo:libosinfo>
|
||||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="network"/>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
</clock>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<pm>
|
||||
<suspend-to-mem enabled="no"/>
|
||||
<suspend-to-disk enabled="no"/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-kvm</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<driver name="qemu" type="qcow2"/>
|
||||
<source file="/dev/default-pool/testvol1.img"/>
|
||||
<target dev="vda" bus="virtio"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
|
||||
<interface type="bridge">
|
||||
<source bridge="eth0"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="virtio"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
<channel type="unix">
|
||||
<source mode="bind"/>
|
||||
<target type="virtio" name="org.qemu.guest_agent.0"/>
|
||||
</channel>
|
||||
<channel type="spicevmc">
|
||||
<target type="virtio" name="com.redhat.spice.0"/>
|
||||
</channel>
|
||||
<input type="tablet" bus="usb"/>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
||||
<image compression="off"/>
|
||||
</graphics>
|
||||
<sound model="ich6"/>
|
||||
<video>
|
||||
<model type="qxl"/>
|
||||
</video>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
<rng model="virtio">
|
||||
<backend model="random">/dev/urandom</backend>
|
||||
</rng>
|
||||
</devices>
|
||||
</domain>
|
||||
<domain type="kvm">
|
||||
<name>foobar</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<metadata>
|
||||
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||
<libosinfo:os id="http://redhat.com/rhel/7.0"/>
|
||||
</libosinfo:libosinfo>
|
||||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
<timer name="hpet" present="no"/>
|
||||
</clock>
|
||||
<pm>
|
||||
<suspend-to-mem enabled="no"/>
|
||||
<suspend-to-disk enabled="no"/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-kvm</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<driver name="qemu" type="qcow2"/>
|
||||
<source file="/dev/default-pool/testvol1.img"/>
|
||||
<target dev="vda" bus="virtio"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
|
||||
<interface type="bridge">
|
||||
<source bridge="eth0"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="virtio"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
<channel type="unix">
|
||||
<source mode="bind"/>
|
||||
<target type="virtio" name="org.qemu.guest_agent.0"/>
|
||||
</channel>
|
||||
<channel type="spicevmc">
|
||||
<target type="virtio" name="com.redhat.spice.0"/>
|
||||
</channel>
|
||||
<input type="tablet" bus="usb"/>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
||||
<image compression="off"/>
|
||||
</graphics>
|
||||
<sound model="ich6"/>
|
||||
<video>
|
||||
<model type="qxl"/>
|
||||
</video>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
<rng model="virtio">
|
||||
<backend model="random">/dev/urandom</backend>
|
||||
</rng>
|
||||
</devices>
|
||||
</domain>
|
|
@ -19,9 +19,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -89,9 +87,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -94,9 +92,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -88,9 +86,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -93,9 +91,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
</hyperv>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -98,9 +96,7 @@
|
|||
</hyperv>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
</hyperv>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -98,9 +96,7 @@
|
|||
</hyperv>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -76,9 +74,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -86,9 +84,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
<cpu mode="host-model">
|
||||
<feature policy="disable" name="x2apic"/>
|
||||
</cpu>
|
||||
<clock offset="localtime">
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
@ -100,9 +98,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="localtime">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -716,6 +716,7 @@ c.add_compare("--disk none --location %(EXISTIMG3)s --nonetworks", "location-iso
|
|||
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel5.4", "kvm-rhel5") # RHEL5 defaults
|
||||
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel6.4", "kvm-rhel6") # RHEL6 defaults
|
||||
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7", skip_check=OLD_OSINFO) # RHEL7 defaults
|
||||
c.add_compare("--connect " + utils.URIs.kvm_nodomcaps + " --disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-cpu-default-fallback", skip_check=OLD_OSINFO) # No domcaps, so mode=host-model isn't safe, so we fallback to host-model-only
|
||||
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant centos7.0", "kvm-centos7", skip_check=OLD_OSINFO) # Centos 7 defaults
|
||||
c.add_compare("--disk %(EXISTIMG1)s --cdrom %(EXISTIMG2)s --os-variant win10", "kvm-win10", skip_check=OLD_OSINFO) # win10 defaults
|
||||
c.add_compare("--os-variant win7 --cdrom %(EXISTIMG2)s --boot loader_type=pflash,loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s", "win7-uefi") # no HYPER-V with UEFI
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
<apic/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>Opteron_G4</model>
|
||||
</cpu>
|
||||
<cpu mode="host-model"/>
|
||||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
|
|
|
@ -73,9 +73,11 @@ class DomainCpu(XMLBuilder):
|
|||
SPECIAL_MODE_HOST_MODEL = "host-model"
|
||||
SPECIAL_MODE_HOST_PASSTHROUGH = "host-passthrough"
|
||||
SPECIAL_MODE_CLEAR = "clear"
|
||||
SPECIAL_MODE_APP_DEFAULT = "default"
|
||||
SPECIAL_MODES = [SPECIAL_MODE_HOST_MODEL_ONLY, SPECIAL_MODE_HV_DEFAULT,
|
||||
SPECIAL_MODE_HOST_COPY, SPECIAL_MODE_HOST_MODEL,
|
||||
SPECIAL_MODE_HOST_PASSTHROUGH, SPECIAL_MODE_CLEAR]
|
||||
SPECIAL_MODE_HOST_PASSTHROUGH, SPECIAL_MODE_CLEAR,
|
||||
SPECIAL_MODE_APP_DEFAULT]
|
||||
def set_special_mode(self, val):
|
||||
if (val == self.SPECIAL_MODE_HOST_MODEL or
|
||||
val == self.SPECIAL_MODE_HOST_PASSTHROUGH):
|
||||
|
@ -231,6 +233,14 @@ class DomainCpu(XMLBuilder):
|
|||
return
|
||||
|
||||
mode = guest.x86_cpu_default
|
||||
if mode == self.SPECIAL_MODE_APP_DEFAULT:
|
||||
# If libvirt is new enough to support reliable mode=host-model
|
||||
# then use it, otherwise use previous default HOST_MODEL_ONLY
|
||||
domcaps = guest.lookup_domcaps()
|
||||
mode = self.SPECIAL_MODE_HOST_MODEL_ONLY
|
||||
if domcaps.supports_safe_host_model():
|
||||
mode = self.SPECIAL_MODE_HOST_MODEL
|
||||
|
||||
self.set_special_mode(mode)
|
||||
if mode == self.SPECIAL_MODE_HOST_MODEL_ONLY:
|
||||
self._validate_default_host_model_only(guest)
|
||||
|
|
|
@ -100,6 +100,7 @@ class _CPUModel(XMLBuilder):
|
|||
class _CPUMode(XMLBuilder):
|
||||
XML_NAME = "mode"
|
||||
name = XMLProperty("./@name")
|
||||
supported = XMLProperty("./@supported", is_yesno=True)
|
||||
models = XMLChildProperty(_CPUModel)
|
||||
|
||||
def get_model(self, name):
|
||||
|
@ -212,6 +213,15 @@ class DomainCapabilities(XMLBuilder):
|
|||
return ("readonly" in self.os.loader.enum_names() and
|
||||
"yes" in self.os.loader.get_enum("readonly").get_values())
|
||||
|
||||
def supports_safe_host_model(self):
|
||||
"""
|
||||
Return True if domcaps reports support for cpu mode=host-model.
|
||||
host-model infact predates this support, however it wasn't
|
||||
general purpose safe prior to domcaps advertisement
|
||||
"""
|
||||
return [(m.name == "host-model" and m.supported)
|
||||
for m in self.cpu.modes]
|
||||
|
||||
|
||||
XML_NAME = "domainCapabilities"
|
||||
os = XMLChildProperty(_OS, is_single=True)
|
||||
|
|
|
@ -161,7 +161,7 @@ class Guest(XMLBuilder):
|
|||
self.skip_default_usbredir = False
|
||||
self.skip_default_graphics = False
|
||||
self.skip_default_rng = False
|
||||
self.x86_cpu_default = self.cpu.SPECIAL_MODE_HOST_MODEL_ONLY
|
||||
self.x86_cpu_default = self.cpu.SPECIAL_MODE_APP_DEFAULT
|
||||
|
||||
self.__osinfo = None
|
||||
self._capsinfo = None
|
||||
|
|
Loading…
Reference in New Issue