[PATCH v2 3/6] qemu: Allow VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE in qemuDomainSetNumaParamsLive()

Michal Privoznik mprivozn at redhat.com
Thu Dec 16 16:01:03 UTC 2021


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 at redhat.com>
---
 docs/formatdomain.rst   | 3 +++
 docs/manpages/virsh.rst | 2 +-
 src/libvirt-domain.c    | 8 ++++++++
 src/qemu/qemu_driver.c  | 6 +++---
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 2e9c450606..572ea15b35 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -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,
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index cd739c32c4..baee508d04 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -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
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 5708ff839b..90b8918bb5 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -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
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bae8b7c39b..e884dde721 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
     }
 
-- 
2.32.0




More information about the libvir-list mailing list