render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
404507
From 606a93eac7434332c39c54015d1e774293e9605d Mon Sep 17 00:00:00 2001
404507
Message-Id: <606a93eac7434332c39c54015d1e774293e9605d@dist-git>
404507
From: Martin Kletzander <mkletzan@redhat.com>
404507
Date: Mon, 5 Feb 2018 13:39:20 +0100
404507
Subject: [PATCH] qemu: Refresh capabilities when creating resctrl allocation
404507
404507
Since one of the things in capabilities (info from resctrl updated with data
404507
about caches) can be change on the system by remounting the /sys/fs/resctrl with
404507
different options, the capabilities need to be refreshed.  There is a better fix
404507
in the works, but it's going to be way bigger than this (hence the XXX note
404507
there), so for the time being let's workaround this.  And in order not to slow
404507
down the domain starting, only get the capabilities if there are any cachetunes.
404507
404507
Relates-to: https://bugzilla.redhat.com/show_bug.cgi?id=1540780
404507
404507
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
404507
(cherry picked from commit 3cac2a6c93c424d55b865a05635d96e0b1aa9d36)
404507
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
404507
---
404507
 src/qemu/qemu_process.c | 8 +++++++-
404507
 1 file changed, 7 insertions(+), 1 deletion(-)
404507
404507
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
404507
index 3853112924..c86f7d3c5b 100644
404507
--- a/src/qemu/qemu_process.c
404507
+++ b/src/qemu/qemu_process.c
404507
@@ -2511,9 +2511,15 @@ qemuProcessResctrlCreate(virQEMUDriverPtr driver,
404507
 {
404507
     int ret = -1;
404507
     size_t i = 0;
404507
-    virCapsPtr caps = virQEMUDriverGetCapabilities(driver, false);
404507
+    virCapsPtr caps = NULL;
404507
     qemuDomainObjPrivatePtr priv = vm->privateData;
404507
 
404507
+    if (!vm->def->ncachetunes)
404507
+        return 0;
404507
+
404507
+    /* Force capability refresh since resctrl info can change
404507
+     * XXX: move cache info into virresctrl so caps are not needed */
404507
+    caps = virQEMUDriverGetCapabilities(driver, true);
404507
     if (!caps)
404507
         return -1;
404507
 
404507
-- 
404507
2.16.1
404507