|
Pablo Greco |
40546a |
From d1b618c627d848ed4549912d83be397f969935d2 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <d1b618c627d848ed4549912d83be397f969935d2@dist-git>
|
|
Pablo Greco |
40546a |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Mon, 1 Jul 2019 17:06:22 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] vircgroup: introduce cgroup v1 backend files
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 1f221d610dc510b82f17407a81a0acd56d9efc5b)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <d49ee905c005a855d89ed463e81aa935b07f003e.1561993100.git.phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
src/Makefile.am | 1 +
|
|
Pablo Greco |
40546a |
src/libvirt_private.syms | 3 ++
|
|
Pablo Greco |
40546a |
src/util/Makefile.inc.am | 2 ++
|
|
Pablo Greco |
40546a |
src/util/vircgroupbackend.c | 2 ++
|
|
Pablo Greco |
40546a |
src/util/vircgroupv1.c | 55 +++++++++++++++++++++++++++++++++++++
|
|
Pablo Greco |
40546a |
src/util/vircgroupv1.h | 27 ++++++++++++++++++
|
|
Pablo Greco |
40546a |
6 files changed, 90 insertions(+)
|
|
Pablo Greco |
40546a |
create mode 100644 src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
create mode 100644 src/util/vircgroupv1.h
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
Pablo Greco |
40546a |
index c4e797f5a2..0def0a3b19 100644
|
|
Pablo Greco |
40546a |
--- a/src/Makefile.am
|
|
Pablo Greco |
40546a |
+++ b/src/Makefile.am
|
|
Pablo Greco |
40546a |
@@ -679,6 +679,7 @@ libvirt_setuid_rpc_client_la_SOURCES = \
|
|
Pablo Greco |
40546a |
util/virbuffer.c \
|
|
Pablo Greco |
40546a |
util/vircgroup.c \
|
|
Pablo Greco |
40546a |
util/vircgroupbackend.c \
|
|
Pablo Greco |
40546a |
+ util/vircgroupv1.c \
|
|
Pablo Greco |
40546a |
util/vircommand.c \
|
|
Pablo Greco |
40546a |
util/virconf.c \
|
|
Pablo Greco |
40546a |
util/virdbus.c \
|
|
Pablo Greco |
40546a |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
Pablo Greco |
40546a |
index 627eb5e587..b144955154 100644
|
|
Pablo Greco |
40546a |
--- a/src/libvirt_private.syms
|
|
Pablo Greco |
40546a |
+++ b/src/libvirt_private.syms
|
|
Pablo Greco |
40546a |
@@ -1595,6 +1595,9 @@ virCgroupTerminateMachine;
|
|
Pablo Greco |
40546a |
virCgroupBackendGetAll;
|
|
Pablo Greco |
40546a |
virCgroupBackendRegister;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
+# util/vircgroupv1.h
|
|
Pablo Greco |
40546a |
+virCgroupV1Register;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
# util/virclosecallbacks.h
|
|
Pablo Greco |
40546a |
virCloseCallbacksGet;
|
|
Pablo Greco |
40546a |
virCloseCallbacksGetConn;
|
|
Pablo Greco |
40546a |
diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
|
|
Pablo Greco |
40546a |
index a9185bd7b7..725ece98e9 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/Makefile.inc.am
|
|
Pablo Greco |
40546a |
+++ b/src/util/Makefile.inc.am
|
|
Pablo Greco |
40546a |
@@ -25,6 +25,8 @@ UTIL_SOURCES = \
|
|
Pablo Greco |
40546a |
util/vircgroup.h util/vircgrouppriv.h \
|
|
Pablo Greco |
40546a |
util/vircgroupbackend.c \
|
|
Pablo Greco |
40546a |
util/vircgroupbackend.h \
|
|
Pablo Greco |
40546a |
+ util/vircgroupv1.c \
|
|
Pablo Greco |
40546a |
+ util/vircgroupv1.h \
|
|
Pablo Greco |
40546a |
util/virclosecallbacks.c \
|
|
Pablo Greco |
40546a |
util/virclosecallbacks.h \
|
|
Pablo Greco |
40546a |
util/vircommand.c \
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupbackend.c b/src/util/vircgroupbackend.c
|
|
Pablo Greco |
40546a |
index e014bfc0e6..d854c9711d 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroupbackend.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupbackend.c
|
|
Pablo Greco |
40546a |
@@ -20,6 +20,7 @@
|
|
Pablo Greco |
40546a |
#include <config.h>
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
#include "vircgroupbackend.h"
|
|
Pablo Greco |
40546a |
+#include "vircgroupv1.h"
|
|
Pablo Greco |
40546a |
#include "virerror.h"
|
|
Pablo Greco |
40546a |
#include "virthread.h"
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -49,6 +50,7 @@ virCgroupBackendRegister(virCgroupBackendPtr backend)
|
|
Pablo Greco |
40546a |
static void
|
|
Pablo Greco |
40546a |
virCgroupBackendOnceInit(void)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
+ virCgroupV1Register();
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..4dda7865f1
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupv1.c
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,55 @@
|
|
Pablo Greco |
40546a |
+/*
|
|
Pablo Greco |
40546a |
+ * vircgroupv1.c: methods for cgroups v1 backend
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * Copyright (C) 2010-2015,2018 Red Hat, Inc.
|
|
Pablo Greco |
40546a |
+ * Copyright IBM Corp. 2008
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * This library is free software; you can redistribute it and/or
|
|
Pablo Greco |
40546a |
+ * modify it under the terms of the GNU Lesser General Public
|
|
Pablo Greco |
40546a |
+ * License as published by the Free Software Foundation; either
|
|
Pablo Greco |
40546a |
+ * version 2.1 of the License, or (at your option) any later version.
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * This library is distributed in the hope that it will be useful,
|
|
Pablo Greco |
40546a |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Pablo Greco |
40546a |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Pablo Greco |
40546a |
+ * Lesser General Public License for more details.
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * You should have received a copy of the GNU Lesser General Public
|
|
Pablo Greco |
40546a |
+ * License along with this library. If not, see
|
|
Pablo Greco |
40546a |
+ * <http://www.gnu.org/licenses/>.
|
|
Pablo Greco |
40546a |
+ */
|
|
Pablo Greco |
40546a |
+#include <config.h>
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+#include "internal.h"
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+#define __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__
|
|
Pablo Greco |
40546a |
+#include "vircgrouppriv.h"
|
|
Pablo Greco |
40546a |
+#undef __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+#include "vircgroup.h"
|
|
Pablo Greco |
40546a |
+#include "vircgroupbackend.h"
|
|
Pablo Greco |
40546a |
+#include "vircgroupv1.h"
|
|
Pablo Greco |
40546a |
+#include "virlog.h"
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+VIR_LOG_INIT("util.cgroup");
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+#define VIR_FROM_THIS VIR_FROM_CGROUP
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+VIR_ENUM_DECL(virCgroupV1Controller);
|
|
Pablo Greco |
40546a |
+VIR_ENUM_IMPL(virCgroupV1Controller, VIR_CGROUP_CONTROLLER_LAST,
|
|
Pablo Greco |
40546a |
+ "cpu", "cpuacct", "cpuset", "memory", "devices",
|
|
Pablo Greco |
40546a |
+ "freezer", "blkio", "net_cls", "perf_event",
|
|
Pablo Greco |
40546a |
+ "name=systemd");
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+virCgroupBackend virCgroupV1Backend = {
|
|
Pablo Greco |
40546a |
+ .type = VIR_CGROUP_BACKEND_TYPE_V1,
|
|
Pablo Greco |
40546a |
+};
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+void
|
|
Pablo Greco |
40546a |
+virCgroupV1Register(void)
|
|
Pablo Greco |
40546a |
+{
|
|
Pablo Greco |
40546a |
+ virCgroupBackendRegister(&virCgroupV1Backend);
|
|
Pablo Greco |
40546a |
+}
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroupv1.h b/src/util/vircgroupv1.h
|
|
Pablo Greco |
40546a |
new file mode 100644
|
|
Pablo Greco |
40546a |
index 0000000000..517517c109
|
|
Pablo Greco |
40546a |
--- /dev/null
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroupv1.h
|
|
Pablo Greco |
40546a |
@@ -0,0 +1,27 @@
|
|
Pablo Greco |
40546a |
+/*
|
|
Pablo Greco |
40546a |
+ * vircgroupv1.h: methods for cgroups v1 backend
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * Copyright (C) 2018 Red Hat, Inc.
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * This library is free software; you can redistribute it and/or
|
|
Pablo Greco |
40546a |
+ * modify it under the terms of the GNU Lesser General Public
|
|
Pablo Greco |
40546a |
+ * License as published by the Free Software Foundation; either
|
|
Pablo Greco |
40546a |
+ * version 2.1 of the License, or (at your option) any later version.
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * This library is distributed in the hope that it will be useful,
|
|
Pablo Greco |
40546a |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Pablo Greco |
40546a |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Pablo Greco |
40546a |
+ * Lesser General Public License for more details.
|
|
Pablo Greco |
40546a |
+ *
|
|
Pablo Greco |
40546a |
+ * You should have received a copy of the GNU Lesser General Public
|
|
Pablo Greco |
40546a |
+ * License along with this library. If not, see
|
|
Pablo Greco |
40546a |
+ * <http://www.gnu.org/licenses/>.
|
|
Pablo Greco |
40546a |
+ */
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+#ifndef __VIR_CGROUP_V1_H__
|
|
Pablo Greco |
40546a |
+# define __VIR_CGROUP_V1_H__
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+void
|
|
Pablo Greco |
40546a |
+virCgroupV1Register(void);
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+#endif /* __VIR_CGROUP_V1_H__ */
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|