2008-02-27 04:35:08 +00:00
|
|
|
/*
|
|
|
|
* capabilities.h: hypervisor capabilities
|
|
|
|
*
|
2010-08-17 21:41:51 +00:00
|
|
|
* Copyright (C) 2006-2008, 2010 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-07-21 10:06:23 +00:00
|
|
|
* License along with this library; If not, see
|
|
|
|
* <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"
|
|
|
|
# include "buf.h"
|
|
|
|
# include "cpu_conf.h"
|
2012-01-27 17:23:05 +00:00
|
|
|
# include "virmacaddr.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;
|
|
|
|
int defaultOn;
|
|
|
|
int toggle;
|
|
|
|
};
|
|
|
|
|
2009-07-23 17:31:34 +00:00
|
|
|
typedef struct _virCapsGuestMachine virCapsGuestMachine;
|
|
|
|
typedef virCapsGuestMachine *virCapsGuestMachinePtr;
|
|
|
|
struct _virCapsGuestMachine {
|
|
|
|
char *name;
|
|
|
|
char *canonical;
|
|
|
|
};
|
|
|
|
|
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;
|
2009-07-24 11:34:20 +00:00
|
|
|
time_t emulator_mtime; /* do @machines need refreshing? */
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virCapsGuestDomain virCapsGuestDomain;
|
|
|
|
typedef virCapsGuestDomain *virCapsGuestDomainPtr;
|
|
|
|
struct _virCapsGuestDomain {
|
|
|
|
char *type;
|
|
|
|
virCapsGuestDomainInfo info;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virCapsGuestArch virCapsGuestArch;
|
|
|
|
typedef virCapsGuestArch *virCapsGuestArchptr;
|
|
|
|
struct _virCapsGuestArch {
|
|
|
|
char *name;
|
|
|
|
int wordsize;
|
|
|
|
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 {
|
|
|
|
char *ostype;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virCapsHostNUMACell virCapsHostNUMACell;
|
|
|
|
typedef virCapsHostNUMACell *virCapsHostNUMACellPtr;
|
|
|
|
struct _virCapsHostNUMACell {
|
|
|
|
int num;
|
|
|
|
int ncpus;
|
|
|
|
int *cpus;
|
|
|
|
};
|
|
|
|
|
2009-03-03 09:44:41 +00:00
|
|
|
typedef struct _virCapsHostSecModel virCapsHostSecModel;
|
|
|
|
struct _virCapsHostSecModel {
|
|
|
|
char *model;
|
|
|
|
char *doi;
|
|
|
|
};
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
typedef struct _virCapsHost virCapsHost;
|
|
|
|
typedef virCapsHost *virCapsHostPtr;
|
|
|
|
struct _virCapsHost {
|
|
|
|
char *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.
|
|
|
|
*/
|
2008-02-27 04:35:08 +00:00
|
|
|
int offlineMigrate;
|
|
|
|
int 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;
|
2009-03-03 09:44:41 +00:00
|
|
|
virCapsHostSecModel secModel;
|
2009-12-18 13:44:55 +00:00
|
|
|
virCPUDefPtr cpu;
|
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;
|
|
|
|
typedef virCaps* virCapsPtr;
|
|
|
|
struct _virCaps {
|
|
|
|
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;
|
2008-10-24 11:20:08 +00:00
|
|
|
unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
|
2009-06-16 15:27:33 +00:00
|
|
|
unsigned int emulatorRequired : 1;
|
2010-06-14 15:08:55 +00:00
|
|
|
const char *defaultDiskDriverName;
|
|
|
|
const char *defaultDiskDriverType;
|
Fix default console type setting
The default console type may vary based on the OS type. ie a Xen
paravirt guests wants a 'xen' console, while a fullvirt guests
wants a 'serial' console.
A plain integer default console type in the capabilities does
not suffice. Instead introduce a callback that is passed the
OS type.
* src/conf/capabilities.h: Use a callback for default console
type
* src/conf/domain_conf.c, src/conf/domain_conf.h: Use callback
for default console type. Add missing LXC/OpenVZ console types.
* src/esx/esx_driver.c, src/libxl/libxl_conf.c,
src/lxc/lxc_conf.c, src/openvz/openvz_conf.c,
src/phyp/phyp_driver.c, src/qemu/qemu_capabilities.c,
src/uml/uml_conf.c, src/vbox/vbox_tmpl.c,
src/vmware/vmware_conf.c, src/xen/xen_hypervisor.c,
src/xenapi/xenapi_driver.c: Set default console type callback
2011-10-20 13:56:20 +00:00
|
|
|
int (*defaultConsoleTargetType)(const char *ostype);
|
2009-10-06 11:50:58 +00:00
|
|
|
void *(*privateDataAllocFunc)(void);
|
|
|
|
void (*privateDataFreeFunc)(void *);
|
2009-11-26 17:57:00 +00:00
|
|
|
int (*privateDataXMLFormat)(virBufferPtr, void *);
|
|
|
|
int (*privateDataXMLParse)(xmlXPathContextPtr, void *);
|
2010-06-15 22:17:34 +00:00
|
|
|
bool hasWideScsiBus;
|
2011-05-12 20:12:05 +00:00
|
|
|
const char *defaultInitPath;
|
2010-04-17 03:08:29 +00:00
|
|
|
|
|
|
|
virDomainXMLNamespace ns;
|
2008-02-27 04:35:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern virCapsPtr
|
|
|
|
virCapabilitiesNew(const char *arch,
|
|
|
|
int offlineMigrate,
|
|
|
|
int liveMigrate);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
virCapabilitiesFree(virCapsPtr caps);
|
|
|
|
|
2009-06-29 10:41:56 +00:00
|
|
|
extern void
|
|
|
|
virCapabilitiesFreeNUMAInfo(virCapsPtr caps);
|
|
|
|
|
2008-10-24 11:20:08 +00:00
|
|
|
extern void
|
|
|
|
virCapabilitiesSetMacPrefix(virCapsPtr caps,
|
2012-07-17 12:07:59 +00:00
|
|
|
const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN]);
|
2008-10-24 11:20:08 +00:00
|
|
|
|
|
|
|
extern void
|
|
|
|
virCapabilitiesGenerateMac(virCapsPtr caps,
|
2012-07-17 12:07:59 +00:00
|
|
|
virMacAddrPtr mac);
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2009-06-16 15:27:33 +00:00
|
|
|
extern void
|
|
|
|
virCapabilitiesSetEmulatorRequired(virCapsPtr caps);
|
|
|
|
|
|
|
|
extern unsigned int
|
|
|
|
virCapabilitiesIsEmulatorRequired(virCapsPtr caps);
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
extern int
|
|
|
|
virCapabilitiesAddHostFeature(virCapsPtr caps,
|
|
|
|
const char *name);
|
|
|
|
|
|
|
|
extern int
|
|
|
|
virCapabilitiesAddHostMigrateTransport(virCapsPtr caps,
|
|
|
|
const char *name);
|
|
|
|
|
|
|
|
|
|
|
|
extern int
|
|
|
|
virCapabilitiesAddHostNUMACell(virCapsPtr caps,
|
|
|
|
int num,
|
|
|
|
int ncpus,
|
|
|
|
const int *cpus);
|
|
|
|
|
|
|
|
|
2009-12-18 13:44:55 +00:00
|
|
|
extern int
|
|
|
|
virCapabilitiesSetHostCPU(virCapsPtr caps,
|
|
|
|
virCPUDefPtr cpu);
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
|
2009-07-23 17:31:34 +00:00
|
|
|
extern virCapsGuestMachinePtr *
|
|
|
|
virCapabilitiesAllocMachines(const char *const *names,
|
|
|
|
int nnames);
|
|
|
|
extern void
|
|
|
|
virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
|
|
|
|
int nmachines);
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
extern virCapsGuestPtr
|
|
|
|
virCapabilitiesAddGuest(virCapsPtr caps,
|
|
|
|
const char *ostype,
|
|
|
|
const char *arch,
|
|
|
|
int wordsize,
|
|
|
|
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
|
|
|
|
|
|
|
extern virCapsGuestDomainPtr
|
|
|
|
virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
|
|
|
|
const char *hvtype,
|
|
|
|
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
|
|
|
|
|
|
|
extern virCapsGuestFeaturePtr
|
|
|
|
virCapabilitiesAddGuestFeature(virCapsGuestPtr guest,
|
|
|
|
const char *name,
|
|
|
|
int defaultOn,
|
|
|
|
int toggle);
|
|
|
|
|
|
|
|
extern int
|
2012-02-20 18:40:30 +00:00
|
|
|
virCapabilitiesSupportsGuestArch(virCapsPtr caps,
|
|
|
|
const char *arch);
|
|
|
|
extern int
|
2008-02-27 04:35:08 +00:00
|
|
|
virCapabilitiesSupportsGuestOSType(virCapsPtr caps,
|
|
|
|
const char *ostype);
|
2009-01-30 17:12:28 +00:00
|
|
|
extern int
|
2012-02-20 18:40:30 +00:00
|
|
|
virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps,
|
|
|
|
const char *ostype,
|
|
|
|
const char *arch);
|
2009-01-30 17:12:28 +00:00
|
|
|
|
|
|
|
|
2008-02-27 04:35:08 +00:00
|
|
|
extern const char *
|
|
|
|
virCapabilitiesDefaultGuestArch(virCapsPtr caps,
|
2009-03-24 11:16:29 +00:00
|
|
|
const char *ostype,
|
|
|
|
const char *domain);
|
2008-02-27 04:35:08 +00:00
|
|
|
extern const char *
|
|
|
|
virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
|
|
|
|
const char *ostype,
|
2009-10-12 09:52:13 +00:00
|
|
|
const char *arch,
|
|
|
|
const char *domain);
|
2008-02-27 04:35:08 +00:00
|
|
|
extern const char *
|
|
|
|
virCapabilitiesDefaultGuestEmulator(virCapsPtr caps,
|
|
|
|
const char *ostype,
|
|
|
|
const char *arch,
|
|
|
|
const char *domain);
|
|
|
|
|
|
|
|
extern char *
|
|
|
|
virCapabilitiesFormatXML(virCapsPtr caps);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __VIR_CAPABILITIES_H */
|