!61 domain: change method of getting domain id

From: @lt0926yy 
Reviewed-by: @Chuan-Zheng 
Signed-off-by: @Chuan-Zheng
This commit is contained in:
openeuler-ci-bot 2024-07-27 09:58:33 +00:00 committed by Gitee
commit 428a088a3c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 81fcff0cff9ef7ba181163467b4d594c35267c5c Mon Sep 17 00:00:00 2001
From: liangtian <lt0926yy@163.com>
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 <cpuset:/machain.slice/machain-qemu\x2d$id\x2d$name.scope>
to <cpuset:/machain/qemu-$id-$name.libvirt-qemu>
Signed-off-by: liangtian <lt0926yy@163.com>
---
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

View File

@ -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 <lt0926yy@163.com> - 1.1-8
- domain: change method of getting domain id
* Sun Oct 09 2022 fushanqing <fushanqing@kylinos.cn> - 1.1-7
- Unified license name specification