2007-12-05 18:28:05 +00:00
|
|
|
|
2007-03-06 21:55:44 +00:00
|
|
|
/* -*- c -*-
|
2006-02-09 17:45:11 +00:00
|
|
|
* libvirt.h:
|
|
|
|
* Summary: core interfaces for the libvirt library
|
|
|
|
* Description: Provides the interfaces of the libvirt library to handle
|
2005-12-08 15:08:46 +00:00
|
|
|
* Xen domains from a process running in domain 0
|
|
|
|
*
|
2006-02-09 17:45:11 +00:00
|
|
|
* Copy: Copyright (C) 2005,2006 Red Hat, Inc.
|
2005-12-08 15:08:46 +00:00
|
|
|
*
|
|
|
|
* See COPYING.LIB for the License of this software
|
|
|
|
*
|
|
|
|
* Author: Daniel Veillard <veillard@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_VIRLIB_H__
|
|
|
|
#define __VIR_VIRLIB_H__
|
|
|
|
|
2007-08-21 10:08:12 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virConnect:
|
|
|
|
*
|
|
|
|
* a virConnect is a private structure representing a connection to
|
|
|
|
* the Xen Hypervisor.
|
|
|
|
*/
|
|
|
|
typedef struct _virConnect virConnect;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virConnectPtr:
|
|
|
|
*
|
|
|
|
* a virConnectPtr is pointer to a virConnect private structure, this is the
|
|
|
|
* type used to reference a connection to the Xen Hypervisor in the API.
|
|
|
|
*/
|
|
|
|
typedef virConnect *virConnectPtr;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virDomain:
|
|
|
|
*
|
|
|
|
* a virDomain is a private structure representing a Xen domain.
|
|
|
|
*/
|
|
|
|
typedef struct _virDomain virDomain;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virDomainPtr:
|
|
|
|
*
|
|
|
|
* a virDomainPtr is pointer to a virDomain private structure, this is the
|
|
|
|
* type used to reference a Xen domain in the API.
|
|
|
|
*/
|
|
|
|
typedef virDomain *virDomainPtr;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virDomainState:
|
|
|
|
*
|
|
|
|
* A domain may be in different states at a given point in time
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
VIR_DOMAIN_NOSTATE = 0, /* no state */
|
|
|
|
VIR_DOMAIN_RUNNING = 1, /* the domain is running */
|
|
|
|
VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */
|
|
|
|
VIR_DOMAIN_PAUSED = 3, /* the domain is paused by user */
|
|
|
|
VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */
|
2006-01-18 10:37:08 +00:00
|
|
|
VIR_DOMAIN_SHUTOFF = 5, /* the domain is shut off */
|
|
|
|
VIR_DOMAIN_CRASHED = 6 /* the domain is crashed */
|
2005-12-08 15:08:46 +00:00
|
|
|
} virDomainState;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virDomainInfoPtr:
|
|
|
|
*
|
2006-03-29 12:46:03 +00:00
|
|
|
* a virDomainInfo is a structure filled by virDomainGetInfo() and extracting
|
|
|
|
* runtime informations for a given active Domain
|
2005-12-08 15:08:46 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _virDomainInfo virDomainInfo;
|
|
|
|
|
|
|
|
struct _virDomainInfo {
|
|
|
|
unsigned char state; /* the running state, one of virDomainFlags */
|
|
|
|
unsigned long maxMem; /* the maximum memory in KBytes allowed */
|
|
|
|
unsigned long memory; /* the memory in KBytes used by the domain */
|
|
|
|
unsigned short nrVirtCpu; /* the number of virtual CPUs for the domain */
|
|
|
|
unsigned long long cpuTime; /* the CPU time used in nanoseconds */
|
|
|
|
};
|
|
|
|
|
2006-01-17 16:56:17 +00:00
|
|
|
/**
|
|
|
|
* virDomainInfoPtr:
|
|
|
|
*
|
|
|
|
* a virDomainInfoPtr is a pointer to a virDomainInfo structure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef virDomainInfo *virDomainInfoPtr;
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
/**
|
2005-12-16 12:16:41 +00:00
|
|
|
* virDomainCreateFlags:
|
2005-12-08 15:08:46 +00:00
|
|
|
*
|
|
|
|
* Flags OR'ed together to provide specific behaviour when creating a
|
|
|
|
* Domain.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
VIR_DOMAIN_NONE = 0
|
2005-12-16 12:16:41 +00:00
|
|
|
} virDomainCreateFlags;
|
2005-12-08 15:08:46 +00:00
|
|
|
|
2006-03-29 12:46:03 +00:00
|
|
|
/**
|
|
|
|
* virNodeInfoPtr:
|
|
|
|
*
|
|
|
|
* a virNodeInfo is a structure filled by virNodeGetInfo() and providing
|
2008-02-05 19:27:37 +00:00
|
|
|
* the informations for the Node.
|
2006-03-29 12:46:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _virNodeInfo virNodeInfo;
|
|
|
|
|
|
|
|
struct _virNodeInfo {
|
|
|
|
char model[32]; /* string indicating the CPU model */
|
2006-04-04 14:37:32 +00:00
|
|
|
unsigned long memory;/* memory size in kilobytes */
|
2006-03-29 12:46:03 +00:00
|
|
|
unsigned int cpus; /* the number of active CPUs */
|
|
|
|
unsigned int mhz; /* expected CPU frequency */
|
|
|
|
unsigned int nodes; /* the number of NUMA cell, 1 for uniform mem access */
|
|
|
|
unsigned int sockets;/* number of CPU socket per node */
|
|
|
|
unsigned int cores; /* number of core per socket */
|
|
|
|
unsigned int threads;/* number of threads per core */
|
|
|
|
};
|
|
|
|
|
2006-08-07 17:37:42 +00:00
|
|
|
|
2007-06-05 12:06:08 +00:00
|
|
|
/**
|
|
|
|
* virDomainSchedParameterType:
|
|
|
|
*
|
|
|
|
* A scheduler parameter field type
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
VIR_DOMAIN_SCHED_FIELD_INT = 1, /* integer case */
|
|
|
|
VIR_DOMAIN_SCHED_FIELD_UINT = 2, /* unsigned integer case */
|
|
|
|
VIR_DOMAIN_SCHED_FIELD_LLONG = 3, /* long long case */
|
|
|
|
VIR_DOMAIN_SCHED_FIELD_ULLONG = 4, /* unsigned long long case */
|
|
|
|
VIR_DOMAIN_SCHED_FIELD_DOUBLE = 5, /* double case */
|
|
|
|
VIR_DOMAIN_SCHED_FIELD_BOOLEAN = 6 /* boolean(character) case */
|
|
|
|
} virSchedParameterType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_DOMAIN_SCHED_FIELD_LENGTH:
|
|
|
|
*
|
|
|
|
* Macro providing the field length of virSchedParameter
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define VIR_DOMAIN_SCHED_FIELD_LENGTH 80
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virDomainSchedParameter:
|
|
|
|
*
|
|
|
|
* a virDomainSchedParameter is the set of scheduler parameters
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _virSchedParameter virSchedParameter;
|
|
|
|
|
|
|
|
struct _virSchedParameter {
|
|
|
|
char field[VIR_DOMAIN_SCHED_FIELD_LENGTH]; /* parameter name */
|
|
|
|
int type; /* parameter type */
|
|
|
|
union {
|
|
|
|
int i; /* data for integer case */
|
|
|
|
unsigned int ui; /* data for unsigned integer case */
|
|
|
|
long long int l; /* data for long long integer case */
|
|
|
|
unsigned long long int ul; /* data for unsigned long long integer case */
|
|
|
|
double d; /* data for double case */
|
|
|
|
char b; /* data for char case */
|
|
|
|
} value; /* parameter value */
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virSchedParameterPtr:
|
|
|
|
*
|
|
|
|
* a virSchedParameterPtr is a pointer to a virSchedParameter structure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef virSchedParameter *virSchedParameterPtr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fetch scheduler parameters, caller allocates 'params' field of size 'nparams'
|
|
|
|
*/
|
|
|
|
int virDomainGetSchedulerParameters (virDomainPtr domain,
|
|
|
|
virSchedParameterPtr params,
|
|
|
|
int *nparams);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Change scheduler parameters
|
|
|
|
*/
|
|
|
|
int virDomainSetSchedulerParameters (virDomainPtr domain,
|
|
|
|
virSchedParameterPtr params,
|
|
|
|
int nparams);
|
|
|
|
|
2007-09-10 09:37:10 +00:00
|
|
|
/**
|
|
|
|
* virDomainBlockStats:
|
|
|
|
*
|
|
|
|
* Block device stats for virDomainBlockStats.
|
2007-08-21 10:08:12 +00:00
|
|
|
*
|
|
|
|
* Hypervisors may return a field set to ((long long)-1) which indicates
|
|
|
|
* that the hypervisor does not support that statistic.
|
|
|
|
*
|
|
|
|
* NB. Here 'long long' means 64 bit integer.
|
|
|
|
*/
|
2007-09-10 09:37:10 +00:00
|
|
|
typedef struct _virDomainBlockStats virDomainBlockStatsStruct;
|
|
|
|
|
2007-08-21 10:08:12 +00:00
|
|
|
struct _virDomainBlockStats {
|
|
|
|
long long rd_req;
|
|
|
|
long long rd_bytes;
|
|
|
|
long long wr_req;
|
|
|
|
long long wr_bytes;
|
2007-09-10 09:37:10 +00:00
|
|
|
long long errs; /* In Xen this returns the mysterious 'oo_req'. */
|
2007-08-21 10:08:12 +00:00
|
|
|
};
|
|
|
|
|
2007-09-10 09:37:10 +00:00
|
|
|
/**
|
|
|
|
* virDomainBlockStatsPtr:
|
|
|
|
*
|
|
|
|
* A pointer to a virDomainBlockStats structure
|
|
|
|
*/
|
|
|
|
typedef virDomainBlockStatsStruct *virDomainBlockStatsPtr;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virDomainInterfaceStats:
|
|
|
|
*
|
|
|
|
* Network interface stats for virDomainInterfaceStats.
|
2007-08-21 10:08:12 +00:00
|
|
|
*
|
|
|
|
* Hypervisors may return a field set to ((long long)-1) which indicates
|
|
|
|
* that the hypervisor does not support that statistic.
|
|
|
|
*
|
|
|
|
* NB. Here 'long long' means 64 bit integer.
|
|
|
|
*/
|
2007-09-10 09:37:10 +00:00
|
|
|
typedef struct _virDomainInterfaceStats virDomainInterfaceStatsStruct;
|
|
|
|
|
2007-08-21 10:08:12 +00:00
|
|
|
struct _virDomainInterfaceStats {
|
|
|
|
long long rx_bytes;
|
|
|
|
long long rx_packets;
|
|
|
|
long long rx_errs;
|
|
|
|
long long rx_drop;
|
|
|
|
long long tx_bytes;
|
|
|
|
long long tx_packets;
|
|
|
|
long long tx_errs;
|
|
|
|
long long tx_drop;
|
|
|
|
};
|
2007-09-10 09:37:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* virDomainInterfaceStatsPtr:
|
|
|
|
*
|
|
|
|
* A pointe to a virDomainInterfaceStats structure
|
|
|
|
*/
|
|
|
|
typedef virDomainInterfaceStatsStruct *virDomainInterfaceStatsPtr;
|
|
|
|
|
2007-08-21 10:08:12 +00:00
|
|
|
|
2007-08-21 09:31:12 +00:00
|
|
|
/* Domain migration flags. */
|
|
|
|
typedef enum {
|
|
|
|
VIR_MIGRATE_LIVE = 1, /* live migration */
|
|
|
|
} virDomainMigrateFlags;
|
|
|
|
|
|
|
|
/* Domain migration. */
|
|
|
|
virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
|
|
|
|
unsigned long flags, const char *dname,
|
|
|
|
const char *uri, unsigned long bandwidth);
|
|
|
|
|
2006-08-07 17:37:42 +00:00
|
|
|
/**
|
|
|
|
* VIR_NODEINFO_MAXCPUS:
|
|
|
|
* @nodeinfo: virNodeInfo instance
|
|
|
|
*
|
|
|
|
* This macro is to calculate the total number of CPUs supported
|
|
|
|
* but not neccessarily active in the host.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#define VIR_NODEINFO_MAXCPUS(nodeinfo) ((nodeinfo).nodes*(nodeinfo).sockets*(nodeinfo).cores*(nodeinfo).threads)
|
|
|
|
|
2006-03-29 12:46:03 +00:00
|
|
|
/**
|
|
|
|
* virNodeInfoPtr:
|
|
|
|
*
|
|
|
|
* a virNodeInfoPtr is a pointer to a virNodeInfo structure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef virNodeInfo *virNodeInfoPtr;
|
|
|
|
|
2007-12-05 18:28:05 +00:00
|
|
|
/**
|
|
|
|
* virConnectFlags
|
|
|
|
*
|
|
|
|
* Flags when openning a connection to a hypervisor
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
VIR_CONNECT_RO = 1, /* A readonly connection */
|
|
|
|
} virConnectFlags;
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
VIR_CRED_USERNAME = 1, /* Identity to act as */
|
|
|
|
VIR_CRED_AUTHNAME = 2, /* Identify to authorize as */
|
|
|
|
VIR_CRED_LANGUAGE = 3, /* RFC 1766 languages, comma separated */
|
|
|
|
VIR_CRED_CNONCE = 4, /* client supplies a nonce */
|
|
|
|
VIR_CRED_PASSPHRASE = 5, /* Passphrase secret */
|
|
|
|
VIR_CRED_ECHOPROMPT = 6, /* Challenge response */
|
|
|
|
VIR_CRED_NOECHOPROMPT = 7, /* Challenge response */
|
|
|
|
VIR_CRED_REALM = 8, /* Authentication realm */
|
|
|
|
VIR_CRED_EXTERNAL = 9, /* Externally managed credential */
|
|
|
|
|
|
|
|
/* More may be added - expect the unexpected */
|
|
|
|
} virConnectCredentialType;
|
|
|
|
|
|
|
|
struct _virConnectCredential {
|
|
|
|
int type; /* One of virConnectCredentialType constants */
|
|
|
|
const char *prompt; /* Prompt to show to user */
|
|
|
|
const char *challenge; /* Additional challenge to show */
|
|
|
|
const char *defresult; /* Optional default result */
|
|
|
|
char *result; /* Result to be filled with user response (or defresult) */
|
|
|
|
unsigned int resultlen; /* Length of the result */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virConnectCredential virConnectCredential;
|
|
|
|
typedef virConnectCredential *virConnectCredentialPtr;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virConnectCredCallbackPtr
|
|
|
|
*
|
|
|
|
* @param authtype type of authentication being performed
|
|
|
|
* @param cred list of virConnectCredential object to fetch from user
|
|
|
|
* @param ncred size of cred list
|
|
|
|
* @param cbdata opaque data passed to virConnectOpenAuth
|
2008-02-05 19:27:37 +00:00
|
|
|
*
|
2007-12-05 18:28:05 +00:00
|
|
|
* When authentication requires one or more interactions, this callback
|
|
|
|
* is invoked. For each interaction supplied, data must be gathered
|
|
|
|
* from the user and filled in to the 'result' and 'resultlen' fields.
|
|
|
|
* If an interaction can not be filled, fill in NULL and 0.
|
|
|
|
*
|
|
|
|
* Return 0 if all interactions were filled, or -1 upon error
|
|
|
|
*/
|
|
|
|
typedef int (*virConnectAuthCallbackPtr)(virConnectCredentialPtr cred,
|
|
|
|
unsigned int ncred,
|
|
|
|
void *cbdata);
|
|
|
|
|
|
|
|
struct _virConnectAuth {
|
|
|
|
int *credtype; /* List of supported virConnectCredentialType values */
|
|
|
|
unsigned int ncredtype;
|
|
|
|
|
|
|
|
virConnectAuthCallbackPtr cb; /* Callback used to collect credentials */
|
|
|
|
void *cbdata;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _virConnectAuth virConnectAuth;
|
|
|
|
typedef virConnectAuth *virConnectAuthPtr;
|
|
|
|
|
2007-12-05 18:55:04 +00:00
|
|
|
extern virConnectAuthPtr virConnectAuthPtrDefault;
|
|
|
|
|
Mon Jan 23 14:36:18 IST 2007 Mark McLoughlin <markmc@redhat.com>
* include/libvirt/libvirt.h.in: add VIR_UUID_BUFLEN and
VIR_UUID_STRING_BUFLEN
* libvirt/proxy/libvirt_proxy.c, libvirt/src/hash.c,
libvirt/src/internal.h, libvirt/src/libvirt.c,
libvirt/src/proxy_internal.c, libvirt/src/test.c,
libvirt/src/virsh.c, libvirt/src/xend_internal.c,
libvirt/src/xm_internal.c, libvirt/src/xml.c,
libvirt/python/libvir.c: use them
2007-01-23 14:39:45 +00:00
|
|
|
/**
|
2007-03-15 17:24:56 +00:00
|
|
|
* VIR_UUID_BUFLEN:
|
Mon Jan 23 14:36:18 IST 2007 Mark McLoughlin <markmc@redhat.com>
* include/libvirt/libvirt.h.in: add VIR_UUID_BUFLEN and
VIR_UUID_STRING_BUFLEN
* libvirt/proxy/libvirt_proxy.c, libvirt/src/hash.c,
libvirt/src/internal.h, libvirt/src/libvirt.c,
libvirt/src/proxy_internal.c, libvirt/src/test.c,
libvirt/src/virsh.c, libvirt/src/xend_internal.c,
libvirt/src/xm_internal.c, libvirt/src/xml.c,
libvirt/python/libvir.c: use them
2007-01-23 14:39:45 +00:00
|
|
|
*
|
|
|
|
* This macro provides the length of the buffer required
|
|
|
|
* for virDomainGetUUID()
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define VIR_UUID_BUFLEN (16)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_UUID_STRING_BUFLEN:
|
|
|
|
*
|
|
|
|
* This macro provides the length of the buffer required
|
|
|
|
* for virDomainGetUUIDString()
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define VIR_UUID_STRING_BUFLEN (36+1)
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
/* library versionning */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* LIBVIR_VERSION_NUMBER:
|
|
|
|
*
|
2008-02-05 19:27:37 +00:00
|
|
|
* Macro providing the version of the library as
|
2005-12-08 15:08:46 +00:00
|
|
|
* version * 1,000,000 + minor * 1000 + micro
|
|
|
|
*/
|
|
|
|
|
2006-02-15 13:21:17 +00:00
|
|
|
#define LIBVIR_VERSION_NUMBER @LIBVIRT_VERSION_NUMBER@
|
2005-12-08 15:08:46 +00:00
|
|
|
|
|
|
|
int virGetVersion (unsigned long *libVer,
|
|
|
|
const char *type,
|
|
|
|
unsigned long *typeVer);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Connection and disconnections to the Hypervisor
|
|
|
|
*/
|
2006-03-27 15:24:36 +00:00
|
|
|
int virInitialize (void);
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
virConnectPtr virConnectOpen (const char *name);
|
|
|
|
virConnectPtr virConnectOpenReadOnly (const char *name);
|
2007-12-05 18:28:05 +00:00
|
|
|
virConnectPtr virConnectOpenAuth (const char *name,
|
|
|
|
virConnectAuthPtr auth,
|
|
|
|
int flags);
|
2005-12-08 15:08:46 +00:00
|
|
|
int virConnectClose (virConnectPtr conn);
|
|
|
|
const char * virConnectGetType (virConnectPtr conn);
|
|
|
|
int virConnectGetVersion (virConnectPtr conn,
|
|
|
|
unsigned long *hvVer);
|
2007-06-26 11:42:46 +00:00
|
|
|
char * virConnectGetHostname (virConnectPtr conn);
|
|
|
|
char * virConnectGetURI (virConnectPtr conn);
|
|
|
|
|
|
|
|
|
2007-03-15 17:24:56 +00:00
|
|
|
/*
|
|
|
|
* Capabilities of the connection / driver.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int virConnectGetMaxVcpus (virConnectPtr conn,
|
2007-03-08 08:31:07 +00:00
|
|
|
const char *type);
|
2006-03-29 12:46:03 +00:00
|
|
|
int virNodeGetInfo (virConnectPtr conn,
|
|
|
|
virNodeInfoPtr info);
|
2007-03-15 17:24:56 +00:00
|
|
|
char * virConnectGetCapabilities (virConnectPtr conn);
|
2005-12-08 15:08:46 +00:00
|
|
|
|
2007-09-30 13:09:07 +00:00
|
|
|
unsigned long long virNodeGetFreeMemory (virConnectPtr conn);
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
/*
|
|
|
|
* Gather list of running domains
|
|
|
|
*/
|
|
|
|
int virConnectListDomains (virConnectPtr conn,
|
|
|
|
int *ids,
|
|
|
|
int maxids);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Number of domains
|
|
|
|
*/
|
|
|
|
int virConnectNumOfDomains (virConnectPtr conn);
|
|
|
|
|
|
|
|
|
2007-06-25 15:56:18 +00:00
|
|
|
/*
|
|
|
|
* Get connection from domain.
|
|
|
|
*/
|
|
|
|
virConnectPtr virDomainGetConnect (virDomainPtr domain);
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
/*
|
|
|
|
* Domain creation and destruction
|
|
|
|
*/
|
|
|
|
virDomainPtr virDomainCreateLinux (virConnectPtr conn,
|
2006-02-16 22:50:52 +00:00
|
|
|
const char *xmlDesc,
|
2005-12-08 15:08:46 +00:00
|
|
|
unsigned int flags);
|
|
|
|
virDomainPtr virDomainLookupByName (virConnectPtr conn,
|
|
|
|
const char *name);
|
|
|
|
virDomainPtr virDomainLookupByID (virConnectPtr conn,
|
|
|
|
int id);
|
2006-02-23 10:13:55 +00:00
|
|
|
virDomainPtr virDomainLookupByUUID (virConnectPtr conn,
|
2006-02-23 10:42:29 +00:00
|
|
|
const unsigned char *uuid);
|
2006-05-22 14:38:33 +00:00
|
|
|
virDomainPtr virDomainLookupByUUIDString (virConnectPtr conn,
|
|
|
|
const char *uuid);
|
|
|
|
|
2005-12-16 12:16:41 +00:00
|
|
|
int virDomainShutdown (virDomainPtr domain);
|
2006-04-03 13:46:43 +00:00
|
|
|
int virDomainReboot (virDomainPtr domain,
|
|
|
|
unsigned int flags);
|
2005-12-08 15:08:46 +00:00
|
|
|
int virDomainDestroy (virDomainPtr domain);
|
2005-12-08 23:46:57 +00:00
|
|
|
int virDomainFree (virDomainPtr domain);
|
2005-12-08 15:08:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Domain suspend/resume
|
|
|
|
*/
|
|
|
|
int virDomainSuspend (virDomainPtr domain);
|
|
|
|
int virDomainResume (virDomainPtr domain);
|
|
|
|
|
2006-01-18 10:37:08 +00:00
|
|
|
/*
|
|
|
|
* Domain save/restore
|
|
|
|
*/
|
|
|
|
int virDomainSave (virDomainPtr domain,
|
|
|
|
const char *to);
|
2006-01-20 10:00:08 +00:00
|
|
|
int virDomainRestore (virConnectPtr conn,
|
2006-01-18 10:37:08 +00:00
|
|
|
const char *from);
|
|
|
|
|
2006-11-22 17:48:29 +00:00
|
|
|
/*
|
|
|
|
* Domain core dump
|
|
|
|
*/
|
|
|
|
int virDomainCoreDump (virDomainPtr domain,
|
|
|
|
const char *to,
|
|
|
|
int flags);
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
/*
|
|
|
|
* Domain runtime informations
|
|
|
|
*/
|
|
|
|
int virDomainGetInfo (virDomainPtr domain,
|
|
|
|
virDomainInfoPtr info);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2007-06-05 12:06:08 +00:00
|
|
|
/*
|
|
|
|
* Return scheduler type in effect 'sedf', 'credit', 'linux'
|
|
|
|
*/
|
|
|
|
char * virDomainGetSchedulerType(virDomainPtr domain,
|
|
|
|
int *nparams);
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
/*
|
|
|
|
* Dynamic control of domains
|
|
|
|
*/
|
|
|
|
const char * virDomainGetName (virDomainPtr domain);
|
|
|
|
unsigned int virDomainGetID (virDomainPtr domain);
|
2006-02-23 10:13:55 +00:00
|
|
|
int virDomainGetUUID (virDomainPtr domain,
|
2006-02-23 10:42:29 +00:00
|
|
|
unsigned char *uuid);
|
2008-02-05 19:27:37 +00:00
|
|
|
int virDomainGetUUIDString (virDomainPtr domain,
|
2006-05-22 14:38:33 +00:00
|
|
|
char *buf);
|
2005-12-16 00:51:27 +00:00
|
|
|
char * virDomainGetOSType (virDomainPtr domain);
|
2005-12-08 15:08:46 +00:00
|
|
|
unsigned long virDomainGetMaxMemory (virDomainPtr domain);
|
|
|
|
int virDomainSetMaxMemory (virDomainPtr domain,
|
|
|
|
unsigned long memory);
|
2006-04-13 17:18:49 +00:00
|
|
|
int virDomainSetMemory (virDomainPtr domain,
|
|
|
|
unsigned long memory);
|
2007-03-08 08:31:07 +00:00
|
|
|
int virDomainGetMaxVcpus (virDomainPtr domain);
|
|
|
|
|
2005-12-16 00:51:27 +00:00
|
|
|
/*
|
|
|
|
* XML domain description
|
|
|
|
*/
|
2007-09-30 13:09:07 +00:00
|
|
|
/**
|
|
|
|
* virDomainXMLFlags:
|
|
|
|
*
|
|
|
|
* Flags available for virDomainGetXMLDesc
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
VIR_DOMAIN_XML_SECURE = 1, /* dump security sensitive informations too */
|
|
|
|
VIR_DOMAIN_XML_INACTIVE = 2/* dump inactive domain informations */
|
|
|
|
} virDomainXMLFlags;
|
|
|
|
|
2006-02-20 17:22:16 +00:00
|
|
|
char * virDomainGetXMLDesc (virDomainPtr domain,
|
|
|
|
int flags);
|
2005-12-08 15:08:46 +00:00
|
|
|
|
2007-08-21 10:08:12 +00:00
|
|
|
int virDomainBlockStats (virDomainPtr dom,
|
|
|
|
const char *path,
|
|
|
|
virDomainBlockStatsPtr stats,
|
|
|
|
size_t size);
|
|
|
|
int virDomainInterfaceStats (virDomainPtr dom,
|
|
|
|
const char *path,
|
|
|
|
virDomainInterfaceStatsPtr stats,
|
|
|
|
size_t size);
|
|
|
|
|
|
|
|
|
2006-04-28 18:29:26 +00:00
|
|
|
/*
|
|
|
|
* defined but not running domains
|
|
|
|
*/
|
|
|
|
virDomainPtr virDomainDefineXML (virConnectPtr conn,
|
|
|
|
const char *xml);
|
|
|
|
int virDomainUndefine (virDomainPtr domain);
|
2006-08-30 14:21:03 +00:00
|
|
|
int virConnectNumOfDefinedDomains (virConnectPtr conn);
|
|
|
|
int virConnectListDefinedDomains (virConnectPtr conn,
|
2007-03-06 21:55:44 +00:00
|
|
|
char **const names,
|
2006-04-28 18:29:26 +00:00
|
|
|
int maxnames);
|
|
|
|
int virDomainCreate (virDomainPtr domain);
|
|
|
|
|
2007-02-23 08:51:30 +00:00
|
|
|
int virDomainGetAutostart (virDomainPtr domain,
|
|
|
|
int *autostart);
|
|
|
|
int virDomainSetAutostart (virDomainPtr domain,
|
|
|
|
int autostart);
|
|
|
|
|
2006-08-04 10:41:05 +00:00
|
|
|
/**
|
|
|
|
* virVcpuInfo: structure for information about a virtual CPU in a domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
VIR_VCPU_OFFLINE = 0, /* the virtual CPU is offline */
|
|
|
|
VIR_VCPU_RUNNING = 1, /* the virtual CPU is running */
|
|
|
|
VIR_VCPU_BLOCKED = 2, /* the virtual CPU is blocked on resource */
|
|
|
|
} virVcpuState;
|
|
|
|
|
|
|
|
typedef struct _virVcpuInfo virVcpuInfo;
|
|
|
|
struct _virVcpuInfo {
|
|
|
|
unsigned int number; /* virtual CPU number */
|
|
|
|
int state; /* value from virVcpuState */
|
|
|
|
unsigned long long cpuTime; /* CPU time used, in nanoseconds */
|
|
|
|
int cpu; /* real CPU number, or -1 if offline */
|
|
|
|
};
|
|
|
|
typedef virVcpuInfo *virVcpuInfoPtr;
|
|
|
|
|
|
|
|
int virDomainSetVcpus (virDomainPtr domain,
|
|
|
|
unsigned int nvcpus);
|
|
|
|
|
|
|
|
int virDomainPinVcpu (virDomainPtr domain,
|
|
|
|
unsigned int vcpu,
|
|
|
|
unsigned char *cpumap,
|
|
|
|
int maplen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_USE_CPU:
|
|
|
|
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN/OUT)
|
|
|
|
* @cpu: the physical CPU number
|
|
|
|
*
|
|
|
|
* This macro is to be used in conjonction with virDomainPinVcpu() API.
|
|
|
|
* USE_CPU macro set the bit (CPU usable) of the related cpu in cpumap.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define VIR_USE_CPU(cpumap,cpu) (cpumap[(cpu)/8] |= (1<<((cpu)%8)))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_UNUSE_CPU:
|
|
|
|
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN/OUT)
|
|
|
|
* @cpu: the physical CPU number
|
|
|
|
*
|
|
|
|
* This macro is to be used in conjonction with virDomainPinVcpu() API.
|
|
|
|
* USE_CPU macro reset the bit (CPU not usable) of the related cpu in cpumap.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define VIR_UNUSE_CPU(cpumap,cpu) (cpumap[(cpu)/8] &= ~(1<<((cpu)%8)))
|
|
|
|
|
2006-08-07 17:37:42 +00:00
|
|
|
/**
|
2006-08-16 17:58:23 +00:00
|
|
|
* VIR_CPU_MAPLEN:
|
2006-08-07 17:37:42 +00:00
|
|
|
* @cpu: number of physical CPUs
|
|
|
|
*
|
|
|
|
* This macro is to be used in conjonction with virDomainPinVcpu() API.
|
|
|
|
* It returns the length (in bytes) required to store the complete
|
|
|
|
* CPU map between a single virtual & all physical CPUs of a domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define VIR_CPU_MAPLEN(cpu) (((cpu)+7)/8)
|
|
|
|
|
|
|
|
|
2006-08-04 10:41:05 +00:00
|
|
|
int virDomainGetVcpus (virDomainPtr domain,
|
|
|
|
virVcpuInfoPtr info,
|
|
|
|
int maxinfo,
|
|
|
|
unsigned char *cpumaps,
|
|
|
|
int maplen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_CPU_USABLE:
|
|
|
|
* @cpumaps: pointer to an array of cpumap (in 8-bit bytes) (IN)
|
|
|
|
* @maplen: the length (in bytes) of one cpumap
|
|
|
|
* @vcpu: the virtual CPU number
|
|
|
|
* @cpu: the physical CPU number
|
|
|
|
*
|
|
|
|
* This macro is to be used in conjonction with virDomainGetVcpus() API.
|
|
|
|
* VIR_CPU_USABLE macro returns a non zero value (true) if the cpu
|
|
|
|
* is usable by the vcpu, and 0 otherwise.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define VIR_CPU_USABLE(cpumaps,maplen,vcpu,cpu) \
|
|
|
|
(cpumaps[((vcpu)*(maplen))+((cpu)/8)] & (1<<((cpu)%8)))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_COPY_CPUMAP:
|
|
|
|
* @cpumaps: pointer to an array of cpumap (in 8-bit bytes) (IN)
|
|
|
|
* @maplen: the length (in bytes) of one cpumap
|
|
|
|
* @vcpu: the virtual CPU number
|
|
|
|
* @cpumap: pointer to a cpumap (in 8-bit bytes) (OUT)
|
|
|
|
* This cpumap must be previously allocated by the caller
|
|
|
|
* (ie: malloc(maplen))
|
|
|
|
*
|
|
|
|
* This macro is to be used in conjonction with virDomainGetVcpus() and
|
|
|
|
* virDomainPinVcpu() APIs. VIR_COPY_CPUMAP macro extract the cpumap of
|
|
|
|
* the specified vcpu from cpumaps array and copy it into cpumap to be used
|
|
|
|
* later by virDomainPinVcpu() API.
|
|
|
|
*/
|
|
|
|
#define VIR_COPY_CPUMAP(cpumaps,maplen,vcpu,cpumap) \
|
|
|
|
memcpy(cpumap, &(cpumaps[(vcpu)*(maplen)]), (maplen))
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_GET_CPUMAP:
|
|
|
|
* @cpumaps: pointer to an array of cpumap (in 8-bit bytes) (IN)
|
|
|
|
* @maplen: the length (in bytes) of one cpumap
|
|
|
|
* @vcpu: the virtual CPU number
|
|
|
|
*
|
|
|
|
* This macro is to be used in conjonction with virDomainGetVcpus() and
|
|
|
|
* virDomainPinVcpu() APIs. VIR_GET_CPUMAP macro returns a pointer to the
|
|
|
|
* cpumap of the specified vcpu from cpumaps array.
|
|
|
|
*/
|
|
|
|
#define VIR_GET_CPUMAP(cpumaps,maplen,vcpu) &(cpumaps[(vcpu)*(maplen)])
|
|
|
|
|
2007-10-15 21:38:56 +00:00
|
|
|
int virDomainAttachDevice(virDomainPtr domain, const char *xml);
|
|
|
|
int virDomainDetachDevice(virDomainPtr domain, const char *xml);
|
2006-08-04 10:41:05 +00:00
|
|
|
|
2007-09-28 14:28:12 +00:00
|
|
|
/*
|
|
|
|
* NUMA support
|
|
|
|
*/
|
|
|
|
|
|
|
|
int virNodeGetCellsFreeMemory(virConnectPtr conn,
|
|
|
|
unsigned long long *freeMems,
|
|
|
|
int startCell,
|
|
|
|
int maxCells);
|
|
|
|
|
2007-02-14 15:37:18 +00:00
|
|
|
/*
|
|
|
|
* Virtual Networks API
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetwork:
|
|
|
|
*
|
|
|
|
* a virNetwork is a private structure representing a virtual network.
|
|
|
|
*/
|
|
|
|
typedef struct _virNetwork virNetwork;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetworkPtr:
|
|
|
|
*
|
|
|
|
* a virNetworkPtr is pointer to a virNetwork private structure, this is the
|
|
|
|
* type used to reference a virtual network in the API.
|
|
|
|
*/
|
|
|
|
typedef virNetwork *virNetworkPtr;
|
|
|
|
|
2007-06-25 15:56:18 +00:00
|
|
|
/*
|
|
|
|
* Get connection from network.
|
|
|
|
*/
|
|
|
|
virConnectPtr virNetworkGetConnect (virNetworkPtr network);
|
|
|
|
|
2007-02-14 15:37:18 +00:00
|
|
|
/*
|
|
|
|
* List active networks
|
|
|
|
*/
|
|
|
|
int virConnectNumOfNetworks (virConnectPtr conn);
|
|
|
|
int virConnectListNetworks (virConnectPtr conn,
|
2007-03-06 21:55:44 +00:00
|
|
|
char **const names,
|
2007-02-14 15:37:18 +00:00
|
|
|
int maxnames);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List inactive networks
|
|
|
|
*/
|
|
|
|
int virConnectNumOfDefinedNetworks (virConnectPtr conn);
|
|
|
|
int virConnectListDefinedNetworks (virConnectPtr conn,
|
2007-03-06 21:55:44 +00:00
|
|
|
char **const names,
|
2007-02-14 15:37:18 +00:00
|
|
|
int maxnames);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Lookup network by name or uuid
|
|
|
|
*/
|
|
|
|
virNetworkPtr virNetworkLookupByName (virConnectPtr conn,
|
|
|
|
const char *name);
|
|
|
|
virNetworkPtr virNetworkLookupByUUID (virConnectPtr conn,
|
|
|
|
const unsigned char *uuid);
|
|
|
|
virNetworkPtr virNetworkLookupByUUIDString (virConnectPtr conn,
|
|
|
|
const char *uuid);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create active transient network
|
|
|
|
*/
|
|
|
|
virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
|
|
|
|
const char *xmlDesc);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define inactive persistent network
|
|
|
|
*/
|
|
|
|
virNetworkPtr virNetworkDefineXML (virConnectPtr conn,
|
|
|
|
const char *xmlDesc);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete persistent network
|
|
|
|
*/
|
|
|
|
int virNetworkUndefine (virNetworkPtr network);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Activate persistent network
|
|
|
|
*/
|
|
|
|
int virNetworkCreate (virNetworkPtr network);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Network destroy/free
|
|
|
|
*/
|
|
|
|
int virNetworkDestroy (virNetworkPtr network);
|
|
|
|
int virNetworkFree (virNetworkPtr network);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Network informations
|
|
|
|
*/
|
|
|
|
const char* virNetworkGetName (virNetworkPtr network);
|
|
|
|
int virNetworkGetUUID (virNetworkPtr network,
|
|
|
|
unsigned char *uuid);
|
|
|
|
int virNetworkGetUUIDString (virNetworkPtr network,
|
|
|
|
char *buf);
|
|
|
|
char * virNetworkGetXMLDesc (virNetworkPtr network,
|
|
|
|
int flags);
|
2007-02-14 16:20:38 +00:00
|
|
|
char * virNetworkGetBridgeName (virNetworkPtr network);
|
2007-02-14 15:37:18 +00:00
|
|
|
|
2007-02-23 08:51:30 +00:00
|
|
|
int virNetworkGetAutostart (virNetworkPtr network,
|
|
|
|
int *autostart);
|
|
|
|
int virNetworkSetAutostart (virNetworkPtr network,
|
|
|
|
int autostart);
|
|
|
|
|
2005-12-08 15:08:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __VIR_VIRLIB_H__ */
|