Re: [PATCH v2 4/4] qemu_command: Generate cmd line for virtio-mem dynamicMemslots

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

 



On Fri, Jan 05, 2024 at 13:33:35 +0100, Michal Privoznik wrote:
> This is pretty straightforward.
> 
> Resolves: https://issues.redhat.com/browse/RHEL-15316
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_command.c                                        | 3 +++
>  .../memory-hotplug-virtio-mem.x86_64-latest.args               | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index bc285c0b6f..0ebd668a9c 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -3608,6 +3608,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
>      unsigned long long requestedsize = 0;
>      unsigned long long address = 0;
>      bool prealloc = false;
> +    bool dynamicMemslots = false;
>  
>      if (!mem->info.alias) {
>          virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> @@ -3649,6 +3650,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
>          blocksize = mem->target.virtio_mem.blocksize;
>          requestedsize = mem->target.virtio_mem.requestedsize;
>          address = mem->target.virtio_mem.address;
> +        dynamicMemslots = mem->target.virtio_mem.dynamicMemslots;

virTristateBool dynamicMemslots;

typedef enum {
    VIR_TRISTATE_BOOL_ABSENT = 0,
    VIR_TRISTATE_BOOL_YES,
    VIR_TRISTATE_BOOL_NO,

    VIR_TRISTATE_BOOL_LAST
} virTristateBool;

>          break;
>  
>      case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
> @@ -3671,6 +3673,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
>                                "s:memdev", memdev,
>                                "B:prealloc", prealloc,
>                                "P:memaddr", address,
> +                              "B:dynamic-memslots", dynamicMemslots,

Either VIR_TRISTATE_BOOL_YES or VIR_TRISTATE_BOOL_NO are non-zero, so
the typecast to bool will make this set dynamic memslots to true in both
cases if the parameter is present ...

Since the test case doesn't contain an explicit 'no' ...

>                                "s:id", mem->info.alias,
>                                NULL) < 0)
>          return NULL;
> diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
> index 607ce9b0e8..489983a2cd 100644
> --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
> +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
> @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
>  -object '{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":false,"size":1073741824}' \
>  -device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":536870912,"memdev":"memvirtiomem0","id":"virtiomem0","bus":"pci.0","addr":"0x2"}' \
>  -object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":2147483648,"host-nodes":[1,2,3],"policy":"bind"}' \
> --device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"memaddr":5637144576,"id":"virtiomem1","bus":"pci.1","addr":"0x1"}' \
> +-device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"requested-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"memaddr":5637144576,"dynamic-memslots":true,"id":"virtiomem1","bus":"pci.1","addr":"0x1"}' \

... it's not visible here.

>  -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
>  -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
>  -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \

Use the proper tristate variable and "T:asdf" convertor when formatting
the json and add also the explicit 'no' to the test case.

With the above

Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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