Re: [PATCH v5 10/11] nvdimm: qemu command-line generating for unarmed property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$SUBJ:

qemu: Add qemu command-line to generate the nvdimm unarmed property


On 12/20/18 4:14 AM, Luyao Zhong wrote:
> According to the result parsing from xml, add unarmed property
> into QEMU command line:
> 
> -device nvdimm,...[,unarmed=on/off]

unarmed=on

(off is never added)

> 
> Signed-off-by: Luyao Zhong <luyao.zhong@xxxxxxxxx>
> ---
>  src/qemu/qemu_command.c                            | 16 ++++++++--
>  src/qemu/qemu_command.h                            |  3 +-
>  src/qemu/qemu_hotplug.c                            |  2 +-
>  ...mory-hotplug-nvdimm-readonly.x86_64-latest.args | 36 ++++++++++++++++++++++
>  tests/qemuxml2argvtest.c                           |  1 +
>  5 files changed, 54 insertions(+), 4 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 6a06161..1de3d07 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3567,7 +3567,8 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf,
>  
>  
>  char *
> -qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
> +qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
> +                         qemuDomainObjPrivatePtr priv)
>  {
>      virBuffer buf = VIR_BUFFER_INITIALIZER;
>      const char *device;
> @@ -3595,6 +3596,17 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
>          if (mem->labelsize)
>              virBufferAsprintf(&buf, "label-size=%llu,", mem->labelsize * 1024);
>  
> +        if (mem->readonly) {
> +            if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_NVDIMM_UNARMED)) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("Set readonly for nvdimm, but the corresponding unarmed"
> +                             "property is not available with this QEMU binary"));

    _("nvdimm readonly property is not available "
      "with this QEMU binary"));

(consistency and no need to confuse the consumer with using 'unarmed').

> +                return NULL;
> +            }
> +            virBufferAsprintf(&buf, "unarmed=%s,",
> +                              mem->readonly ? "on" : "off");

Similar to previous, we cannot have "off" here, so just go with:

    virBufferAddLit(&buf, "unarmed=on,");

I can adjust for you,

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John

[...]

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux