|
|
404507 |
From ff96b6f60e7062da45f24366db871c3ce675892e Mon Sep 17 00:00:00 2001
|
|
|
404507 |
Message-Id: <ff96b6f60e7062da45f24366db871c3ce675892e@dist-git>
|
|
|
404507 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
404507 |
Date: Wed, 31 Jan 2018 16:32:28 +0100
|
|
|
404507 |
Subject: [PATCH] fixup_resctrlinfo
|
|
|
404507 |
|
|
|
404507 |
https://bugzilla.redhat.com/show_bug.cgi?id=1289368
|
|
|
404507 |
|
|
|
404507 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
404507 |
(cherry picked from commit 434848d7dca9d1a7838ab53bbfdcf580ef7f2cc2)
|
|
|
404507 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
404507 |
---
|
|
|
404507 |
src/util/virresctrl.c | 29 +++++++++++++++++++----------
|
|
|
404507 |
1 file changed, 19 insertions(+), 10 deletions(-)
|
|
|
404507 |
|
|
|
404507 |
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
|
|
|
404507 |
index f122af2050..d439e7792c 100644
|
|
|
404507 |
--- a/src/util/virresctrl.c
|
|
|
404507 |
+++ b/src/util/virresctrl.c
|
|
|
404507 |
@@ -200,6 +200,8 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
|
|
404507 |
}
|
|
|
404507 |
|
|
|
404507 |
while ((rv = virDirRead(dirp, &ent, SYSFS_RESCTRL_PATH "/info")) > 0) {
|
|
|
404507 |
+ VIR_DEBUG("Parsing info type '%s'", ent->d_name);
|
|
|
404507 |
+
|
|
|
404507 |
if (ent->d_type != DT_DIR)
|
|
|
404507 |
continue;
|
|
|
404507 |
|
|
|
404507 |
@@ -207,16 +209,14 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
|
|
404507 |
continue;
|
|
|
404507 |
|
|
|
404507 |
if (virStrToLong_uip(ent->d_name + 1, &endptr, 10, &level) < 0) {
|
|
|
404507 |
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
404507 |
- _("Cannot parse resctrl cache info level"));
|
|
|
404507 |
- goto cleanup;
|
|
|
404507 |
+ VIR_DEBUG("Cannot parse resctrl cache info level '%s'", ent->d_name + 1);
|
|
|
404507 |
+ continue;
|
|
|
404507 |
}
|
|
|
404507 |
|
|
|
404507 |
type = virResctrlTypeFromString(endptr);
|
|
|
404507 |
if (type < 0) {
|
|
|
404507 |
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
404507 |
- _("Cannot parse resctrl cache info type"));
|
|
|
404507 |
- goto cleanup;
|
|
|
404507 |
+ VIR_DEBUG("Cannot parse resctrl cache info type '%s'", endptr);
|
|
|
404507 |
+ continue;
|
|
|
404507 |
}
|
|
|
404507 |
|
|
|
404507 |
if (VIR_ALLOC(i_type) < 0)
|
|
|
404507 |
@@ -259,10 +259,19 @@ virResctrlGetInfo(virResctrlInfoPtr resctrl)
|
|
|
404507 |
level - resctrl->nlevels + 1) < 0)
|
|
|
404507 |
goto cleanup;
|
|
|
404507 |
|
|
|
404507 |
- if (!resctrl->levels[level] &&
|
|
|
404507 |
- (VIR_ALLOC(resctrl->levels[level]) < 0 ||
|
|
|
404507 |
- VIR_ALLOC_N(resctrl->levels[level]->types, VIR_CACHE_TYPE_LAST) < 0))
|
|
|
404507 |
- goto cleanup;
|
|
|
404507 |
+ if (!resctrl->levels[level]) {
|
|
|
404507 |
+ virResctrlInfoPerTypePtr *types = NULL;
|
|
|
404507 |
+
|
|
|
404507 |
+ if (VIR_ALLOC_N(types, VIR_CACHE_TYPE_LAST) < 0)
|
|
|
404507 |
+ goto cleanup;
|
|
|
404507 |
+
|
|
|
404507 |
+ if (VIR_ALLOC(resctrl->levels[level]) < 0) {
|
|
|
404507 |
+ VIR_FREE(types);
|
|
|
404507 |
+ goto cleanup;
|
|
|
404507 |
+ }
|
|
|
404507 |
+ resctrl->levels[level]->types = types;
|
|
|
404507 |
+ }
|
|
|
404507 |
+
|
|
|
404507 |
i_level = resctrl->levels[level];
|
|
|
404507 |
|
|
|
404507 |
if (i_level->types[type]) {
|
|
|
404507 |
--
|
|
|
404507 |
2.16.1
|
|
|
404507 |
|