qemuDomainGetResctrlMonData filled the monitor's reported name from virResctrlMonitorGetID(), the bare id parsed from the domain XML (e.g. "vcpus_0-1"). That is a bug and a duplicate: the id is only a fragment of the real resctrl group name and vcpus are already reported with the vcpus attribute. The group actually lives at mon_groups/<machine>-<id>. Add virResctrlMonitorGetName(), which returns the basename of the monitor's resctrl path. The stats name now maps 1:1 to the mon_group directory backing the monitor. Signed-off-by: Jedrzej Wasiukiewicz <jedrzej.wasiukiewicz@intel.com> Reviewed-by: Christopher M. Cantalupo <christopher.m.cantalupo@intel.com> --- src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 2 +- src/util/virresctrl.c | 10 ++++++++++ src/util/virresctrl.h | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 81d0574676..798d2d28c8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3397,6 +3397,7 @@ virResctrlMonitorAddPID; virResctrlMonitorCreate; virResctrlMonitorDeterminePath; virResctrlMonitorGetID; +virResctrlMonitorGetName; virResctrlMonitorGetStats; virResctrlMonitorNew; virResctrlMonitorRemove; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cb144407c4..9abd4d5618 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17415,7 +17415,7 @@ qemuDomainGetResctrlMonData(virQEMUDriver *driver, * let this newly allocated memory buffer to be freed along with * the free of 'res' */ res->vcpus = virBitmapFormat(domresmon->vcpus); - res->name = g_strdup(virResctrlMonitorGetID(monitor)); + res->name = virResctrlMonitorGetName(monitor); if (virResctrlMonitorGetStats(monitor, (const char **)features, &res->stats, &res->nstats) < 0) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 66df44fb58..b3e5c34443 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2587,6 +2587,16 @@ virResctrlMonitorGetID(virResctrlMonitor *monitor) } +char * +virResctrlMonitorGetName(virResctrlMonitor *monitor) +{ + if (!monitor->path) + return NULL; + + return g_path_get_basename(monitor->path); +} + + void virResctrlMonitorSetAlloc(virResctrlMonitor *monitor, virResctrlAlloc *alloc) diff --git a/src/util/virresctrl.h b/src/util/virresctrl.h index 2818b6e8cc..c12b521621 100644 --- a/src/util/virresctrl.h +++ b/src/util/virresctrl.h @@ -233,6 +233,9 @@ virResctrlMonitorSetID(virResctrlMonitor *monitor, const char * virResctrlMonitorGetID(virResctrlMonitor *monitor); +char * +virResctrlMonitorGetName(virResctrlMonitor *monitor); + void virResctrlMonitorSetAlloc(virResctrlMonitor *monitor, virResctrlAlloc *alloc); -- 2.43.0 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.