
$SUBJ: qemu: Add command-line to generate the nvdimm align property On 12/20/18 4:14 AM, Luyao Zhong wrote:
According to the result parsing from xml, add align property into QEMU command line:
-object memory-backend-file,...[,align=xxx]
Signed-off-by: Luyao Zhong <luyao.zhong@intel.com> --- src/qemu/qemu_command.c | 14 +++++++++ .../memory-hotplug-nvdimm-align.x86_64-latest.args | 36 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 51 insertions(+) create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 66a4a35..eeb49de 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3398,6 +3398,20 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, if (virJSONValueObjectAdd(props, "U:size", mem->size * 1024, NULL) < 0) goto cleanup;
+ if (mem->alignsize) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("align property is not available "
nvdimm align
+ "with this QEMU binary")); + goto cleanup; + } + if (virJSONValueObjectAdd(props, + "U:align", + mem->alignsize * 1024, + NULL) < 0)
Since we'd be only going a little beyond 80 chars and this helper already does it, let's just go with one line here: if (virJSONValueObjectAdd(props, "U:align", mem->alignsize * 1024, NULL) < 0) I can adjust for you, Reviewed-by: John Ferlan <jferlan@redhat.com> John [...]