mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
vircgroup: introduce cgroup v1 backend files
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
1a2dbb5595
commit
1f221d610d
@ -674,6 +674,7 @@ libvirt_setuid_rpc_client_la_SOURCES = \
|
|||||||
util/virbuffer.c \
|
util/virbuffer.c \
|
||||||
util/vircgroup.c \
|
util/vircgroup.c \
|
||||||
util/vircgroupbackend.c \
|
util/vircgroupbackend.c \
|
||||||
|
util/vircgroupv1.c \
|
||||||
util/vircommand.c \
|
util/vircommand.c \
|
||||||
util/virconf.c \
|
util/virconf.c \
|
||||||
util/virdbus.c \
|
util/virdbus.c \
|
||||||
|
@ -1580,6 +1580,9 @@ virCgroupTerminateMachine;
|
|||||||
virCgroupBackendGetAll;
|
virCgroupBackendGetAll;
|
||||||
virCgroupBackendRegister;
|
virCgroupBackendRegister;
|
||||||
|
|
||||||
|
# util/vircgroupv1.h
|
||||||
|
virCgroupV1Register;
|
||||||
|
|
||||||
# util/virclosecallbacks.h
|
# util/virclosecallbacks.h
|
||||||
virCloseCallbacksGet;
|
virCloseCallbacksGet;
|
||||||
virCloseCallbacksGetConn;
|
virCloseCallbacksGetConn;
|
||||||
|
@ -25,6 +25,8 @@ UTIL_SOURCES = \
|
|||||||
util/vircgroup.h util/vircgrouppriv.h \
|
util/vircgroup.h util/vircgrouppriv.h \
|
||||||
util/vircgroupbackend.c \
|
util/vircgroupbackend.c \
|
||||||
util/vircgroupbackend.h \
|
util/vircgroupbackend.h \
|
||||||
|
util/vircgroupv1.c \
|
||||||
|
util/vircgroupv1.h \
|
||||||
util/virclosecallbacks.c \
|
util/virclosecallbacks.c \
|
||||||
util/virclosecallbacks.h \
|
util/virclosecallbacks.h \
|
||||||
util/vircommand.c \
|
util/vircommand.c \
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "vircgroupbackend.h"
|
#include "vircgroupbackend.h"
|
||||||
|
#include "vircgroupv1.h"
|
||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
#include "virthread.h"
|
#include "virthread.h"
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ virCgroupBackendRegister(virCgroupBackendPtr backend)
|
|||||||
static void
|
static void
|
||||||
virCgroupBackendOnceInit(void)
|
virCgroupBackendOnceInit(void)
|
||||||
{
|
{
|
||||||
|
virCgroupV1Register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
55
src/util/vircgroupv1.c
Normal file
55
src/util/vircgroupv1.c
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* vircgroupv1.c: methods for cgroups v1 backend
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2015,2018 Red Hat, Inc.
|
||||||
|
* Copyright IBM Corp. 2008
|
||||||
|
*
|
||||||
|
* 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 "internal.h"
|
||||||
|
|
||||||
|
#define __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__
|
||||||
|
#include "vircgrouppriv.h"
|
||||||
|
#undef __VIR_CGROUP_ALLOW_INCLUDE_PRIV_H__
|
||||||
|
|
||||||
|
#include "vircgroup.h"
|
||||||
|
#include "vircgroupbackend.h"
|
||||||
|
#include "vircgroupv1.h"
|
||||||
|
#include "virlog.h"
|
||||||
|
|
||||||
|
VIR_LOG_INIT("util.cgroup");
|
||||||
|
|
||||||
|
#define VIR_FROM_THIS VIR_FROM_CGROUP
|
||||||
|
|
||||||
|
|
||||||
|
VIR_ENUM_DECL(virCgroupV1Controller);
|
||||||
|
VIR_ENUM_IMPL(virCgroupV1Controller, VIR_CGROUP_CONTROLLER_LAST,
|
||||||
|
"cpu", "cpuacct", "cpuset", "memory", "devices",
|
||||||
|
"freezer", "blkio", "net_cls", "perf_event",
|
||||||
|
"name=systemd");
|
||||||
|
|
||||||
|
|
||||||
|
virCgroupBackend virCgroupV1Backend = {
|
||||||
|
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
virCgroupV1Register(void)
|
||||||
|
{
|
||||||
|
virCgroupBackendRegister(&virCgroupV1Backend);
|
||||||
|
}
|
27
src/util/vircgroupv1.h
Normal file
27
src/util/vircgroupv1.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* vircgroupv1.h: methods for cgroups v1 backend
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* 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 __VIR_CGROUP_V1_H__
|
||||||
|
# define __VIR_CGROUP_V1_H__
|
||||||
|
|
||||||
|
void
|
||||||
|
virCgroupV1Register(void);
|
||||||
|
|
||||||
|
#endif /* __VIR_CGROUP_V1_H__ */
|
Loading…
Reference in New Issue
Block a user