[libvirt] [PATCH v1 04/26] qemu_command.c: move nvdimm validation to qemu_domain.c
Cole Robinson
crobinso at redhat.com
Mon Dec 16 22:42:01 UTC 2019
On 12/9/19 6:15 PM, Daniel Henrique Barboza wrote:
> QEMU_CAPS_DEVICE_NVDIMM validation is now being done inside
> qemuDomainDefValidateMemory().
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
> ---
> src/qemu/qemu_command.c | 5 -----
> src/qemu/qemu_domain.c | 10 ++++++++++
> tests/qemuxml2xmltest.c | 2 +-
> 3 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index e7365ba86a..25886bf49a 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7180,11 +7180,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;
> }
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index d62e13f26c..8eb0905f22 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -5021,6 +5021,7 @@ qemuDomainDefValidateMemory(const virDomainDef *def,
> {
> const long system_page_size = virGetSystemPageSizeKB();
> const virDomainMemtune *mem = &def->mem;
> + size_t i;
>
> if (mem->nhugepages == 0)
> return 0;
> @@ -5066,6 +5067,15 @@ qemuDomainDefValidateMemory(const virDomainDef *def,
> return -1;
> }
>
> + for (i = 0; i < def->nmems; i++) {
> + if (def->mems[i]->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;
> + }
> + }
> +
This should be added to a function like
qemuDomainDeviceDefValidateMemory called via qemuDomainDeviceDefValidate
- Cole
More information about the libvir-list
mailing list