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