[libvirt] [PATCH 2/2] qemuBuildMemPathStr: Forbid memoryBacking/access for non-numa case

Ján Tomko jtomko at redhat.com
Wed Dec 20 13:00:31 UTC 2017


On Mon, Dec 18, 2017 at 09:28:24AM +0100, Michal Privoznik wrote:
>On 12/15/2017 08:48 PM, John Ferlan wrote:
>>
>>
>> On 12/12/2017 08:36 AM, Michal Privoznik wrote:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=1448149
>>>
>>> If a domain has no numa nodes, that means we don't put any
>>> memory-backend-file onto the qemu command line. That in turn
>>> means we can't set access='shared'. Therefore, we should produce
>>> an error instead of ignoring the setting silently.
>>>
>>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>>> ---
>>>  src/qemu/qemu_command.c                         |  9 +++
>>>  tests/qemuxml2argvdata/hugepages-memaccess3.xml | 87 +++++++++++++++++++++++++
>>>  tests/qemuxml2argvtest.c                        |  3 +
>>>  3 files changed, 99 insertions(+)
>>>  create mode 100644 tests/qemuxml2argvdata/hugepages-memaccess3.xml
>>>
>>> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>>> index 2dd50a214..dfc17ce34 100644
>>> --- a/src/qemu/qemu_command.c
>>> +++ b/src/qemu/qemu_command.c
>>> @@ -7682,6 +7682,15 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
>>>          return -1;
>>>      }
>>>
>>> +    if (def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_DEFAULT &&
>>> +        def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_PRIVATE) {
>>> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>>> +                       _("memory access mode '%s' not supported "
>>> +                         "without guest numa node"),
>>> +                       virDomainMemoryAccessTypeToString(def->mem.access));
>>> +        return -1;
>>> +    }
>>> +
>>
>> This works; however, why not move this and the virQEMUCapsGet check into
>> a qemu_domain qemuDomainDef*Memory*Validate type function?  Thus
>> removing failure checks from qemu_command...
>
>I'm not quite sure which function you have in mind.
>

A newly created qemuDomainDeviceDefValidateMemory function called from
qemuDomainDeviceDefValidate if this error is qemu-specific or
a newly created virDomainMemoryDefValidate called from virDomainDeviceDefValidateInternal
if this combination is nonsensical for all drivers.

Jan

>>
>> I suppose it's OK here, but I think better there.  Still for the concept,
>>
>> Reviewed-by: John Ferlan <jferlan at redhat.com>
>
>Thanks, I'll hold pushing these until we have clear consensus here.
>
>Michal
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20171220/d8275094/attachment-0001.sig>


More information about the libvir-list mailing list