From 2bd0d9255126dd1f3b48d6b93af879d7315e68ad Mon Sep 17 00:00:00 2001 From: liangtian Date: Sat, 27 Jul 2024 17:30:44 +0800 Subject: [PATCH] domain: change method of getting domain id libvirt 9.10 change cpuset of cgroup path of vm change to Signed-off-by: liangtian --- ...n-change-method-of-getting-domain-id.patch | 42 +++++++++++++++++++ vmtop.spec | 6 ++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 domain-change-method-of-getting-domain-id.patch diff --git a/domain-change-method-of-getting-domain-id.patch b/domain-change-method-of-getting-domain-id.patch new file mode 100644 index 0000000..49b7068 --- /dev/null +++ b/domain-change-method-of-getting-domain-id.patch @@ -0,0 +1,42 @@ +From 81fcff0cff9ef7ba181163467b4d594c35267c5c Mon Sep 17 00:00:00 2001 +From: liangtian +Date: Sat, 27 Jul 2024 16:44:11 +0800 +Subject: [PATCH] domain: change method of getting domain id + +libvirt 9.10 change cpuset of cgroup path of vm +change +to + +Signed-off-by: liangtian +--- + src/domain.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/domain.c b/src/domain.c +index 977cabe..8039182 100644 +--- a/src/domain.c ++++ b/src/domain.c +@@ -107,17 +107,17 @@ static int get_id_from_cgroup(pid_t pid) + if (fp == NULL) { + return id; + } +- /* parse id from "cpuset:machine.slice/machine-qemu\x2d$id" */ ++ /* parse id from "cpuset:/machine/qemu-$id" */ + while (fgets(buf, BUF_SIZE - 1, fp)) { + if (strstr(buf, "cpuset:") == NULL) { + memset(buf, 0, BUF_SIZE); + continue; + } +- tmp = strstr(buf, "machine-qemu\\x2d"); ++ tmp = strstr(buf, "qemu-"); + if (tmp == NULL) { + continue; + } +- tmp += strlen("machine-qemu\\x2d"); ++ tmp += strlen("qemu-"); + id = atoi(tmp); + break; + } +-- +2.45.2.windows.1 + diff --git a/vmtop.spec b/vmtop.spec index ce2b7f7..2b1514f 100644 --- a/vmtop.spec +++ b/vmtop.spec @@ -1,6 +1,6 @@ Name: vmtop Version: 1.1 -Release: 7 +Release: 8 Summary: A tool for collecting and analyzing data of virtual machine License: MulanPSL-2.0 Group: Application/System @@ -39,6 +39,7 @@ Patch0028: proc-del-unused-items-getting-from-proc-stat-refresh.patch Patch0029: proc-del-loop-sscanf-for-proc-pid-stat-file.patch Patch0030: utils-del-realpath-from-read_file.patch Patch0031: add-README.zh.md.-update-README.md.patch +Patch0032: domain-change-method-of-getting-domain-id.patch Requires: libvirt, ncurses @@ -79,6 +80,9 @@ install -m 550 vmtop ${RPM_BUILD_ROOT}/usr/bin/%{name} %{_bindir}/vmtop %changelog +* Sat Jul 27 2024 liangtian - 1.1-8 +- domain: change method of getting domain id + * Sun Oct 09 2022 fushanqing - 1.1-7 - Unified license name specification -- Gitee