On 11/12/18 8:31 AM, Wang Huaqiang wrote:
Refactor schemas and virresctrl to support optional <cache>
element
in <cachetune>.
Later, the monitor entry will be introduced and to be placed
under <cachetune>. Either cache entry or monitor entry is
an optional element of <cachetune>.
An cachetune has no <cache> element is taking the default resource
allocating policy defined in '/sys/fs/resctrl/schemata'.
Signed-off-by: Wang Huaqiang <huaqiang.wang(a)intel.com>
---
docs/formatdomain.html.in | 4 ++--
docs/schemas/domaincommon.rng | 4 ++--
src/util/virresctrl.c | 27 +++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 4 deletions(-)
[...]
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
index 5d811a2..7339e9b 100644
--- a/src/util/virresctrl.c
+++ b/src/util/virresctrl.c
[...]
@@ -2302,6 +2320,11 @@ virResctrlAllocAddPID(virResctrlAllocPtr
alloc,
char *pidstr = NULL;
int ret = 0;
+ /* If allocation is empty, then no resctrl directory and the 'tasks' file
+ * exists, just return */
/* If the allocation is empty, then it is impossible to add a PID to
* allocation due to lacking of its 'tasks' file so just return */
+ if (virResctrlAllocIsEmpty(alloc))
+ return 0;
+
if (!alloc->path) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot add pid to non-existing resctrl
allocation"));
@@ -2334,6 +2357,10 @@ virResctrlAllocRemove(virResctrlAllocPtr alloc)
{
int ret = 0;
+ /* Do not destroy if path is the system/default path for the allocation */
+ if (STREQ(alloc->path, SYSFS_RESCTRL_PATH))
+ return 0;
+
You added this backwards, must go below the following:
if (!alloc->path)
return 0;
With those changes,
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
(As with the rest, I can make the changes for you).
John