提交 343894b7 编写于 作者: M Martin Kletzander

qemu: Move checks for SMM from command-line creation into validation phase

We are still hoping all of such checks will be moved there and this is one small
step in that direction.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e546785d
...@@ -4773,17 +4773,6 @@ virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, ...@@ -4773,17 +4773,6 @@ virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps,
} }
bool
virQEMUCapsSupportsSMM(virQEMUCapsPtr qemuCaps,
const virDomainDef *def)
{
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT))
return false;
return qemuDomainIsQ35(def);
}
bool bool
virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps, virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
const char *canonical_machine) const char *canonical_machine)
......
...@@ -505,9 +505,6 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, ...@@ -505,9 +505,6 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps,
const virDomainDef *def); const virDomainDef *def);
bool virQEMUCapsSupportsSMM(virQEMUCapsPtr qemuCaps,
const virDomainDef *def);
char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps); char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps);
const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps); const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps);
......
...@@ -7136,16 +7136,8 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, ...@@ -7136,16 +7136,8 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
virTristateSwitchTypeToString(vmport)); virTristateSwitchTypeToString(vmport));
} }
if (smm) { if (smm)
if (!virQEMUCapsSupportsSMM(qemuCaps, def)) { virBufferAsprintf(&buf, ",smm=%s", virTristateSwitchTypeToString(smm));
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("smm is not available with this QEMU binary"));
goto cleanup;
}
virBufferAsprintf(&buf, ",smm=%s",
virTristateSwitchTypeToString(smm));
}
if (def->mem.dump_core) { if (def->mem.dump_core) {
virBufferAsprintf(&buf, ",dump-guest-core=%s", virBufferAsprintf(&buf, ",dump-guest-core=%s",
......
...@@ -3743,7 +3743,8 @@ qemuDomainDefGetVcpuHotplugGranularity(const virDomainDef *def) ...@@ -3743,7 +3743,8 @@ qemuDomainDefGetVcpuHotplugGranularity(const virDomainDef *def)
static int static int
qemuDomainDefValidateFeatures(const virDomainDef *def) qemuDomainDefValidateFeatures(const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{ {
size_t i; size_t i;
...@@ -3790,6 +3791,16 @@ qemuDomainDefValidateFeatures(const virDomainDef *def) ...@@ -3790,6 +3791,16 @@ qemuDomainDefValidateFeatures(const virDomainDef *def)
} }
break; break;
case VIR_DOMAIN_FEATURE_SMM:
if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
(!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT) ||
!qemuDomainIsQ35(def))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("smm is not available with this QEMU binary"));
return -1;
}
break;
case VIR_DOMAIN_FEATURE_ACPI: case VIR_DOMAIN_FEATURE_ACPI:
case VIR_DOMAIN_FEATURE_APIC: case VIR_DOMAIN_FEATURE_APIC:
case VIR_DOMAIN_FEATURE_PAE: case VIR_DOMAIN_FEATURE_PAE:
...@@ -3802,7 +3813,6 @@ qemuDomainDefValidateFeatures(const virDomainDef *def) ...@@ -3802,7 +3813,6 @@ qemuDomainDefValidateFeatures(const virDomainDef *def)
case VIR_DOMAIN_FEATURE_CAPABILITIES: case VIR_DOMAIN_FEATURE_CAPABILITIES:
case VIR_DOMAIN_FEATURE_PMU: case VIR_DOMAIN_FEATURE_PMU:
case VIR_DOMAIN_FEATURE_VMPORT: case VIR_DOMAIN_FEATURE_VMPORT:
case VIR_DOMAIN_FEATURE_SMM:
case VIR_DOMAIN_FEATURE_VMCOREINFO: case VIR_DOMAIN_FEATURE_VMCOREINFO:
case VIR_DOMAIN_FEATURE_LAST: case VIR_DOMAIN_FEATURE_LAST:
break; break;
...@@ -3925,7 +3935,7 @@ qemuDomainDefValidate(const virDomainDef *def, ...@@ -3925,7 +3935,7 @@ qemuDomainDefValidate(const virDomainDef *def,
} }
} }
if (qemuDomainDefValidateFeatures(def) < 0) if (qemuDomainDefValidateFeatures(def, qemuCaps) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册