$SUBJ:
qemu: Add command-line to generate the nvdimm pmem property
On 12/20/18 4:14 AM, Luyao Zhong wrote:
According to the result parsing from xml, add pmem property
into QEMU command line:
-object memory-backend-file,...[,pmem=on/off]
"pmem=on"
(off is never added).
Signed-off-by: Luyao Zhong <luyao.zhong(a)intel.com>
---
src/qemu/qemu_command.c | 14 +++++++++
.../memory-hotplug-nvdimm-pmem.x86_64-latest.args | 36 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
3 files changed, 51 insertions(+)
create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index eeb49de..6a06161 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3412,6 +3412,20 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
goto cleanup;
}
+ if (mem->nvdimmPmem) {
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("pmem property is not available "
nvdimm pmem ...
+ "with this QEMU binary"));
+ goto cleanup;
+ }
+ if (virJSONValueObjectAdd(props,
+ "s:pmem",
+ mem->nvdimmPmem ? "on" : "off",
Since when nvdimmPmem is false, we wouldn't get here, let's go with:
if (virJSONValueObjectAdd(props, "s:pmem", "on", NULL) <
0)
I can adjust for you,
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John
[...]