2005-12-05 11:16:07 +00:00
/*
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-07 10:59:26 +00:00
* Xen domains from a process running in domain 0
2005-12-05 11:16:07 +00:00
*
2006-02-09 17:45:11 +00:00
* Copy : Copyright ( C ) 2005 , 2006 Red Hat , Inc .
2005-12-05 11:16:07 +00:00
*
* See COPYING . LIB for the License of this software
*
2005-12-07 10:59:26 +00:00
* Author : Daniel Veillard < veillard @ redhat . com >
2005-12-05 11:16:07 +00:00
*/
# ifndef __VIR_VIRLIB_H__
# define __VIR_VIRLIB_H__
# 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 ;
2005-12-05 18:14:37 +00:00
/**
* 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-17 16:56:17 +00:00
VIR_DOMAIN_SHUTOFF = 5 , /* the domain is shut off */
2006-01-18 10:37:08 +00:00
VIR_DOMAIN_CRASHED = 6 /* the domain is crashed */
2005-12-05 18:14:37 +00:00
} virDomainState ;
2006-01-13 16:41:01 +00:00
/**
* virDomainRestart :
*
* Flags that determine the action to take on a shutdown or crash of a domain
*/
typedef enum {
VIR_DOMAIN_DESTROY = 1 , /* destroy the domain */
VIR_DOMAIN_RESTART = 2 , /* restart the domain */
VIR_DOMAIN_PRESERVE = 3 , /* keep as is, need manual destroy, for debug */
VIR_DOMAIN_RENAME_RESTART = 4 /* restart under an new unique name */
} virDomainRestart ;
/**
* virDeviceMode :
*
* Flags that determine permission to expose a device to the guest
*/
typedef enum {
VIR_DEVICE_DEFAULT = 0 , /* Default mode */
VIR_DEVICE_RO = 1 , /* Access read-only */
VIR_DEVICE_RW = 2 , /* Access read-write */
VIR_DEVICE_RW_FORCE = 3 /* Forced read-write even if already used */
} virDeviceMode ;
2005-12-05 18:14:37 +00:00
/**
* 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-05 18:14:37 +00:00
*/
typedef struct _virDomainInfo virDomainInfo ;
struct _virDomainInfo {
2006-01-18 10:37:08 +00:00
unsigned char state ; /* the running state, one of virDomainFlags */
2005-12-06 16:50:31 +00:00
unsigned long maxMem ; /* the maximum memory in KBytes allowed */
unsigned long memory ; /* the memory in KBytes used by the domain */
2005-12-06 16:12:49 +00:00
unsigned short nrVirtCpu ; /* the number of virtual CPUs for the domain */
2005-12-06 13:47:40 +00:00
unsigned long long cpuTime ; /* the CPU time used in nanoseconds */
2005-12-05 18:14:37 +00:00
} ;
/**
* virDomainInfoPtr :
*
* a virDomainInfoPtr is a pointer to a virDomainInfo structure .
*/
typedef virDomainInfo * virDomainInfoPtr ;
2006-01-13 16:41:01 +00:00
/**
* virDomainKernel :
*
* a virDomainImage is the set of kernel related informations associated
* to a domain
*/
typedef struct _virDomainKernel virDomainKernel ;
struct _virDomainKernel {
const char * kernel ; /* filename pointing to the kernel image */
const char * ramdisk ; /* an optional init ramdisk */
const char * root ; /* an optional root block device */
const char * extra ; /* optional kernel command line parameters */
} ;
/**
* virDomainKernelPtr :
*
* a virDomainKernelPtr is a pointer to a virDomainKernel structure .
*/
typedef virDomainKernel * virDomainKernelPtr ;
2005-12-05 11:16:07 +00:00
/**
2005-12-16 12:16:41 +00:00
* virDomainCreateFlags :
2005-12-05 11:16:07 +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-05 11:16:07 +00:00
2006-03-29 12:46:03 +00:00
/**
* virNodeInfoPtr :
*
* a virNodeInfo is a structure filled by virNodeGetInfo ( ) and providing
* the informations for the Node .
*/
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 */
} ;
/**
* virNodeInfoPtr :
*
* a virNodeInfoPtr is a pointer to a virNodeInfo structure .
*/
typedef virNodeInfo * virNodeInfoPtr ;
2005-12-08 15:08:46 +00:00
/* library versionning */
/**
* LIBVIR_VERSION_NUMBER :
*
* Macro providing the version of the library as
* version * 1 , 000 , 000 + minor * 1000 + micro
*/
2006-04-10 14:15:33 +00:00
# define LIBVIR_VERSION_NUMBER 1000
2005-12-08 15:08:46 +00:00
int virGetVersion ( unsigned long * libVer ,
const char * type ,
unsigned long * typeVer ) ;
2005-12-05 11:16:07 +00:00
/*
* Connection and disconnections to the Hypervisor
*/
2006-03-27 15:24:36 +00:00
int virInitialize ( void ) ;
2005-12-05 11:16:07 +00:00
virConnectPtr virConnectOpen ( const char * name ) ;
virConnectPtr virConnectOpenReadOnly ( const char * name ) ;
int virConnectClose ( virConnectPtr conn ) ;
2005-12-08 13:26:52 +00:00
const char * virConnectGetType ( virConnectPtr conn ) ;
2005-12-08 15:08:46 +00:00
int virConnectGetVersion ( virConnectPtr conn ,
unsigned long * hvVer ) ;
2006-03-29 12:46:03 +00:00
int virNodeGetInfo ( virConnectPtr conn ,
virNodeInfoPtr info ) ;
2005-12-05 11:16:07 +00:00
/*
* Gather list of running domains
*/
int virConnectListDomains ( virConnectPtr conn ,
int * ids ,
int maxids ) ;
2005-12-07 11:03:24 +00:00
/*
* Number of domains
*/
int virConnectNumOfDomains ( virConnectPtr conn ) ;
2005-12-05 11:16:07 +00:00
/*
* Domain creation and destruction
*/
virDomainPtr virDomainCreateLinux ( virConnectPtr conn ,
2006-02-16 22:50:52 +00:00
const char * xmlDesc ,
2005-12-05 11:16:07 +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 ,
const unsigned char * uuid ) ;
2006-05-29 15:39:31 +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-05 11:16:07 +00:00
int virDomainDestroy ( virDomainPtr domain ) ;
2005-12-08 16:42:56 +00:00
int virDomainFree ( virDomainPtr domain ) ;
2005-12-05 11:16:07 +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 ) ;
2005-12-05 18:14:37 +00:00
/*
* Domain runtime informations
*/
int virDomainGetInfo ( virDomainPtr domain ,
virDomainInfoPtr info ) ;
2005-12-05 11:16:07 +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 ,
unsigned char * uuid ) ;
2006-05-29 15:39:31 +00:00
int virDomainGetUUIDString ( virDomainPtr domain ,
char * buf ) ;
2005-12-16 12:16:41 +00:00
char * virDomainGetOSType ( virDomainPtr domain ) ;
2005-12-05 11:16:07 +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 ) ;
2005-12-16 12:16:41 +00:00
/*
* XML domain description
*/
2006-02-20 17:22:16 +00:00
char * virDomainGetXMLDesc ( virDomainPtr domain ,
int flags ) ;
2005-12-05 11:16:07 +00:00
2006-04-28 18:29:26 +00:00
/*
* defined but not running domains
*/
virDomainPtr virDomainDefineXML ( virConnectPtr conn ,
const char * xml ) ;
int virDomainUndefine ( virDomainPtr domain ) ;
int virConnectListDefinedDomains ( virConnectPtr conn ,
const char * * names ,
int maxnames ) ;
int virDomainCreate ( virDomainPtr domain ) ;
2005-12-05 11:16:07 +00:00
# ifdef __cplusplus
}
# endif
# endif /* __VIR_VIRLIB_H__ */