2010-12-16 16:10:54 +00:00
|
|
|
/*
|
|
|
|
* qemu_cgroup.h: QEMU cgroup management
|
|
|
|
*
|
2014-07-08 09:59:49 +02:00
|
|
|
* Copyright (C) 2006-2007, 2009-2014 Red Hat, Inc.
|
2010-12-16 16:10:54 +00:00
|
|
|
* Copyright (C) 2006 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* 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
|
2012-09-20 16:30:55 -06:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 18:06:23 +08:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-12-16 16:10:54 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-18 11:12:37 -05:00
|
|
|
#pragma once
|
2010-12-16 16:10:54 +00:00
|
|
|
|
2019-06-18 11:12:37 -05:00
|
|
|
#include "virusb.h"
|
|
|
|
#include "vircgroup.h"
|
|
|
|
#include "domain_conf.h"
|
|
|
|
#include "qemu_conf.h"
|
2010-12-16 16:10:54 +00:00
|
|
|
|
2016-02-15 16:15:58 +01:00
|
|
|
int qemuSetupImageCgroup(virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src);
|
|
|
|
int qemuTeardownImageCgroup(virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src);
|
2019-01-16 15:49:07 +01:00
|
|
|
int qemuSetupImageChainCgroup(virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src);
|
|
|
|
int qemuTeardownImageChainCgroup(virDomainObjPtr vm,
|
|
|
|
virStorageSourcePtr src);
|
2017-11-21 13:33:07 +01:00
|
|
|
int qemuSetupInputCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainInputDefPtr dev);
|
|
|
|
int qemuTeardownInputCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainInputDefPtr dev);
|
2015-11-19 14:35:46 +01:00
|
|
|
int qemuSetupHostdevCgroup(virDomainObjPtr vm,
|
2013-04-29 13:15:26 -04:00
|
|
|
virDomainHostdevDefPtr dev)
|
2019-10-14 14:25:14 +02:00
|
|
|
G_GNUC_WARN_UNUSED_RESULT;
|
2013-04-29 13:15:26 -04:00
|
|
|
int qemuTeardownHostdevCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainHostdevDefPtr dev)
|
2019-10-14 14:25:14 +02:00
|
|
|
G_GNUC_WARN_UNUSED_RESULT;
|
2017-02-22 16:33:12 +01:00
|
|
|
int qemuSetupMemoryDevicesCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainMemoryDefPtr mem);
|
|
|
|
int qemuTeardownMemoryDevicesCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainMemoryDefPtr mem);
|
2016-11-18 11:17:51 +01:00
|
|
|
int qemuSetupRNGCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainRNGDefPtr rng);
|
|
|
|
int qemuTeardownRNGCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainRNGDefPtr rng);
|
2016-11-18 11:45:44 +01:00
|
|
|
int qemuSetupChardevCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainChrDefPtr dev);
|
|
|
|
int qemuTeardownChardevCgroup(virDomainObjPtr vm,
|
|
|
|
virDomainChrDefPtr dev);
|
2017-07-25 17:49:43 +02:00
|
|
|
int qemuConnectCgroup(virDomainObjPtr vm);
|
|
|
|
int qemuSetupCgroup(virDomainObjPtr vm,
|
2015-01-16 11:25:50 +00:00
|
|
|
size_t nnicindexes,
|
|
|
|
int *nicindexes);
|
2011-07-21 10:10:31 +08:00
|
|
|
int qemuSetupCgroupVcpuBW(virCgroupPtr cgroup,
|
|
|
|
unsigned long long period,
|
|
|
|
long long quota);
|
2015-03-27 13:28:59 +01:00
|
|
|
int qemuSetupCgroupCpusetCpus(virCgroupPtr cgroup, virBitmapPtr cpumask);
|
2016-02-16 16:43:37 +03:00
|
|
|
int qemuSetupGlobalCpuCgroup(virDomainObjPtr vm);
|
2018-04-05 15:06:55 -04:00
|
|
|
int qemuSetupCgroupForExtDevices(virDomainObjPtr vm,
|
|
|
|
virQEMUDriverPtr driver);
|
2016-02-01 16:50:54 +01:00
|
|
|
int qemuRemoveCgroup(virDomainObjPtr vm);
|
2010-12-16 16:10:54 +00:00
|
|
|
|
2016-09-07 13:11:59 +02:00
|
|
|
typedef struct _qemuCgroupEmulatorAllNodesData qemuCgroupEmulatorAllNodesData;
|
|
|
|
typedef qemuCgroupEmulatorAllNodesData *qemuCgroupEmulatorAllNodesDataPtr;
|
|
|
|
struct _qemuCgroupEmulatorAllNodesData {
|
|
|
|
virCgroupPtr emulatorCgroup;
|
|
|
|
char *emulatorMemMask;
|
|
|
|
};
|
|
|
|
|
|
|
|
int qemuCgroupEmulatorAllNodesAllow(virCgroupPtr cgroup,
|
|
|
|
qemuCgroupEmulatorAllNodesDataPtr *data);
|
2016-09-13 12:24:02 +02:00
|
|
|
void qemuCgroupEmulatorAllNodesRestore(qemuCgroupEmulatorAllNodesDataPtr data);
|
2016-09-07 13:11:59 +02:00
|
|
|
|
2016-11-15 11:28:51 +01:00
|
|
|
extern const char *const defaultDeviceACL[];
|