qemu: Allow VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE in qemuDomainSetNumaParamsLive()

The whole idea of VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE is that the
memory location is restricted only via CGroups and thus can be
changed on the fly (which is exactly what
qemuDomainSetNumaParamsLive() does. Allow this mode there then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Michal Privoznik 2021-12-15 16:11:28 +01:00
parent dfd1ffc544
commit a19b93d4e0
4 changed files with 15 additions and 4 deletions

View File

@ -1127,6 +1127,9 @@ NUMA Node Tuning
will be ignored if it's specified. If ``placement`` of ``vcpu`` is 'auto',
and ``numatune`` is not specified, a default ``numatune`` with ``placement``
'auto' and ``mode`` 'strict' will be added implicitly. :since:`Since 0.9.3`
See `virDomainSetNumaParameters
<html/libvirt-libvirt-domain.html#virDomainSetNumaParameters>`__ for more
information on update of this element.
``memnode``
Optional ``memnode`` elements can specify memory allocation policies per each
guest NUMA node. For those nodes having no corresponding ``memnode`` element,

View File

@ -3549,7 +3549,7 @@ displayed.
\'restrictive' or any valid number from the virDomainNumatuneMemMode enum
in case the daemon supports it. For a running domain, the mode can't be
changed, and the nodeset can be changed only if the domain was started with
a mode of \`strict'.
a mode of either \`strict' or \`restrictive'.
*nodeset* is a list of numa nodes used by the host for running the domain.
Its syntax is a comma separated list, with '-' for ranges and '^' for

View File

@ -2182,6 +2182,14 @@ virDomainGetMemoryParameters(virDomainPtr domain,
* Change all or a subset of the numa tunables.
* This function may require privileged access to the hypervisor.
*
* Changing live configuration may be possible only in some cases. For
* instance, for QEMU driver the mode (VIR_DOMAIN_NUMA_MODE) can not be
* changed, and changing the nodeset (VIR_DOMAIN_NUMA_NODESET) is possible
* only for VIR_DOMAIN_NUMATUNE_MEM_STRICT and
* VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE modes.
*
* Changing persistent configuration does not pose such limitations.
*
* Returns -1 in case of error, 0 in case of success.
*/
int

View File

@ -8777,10 +8777,10 @@ qemuDomainSetNumaParamsLive(virDomainObj *vm,
size_t i = 0;
if (virDomainNumatuneGetMode(vm->def->numa, -1, &mode) == 0 &&
mode != VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
mode != VIR_DOMAIN_NUMATUNE_MEM_STRICT &&
mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("change of nodeset for running domain "
"requires strict numa mode"));
_("change of nodeset for running domain requires strict or restrictive numa mode"));
return -1;
}