mirror of https://gitee.com/openkylin/libvirt.git
qemu: command: move NVDIMM validation to qemu_domain.c
Move the NVDIMM validation from qemuBuildMachineCommandLine() to a new function in qemu_domain.c, qemuDomainDeviceDefValidateMemory(), which is called by qemuDomainDeviceDefValidate(). This allows NVDIMM validation to occur in domain define time. It also increments memory hotplug validation, which can be seen by the failures in the hotplug tests in qemuxml2xmltest.c that needed to be adjusted after the move. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
5742d4c018
commit
2acbbd821b
|
@ -6982,11 +6982,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
|||
|
||||
for (i = 0; i < def->nmems; i++) {
|
||||
if (def->mems[i]->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("nvdimm isn't supported by this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
virBufferAddLit(&buf, ",nvdimm=on");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -5637,6 +5637,19 @@ qemuDomainDeviceDefValidateSound(virDomainSoundDefPtr sound,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainDeviceDefValidateMemory(virDomainMemoryDefPtr mem,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
if (mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("nvdimm isn't supported by this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainDefValidate(const virDomainDef *def,
|
||||
|
@ -8365,9 +8378,12 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev,
|
|||
ret = qemuDomainDeviceDefValidateSound(dev->data.sound, qemuCaps);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
ret = qemuDomainDeviceDefValidateMemory(dev->data.memory, qemuCaps);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
case VIR_DOMAIN_DEVICE_SHMEM:
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
case VIR_DOMAIN_DEVICE_PANIC:
|
||||
case VIR_DOMAIN_DEVICE_NONE:
|
||||
case VIR_DOMAIN_DEVICE_LAST:
|
||||
|
|
|
@ -1221,12 +1221,12 @@ mymain(void)
|
|||
DO_TEST("memory-hotplug", NONE);
|
||||
DO_TEST("memory-hotplug-nonuma", NONE);
|
||||
DO_TEST("memory-hotplug-dimm", NONE);
|
||||
DO_TEST("memory-hotplug-nvdimm", NONE);
|
||||
DO_TEST("memory-hotplug-nvdimm-access", NONE);
|
||||
DO_TEST("memory-hotplug-nvdimm-label", NONE);
|
||||
DO_TEST("memory-hotplug-nvdimm-align", NONE);
|
||||
DO_TEST("memory-hotplug-nvdimm-pmem", NONE);
|
||||
DO_TEST("memory-hotplug-nvdimm-readonly", NONE);
|
||||
DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm-access", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm-label", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm-align", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm-pmem", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("memory-hotplug-nvdimm-readonly", QEMU_CAPS_DEVICE_NVDIMM);
|
||||
DO_TEST("net-udp", NONE);
|
||||
|
||||
DO_TEST("video-virtio-gpu-device", QEMU_CAPS_DEVICE_VIRTIO_GPU);
|
||||
|
|
Loading…
Reference in New Issue