2008-02-27 04:35:08 +00:00
|
|
|
/*
|
|
|
|
* capabilities.h: hypervisor capabilities
|
|
|
|
*
|
2019-03-15 00:44:34 +00:00
|
|
|
* Copyright (C) 2006-2019 Red Hat, Inc.
|
2008-02-27 04:35:08 +00:00
|
|
|
* Copyright (C) 2006-2008 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 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2008-02-27 04:35:08 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#pragma once
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virconftypes.h"
|
|
|
|
#include "virbuffer.h"
|
|
|
|
#include "cpu_conf.h"
|
|
|
|
#include "virarch.h"
|
|
|
|
#include "virmacaddr.h"
|
|
|
|
#include "virobject.h"
|
|
|
|
#include "virresctrl.h"
|
2009-11-26 17:57:00 +00:00
|
|
|
|
2019-06-07 20:20:21 +00:00
|
|
|
#include <libxml/xpath.h>
|
2008-10-24 11:20:08 +00:00
|
|
|
|
2019-10-23 15:04:20 +00:00
|
|
|
typedef enum {
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_PAE = 0,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_NONPAE,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_IA64_BE,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_ACPI,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_APIC,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_CPUSELECTION,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_DEVICEBOOT,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_DISKSNAPSHOT,
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_HAP,
|
|
|
|
|
|
|
|
VIR_CAPS_GUEST_FEATURE_TYPE_LAST
|
|
|
|
} virCapsGuestFeatureType;
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
struct _virCapsGuestFeature {
|
2019-10-23 15:04:20 +00:00
|
|
|
bool present;
|
|
|
|
virTristateSwitch defaultOn;
|
|
|
|
virTristateBool toggle;
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
2009-07-23 17:31:34 +00:00
|
|
|
struct _virCapsGuestMachine {
|
|
|
|
char *name;
|
|
|
|
char *canonical;
|
2013-06-26 15:46:35 +00:00
|
|
|
unsigned int maxCpus;
|
2009-07-23 17:31:34 +00:00
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
struct _virCapsGuestDomainInfo {
|
|
|
|
char *emulator;
|
|
|
|
char *loader;
|
|
|
|
int nmachines;
|
2009-07-23 17:31:34 +00:00
|
|
|
virCapsGuestMachinePtr *machines;
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _virCapsGuestDomain {
|
2015-09-17 08:46:55 +00:00
|
|
|
int type; /* virDomainVirtType */
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestDomainInfo info;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _virCapsGuestArch {
|
2012-12-10 22:28:09 +00:00
|
|
|
virArch id;
|
|
|
|
unsigned int wordsize;
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestDomainInfo defaultInfo;
|
2010-08-17 21:41:51 +00:00
|
|
|
size_t ndomains;
|
|
|
|
size_t ndomains_max;
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestDomainPtr *domains;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _virCapsGuest {
|
2015-04-16 23:18:32 +00:00
|
|
|
int ostype;
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestArch arch;
|
2019-10-23 15:04:20 +00:00
|
|
|
virCapsGuestFeature features[VIR_CAPS_GUEST_FEATURE_TYPE_LAST];
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
2013-01-22 17:42:08 +00:00
|
|
|
struct _virCapsHostNUMACellCPU {
|
|
|
|
unsigned int id;
|
|
|
|
unsigned int socket_id;
|
|
|
|
unsigned int core_id;
|
|
|
|
virBitmapPtr siblings;
|
|
|
|
};
|
|
|
|
|
2014-06-03 13:18:27 +00:00
|
|
|
struct _virCapsHostNUMACellSiblingInfo {
|
|
|
|
int node; /* foreign NUMA node */
|
|
|
|
unsigned int distance; /* distance to the node */
|
|
|
|
};
|
|
|
|
|
2014-06-06 16:12:51 +00:00
|
|
|
struct _virCapsHostNUMACellPageInfo {
|
|
|
|
unsigned int size; /* page size in kibibytes */
|
2018-04-23 14:36:53 +00:00
|
|
|
unsigned long long avail; /* the size of pool */
|
2014-06-06 16:12:51 +00:00
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
struct _virCapsHostNUMACell {
|
|
|
|
int num;
|
|
|
|
int ncpus;
|
2013-03-07 16:03:36 +00:00
|
|
|
unsigned long long mem; /* in kibibytes */
|
2013-01-22 17:42:08 +00:00
|
|
|
virCapsHostNUMACellCPUPtr cpus;
|
2014-06-03 13:18:27 +00:00
|
|
|
int nsiblings;
|
|
|
|
virCapsHostNUMACellSiblingInfoPtr siblings;
|
2014-06-06 16:12:51 +00:00
|
|
|
int npageinfo;
|
|
|
|
virCapsHostNUMACellPageInfoPtr pageinfo;
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
2019-11-29 09:55:59 +00:00
|
|
|
struct _virCapsHostNUMA {
|
|
|
|
gint refs;
|
|
|
|
GPtrArray *cells;
|
|
|
|
};
|
|
|
|
|
2013-10-18 12:13:21 +00:00
|
|
|
struct _virCapsHostSecModelLabel {
|
|
|
|
char *type;
|
|
|
|
char *label;
|
|
|
|
};
|
|
|
|
|
2009-03-03 09:44:41 +00:00
|
|
|
struct _virCapsHostSecModel {
|
|
|
|
char *model;
|
|
|
|
char *doi;
|
2013-10-18 12:13:21 +00:00
|
|
|
size_t nlabels;
|
|
|
|
virCapsHostSecModelLabelPtr labels;
|
2009-03-03 09:44:41 +00:00
|
|
|
};
|
|
|
|
|
2017-03-30 13:01:27 +00:00
|
|
|
struct _virCapsHostCacheBank {
|
|
|
|
unsigned int id;
|
|
|
|
unsigned int level; /* 1=L1, 2=L2, 3=L3, etc. */
|
|
|
|
unsigned long long size; /* B */
|
|
|
|
virCacheType type; /* Data, Instruction or Unified */
|
|
|
|
virBitmapPtr cpus; /* All CPUs that share this bank */
|
2017-05-17 09:08:33 +00:00
|
|
|
size_t ncontrols;
|
2017-11-20 09:23:04 +00:00
|
|
|
virResctrlInfoPerCachePtr *controls;
|
2017-03-30 13:01:27 +00:00
|
|
|
};
|
|
|
|
|
2018-09-20 10:10:48 +00:00
|
|
|
struct _virCapsHostCache {
|
|
|
|
size_t nbanks;
|
|
|
|
virCapsHostCacheBankPtr *banks;
|
2018-09-20 10:10:50 +00:00
|
|
|
|
|
|
|
virResctrlInfoMonPtr monitor;
|
2018-09-20 10:10:48 +00:00
|
|
|
};
|
|
|
|
|
2018-07-30 03:12:41 +00:00
|
|
|
struct _virCapsHostMemBWNode {
|
|
|
|
unsigned int id;
|
|
|
|
virBitmapPtr cpus; /* All CPUs that belong to this node*/
|
|
|
|
virResctrlInfoMemBWPerNode control;
|
|
|
|
};
|
|
|
|
|
2018-09-20 10:10:49 +00:00
|
|
|
struct _virCapsHostMemBW {
|
|
|
|
size_t nnodes;
|
|
|
|
virCapsHostMemBWNodePtr *nodes;
|
2018-09-20 10:10:50 +00:00
|
|
|
|
|
|
|
virResctrlInfoMonPtr monitor;
|
2018-09-20 10:10:49 +00:00
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
struct _virCapsHost {
|
2012-12-10 22:28:09 +00:00
|
|
|
virArch arch;
|
2010-08-17 21:41:51 +00:00
|
|
|
size_t nfeatures;
|
|
|
|
size_t nfeatures_max;
|
2008-02-27 04:35:08 +00:00
|
|
|
char **features;
|
2011-11-22 03:31:22 +00:00
|
|
|
unsigned int powerMgmt; /* Bitmask of the PM capabilities.
|
|
|
|
* See enum virHostPMCapability.
|
|
|
|
*/
|
2014-07-14 12:56:13 +00:00
|
|
|
bool offlineMigrate;
|
|
|
|
bool liveMigrate;
|
2010-08-17 21:41:51 +00:00
|
|
|
size_t nmigrateTrans;
|
|
|
|
size_t nmigrateTrans_max;
|
2008-02-27 04:35:08 +00:00
|
|
|
char **migrateTrans;
|
2019-11-29 09:55:59 +00:00
|
|
|
|
|
|
|
virCapsHostNUMAPtr numa;
|
2012-08-15 22:10:35 +00:00
|
|
|
|
2017-11-20 12:43:30 +00:00
|
|
|
virResctrlInfoPtr resctrl;
|
|
|
|
|
2018-09-20 10:10:48 +00:00
|
|
|
virCapsHostCache cache;
|
2017-03-30 13:01:27 +00:00
|
|
|
|
2018-09-20 10:10:49 +00:00
|
|
|
virCapsHostMemBW memBW;
|
2018-07-30 03:12:41 +00:00
|
|
|
|
2012-08-15 22:10:35 +00:00
|
|
|
size_t nsecModels;
|
|
|
|
virCapsHostSecModelPtr secModels;
|
|
|
|
|
2016-02-03 21:40:33 +00:00
|
|
|
char *netprefix;
|
2009-12-18 13:44:55 +00:00
|
|
|
virCPUDefPtr cpu;
|
2014-06-06 16:12:51 +00:00
|
|
|
int nPagesSize; /* size of pagesSize array */
|
|
|
|
unsigned int *pagesSize; /* page sizes support on the system */
|
2010-05-25 14:33:51 +00:00
|
|
|
unsigned char host_uuid[VIR_UUID_BUFLEN];
|
2018-06-01 08:15:59 +00:00
|
|
|
bool iommu;
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
2019-01-10 12:19:35 +00:00
|
|
|
struct _virCapsStoragePool {
|
|
|
|
int type;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
struct _virCaps {
|
2013-02-01 12:26:18 +00:00
|
|
|
virObject parent;
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsHost host;
|
2010-08-17 21:41:51 +00:00
|
|
|
size_t nguests;
|
|
|
|
size_t nguests_max;
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestPtr *guests;
|
2019-01-10 12:19:35 +00:00
|
|
|
|
|
|
|
size_t npools;
|
|
|
|
size_t npools_max;
|
|
|
|
virCapsStoragePoolPtr *pools;
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
2019-10-04 16:14:10 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCaps, virObjectUnref);
|
|
|
|
|
|
|
|
|
2015-04-17 16:38:55 +00:00
|
|
|
struct _virCapsDomainData {
|
|
|
|
int ostype;
|
|
|
|
int arch;
|
2015-09-17 08:46:55 +00:00
|
|
|
int domaintype; /* virDomainVirtType */
|
2015-04-17 16:38:55 +00:00
|
|
|
const char *emulator;
|
|
|
|
const char *machinetype;
|
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
virCapsPtr
|
2012-12-10 22:28:09 +00:00
|
|
|
virCapabilitiesNew(virArch hostarch,
|
2014-07-14 12:56:13 +00:00
|
|
|
bool offlineMigrate,
|
|
|
|
bool liveMigrate);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
void
|
2019-11-29 09:55:59 +00:00
|
|
|
virCapabilitiesHostNUMAUnref(virCapsHostNUMAPtr caps);
|
|
|
|
void
|
|
|
|
virCapabilitiesHostNUMARef(virCapsHostNUMAPtr caps);
|
|
|
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCapsHostNUMA, virCapabilitiesHostNUMAUnref);
|
2009-06-29 10:41:56 +00:00
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
int
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesAddHostFeature(virCapsPtr caps,
|
|
|
|
const char *name);
|
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
int
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesAddHostMigrateTransport(virCapsPtr caps,
|
|
|
|
const char *name);
|
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
int
|
2016-02-03 21:40:33 +00:00
|
|
|
virCapabilitiesSetNetPrefix(virCapsPtr caps,
|
|
|
|
const char *prefix);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2019-11-29 09:55:59 +00:00
|
|
|
void
|
|
|
|
virCapabilitiesHostNUMAAddCell(virCapsHostNUMAPtr caps,
|
2008-02-27 04:35:08 +00:00
|
|
|
int num,
|
2013-03-07 16:03:36 +00:00
|
|
|
unsigned long long mem,
|
2014-06-03 13:18:27 +00:00
|
|
|
int ncpus,
|
|
|
|
virCapsHostNUMACellCPUPtr cpus,
|
|
|
|
int nsiblings,
|
2014-06-06 16:12:51 +00:00
|
|
|
virCapsHostNUMACellSiblingInfoPtr siblings,
|
|
|
|
int npageinfo,
|
|
|
|
virCapsHostNUMACellPageInfoPtr pageinfo);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
int
|
2009-12-18 13:44:55 +00:00
|
|
|
virCapabilitiesSetHostCPU(virCapsPtr caps,
|
|
|
|
virCPUDefPtr cpu);
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
virCapsGuestMachinePtr *
|
2009-07-23 17:31:34 +00:00
|
|
|
virCapabilitiesAllocMachines(const char *const *names,
|
|
|
|
int nnames);
|
2016-05-10 11:37:32 +00:00
|
|
|
void
|
2009-07-23 17:31:34 +00:00
|
|
|
virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
|
|
|
|
int nmachines);
|
|
|
|
|
2017-03-15 12:01:13 +00:00
|
|
|
void
|
|
|
|
virCapabilitiesFreeGuest(virCapsGuestPtr guest);
|
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
virCapsGuestPtr
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesAddGuest(virCapsPtr caps,
|
2015-04-17 22:09:16 +00:00
|
|
|
int ostype,
|
2012-12-10 22:28:09 +00:00
|
|
|
virArch arch,
|
2008-02-27 04:35:08 +00:00
|
|
|
const char *emulator,
|
|
|
|
const char *loader,
|
|
|
|
int nmachines,
|
2009-07-23 17:31:34 +00:00
|
|
|
virCapsGuestMachinePtr *machines);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
virCapsGuestDomainPtr
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
|
2015-04-17 22:38:10 +00:00
|
|
|
int hvtype,
|
2008-02-27 04:35:08 +00:00
|
|
|
const char *emulator,
|
|
|
|
const char *loader,
|
|
|
|
int nmachines,
|
2009-07-23 17:31:34 +00:00
|
|
|
virCapsGuestMachinePtr *machines);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2019-11-12 12:57:23 +00:00
|
|
|
void
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesAddGuestFeature(virCapsGuestPtr guest,
|
2019-11-12 12:57:23 +00:00
|
|
|
virCapsGuestFeatureType feature);
|
|
|
|
void
|
|
|
|
virCapabilitiesAddGuestFeatureWithToggle(virCapsGuestPtr guest,
|
|
|
|
virCapsGuestFeatureType feature,
|
|
|
|
bool defaultOn,
|
|
|
|
bool toggle);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2019-01-10 12:19:35 +00:00
|
|
|
int
|
|
|
|
virCapabilitiesAddStoragePool(virCapsPtr caps,
|
|
|
|
int poolType);
|
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
int
|
2013-10-18 12:13:21 +00:00
|
|
|
virCapabilitiesHostSecModelAddBaseLabel(virCapsHostSecModelPtr secmodel,
|
|
|
|
const char *type,
|
|
|
|
const char *label);
|
|
|
|
|
2015-04-17 16:38:55 +00:00
|
|
|
virCapsDomainDataPtr
|
|
|
|
virCapabilitiesDomainDataLookup(virCapsPtr caps,
|
|
|
|
int ostype,
|
|
|
|
virArch arch,
|
|
|
|
int domaintype,
|
|
|
|
const char *emulator,
|
|
|
|
const char *machinetype);
|
|
|
|
|
2019-11-26 16:09:33 +00:00
|
|
|
bool
|
|
|
|
virCapabilitiesDomainSupported(virCapsPtr caps,
|
|
|
|
int ostype,
|
|
|
|
virArch arch,
|
|
|
|
int domaintype);
|
|
|
|
|
|
|
|
|
2013-01-22 17:42:08 +00:00
|
|
|
void
|
|
|
|
virCapabilitiesClearHostNUMACellCPUTopology(virCapsHostNUMACellCPUPtr cpu,
|
|
|
|
size_t ncpus);
|
2009-01-30 17:12:28 +00:00
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
char *
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesFormatXML(virCapsPtr caps);
|
|
|
|
|
2019-11-29 09:55:59 +00:00
|
|
|
virBitmapPtr virCapabilitiesHostNUMAGetCpus(virCapsHostNUMAPtr caps,
|
|
|
|
virBitmapPtr nodemask);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2017-03-07 09:40:15 +00:00
|
|
|
int virCapabilitiesGetNodeInfo(virNodeInfoPtr nodeinfo);
|
|
|
|
|
2017-03-11 15:32:13 +00:00
|
|
|
int virCapabilitiesInitPages(virCapsPtr caps);
|
|
|
|
|
2019-11-29 09:55:59 +00:00
|
|
|
virCapsHostNUMAPtr virCapabilitiesHostNUMANew(void);
|
|
|
|
virCapsHostNUMAPtr virCapabilitiesHostNUMANewHost(void);
|
2017-03-07 09:40:15 +00:00
|
|
|
|
2017-03-30 13:01:27 +00:00
|
|
|
bool virCapsHostCacheBankEquals(virCapsHostCacheBankPtr a,
|
|
|
|
virCapsHostCacheBankPtr b);
|
|
|
|
void virCapsHostCacheBankFree(virCapsHostCacheBankPtr ptr);
|
|
|
|
|
|
|
|
int virCapabilitiesInitCaches(virCapsPtr caps);
|
|
|
|
|
2018-06-01 08:15:59 +00:00
|
|
|
void virCapabilitiesHostInitIOMMU(virCapsPtr caps);
|