2008-02-27 04:35:08 +00:00
|
|
|
/*
|
|
|
|
* capabilities.h: hypervisor capabilities
|
|
|
|
*
|
2015-09-17 08:46:55 +00:00
|
|
|
* Copyright (C) 2006-2015 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
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_CAPABILITIES_H
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __VIR_CAPABILITIES_H
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
2012-12-04 12:04:07 +00:00
|
|
|
# include "virbuffer.h"
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "cpu_conf.h"
|
2012-12-10 22:28:09 +00:00
|
|
|
# include "virarch.h"
|
2012-01-27 17:23:05 +00:00
|
|
|
# include "virmacaddr.h"
|
2013-02-01 12:26:18 +00:00
|
|
|
# include "virobject.h"
|
2009-11-26 17:57:00 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include <libxml/xpath.h>
|
2008-10-24 11:20:08 +00:00
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
typedef struct _virCapsGuestFeature virCapsGuestFeature;
|
|
|
|
typedef virCapsGuestFeature *virCapsGuestFeaturePtr;
|
|
|
|
struct _virCapsGuestFeature {
|
|
|
|
char *name;
|
2014-07-14 12:56:13 +00:00
|
|
|
bool defaultOn;
|
|
|
|
bool toggle;
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
2009-07-23 17:31:34 +00:00
|
|
|
typedef struct _virCapsGuestMachine virCapsGuestMachine;
|
|
|
|
typedef virCapsGuestMachine *virCapsGuestMachinePtr;
|
|
|
|
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
|
|
|
typedef struct _virCapsGuestDomainInfo virCapsGuestDomainInfo;
|
|
|
|
typedef virCapsGuestDomainInfo *virCapsGuestDomainInfoPtr;
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virCapsGuestDomain virCapsGuestDomain;
|
|
|
|
typedef virCapsGuestDomain *virCapsGuestDomainPtr;
|
|
|
|
struct _virCapsGuestDomain {
|
2015-09-17 08:46:55 +00:00
|
|
|
int type; /* virDomainVirtType */
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestDomainInfo info;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virCapsGuestArch virCapsGuestArch;
|
|
|
|
typedef virCapsGuestArch *virCapsGuestArchptr;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virCapsGuest virCapsGuest;
|
|
|
|
typedef virCapsGuest *virCapsGuestPtr;
|
|
|
|
struct _virCapsGuest {
|
2015-04-16 23:18:32 +00:00
|
|
|
int ostype;
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestArch arch;
|
2010-08-17 21:41:51 +00:00
|
|
|
size_t nfeatures;
|
|
|
|
size_t nfeatures_max;
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsGuestFeaturePtr *features;
|
|
|
|
};
|
|
|
|
|
2013-01-22 17:42:08 +00:00
|
|
|
typedef struct _virCapsHostNUMACellCPU virCapsHostNUMACellCPU;
|
|
|
|
typedef virCapsHostNUMACellCPU *virCapsHostNUMACellCPUPtr;
|
|
|
|
struct _virCapsHostNUMACellCPU {
|
|
|
|
unsigned int id;
|
|
|
|
unsigned int socket_id;
|
|
|
|
unsigned int core_id;
|
|
|
|
virBitmapPtr siblings;
|
|
|
|
};
|
|
|
|
|
2014-06-03 13:18:27 +00:00
|
|
|
typedef struct _virCapsHostNUMACellSiblingInfo virCapsHostNUMACellSiblingInfo;
|
|
|
|
typedef virCapsHostNUMACellSiblingInfo *virCapsHostNUMACellSiblingInfoPtr;
|
|
|
|
struct _virCapsHostNUMACellSiblingInfo {
|
|
|
|
int node; /* foreign NUMA node */
|
|
|
|
unsigned int distance; /* distance to the node */
|
|
|
|
};
|
|
|
|
|
2014-06-06 16:12:51 +00:00
|
|
|
typedef struct _virCapsHostNUMACellPageInfo virCapsHostNUMACellPageInfo;
|
|
|
|
typedef virCapsHostNUMACellPageInfo *virCapsHostNUMACellPageInfoPtr;
|
|
|
|
struct _virCapsHostNUMACellPageInfo {
|
|
|
|
unsigned int size; /* page size in kibibytes */
|
|
|
|
size_t avail; /* the size of pool */
|
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
typedef struct _virCapsHostNUMACell virCapsHostNUMACell;
|
|
|
|
typedef virCapsHostNUMACell *virCapsHostNUMACellPtr;
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2013-10-18 12:13:21 +00:00
|
|
|
typedef struct _virCapsHostSecModelLabel virCapsHostSecModelLabel;
|
|
|
|
typedef virCapsHostSecModelLabel *virCapsHostSecModelLabelPtr;
|
|
|
|
struct _virCapsHostSecModelLabel {
|
|
|
|
char *type;
|
|
|
|
char *label;
|
|
|
|
};
|
|
|
|
|
2009-03-03 09:44:41 +00:00
|
|
|
typedef struct _virCapsHostSecModel virCapsHostSecModel;
|
2012-08-15 22:10:35 +00:00
|
|
|
typedef virCapsHostSecModel *virCapsHostSecModelPtr;
|
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
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
typedef struct _virCapsHost virCapsHost;
|
|
|
|
typedef virCapsHost *virCapsHostPtr;
|
|
|
|
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;
|
2010-08-17 21:41:51 +00:00
|
|
|
size_t nnumaCell;
|
|
|
|
size_t nnumaCell_max;
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapsHostNUMACellPtr *numaCell;
|
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];
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
2010-04-17 03:08:29 +00:00
|
|
|
typedef int (*virDomainDefNamespaceParse)(xmlDocPtr, xmlNodePtr,
|
|
|
|
xmlXPathContextPtr, void **);
|
|
|
|
typedef void (*virDomainDefNamespaceFree)(void *);
|
|
|
|
typedef int (*virDomainDefNamespaceXMLFormat)(virBufferPtr, void *);
|
|
|
|
typedef const char *(*virDomainDefNamespaceHref)(void);
|
|
|
|
|
|
|
|
typedef struct _virDomainXMLNamespace virDomainXMLNamespace;
|
|
|
|
typedef virDomainXMLNamespace *virDomainXMLNamespacePtr;
|
|
|
|
struct _virDomainXMLNamespace {
|
|
|
|
virDomainDefNamespaceParse parse;
|
|
|
|
virDomainDefNamespaceFree free;
|
|
|
|
virDomainDefNamespaceXMLFormat format;
|
|
|
|
virDomainDefNamespaceHref href;
|
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
typedef struct _virCaps virCaps;
|
2013-10-29 19:57:19 +00:00
|
|
|
typedef virCaps *virCapsPtr;
|
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;
|
|
|
|
};
|
|
|
|
|
2015-04-17 16:38:55 +00:00
|
|
|
typedef struct _virCapsDomainData virCapsDomainData;
|
|
|
|
typedef virCapsDomainData *virCapsDomainDataPtr;
|
|
|
|
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
|
2009-06-29 10:41:56 +00:00
|
|
|
virCapabilitiesFreeNUMAInfo(virCapsPtr caps);
|
|
|
|
|
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
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
int
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesAddHostNUMACell(virCapsPtr caps,
|
|
|
|
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
|
|
|
|
2016-05-10 11:37:32 +00:00
|
|
|
virCapsGuestFeaturePtr
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesAddGuestFeature(virCapsGuestPtr guest,
|
|
|
|
const char *name,
|
2014-07-14 12:56:13 +00:00
|
|
|
bool defaultOn,
|
|
|
|
bool toggle);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
2013-07-18 09:21:48 +00:00
|
|
|
virBitmapPtr virCapabilitiesGetCpusForNodemask(virCapsPtr caps,
|
|
|
|
virBitmapPtr nodemask);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
|
|
|
#endif /* __VIR_CAPABILITIES_H */
|