2018-02-09 17:35:42 +01:00
|
|
|
From 6609ed5a377c3beaf8389e870b6851856cee42c7 Mon Sep 17 00:00:00 2001
|
|
|
|
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
|
|
|
|
Date: Thu, 4 Jan 2018 12:04:07 +0100
|
|
|
|
Subject: [PATCH 1/3] Extract stats functions from the qemu driver
|
|
|
|
|
|
|
|
Some of the qemu functions getting statistics can easily be reused in
|
|
|
|
other drivers. Create a conf/domain_stats.[ch] pair to host some of
|
|
|
|
them.
|
|
|
|
---
|
|
|
|
src/Makefile.am | 1 +
|
|
|
|
src/conf/domain_stats.c | 139 +++++++++++++++++++++++++++++++++++++++++
|
|
|
|
src/conf/domain_stats.h | 64 +++++++++++++++++++
|
|
|
|
src/libvirt_private.syms | 4 ++
|
|
|
|
src/qemu/qemu_driver.c | 158 +++--------------------------------------------
|
|
|
|
src/util/vircgroup.c | 46 ++++++++++++++
|
|
|
|
src/util/vircgroup.h | 4 ++
|
|
|
|
7 files changed, 265 insertions(+), 151 deletions(-)
|
|
|
|
create mode 100644 src/conf/domain_stats.c
|
|
|
|
create mode 100644 src/conf/domain_stats.h
|
|
|
|
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/conf/domain_stats.c
|
Accepting request 583090 from home:jfehlig:branches:Virtualization
- Update to libvirt 4.1.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
72adaf2f-revert-qemu-monitor-error-report.patch,
71d56a39-nodedev-fix-parse-PCI-address.patch,
68eed56b-conf-smbios-oem-strings.patch,
76977061-qemu-smbios-oem-strings.patch,
0c710a37-libxl-resume-lock-on-mig-failure.patch,
759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch,
c2dc6698-fix-deadlock-obtaining-hostname.patch,
c391e07e-libxl-clock-settings.patch,
ef71caea-libxl-memalign.patch,
suse-apparmor-signal.patch
OBS-URL: https://build.opensuse.org/request/show/583090
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=674
2018-03-05 18:46:32 +01:00
|
|
|
===================================================================
|
2018-02-09 17:35:42 +01:00
|
|
|
--- /dev/null
|
2021-10-01 23:10:15 +02:00
|
|
|
+++ libvirt-7.8.0/src/conf/domain_stats.c
|
2021-05-18 00:14:02 +02:00
|
|
|
@@ -0,0 +1,117 @@
|
2018-02-09 17:35:42 +01:00
|
|
|
+/*
|
|
|
|
+ * domain_stats.c: domain stats extraction helpers
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2006-2016 Red Hat, Inc.
|
|
|
|
+ * Copyright (C) 2006-2008 Daniel P. Berrange
|
|
|
|
+ * Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
|
|
+ *
|
|
|
|
+ * This library is free software; you can redistribute it and/or
|
|
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
|
+ * License as published by the Free Software Foundation; either
|
|
|
|
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * This library is distributed in the hope that it will be useful,
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
+ * Lesser General Public License for more details.
|
|
|
|
+ *
|
|
|
|
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
|
+ * License along with this library. If not, see
|
|
|
|
+ * <http://www.gnu.org/licenses/>.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <config.h>
|
|
|
|
+
|
|
|
|
+#include <stdio.h>
|
|
|
|
+
|
|
|
|
+#include "virlog.h"
|
|
|
|
+#include "domain_stats.h"
|
|
|
|
+#include "virtypedparam.h"
|
|
|
|
+#include "virnetdevtap.h"
|
|
|
|
+#include "virnetdevopenvswitch.h"
|
|
|
|
+
|
|
|
|
+#define VIR_FROM_THIS VIR_FROM_DOMAIN
|
|
|
|
+
|
|
|
|
+VIR_LOG_INIT("conf.domain_stats");
|
|
|
|
+
|
|
|
|
+int
|
2021-05-18 00:14:02 +02:00
|
|
|
+virDomainStatsGetState(virDomainObj *dom,
|
|
|
|
+ virTypedParamList *params)
|
2018-02-09 17:35:42 +01:00
|
|
|
+{
|
2019-10-10 19:20:38 +02:00
|
|
|
+ if (virTypedParamListAddInt(params, dom->state.state, "state.state") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
+ return -1;
|
|
|
|
+
|
2019-10-10 19:20:38 +02:00
|
|
|
+ if (virTypedParamListAddInt(params, dom->state.reason, "state.reason") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2019-10-10 19:20:38 +02:00
|
|
|
+#define STATS_ADD_NET_PARAM(params, num, name, value) \
|
|
|
|
+ if (value >= 0 && \
|
|
|
|
+ virTypedParamListAddULLong((params), (value), "net.%zu.%s", (num), (name)) < 0) \
|
|
|
|
+ return -1;
|
2018-02-09 17:35:42 +01:00
|
|
|
+
|
|
|
|
+int
|
2021-05-18 00:14:02 +02:00
|
|
|
+virDomainStatsGetInterface(virDomainObj *dom,
|
|
|
|
+ virTypedParamList *params)
|
2018-02-09 17:35:42 +01:00
|
|
|
+{
|
|
|
|
+ size_t i;
|
|
|
|
+ struct _virDomainInterfaceStats tmp;
|
|
|
|
+
|
|
|
|
+ if (!virDomainObjIsActive(dom))
|
|
|
|
+ return 0;
|
|
|
|
+
|
2019-10-10 19:20:38 +02:00
|
|
|
+ if (virTypedParamListAddUInt(params, dom->def->nnets, "net.count") < 0)
|
|
|
|
+ return -1;
|
2018-02-09 17:35:42 +01:00
|
|
|
+
|
|
|
|
+ /* Check the path is one of the domain's network interfaces. */
|
|
|
|
+ for (i = 0; i < dom->def->nnets; i++) {
|
2021-05-18 00:14:02 +02:00
|
|
|
+ virDomainNetDef *net = dom->def->nets[i];
|
2018-02-09 17:35:42 +01:00
|
|
|
+ virDomainNetType actualType;
|
|
|
|
+
|
|
|
|
+ if (!net->ifname)
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ memset(&tmp, 0, sizeof(tmp));
|
|
|
|
+
|
|
|
|
+ actualType = virDomainNetGetActualType(net);
|
|
|
|
+
|
2019-10-10 19:20:38 +02:00
|
|
|
+ if (virTypedParamListAddString(params, net->ifname, "net.%zu.name", i) < 0)
|
|
|
|
+ return -1;
|
2018-02-09 17:35:42 +01:00
|
|
|
+
|
|
|
|
+ if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
|
|
|
+ if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0) {
|
|
|
|
+ virResetLastError();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (virNetDevTapInterfaceStats(net->ifname, &tmp,
|
|
|
|
+ !virDomainNetTypeSharesHostView(net)) < 0) {
|
|
|
|
+ virResetLastError();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2019-10-10 19:20:38 +02:00
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "rx.bytes", tmp.rx_bytes);
|
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "rx.pkts", tmp.rx_packets);
|
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "rx.errs", tmp.rx_errs);
|
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "rx.drop", tmp.rx_drop);
|
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "tx.bytes", tmp.tx_bytes);
|
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "tx.pkts", tmp.tx_packets);
|
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "tx.errs", tmp.tx_errs);
|
|
|
|
+ STATS_ADD_NET_PARAM(params, i,
|
|
|
|
+ "tx.drop", tmp.tx_drop);
|
2018-02-09 17:35:42 +01:00
|
|
|
+ }
|
|
|
|
+
|
2019-10-10 19:20:38 +02:00
|
|
|
+ return 0;
|
2018-02-09 17:35:42 +01:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#undef STATS_ADD_NET_PARAM
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/conf/domain_stats.h
|
Accepting request 583090 from home:jfehlig:branches:Virtualization
- Update to libvirt 4.1.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
72adaf2f-revert-qemu-monitor-error-report.patch,
71d56a39-nodedev-fix-parse-PCI-address.patch,
68eed56b-conf-smbios-oem-strings.patch,
76977061-qemu-smbios-oem-strings.patch,
0c710a37-libxl-resume-lock-on-mig-failure.patch,
759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch,
c2dc6698-fix-deadlock-obtaining-hostname.patch,
c391e07e-libxl-clock-settings.patch,
ef71caea-libxl-memalign.patch,
suse-apparmor-signal.patch
OBS-URL: https://build.opensuse.org/request/show/583090
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=674
2018-03-05 18:46:32 +01:00
|
|
|
===================================================================
|
2018-02-09 17:35:42 +01:00
|
|
|
--- /dev/null
|
2021-10-01 23:10:15 +02:00
|
|
|
+++ libvirt-7.8.0/src/conf/domain_stats.h
|
2021-05-18 00:14:02 +02:00
|
|
|
@@ -0,0 +1,60 @@
|
2018-02-09 17:35:42 +01:00
|
|
|
+/*
|
|
|
|
+ * domain_stats.h: domain stats extraction helpers
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2006-2016 Red Hat, Inc.
|
|
|
|
+ * Copyright (C) 2006-2008 Daniel P. Berrange
|
|
|
|
+ * Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
|
|
+ *
|
|
|
|
+ * This library is free software; you can redistribute it and/or
|
|
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
|
+ * License as published by the Free Software Foundation; either
|
|
|
|
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * This library is distributed in the hope that it will be useful,
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
+ * Lesser General Public License for more details.
|
|
|
|
+ *
|
|
|
|
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
|
+ * License along with this library. If not, see
|
|
|
|
+ * <http://www.gnu.org/licenses/>.
|
|
|
|
+ */
|
|
|
|
+#ifndef __DOMAIN_STATS_H
|
|
|
|
+# define __DOMAIN_STATS_H
|
|
|
|
+
|
|
|
|
+# include "internal.h"
|
|
|
|
+# include "domain_conf.h"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+# define VIR_DOMAIN_STATS_ADD_COUNT_PARAM(record, maxparams, type, count) \
|
|
|
|
+do { \
|
|
|
|
+ char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \
|
|
|
|
+ snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, "%s.count", type); \
|
|
|
|
+ if (virTypedParamsAddUInt(&(record)->params, \
|
|
|
|
+ &(record)->nparams, \
|
|
|
|
+ maxparams, \
|
|
|
|
+ param_name, \
|
|
|
|
+ count) < 0) \
|
|
|
|
+ goto cleanup; \
|
|
|
|
+} while (0)
|
|
|
|
+
|
|
|
|
+# define VIR_DOMAIN_STATS_ADD_NAME_PARAM(record, maxparams, type, subtype, num, name) \
|
|
|
|
+do { \
|
|
|
|
+ char param_name[VIR_TYPED_PARAM_FIELD_LENGTH]; \
|
|
|
|
+ snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH, \
|
|
|
|
+ "%s.%zu.%s", type, num, subtype); \
|
|
|
|
+ if (virTypedParamsAddString(&(record)->params, \
|
|
|
|
+ &(record)->nparams, \
|
|
|
|
+ maxparams, \
|
|
|
|
+ param_name, \
|
|
|
|
+ name) < 0) \
|
|
|
|
+ goto cleanup; \
|
|
|
|
+} while (0)
|
|
|
|
+
|
2021-05-18 00:14:02 +02:00
|
|
|
+int virDomainStatsGetState(virDomainObj *dom,
|
|
|
|
+ virTypedParamList *params);
|
2018-02-09 17:35:42 +01:00
|
|
|
+
|
2021-05-18 00:14:02 +02:00
|
|
|
+int virDomainStatsGetInterface(virDomainObj *dom,
|
|
|
|
+ virTypedParamList *params);
|
2018-02-09 17:35:42 +01:00
|
|
|
+
|
|
|
|
+#endif /* __DOMAIN_STATS_H */
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/libvirt_private.syms
|
Accepting request 583090 from home:jfehlig:branches:Virtualization
- Update to libvirt 4.1.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
72adaf2f-revert-qemu-monitor-error-report.patch,
71d56a39-nodedev-fix-parse-PCI-address.patch,
68eed56b-conf-smbios-oem-strings.patch,
76977061-qemu-smbios-oem-strings.patch,
0c710a37-libxl-resume-lock-on-mig-failure.patch,
759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch,
c2dc6698-fix-deadlock-obtaining-hostname.patch,
c391e07e-libxl-clock-settings.patch,
ef71caea-libxl-memalign.patch,
suse-apparmor-signal.patch
OBS-URL: https://build.opensuse.org/request/show/583090
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=674
2018-03-05 18:46:32 +01:00
|
|
|
===================================================================
|
2021-10-01 23:10:15 +02:00
|
|
|
--- libvirt-7.8.0.orig/src/libvirt_private.syms
|
|
|
|
+++ libvirt-7.8.0/src/libvirt_private.syms
|
|
|
|
@@ -763,6 +763,11 @@ virDomainConfNWFilterTeardown;
|
2018-02-09 17:35:42 +01:00
|
|
|
virDomainConfVMNWFilterTeardown;
|
|
|
|
|
2021-01-20 00:09:19 +01:00
|
|
|
|
2018-02-09 17:35:42 +01:00
|
|
|
+# conf/domain_stats.h
|
|
|
|
+virDomainStatsGetInterface;
|
|
|
|
+virDomainStatsGetState;
|
2021-01-20 00:09:19 +01:00
|
|
|
+
|
|
|
|
+
|
|
|
|
# conf/domain_validate.h
|
|
|
|
virDomainActualNetDefValidate;
|
|
|
|
virDomainDefValidate;
|
2021-10-01 23:10:15 +02:00
|
|
|
@@ -1939,6 +1944,7 @@ virCgroupGetMemoryUsage;
|
2018-02-09 17:35:42 +01:00
|
|
|
virCgroupGetMemSwapHardLimit;
|
|
|
|
virCgroupGetMemSwapUsage;
|
|
|
|
virCgroupGetPercpuStats;
|
|
|
|
+virCgroupGetStatsCpu;
|
|
|
|
virCgroupHasController;
|
|
|
|
virCgroupHasEmptyTasks;
|
Accepting request 636920 from home:jfehlig:branches:Virtualization
- libxl: fix VM migration on busy hosts
60b4fd90-libxl-rm-vm-finish-phase.patch,
e39c66d3-libxl-fix-p2p-migration.patch,
47da84e0-libxl-fix-job-handling-migsrc.patch,
0149464a-libxl-fix-job-handling-migdst.patch,
5ea2abb3-libxl-join-mig-rcv-thread.patch
bsc#1108086
- Update to libvirt 4.7.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
9ed59012--revert-jansson1.patch,
54f2b5e3-revert-jansson2.patch,
b56950fd-revert-jansson3.patch,
6c3d66ac-revert-jansson4.patch,
8e373e6d-revert-jansson5.patch,
6f99de31-revert-jansson6.patch,
f204cf51-revert-jansson7.patch,
5a58b5ed-revert-jansson8.patch,
63f6e0e9-revert-jansson9.patch,
8687eba-revert-jansson10.patch,
e96e71d8-revert-jansson11.patch,
d99a8959-revert-jansson12.patch,
074a7e14-revert-jansson13.patch
OBS-URL: https://build.opensuse.org/request/show/636920
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=704
2018-09-20 19:06:17 +02:00
|
|
|
virCgroupKillPainfully;
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/qemu/qemu_driver.c
|
Accepting request 583090 from home:jfehlig:branches:Virtualization
- Update to libvirt 4.1.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
72adaf2f-revert-qemu-monitor-error-report.patch,
71d56a39-nodedev-fix-parse-PCI-address.patch,
68eed56b-conf-smbios-oem-strings.patch,
76977061-qemu-smbios-oem-strings.patch,
0c710a37-libxl-resume-lock-on-mig-failure.patch,
759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch,
c2dc6698-fix-deadlock-obtaining-hostname.patch,
c391e07e-libxl-clock-settings.patch,
ef71caea-libxl-memalign.patch,
suse-apparmor-signal.patch
OBS-URL: https://build.opensuse.org/request/show/583090
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=674
2018-03-05 18:46:32 +01:00
|
|
|
===================================================================
|
2021-10-01 23:10:15 +02:00
|
|
|
--- libvirt-7.8.0.orig/src/qemu/qemu_driver.c
|
|
|
|
+++ libvirt-7.8.0/src/qemu/qemu_driver.c
|
2021-09-01 18:17:27 +02:00
|
|
|
@@ -68,6 +68,7 @@
|
Accepting request 593871 from home:jfehlig:branches:Virtualization
- util: improvements in error handling
09877303-virSocketAddrParseInternal.patch,
412afdb8-intro-virSocketAddrParseAny.patch
bsc#1080957
- Update to libvirt 4.2.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
6b3d716e-keycodemap-py3.patch,
33c6eb96-fix-libvirtd-reload-deadlock.patch,
464889ff-rpc-aquire-ref-dispatch.patch,
c6f1d519-rpc-simplify-dispatch.patch,
06e7ebb6-rpc-invoke-dispatch-unlocked.patch,
86cae503-rpc-fix-pre-exec.patch,
eefabb38-rpc-virtlockd-virtlogd-single-thread.patch,
fbf31e1a-CVE-2018-1064.patch,
fb327ac2-virtlockd-admin-socket.patch,
64370c4b-libxl-MigrateBegin.patch,
99486799-libxl-MigrateConfirm.patch,
f5eacf2a-libxl-MigratePerform.patch,
4e6fcdb6-libxl-libxlDomObjFromDomain-cleanup.patch,
fe51dbda-libxl-use-FindByRef.patch,
60b3fcd9-libxl-MigratePrepare.patch,
3c89868c-libxl-lock-after-ListRemove.patch,
13e81fc6-libxl-EndJob-on-error.patch,
594b8b99-libxl-DefineXMLFlags-API-pattern.patch,
c66e344e-libxl-dont-deref-NULL.patch,
83edaf44-libxl-dont-hardcode-sched-weight.patch,
apibuild-py3.patch
OBS-URL: https://build.opensuse.org/request/show/593871
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=683
2018-04-05 23:47:55 +02:00
|
|
|
#include "virarptable.h"
|
2018-02-09 17:35:42 +01:00
|
|
|
#include "viruuid.h"
|
|
|
|
#include "domain_conf.h"
|
|
|
|
+#include "domain_stats.h"
|
|
|
|
#include "domain_audit.h"
|
2020-03-10 02:55:25 +01:00
|
|
|
#include "domain_cgroup.h"
|
|
|
|
#include "domain_driver.h"
|
2021-10-01 23:10:15 +02:00
|
|
|
@@ -17323,13 +17324,7 @@ qemuDomainGetStatsState(virQEMUDriver *d
|
2021-05-18 00:14:02 +02:00
|
|
|
virTypedParamList *params,
|
2019-11-06 16:48:56 +01:00
|
|
|
unsigned int privflags G_GNUC_UNUSED)
|
2018-02-09 17:35:42 +01:00
|
|
|
{
|
2019-10-10 19:20:38 +02:00
|
|
|
- if (virTypedParamListAddInt(params, dom->state.state, "state.state") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
- return -1;
|
|
|
|
-
|
2019-10-10 19:20:38 +02:00
|
|
|
- if (virTypedParamListAddInt(params, dom->state.reason, "state.reason") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- return 0;
|
2019-10-10 19:20:38 +02:00
|
|
|
+ return virDomainStatsGetState(dom, params);
|
2018-02-09 17:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-01 23:10:15 +02:00
|
|
|
@@ -17621,25 +17616,11 @@ qemuDomainGetStatsCpuCgroup(virDomainObj
|
2021-05-18 00:14:02 +02:00
|
|
|
virTypedParamList *params)
|
2020-09-03 00:47:08 +02:00
|
|
|
{
|
2021-05-18 00:14:02 +02:00
|
|
|
qemuDomainObjPrivate *priv = dom->privateData;
|
2020-09-03 00:47:08 +02:00
|
|
|
- unsigned long long cpu_time = 0;
|
|
|
|
- unsigned long long user_time = 0;
|
|
|
|
- unsigned long long sys_time = 0;
|
|
|
|
- int err = 0;
|
|
|
|
|
2019-10-10 19:20:38 +02:00
|
|
|
if (!priv->cgroup)
|
|
|
|
return 0;
|
|
|
|
|
2018-02-09 17:35:42 +01:00
|
|
|
- err = virCgroupGetCpuacctUsage(priv->cgroup, &cpu_time);
|
2019-10-10 19:20:38 +02:00
|
|
|
- if (!err && virTypedParamListAddULLong(params, cpu_time, "cpu.time") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- err = virCgroupGetCpuacctStat(priv->cgroup, &user_time, &sys_time);
|
2019-10-10 19:20:38 +02:00
|
|
|
- if (!err && virTypedParamListAddULLong(params, user_time, "cpu.user") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
- return -1;
|
2019-10-10 19:20:38 +02:00
|
|
|
- if (!err && virTypedParamListAddULLong(params, sys_time, "cpu.system") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- return 0;
|
2019-10-10 19:20:38 +02:00
|
|
|
+ return virCgroupGetStatsCpu(priv->cgroup, params);
|
2018-02-09 17:35:42 +01:00
|
|
|
}
|
|
|
|
|
2021-08-03 21:49:58 +02:00
|
|
|
static int
|
2021-10-01 23:10:15 +02:00
|
|
|
@@ -17832,76 +17813,15 @@ qemuDomainGetStatsVcpu(virQEMUDriver *dr
|
2018-02-09 17:35:42 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-10-10 19:20:38 +02:00
|
|
|
-#define QEMU_ADD_NET_PARAM(params, num, name, value) \
|
|
|
|
- if (value >= 0 && \
|
|
|
|
- virTypedParamListAddULLong((params), (value), "net.%zu.%s", (num), (name)) < 0) \
|
|
|
|
- return -1;
|
2018-02-09 17:35:42 +01:00
|
|
|
-
|
|
|
|
static int
|
2021-05-18 00:14:02 +02:00
|
|
|
qemuDomainGetStatsInterface(virQEMUDriver *driver G_GNUC_UNUSED,
|
|
|
|
virDomainObj *dom,
|
|
|
|
virTypedParamList *params,
|
2019-11-06 16:48:56 +01:00
|
|
|
unsigned int privflags G_GNUC_UNUSED)
|
2018-02-09 17:35:42 +01:00
|
|
|
{
|
|
|
|
- size_t i;
|
|
|
|
- struct _virDomainInterfaceStats tmp;
|
|
|
|
-
|
|
|
|
- if (!virDomainObjIsActive(dom))
|
|
|
|
- return 0;
|
|
|
|
-
|
2019-10-10 19:20:38 +02:00
|
|
|
- if (virTypedParamListAddUInt(params, dom->def->nnets, "net.count") < 0)
|
2019-12-03 05:35:26 +01:00
|
|
|
- return -1;
|
2018-02-09 17:35:42 +01:00
|
|
|
-
|
|
|
|
- /* Check the path is one of the domain's network interfaces. */
|
|
|
|
- for (i = 0; i < dom->def->nnets; i++) {
|
2021-05-18 00:14:02 +02:00
|
|
|
- virDomainNetDef *net = dom->def->nets[i];
|
2018-02-09 17:35:42 +01:00
|
|
|
- virDomainNetType actualType;
|
|
|
|
-
|
|
|
|
- if (!net->ifname)
|
|
|
|
- continue;
|
|
|
|
-
|
|
|
|
- memset(&tmp, 0, sizeof(tmp));
|
|
|
|
-
|
|
|
|
- actualType = virDomainNetGetActualType(net);
|
|
|
|
-
|
2019-10-10 19:20:38 +02:00
|
|
|
- if (virTypedParamListAddString(params, net->ifname, "net.%zu.name", i) < 0)
|
2019-12-03 05:35:26 +01:00
|
|
|
- return -1;
|
2018-02-09 17:35:42 +01:00
|
|
|
-
|
|
|
|
- if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
|
|
|
- if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0) {
|
|
|
|
- virResetLastError();
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (virNetDevTapInterfaceStats(net->ifname, &tmp,
|
|
|
|
- !virDomainNetTypeSharesHostView(net)) < 0) {
|
|
|
|
- virResetLastError();
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "rx.bytes", tmp.rx_bytes);
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "rx.pkts", tmp.rx_packets);
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "rx.errs", tmp.rx_errs);
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "rx.drop", tmp.rx_drop);
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "tx.bytes", tmp.tx_bytes);
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "tx.pkts", tmp.tx_packets);
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "tx.errs", tmp.tx_errs);
|
2019-10-10 19:20:38 +02:00
|
|
|
- QEMU_ADD_NET_PARAM(params, i,
|
2018-02-09 17:35:42 +01:00
|
|
|
- "tx.drop", tmp.tx_drop);
|
|
|
|
- }
|
|
|
|
-
|
2019-12-03 05:35:26 +01:00
|
|
|
- return 0;
|
2019-10-10 19:20:38 +02:00
|
|
|
+ return virDomainStatsGetInterface(dom,params);
|
2018-02-09 17:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-#undef QEMU_ADD_NET_PARAM
|
|
|
|
|
2019-10-10 19:20:38 +02:00
|
|
|
/* refresh information by opening images on the disk */
|
2018-02-09 17:35:42 +01:00
|
|
|
static int
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/util/vircgroup.c
|
Accepting request 583090 from home:jfehlig:branches:Virtualization
- Update to libvirt 4.1.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
72adaf2f-revert-qemu-monitor-error-report.patch,
71d56a39-nodedev-fix-parse-PCI-address.patch,
68eed56b-conf-smbios-oem-strings.patch,
76977061-qemu-smbios-oem-strings.patch,
0c710a37-libxl-resume-lock-on-mig-failure.patch,
759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch,
c2dc6698-fix-deadlock-obtaining-hostname.patch,
c391e07e-libxl-clock-settings.patch,
ef71caea-libxl-memalign.patch,
suse-apparmor-signal.patch
OBS-URL: https://build.opensuse.org/request/show/583090
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=674
2018-03-05 18:46:32 +01:00
|
|
|
===================================================================
|
2021-10-01 23:10:15 +02:00
|
|
|
--- libvirt-7.8.0.orig/src/util/vircgroup.c
|
|
|
|
+++ libvirt-7.8.0/src/util/vircgroup.c
|
2021-09-01 18:17:27 +02:00
|
|
|
@@ -3036,6 +3036,31 @@ virCgroupGetInode(virCgroup *cgroup)
|
|
|
|
return st.st_ino;
|
2018-02-09 17:35:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+int
|
2021-05-18 00:14:02 +02:00
|
|
|
+virCgroupGetStatsCpu(virCgroup *cgroup,
|
|
|
|
+ virTypedParamList *params)
|
2018-02-09 17:35:42 +01:00
|
|
|
+{
|
|
|
|
+ unsigned long long cpu_time = 0;
|
|
|
|
+ unsigned long long user_time = 0;
|
|
|
|
+ unsigned long long sys_time = 0;
|
|
|
|
+ int err = 0;
|
|
|
|
+
|
|
|
|
+ if (!cgroup)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ err = virCgroupGetCpuacctUsage(cgroup, &cpu_time);
|
2019-10-10 19:20:38 +02:00
|
|
|
+ if (!err && virTypedParamListAddULLong(params, cpu_time, "cpu.time") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ err = virCgroupGetCpuacctStat(cgroup, &user_time, &sys_time);
|
2019-10-10 19:20:38 +02:00
|
|
|
+ if (!err && virTypedParamListAddULLong(params, user_time, "cpu.user") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
+ return -1;
|
2019-10-10 19:20:38 +02:00
|
|
|
+ if (!err && virTypedParamListAddULLong(params, sys_time, "cpu.system") < 0)
|
2018-02-09 17:35:42 +01:00
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2018-10-03 22:24:42 +02:00
|
|
|
#else /* !__linux__ */
|
2018-02-09 17:35:42 +01:00
|
|
|
|
|
|
|
bool
|
2021-09-01 18:17:27 +02:00
|
|
|
@@ -3045,6 +3070,14 @@ virCgroupAvailable(void)
|
2018-02-09 17:35:42 +01:00
|
|
|
}
|
2018-10-03 22:24:42 +02:00
|
|
|
|
|
|
|
|
2018-02-09 17:35:42 +01:00
|
|
|
+int
|
2021-05-18 00:14:02 +02:00
|
|
|
+virCgroupGetStatsCpu(virCgroup *cgroup,
|
|
|
|
+ virTypedParamList *params)
|
2018-02-09 17:35:42 +01:00
|
|
|
+{
|
|
|
|
+ return 0;
|
|
|
|
+}
|
2018-10-03 22:24:42 +02:00
|
|
|
+
|
|
|
|
+
|
|
|
|
int
|
2019-11-06 16:48:56 +01:00
|
|
|
virCgroupNewPartition(const char *path G_GNUC_UNUSED,
|
|
|
|
bool create G_GNUC_UNUSED,
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/util/vircgroup.h
|
Accepting request 583090 from home:jfehlig:branches:Virtualization
- Update to libvirt 4.1.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
72adaf2f-revert-qemu-monitor-error-report.patch,
71d56a39-nodedev-fix-parse-PCI-address.patch,
68eed56b-conf-smbios-oem-strings.patch,
76977061-qemu-smbios-oem-strings.patch,
0c710a37-libxl-resume-lock-on-mig-failure.patch,
759b4d1b-virlog-determine-the-hostname-on-startup-CVE-2018-67.patch,
c2dc6698-fix-deadlock-obtaining-hostname.patch,
c391e07e-libxl-clock-settings.patch,
ef71caea-libxl-memalign.patch,
suse-apparmor-signal.patch
OBS-URL: https://build.opensuse.org/request/show/583090
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=674
2018-03-05 18:46:32 +01:00
|
|
|
===================================================================
|
2021-10-01 23:10:15 +02:00
|
|
|
--- libvirt-7.8.0.orig/src/util/vircgroup.h
|
|
|
|
+++ libvirt-7.8.0/src/util/vircgroup.h
|
2020-03-10 02:55:25 +01:00
|
|
|
@@ -23,6 +23,7 @@
|
|
|
|
|
2019-10-10 19:20:38 +02:00
|
|
|
#include "virbitmap.h"
|
|
|
|
#include "virenum.h"
|
|
|
|
+#include "virtypedparam.h"
|
|
|
|
|
|
|
|
struct _virCgroup;
|
|
|
|
typedef struct _virCgroup virCgroup;
|
2021-09-01 18:17:27 +02:00
|
|
|
@@ -284,4 +285,7 @@ int virCgroupHasEmptyTasks(virCgroup *cg
|
2018-02-09 17:35:42 +01:00
|
|
|
|
|
|
|
bool virCgroupControllerAvailable(int controller);
|
2021-09-01 18:17:27 +02:00
|
|
|
|
2021-05-18 00:14:02 +02:00
|
|
|
+int virCgroupGetStatsCpu(virCgroup *cgroup,
|
|
|
|
+ virTypedParamList *params);
|
2021-09-01 18:17:27 +02:00
|
|
|
+
|
|
|
|
int virCgroupGetInode(virCgroup *cgroup);
|
2021-10-01 23:10:15 +02:00
|
|
|
Index: libvirt-7.8.0/src/conf/meson.build
|
Accepting request 593871 from home:jfehlig:branches:Virtualization
- util: improvements in error handling
09877303-virSocketAddrParseInternal.patch,
412afdb8-intro-virSocketAddrParseAny.patch
bsc#1080957
- Update to libvirt 4.2.0
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Dropped patches:
6b3d716e-keycodemap-py3.patch,
33c6eb96-fix-libvirtd-reload-deadlock.patch,
464889ff-rpc-aquire-ref-dispatch.patch,
c6f1d519-rpc-simplify-dispatch.patch,
06e7ebb6-rpc-invoke-dispatch-unlocked.patch,
86cae503-rpc-fix-pre-exec.patch,
eefabb38-rpc-virtlockd-virtlogd-single-thread.patch,
fbf31e1a-CVE-2018-1064.patch,
fb327ac2-virtlockd-admin-socket.patch,
64370c4b-libxl-MigrateBegin.patch,
99486799-libxl-MigrateConfirm.patch,
f5eacf2a-libxl-MigratePerform.patch,
4e6fcdb6-libxl-libxlDomObjFromDomain-cleanup.patch,
fe51dbda-libxl-use-FindByRef.patch,
60b3fcd9-libxl-MigratePrepare.patch,
3c89868c-libxl-lock-after-ListRemove.patch,
13e81fc6-libxl-EndJob-on-error.patch,
594b8b99-libxl-DefineXMLFlags-API-pattern.patch,
c66e344e-libxl-dont-deref-NULL.patch,
83edaf44-libxl-dont-hardcode-sched-weight.patch,
apibuild-py3.patch
OBS-URL: https://build.opensuse.org/request/show/593871
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=683
2018-04-05 23:47:55 +02:00
|
|
|
===================================================================
|
2021-10-01 23:10:15 +02:00
|
|
|
--- libvirt-7.8.0.orig/src/conf/meson.build
|
|
|
|
+++ libvirt-7.8.0/src/conf/meson.build
|
2021-01-20 00:09:19 +01:00
|
|
|
@@ -15,6 +15,7 @@ domain_conf_sources = [
|
2020-09-03 00:47:08 +02:00
|
|
|
'domain_conf.c',
|
|
|
|
'domain_nwfilter.c',
|
2021-01-20 00:09:19 +01:00
|
|
|
'domain_validate.c',
|
2020-09-03 00:47:08 +02:00
|
|
|
+ 'domain_stats.c',
|
|
|
|
'moment_conf.c',
|
|
|
|
'numa_conf.c',
|
|
|
|
'snapshot_conf.c',
|