mirror of https://gitee.com/openkylin/libvirt.git
qemu: Fill default value in //cpu/@migratable attribute
Before QEMU introduced migratable CPU property, "-cpu host" included all features that could be enabled on the host, even those which would block migration. In other words, the default was equivalent to migratable=off. When the migratable property was introduced, the default changed to migratable=on. Let's record the default in domain XML. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
19926477cb
commit
201bd5db63
|
@ -4792,7 +4792,8 @@ qemuDomainDefSetDefaultCPU(virDomainDefPtr def,
|
|||
|
||||
|
||||
static int
|
||||
qemuDomainDefCPUPostParse(virDomainDefPtr def)
|
||||
qemuDomainDefCPUPostParse(virDomainDefPtr def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
virCPUFeatureDefPtr sveFeature = NULL;
|
||||
bool sveVectorLengthsProvided = false;
|
||||
|
@ -4888,6 +4889,15 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def)
|
|||
}
|
||||
}
|
||||
|
||||
if (qemuCaps &&
|
||||
def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH &&
|
||||
!def->cpu->migratable) {
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_MIGRATABLE))
|
||||
def->cpu->migratable = VIR_TRISTATE_SWITCH_ON;
|
||||
else if (ARCH_IS_X86(def->os.arch))
|
||||
def->cpu->migratable = VIR_TRISTATE_SWITCH_OFF;
|
||||
}
|
||||
|
||||
/* Nothing to be done if only CPU topology is specified. */
|
||||
if (def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
|
||||
!def->cpu->model)
|
||||
|
@ -5033,7 +5043,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
|||
if (qemuDomainDefVcpusPostParse(def) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainDefCPUPostParse(def) < 0)
|
||||
if (qemuDomainDefCPUPostParse(def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainDefTsegPostParse(def, qemuCaps) < 0)
|
||||
|
|
|
@ -277,7 +277,7 @@
|
|||
<apic/>
|
||||
<vmport state='off'/>
|
||||
</features>
|
||||
<cpu mode='host-passthrough' check='none'/>
|
||||
<cpu mode='host-passthrough' check='none' migratable='on'/>
|
||||
<clock offset='utc'>
|
||||
<timer name='rtc' tickpolicy='catchup'/>
|
||||
<timer name='pit' tickpolicy='delay'/>
|
||||
|
|
|
@ -291,7 +291,7 @@
|
|||
<apic/>
|
||||
<vmport state='off'/>
|
||||
</features>
|
||||
<cpu mode='host-passthrough' check='none'/>
|
||||
<cpu mode='host-passthrough' check='none' migratable='on'/>
|
||||
<clock offset='utc'>
|
||||
<timer name='rtc' tickpolicy='catchup'/>
|
||||
<timer name='pit' tickpolicy='delay'/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='network'/>
|
||||
</os>
|
||||
<cpu mode='host-passthrough' check='none'/>
|
||||
<cpu mode='host-passthrough' check='none' migratable='off'/>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='network'/>
|
||||
</os>
|
||||
<cpu mode='host-passthrough' check='none'/>
|
||||
<cpu mode='host-passthrough' check='none' migratable='off'/>
|
||||
<clock offset='utc'>
|
||||
<timer name='kvmclock' present='no'/>
|
||||
</clock>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<cpu mode='host-passthrough' check='none'>
|
||||
<cpu mode='host-passthrough' check='none' migratable='off'>
|
||||
<feature policy='require' name='abm'/>
|
||||
<feature policy='force' name='ds'/>
|
||||
<feature policy='disable' name='invtsc'/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<hint-dedicated state='on'/>
|
||||
</kvm>
|
||||
</features>
|
||||
<cpu mode='host-passthrough' check='none'/>
|
||||
<cpu mode='host-passthrough' check='none' migratable='off'/>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
|
Loading…
Reference in New Issue