Module libvirt from libvirt
Provides the interfaces of the libvirt library to handle virtualized domains Copyright (C) 2005-2006, 2010-2013 Red Hat, Inc. 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 License along with this library. If not, see <http://www.gnu.org/licenses/>.
Table of Contents
Macros
#define LIBVIR_VERSION_NUMBER #define VIR_COPY_CPUMAP #define VIR_CPU_MAPLEN #define VIR_CPU_USABLE #define VIR_CPU_USED #define VIR_DOMAIN_BANDWIDTH_IN_AVERAGE #define VIR_DOMAIN_BANDWIDTH_IN_BURST #define VIR_DOMAIN_BANDWIDTH_IN_PEAK #define VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE #define VIR_DOMAIN_BANDWIDTH_OUT_BURST #define VIR_DOMAIN_BANDWIDTH_OUT_PEAK #define VIR_DOMAIN_BLKIO_DEVICE_WEIGHT #define VIR_DOMAIN_BLKIO_FIELD_LENGTH #define VIR_DOMAIN_BLKIO_WEIGHT #define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC #define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC #define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC #define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC #define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC #define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC #define VIR_DOMAIN_BLOCK_STATS_ERRS #define VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH #define VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ #define VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES #define VIR_DOMAIN_BLOCK_STATS_READ_BYTES #define VIR_DOMAIN_BLOCK_STATS_READ_REQ #define VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES #define VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES #define VIR_DOMAIN_BLOCK_STATS_WRITE_REQ #define VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES #define VIR_DOMAIN_CPU_STATS_CPUTIME #define VIR_DOMAIN_CPU_STATS_SYSTEMTIME #define VIR_DOMAIN_CPU_STATS_USERTIME #define VIR_DOMAIN_CPU_STATS_VCPUTIME #define VIR_DOMAIN_EVENT_CALLBACK #define VIR_DOMAIN_JOB_COMPRESSION_BYTES #define VIR_DOMAIN_JOB_COMPRESSION_CACHE #define VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES #define VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW #define VIR_DOMAIN_JOB_COMPRESSION_PAGES #define VIR_DOMAIN_JOB_DATA_PROCESSED #define VIR_DOMAIN_JOB_DATA_REMAINING #define VIR_DOMAIN_JOB_DATA_TOTAL #define VIR_DOMAIN_JOB_DISK_PROCESSED #define VIR_DOMAIN_JOB_DISK_REMAINING #define VIR_DOMAIN_JOB_DISK_TOTAL #define VIR_DOMAIN_JOB_DOWNTIME #define VIR_DOMAIN_JOB_MEMORY_CONSTANT #define VIR_DOMAIN_JOB_MEMORY_NORMAL #define VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES #define VIR_DOMAIN_JOB_MEMORY_PROCESSED #define VIR_DOMAIN_JOB_MEMORY_REMAINING #define VIR_DOMAIN_JOB_MEMORY_TOTAL #define VIR_DOMAIN_JOB_TIME_ELAPSED #define VIR_DOMAIN_JOB_TIME_REMAINING #define VIR_DOMAIN_MEMORY_FIELD_LENGTH #define VIR_DOMAIN_MEMORY_HARD_LIMIT #define VIR_DOMAIN_MEMORY_MIN_GUARANTEE #define VIR_DOMAIN_MEMORY_PARAM_UNLIMITED #define VIR_DOMAIN_MEMORY_SOFT_LIMIT #define VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT #define VIR_DOMAIN_NUMA_MODE #define VIR_DOMAIN_NUMA_NODESET #define VIR_DOMAIN_SCHEDULER_CAP #define VIR_DOMAIN_SCHEDULER_CPU_SHARES #define VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD #define VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA #define VIR_DOMAIN_SCHEDULER_LIMIT #define VIR_DOMAIN_SCHEDULER_RESERVATION #define VIR_DOMAIN_SCHEDULER_SHARES #define VIR_DOMAIN_SCHEDULER_VCPU_PERIOD #define VIR_DOMAIN_SCHEDULER_VCPU_QUOTA #define VIR_DOMAIN_SCHEDULER_WEIGHT #define VIR_DOMAIN_SCHED_FIELD_LENGTH #define VIR_DOMAIN_SEND_KEY_MAX_KEYS #define VIR_GET_CPUMAP #define VIR_NODEINFO_MAXCPUS #define VIR_NODE_CPU_STATS_FIELD_LENGTH #define VIR_NODE_CPU_STATS_IDLE #define VIR_NODE_CPU_STATS_IOWAIT #define VIR_NODE_CPU_STATS_KERNEL #define VIR_NODE_CPU_STATS_USER #define VIR_NODE_CPU_STATS_UTILIZATION #define VIR_NODE_MEMORY_STATS_BUFFERS #define VIR_NODE_MEMORY_STATS_CACHED #define VIR_NODE_MEMORY_STATS_FIELD_LENGTH #define VIR_NODE_MEMORY_STATS_FREE #define VIR_NODE_MEMORY_STATS_TOTAL #define VIR_SECURITY_DOI_BUFLEN #define VIR_SECURITY_LABEL_BUFLEN #define VIR_SECURITY_MODEL_BUFLEN #define VIR_TYPED_PARAM_FIELD_LENGTH #define VIR_UNUSE_CPU #define VIR_USE_CPU #define VIR_UUID_BUFLEN #define VIR_UUID_STRING_BUFLEN #define _virBlkioParameter #define _virMemoryParameter #define _virSchedParameter
Types
typedef struct _virTypedParameter virBlkioParameter typedef virBlkioParameter * virBlkioParameterPtr typedef enum virBlkioParameterType typedef enum virCPUCompareResult typedef struct _virConnect virConnect typedef struct _virConnectAuth virConnectAuth typedef virConnectAuth * virConnectAuthPtr typedef enum virConnectCloseReason typedef struct _virConnectCredential virConnectCredential typedef virConnectCredential * virConnectCredentialPtr typedef enum virConnectCredentialType typedef enum virConnectDomainEventBlockJobStatus typedef enum virConnectDomainEventDiskChangeReason typedef enum virConnectFlags typedef enum virConnectListAllDomainsFlags typedef enum virConnectListAllInterfacesFlags typedef enum virConnectListAllNetworksFlags typedef enum virConnectListAllNodeDeviceFlags typedef enum virConnectListAllSecretsFlags typedef enum virConnectListAllStoragePoolsFlags typedef virConnect * virConnectPtr typedef struct _virDomain virDomain typedef enum virDomainBlockCommitFlags typedef struct _virDomainBlockInfo virDomainBlockInfo typedef virDomainBlockInfo * virDomainBlockInfoPtr typedef enum virDomainBlockJobAbortFlags typedef unsigned long long virDomainBlockJobCursor typedef struct _virDomainBlockJobInfo virDomainBlockJobInfo typedef virDomainBlockJobInfo * virDomainBlockJobInfoPtr typedef enum virDomainBlockJobType typedef enum virDomainBlockRebaseFlags typedef enum virDomainBlockResizeFlags typedef virDomainBlockStatsStruct * virDomainBlockStatsPtr typedef struct _virDomainBlockStats virDomainBlockStatsStruct typedef enum virDomainBlockedReason typedef enum virDomainChannelFlags typedef enum virDomainConsoleFlags typedef struct _virDomainControlInfo virDomainControlInfo typedef virDomainControlInfo * virDomainControlInfoPtr typedef enum virDomainControlState typedef enum virDomainCoreDumpFlags typedef enum virDomainCrashedReason typedef enum virDomainCreateFlags typedef enum virDomainDestroyFlagsValues typedef enum virDomainDeviceModifyFlags typedef struct _virDomainDiskError virDomainDiskError typedef enum virDomainDiskErrorCode typedef virDomainDiskError * virDomainDiskErrorPtr typedef enum virDomainEventDefinedDetailType typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress typedef virDomainEventGraphicsAddress * virDomainEventGraphicsAddressPtr typedef enum virDomainEventGraphicsAddressType typedef enum virDomainEventGraphicsPhase typedef struct _virDomainEventGraphicsSubject virDomainEventGraphicsSubject typedef struct _virDomainEventGraphicsSubjectIdentity virDomainEventGraphicsSubjectIdentity typedef virDomainEventGraphicsSubjectIdentity * virDomainEventGraphicsSubjectIdentityPtr typedef virDomainEventGraphicsSubject * virDomainEventGraphicsSubjectPtr typedef enum virDomainEventID typedef enum virDomainEventIOErrorAction typedef enum virDomainEventPMSuspendedDetailType typedef enum virDomainEventResumedDetailType typedef enum virDomainEventShutdownDetailType typedef enum virDomainEventStartedDetailType typedef enum virDomainEventStoppedDetailType typedef enum virDomainEventSuspendedDetailType typedef enum virDomainEventTrayChangeReason typedef enum virDomainEventType typedef enum virDomainEventUndefinedDetailType typedef enum virDomainEventWatchdogAction typedef struct _virDomainInfo virDomainInfo typedef virDomainInfo * virDomainInfoPtr typedef virDomainInterfaceStatsStruct * virDomainInterfaceStatsPtr typedef struct _virDomainInterfaceStats virDomainInterfaceStatsStruct typedef struct _virDomainJobInfo virDomainJobInfo typedef virDomainJobInfo * virDomainJobInfoPtr typedef enum virDomainJobType typedef enum virDomainMemoryFlags typedef enum virDomainMemoryModFlags typedef virDomainMemoryStatStruct * virDomainMemoryStatPtr typedef struct _virDomainMemoryStat virDomainMemoryStatStruct typedef enum virDomainMemoryStatTags typedef enum virDomainMetadataType typedef enum virDomainMigrateFlags typedef enum virDomainModificationImpact typedef enum virDomainNostateReason typedef enum virDomainNumatuneMemMode typedef enum virDomainOpenGraphicsFlags typedef enum virDomainPMSuspendedDiskReason typedef enum virDomainPMSuspendedReason typedef enum virDomainPausedReason typedef enum virDomainProcessSignal typedef virDomain * virDomainPtr typedef enum virDomainRebootFlagValues typedef enum virDomainRunningReason typedef enum virDomainSaveRestoreFlags typedef enum virDomainShutdownFlagValues typedef enum virDomainShutdownReason typedef enum virDomainShutoffReason typedef struct _virDomainSnapshot virDomainSnapshot typedef enum virDomainSnapshotCreateFlags typedef enum virDomainSnapshotDeleteFlags typedef enum virDomainSnapshotListFlags typedef virDomainSnapshot * virDomainSnapshotPtr typedef enum virDomainSnapshotRevertFlags typedef enum virDomainState typedef enum virDomainUndefineFlagsValues typedef enum virDomainVcpuFlags typedef enum virDomainXMLFlags typedef enum virEventHandleType typedef struct _virInterface virInterface typedef virInterface * virInterfacePtr typedef enum virInterfaceXMLFlags typedef enum virKeycodeSet typedef struct _virTypedParameter virMemoryParameter typedef virMemoryParameter * virMemoryParameterPtr typedef enum virMemoryParameterType typedef struct _virNWFilter virNWFilter typedef virNWFilter * virNWFilterPtr typedef struct _virNetwork virNetwork typedef virNetwork * virNetworkPtr typedef enum virNetworkUpdateCommand typedef enum virNetworkUpdateFlags typedef enum virNetworkUpdateSection typedef enum virNetworkXMLFlags typedef struct _virNodeCPUStats virNodeCPUStats typedef virNodeCPUStats * virNodeCPUStatsPtr typedef struct _virNodeDevice virNodeDevice typedef virNodeDevice * virNodeDevicePtr typedef enum virNodeGetCPUStatsAllCPUs typedef enum virNodeGetMemoryStatsAllCells typedef struct _virNodeInfo virNodeInfo typedef virNodeInfo * virNodeInfoPtr typedef struct _virNodeMemoryStats virNodeMemoryStats typedef virNodeMemoryStats * virNodeMemoryStatsPtr typedef enum virNodeSuspendTarget typedef struct _virTypedParameter virSchedParameter typedef virSchedParameter * virSchedParameterPtr typedef enum virSchedParameterType typedef struct _virSecret virSecret typedef virSecret * virSecretPtr typedef enum virSecretUsageType typedef struct _virSecurityLabel virSecurityLabel typedef virSecurityLabel * virSecurityLabelPtr typedef struct _virSecurityModel virSecurityModel typedef virSecurityModel * virSecurityModelPtr typedef struct _virStoragePool virStoragePool typedef enum virStoragePoolBuildFlags typedef enum virStoragePoolDeleteFlags typedef struct _virStoragePoolInfo virStoragePoolInfo typedef virStoragePoolInfo * virStoragePoolInfoPtr typedef virStoragePool * virStoragePoolPtr typedef enum virStoragePoolState typedef struct _virStorageVol virStorageVol typedef enum virStorageVolCreateFlags typedef enum virStorageVolDeleteFlags typedef struct _virStorageVolInfo virStorageVolInfo typedef virStorageVolInfo * virStorageVolInfoPtr typedef virStorageVol * virStorageVolPtr typedef enum virStorageVolResizeFlags typedef enum virStorageVolType typedef enum virStorageVolWipeAlgorithm typedef enum virStorageXMLFlags typedef struct _virStream virStream typedef enum virStreamEventType typedef enum virStreamFlags typedef virStream * virStreamPtr typedef struct _virTypedParameter virTypedParameter typedef enum virTypedParameterFlags typedef virTypedParameter * virTypedParameterPtr typedef enum virTypedParameterType typedef struct _virVcpuInfo virVcpuInfo typedef virVcpuInfo * virVcpuInfoPtr typedef enum virVcpuState
Functions
typedef virConnectAuthCallbackPtr int virConnectAuthCallbackPtr (virConnectCredentialPtr cred,
unsigned int ncred,
void * cbdata) char * virConnectBaselineCPU (virConnectPtr conn,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags) int virConnectClose (virConnectPtr conn) typedef virConnectCloseFunc void virConnectCloseFunc (virConnectPtr conn,
int reason,
void * opaque) int virConnectCompareCPU (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) typedef virConnectDomainEventBalloonChangeCallback void virConnectDomainEventBalloonChangeCallback (virConnectPtr conn,
virDomainPtr dom,
unsigned long long actual,
void * opaque) typedef virConnectDomainEventBlockJobCallback void virConnectDomainEventBlockJobCallback (virConnectPtr conn,
virDomainPtr dom,
const char * disk,
int type,
int status,
void * opaque) typedef virConnectDomainEventCallback int virConnectDomainEventCallback (virConnectPtr conn,
virDomainPtr dom,
int event,
int detail,
void * opaque) int virConnectDomainEventDeregister (virConnectPtr conn,
virConnectDomainEventCallback cb) int virConnectDomainEventDeregisterAny (virConnectPtr conn,
int callbackID) typedef virConnectDomainEventDiskChangeCallback void virConnectDomainEventDiskChangeCallback (virConnectPtr conn,
virDomainPtr dom,
const char * oldSrcPath,
const char * newSrcPath,
const char * devAlias,
int reason,
void * opaque) typedef virConnectDomainEventGenericCallback void virConnectDomainEventGenericCallback (virConnectPtr conn,
virDomainPtr dom,
void * opaque) typedef virConnectDomainEventGraphicsCallback void virConnectDomainEventGraphicsCallback (virConnectPtr conn,
virDomainPtr dom,
int phase,
virDomainEventGraphicsAddressPtr local,
virDomainEventGraphicsAddressPtr remote,
const char * authScheme,
virDomainEventGraphicsSubjectPtr subject,
void * opaque) typedef virConnectDomainEventIOErrorCallback void virConnectDomainEventIOErrorCallback (virConnectPtr conn,
virDomainPtr dom,
const char * srcPath,
const char * devAlias,
int action,
void * opaque) typedef virConnectDomainEventIOErrorReasonCallback void virConnectDomainEventIOErrorReasonCallback (virConnectPtr conn,
virDomainPtr dom,
const char * srcPath,
const char * devAlias,
int action,
const char * reason,
void * opaque) typedef virConnectDomainEventPMSuspendCallback void virConnectDomainEventPMSuspendCallback (virConnectPtr conn,
virDomainPtr dom,
int reason,
void * opaque) typedef virConnectDomainEventPMSuspendDiskCallback void virConnectDomainEventPMSuspendDiskCallback (virConnectPtr conn,
virDomainPtr dom,
int reason,
void * opaque) typedef virConnectDomainEventPMWakeupCallback void virConnectDomainEventPMWakeupCallback (virConnectPtr conn,
virDomainPtr dom,
int reason,
void * opaque) typedef virConnectDomainEventRTCChangeCallback void virConnectDomainEventRTCChangeCallback (virConnectPtr conn,
virDomainPtr dom,
long long utcoffset,
void * opaque) int virConnectDomainEventRegister (virConnectPtr conn,
virConnectDomainEventCallback cb,
void * opaque,
virFreeCallback freecb) int virConnectDomainEventRegisterAny (virConnectPtr conn,
virDomainPtr dom,
int eventID,
virConnectDomainEventGenericCallback cb,
void * opaque,
virFreeCallback freecb) typedef virConnectDomainEventTrayChangeCallback void virConnectDomainEventTrayChangeCallback (virConnectPtr conn,
virDomainPtr dom,
const char * devAlias,
int reason,
void * opaque) typedef virConnectDomainEventWatchdogCallback void virConnectDomainEventWatchdogCallback (virConnectPtr conn,
virDomainPtr dom,
int action,
void * opaque) char * virConnectDomainXMLFromNative (virConnectPtr conn,
const char * nativeFormat,
const char * nativeConfig,
unsigned int flags) char * virConnectDomainXMLToNative (virConnectPtr conn,
const char * nativeFormat,
const char * domainXml,
unsigned int flags) char * virConnectFindStoragePoolSources (virConnectPtr conn,
const char * type,
const char * srcSpec,
unsigned int flags) char * virConnectGetCapabilities (virConnectPtr conn) char * virConnectGetHostname (virConnectPtr conn) int virConnectGetLibVersion (virConnectPtr conn,
unsigned long * libVer) int virConnectGetMaxVcpus (virConnectPtr conn,
const char * type) char * virConnectGetSysinfo (virConnectPtr conn,
unsigned int flags) const char * virConnectGetType (virConnectPtr conn) char * virConnectGetURI (virConnectPtr conn) int virConnectGetVersion (virConnectPtr conn,
unsigned long * hvVer) int virConnectIsAlive (virConnectPtr conn) int virConnectIsEncrypted (virConnectPtr conn) int virConnectIsSecure (virConnectPtr conn) int virConnectListAllDomains (virConnectPtr conn,
virDomainPtr ** domains,
unsigned int flags) int virConnectListAllInterfaces (virConnectPtr conn,
virInterfacePtr ** ifaces,
unsigned int flags) int virConnectListAllNWFilters (virConnectPtr conn,
virNWFilterPtr ** filters,
unsigned int flags) int virConnectListAllNetworks (virConnectPtr conn,
virNetworkPtr ** nets,
unsigned int flags) int virConnectListAllNodeDevices (virConnectPtr conn,
virNodeDevicePtr ** devices,
unsigned int flags) int virConnectListAllSecrets (virConnectPtr conn,
virSecretPtr ** secrets,
unsigned int flags) int virConnectListAllStoragePools (virConnectPtr conn,
virStoragePoolPtr ** pools,
unsigned int flags) int virConnectListDefinedDomains (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDefinedInterfaces (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDefinedNetworks (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDefinedStoragePools (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListDomains (virConnectPtr conn,
int * ids,
int maxids) int virConnectListInterfaces (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListNWFilters (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListNetworks (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectListSecrets (virConnectPtr conn,
char ** uuids,
int maxuuids) int virConnectListStoragePools (virConnectPtr conn,
char ** const names,
int maxnames) int virConnectNumOfDefinedDomains (virConnectPtr conn) int virConnectNumOfDefinedInterfaces (virConnectPtr conn) int virConnectNumOfDefinedNetworks (virConnectPtr conn) int virConnectNumOfDefinedStoragePools (virConnectPtr conn) int virConnectNumOfDomains (virConnectPtr conn) int virConnectNumOfInterfaces (virConnectPtr conn) int virConnectNumOfNWFilters (virConnectPtr conn) int virConnectNumOfNetworks (virConnectPtr conn) int virConnectNumOfSecrets (virConnectPtr conn) int virConnectNumOfStoragePools (virConnectPtr conn) virConnectPtr virConnectOpen (const char * name) virConnectPtr virConnectOpenAuth (const char * name,
virConnectAuthPtr auth,
unsigned int flags) virConnectPtr virConnectOpenReadOnly (const char * name) int virConnectRef (virConnectPtr conn) int virConnectRegisterCloseCallback (virConnectPtr conn,
virConnectCloseFunc cb,
void * opaque,
virFreeCallback freecb) int virConnectSetKeepAlive (virConnectPtr conn,
int interval,
unsigned int count) int virConnectUnregisterCloseCallback (virConnectPtr conn,
virConnectCloseFunc cb) int virDomainAbortJob (virDomainPtr domain) int virDomainAttachDevice (virDomainPtr domain,
const char * xml) int virDomainAttachDeviceFlags (virDomainPtr domain,
const char * xml,
unsigned int flags) int virDomainBlockCommit (virDomainPtr dom,
const char * disk,
const char * base,
const char * top,
unsigned long bandwidth,
unsigned int flags) int virDomainBlockJobAbort (virDomainPtr dom,
const char * disk,
unsigned int flags) int virDomainBlockJobSetSpeed (virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
unsigned int flags) int virDomainBlockPeek (virDomainPtr dom,
const char * disk,
unsigned long long offset,
size_t size,
void * buffer,
unsigned int flags) int virDomainBlockPull (virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
unsigned int flags) int virDomainBlockRebase (virDomainPtr dom,
const char * disk,
const char * base,
unsigned long bandwidth,
unsigned int flags) int virDomainBlockResize (virDomainPtr dom,
const char * disk,
unsigned long long size,
unsigned int flags) int virDomainBlockStats (virDomainPtr dom,
const char * disk,
virDomainBlockStatsPtr stats,
size_t size) int virDomainBlockStatsFlags (virDomainPtr dom,
const char * disk,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) int virDomainCoreDump (virDomainPtr domain,
const char * to,
unsigned int flags) int virDomainCreate (virDomainPtr domain) virDomainPtr virDomainCreateLinux (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) int virDomainCreateWithFlags (virDomainPtr domain,
unsigned int flags) virDomainPtr virDomainCreateXML (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) virDomainPtr virDomainDefineXML (virConnectPtr conn,
const char * xml) int virDomainDestroy (virDomainPtr domain) int virDomainDestroyFlags (virDomainPtr domain,
unsigned int flags) int virDomainDetachDevice (virDomainPtr domain,
const char * xml) int virDomainDetachDeviceFlags (virDomainPtr domain,
const char * xml,
unsigned int flags) int virDomainFSTrim (virDomainPtr dom,
const char * mountPoint,
unsigned long long minimum,
unsigned int flags) int virDomainFree (virDomainPtr domain) int virDomainGetAutostart (virDomainPtr domain,
int * autostart) int virDomainGetBlkioParameters (virDomainPtr domain,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) int virDomainGetBlockInfo (virDomainPtr domain,
const char * disk,
virDomainBlockInfoPtr info,
unsigned int flags) int virDomainGetBlockIoTune (virDomainPtr dom,
const char * disk,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) int virDomainGetBlockJobInfo (virDomainPtr dom,
const char * disk,
virDomainBlockJobInfoPtr info,
unsigned int flags) int virDomainGetCPUStats (virDomainPtr domain,
virTypedParameterPtr params,
unsigned int nparams,
int start_cpu,
unsigned int ncpus,
unsigned int flags) virConnectPtr virDomainGetConnect (virDomainPtr dom) int virDomainGetControlInfo (virDomainPtr domain,
virDomainControlInfoPtr info,
unsigned int flags) int virDomainGetDiskErrors (virDomainPtr dom,
virDomainDiskErrorPtr errors,
unsigned int maxerrors,
unsigned int flags) int virDomainGetEmulatorPinInfo (virDomainPtr domain,
unsigned char * cpumap,
int maplen,
unsigned int flags) char * virDomainGetHostname (virDomainPtr domain,
unsigned int flags) unsigned int virDomainGetID (virDomainPtr domain) int virDomainGetInfo (virDomainPtr domain,
virDomainInfoPtr info) int virDomainGetInterfaceParameters (virDomainPtr domain,
const char * device,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) int virDomainGetJobInfo (virDomainPtr domain,
virDomainJobInfoPtr info) int virDomainGetJobStats (virDomainPtr domain,
int * type,
virTypedParameterPtr * params,
int * nparams,
unsigned int flags) unsigned long virDomainGetMaxMemory (virDomainPtr domain) int virDomainGetMaxVcpus (virDomainPtr domain) int virDomainGetMemoryParameters (virDomainPtr domain,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) char * virDomainGetMetadata (virDomainPtr domain,
int type,
const char * uri,
unsigned int flags) const char * virDomainGetName (virDomainPtr domain) int virDomainGetNumaParameters (virDomainPtr domain,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) char * virDomainGetOSType (virDomainPtr domain) int virDomainGetSchedulerParameters (virDomainPtr domain,
virTypedParameterPtr params,
int * nparams) int virDomainGetSchedulerParametersFlags (virDomainPtr domain,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) char * virDomainGetSchedulerType (virDomainPtr domain,
int * nparams) int virDomainGetSecurityLabel (virDomainPtr domain,
virSecurityLabelPtr seclabel) int virDomainGetSecurityLabelList (virDomainPtr domain,
virSecurityLabelPtr * seclabels) int virDomainGetState (virDomainPtr domain,
int * state,
int * reason,
unsigned int flags) int virDomainGetUUID (virDomainPtr domain,
unsigned char * uuid) int virDomainGetUUIDString (virDomainPtr domain,
char * buf) int virDomainGetVcpuPinInfo (virDomainPtr domain,
int ncpumaps,
unsigned char * cpumaps,
int maplen,
unsigned int flags) int virDomainGetVcpus (virDomainPtr domain,
virVcpuInfoPtr info,
int maxinfo,
unsigned char * cpumaps,
int maplen) int virDomainGetVcpusFlags (virDomainPtr domain,
unsigned int flags) char * virDomainGetXMLDesc (virDomainPtr domain,
unsigned int flags) int virDomainHasCurrentSnapshot (virDomainPtr domain,
unsigned int flags) int virDomainHasManagedSaveImage (virDomainPtr dom,
unsigned int flags) int virDomainInjectNMI (virDomainPtr domain,
unsigned int flags) int virDomainInterfaceStats (virDomainPtr dom,
const char * path,
virDomainInterfaceStatsPtr stats,
size_t size) int virDomainIsActive (virDomainPtr dom) int virDomainIsPersistent (virDomainPtr dom) int virDomainIsUpdated (virDomainPtr dom) int virDomainListAllSnapshots (virDomainPtr domain,
virDomainSnapshotPtr ** snaps,
unsigned int flags) virDomainPtr virDomainLookupByID (virConnectPtr conn,
int id) virDomainPtr virDomainLookupByName (virConnectPtr conn,
const char * name) virDomainPtr virDomainLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virDomainPtr virDomainLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) int virDomainManagedSave (virDomainPtr dom,
unsigned int flags) int virDomainManagedSaveRemove (virDomainPtr dom,
unsigned int flags) int virDomainMemoryPeek (virDomainPtr dom,
unsigned long long start,
size_t size,
void * buffer,
unsigned int flags) int virDomainMemoryStats (virDomainPtr dom,
virDomainMemoryStatPtr stats,
unsigned int nr_stats,
unsigned int flags) virDomainPtr virDomainMigrate (virDomainPtr domain,
virConnectPtr dconn,
unsigned long flags,
const char * dname,
const char * uri,
unsigned long bandwidth) virDomainPtr virDomainMigrate2 (virDomainPtr domain,
virConnectPtr dconn,
const char * dxml,
unsigned long flags,
const char * dname,
const char * uri,
unsigned long bandwidth) int virDomainMigrateGetCompressionCache (virDomainPtr domain,
unsigned long long * cacheSize,
unsigned int flags) int virDomainMigrateGetMaxSpeed (virDomainPtr domain,
unsigned long * bandwidth,
unsigned int flags) int virDomainMigrateSetCompressionCache (virDomainPtr domain,
unsigned long long cacheSize,
unsigned int flags) int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
unsigned long long downtime,
unsigned int flags) int virDomainMigrateSetMaxSpeed (virDomainPtr domain,
unsigned long bandwidth,
unsigned int flags) int virDomainMigrateToURI (virDomainPtr domain,
const char * duri,
unsigned long flags,
const char * dname,
unsigned long bandwidth) int virDomainMigrateToURI2 (virDomainPtr domain,
const char * dconnuri,
const char * miguri,
const char * dxml,
unsigned long flags,
const char * dname,
unsigned long bandwidth) int virDomainOpenChannel (virDomainPtr dom,
const char * name,
virStreamPtr st,
unsigned int flags) int virDomainOpenConsole (virDomainPtr dom,
const char * dev_name,
virStreamPtr st,
unsigned int flags) int virDomainOpenGraphics (virDomainPtr dom,
unsigned int idx,
int fd,
unsigned int flags) int virDomainPMSuspendForDuration (virDomainPtr dom,
unsigned int target,
unsigned long long duration,
unsigned int flags) int virDomainPMWakeup (virDomainPtr dom,
unsigned int flags) int virDomainPinEmulator (virDomainPtr domain,
unsigned char * cpumap,
int maplen,
unsigned int flags) int virDomainPinVcpu (virDomainPtr domain,
unsigned int vcpu,
unsigned char * cpumap,
int maplen) int virDomainPinVcpuFlags (virDomainPtr domain,
unsigned int vcpu,
unsigned char * cpumap,
int maplen,
unsigned int flags) int virDomainReboot (virDomainPtr domain,
unsigned int flags) int virDomainRef (virDomainPtr domain) int virDomainReset (virDomainPtr domain,
unsigned int flags) int virDomainRestore (virConnectPtr conn,
const char * from) int virDomainRestoreFlags (virConnectPtr conn,
const char * from,
const char * dxml,
unsigned int flags) int virDomainResume (virDomainPtr domain) int virDomainRevertToSnapshot (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSave (virDomainPtr domain,
const char * to) int virDomainSaveFlags (virDomainPtr domain,
const char * to,
const char * dxml,
unsigned int flags) int virDomainSaveImageDefineXML (virConnectPtr conn,
const char * file,
const char * dxml,
unsigned int flags) char * virDomainSaveImageGetXMLDesc (virConnectPtr conn,
const char * file,
unsigned int flags) char * virDomainScreenshot (virDomainPtr domain,
virStreamPtr stream,
unsigned int screen,
unsigned int flags) int virDomainSendKey (virDomainPtr domain,
unsigned int codeset,
unsigned int holdtime,
unsigned int * keycodes,
int nkeycodes,
unsigned int flags) int virDomainSendProcessSignal (virDomainPtr domain,
long long pid_value,
unsigned int signum,
unsigned int flags) int virDomainSetAutostart (virDomainPtr domain,
int autostart) int virDomainSetBlkioParameters (virDomainPtr domain,
virTypedParameterPtr params,
int nparams,
unsigned int flags) int virDomainSetBlockIoTune (virDomainPtr dom,
const char * disk,
virTypedParameterPtr params,
int nparams,
unsigned int flags) int virDomainSetInterfaceParameters (virDomainPtr domain,
const char * device,
virTypedParameterPtr params,
int nparams,
unsigned int flags) int virDomainSetMaxMemory (virDomainPtr domain,
unsigned long memory) int virDomainSetMemory (virDomainPtr domain,
unsigned long memory) int virDomainSetMemoryFlags (virDomainPtr domain,
unsigned long memory,
unsigned int flags) int virDomainSetMemoryParameters (virDomainPtr domain,
virTypedParameterPtr params,
int nparams,
unsigned int flags) int virDomainSetMetadata (virDomainPtr domain,
int type,
const char * metadata,
const char * key,
const char * uri,
unsigned int flags) int virDomainSetNumaParameters (virDomainPtr domain,
virTypedParameterPtr params,
int nparams,
unsigned int flags) int virDomainSetSchedulerParameters (virDomainPtr domain,
virTypedParameterPtr params,
int nparams) int virDomainSetSchedulerParametersFlags (virDomainPtr domain,
virTypedParameterPtr params,
int nparams,
unsigned int flags) int virDomainSetVcpus (virDomainPtr domain,
unsigned int nvcpus) int virDomainSetVcpusFlags (virDomainPtr domain,
unsigned int nvcpus,
unsigned int flags) int virDomainShutdown (virDomainPtr domain) int virDomainShutdownFlags (virDomainPtr domain,
unsigned int flags) virDomainSnapshotPtr virDomainSnapshotCreateXML (virDomainPtr domain,
const char * xmlDesc,
unsigned int flags) virDomainSnapshotPtr virDomainSnapshotCurrent (virDomainPtr domain,
unsigned int flags) int virDomainSnapshotDelete (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSnapshotFree (virDomainSnapshotPtr snapshot) virConnectPtr virDomainSnapshotGetConnect (virDomainSnapshotPtr snapshot) virDomainPtr virDomainSnapshotGetDomain (virDomainSnapshotPtr snapshot) const char * virDomainSnapshotGetName (virDomainSnapshotPtr snapshot) virDomainSnapshotPtr virDomainSnapshotGetParent (virDomainSnapshotPtr snapshot,
unsigned int flags) char * virDomainSnapshotGetXMLDesc (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSnapshotHasMetadata (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSnapshotIsCurrent (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSnapshotListAllChildren (virDomainSnapshotPtr snapshot,
virDomainSnapshotPtr ** snaps,
unsigned int flags) int virDomainSnapshotListChildrenNames (virDomainSnapshotPtr snapshot,
char ** names,
int nameslen,
unsigned int flags) int virDomainSnapshotListNames (virDomainPtr domain,
char ** names,
int nameslen,
unsigned int flags) virDomainSnapshotPtr virDomainSnapshotLookupByName (virDomainPtr domain,
const char * name,
unsigned int flags) int virDomainSnapshotNum (virDomainPtr domain,
unsigned int flags) int virDomainSnapshotNumChildren (virDomainSnapshotPtr snapshot,
unsigned int flags) int virDomainSnapshotRef (virDomainSnapshotPtr snapshot) int virDomainSuspend (virDomainPtr domain) int virDomainUndefine (virDomainPtr domain) int virDomainUndefineFlags (virDomainPtr domain,
unsigned int flags) int virDomainUpdateDeviceFlags (virDomainPtr domain,
const char * xml,
unsigned int flags) int virEventAddHandle (int fd,
int events,
virEventHandleCallback cb,
void * opaque,
virFreeCallback ff) typedef virEventAddHandleFunc int virEventAddHandleFunc (int fd,
int event,
virEventHandleCallback cb,
void * opaque,
virFreeCallback ff) int virEventAddTimeout (int timeout,
virEventTimeoutCallback cb,
void * opaque,
virFreeCallback ff) typedef virEventAddTimeoutFunc int virEventAddTimeoutFunc (int timeout,
virEventTimeoutCallback cb,
void * opaque,
virFreeCallback ff) typedef virEventHandleCallback void virEventHandleCallback (int watch,
int fd,
int events,
void * opaque) int virEventRegisterDefaultImpl (void) void virEventRegisterImpl (virEventAddHandleFunc addHandle,
virEventUpdateHandleFunc updateHandle,
virEventRemoveHandleFunc removeHandle,
virEventAddTimeoutFunc addTimeout,
virEventUpdateTimeoutFunc updateTimeout,
virEventRemoveTimeoutFunc removeTimeout) int virEventRemoveHandle (int watch) typedef virEventRemoveHandleFunc int virEventRemoveHandleFunc (int watch) int virEventRemoveTimeout (int timer) typedef virEventRemoveTimeoutFunc int virEventRemoveTimeoutFunc (int timer) int virEventRunDefaultImpl (void) typedef virEventTimeoutCallback void virEventTimeoutCallback (int timer,
void * opaque) void virEventUpdateHandle (int watch,
int events) typedef virEventUpdateHandleFunc void virEventUpdateHandleFunc (int watch,
int event) void virEventUpdateTimeout (int timer,
int timeout) typedef virEventUpdateTimeoutFunc void virEventUpdateTimeoutFunc (int timer,
int timeout) typedef virFreeCallback void virFreeCallback (void * opaque) int virGetVersion (unsigned long * libVer,
const char * type,
unsigned long * typeVer) int virInitialize (void) int virInterfaceChangeBegin (virConnectPtr conn,
unsigned int flags) int virInterfaceChangeCommit (virConnectPtr conn,
unsigned int flags) int virInterfaceChangeRollback (virConnectPtr conn,
unsigned int flags) int virInterfaceCreate (virInterfacePtr iface,
unsigned int flags) virInterfacePtr virInterfaceDefineXML (virConnectPtr conn,
const char * xml,
unsigned int flags) int virInterfaceDestroy (virInterfacePtr iface,
unsigned int flags) int virInterfaceFree (virInterfacePtr iface) virConnectPtr virInterfaceGetConnect (virInterfacePtr iface) const char * virInterfaceGetMACString (virInterfacePtr iface) const char * virInterfaceGetName (virInterfacePtr iface) char * virInterfaceGetXMLDesc (virInterfacePtr iface,
unsigned int flags) int virInterfaceIsActive (virInterfacePtr iface) virInterfacePtr virInterfaceLookupByMACString (virConnectPtr conn,
const char * macstr) virInterfacePtr virInterfaceLookupByName (virConnectPtr conn,
const char * name) int virInterfaceRef (virInterfacePtr iface) int virInterfaceUndefine (virInterfacePtr iface) virNWFilterPtr virNWFilterDefineXML (virConnectPtr conn,
const char * xmlDesc) int virNWFilterFree (virNWFilterPtr nwfilter) const char * virNWFilterGetName (virNWFilterPtr nwfilter) int virNWFilterGetUUID (virNWFilterPtr nwfilter,
unsigned char * uuid) int virNWFilterGetUUIDString (virNWFilterPtr nwfilter,
char * buf) char * virNWFilterGetXMLDesc (virNWFilterPtr nwfilter,
unsigned int flags) virNWFilterPtr virNWFilterLookupByName (virConnectPtr conn,
const char * name) virNWFilterPtr virNWFilterLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virNWFilterPtr virNWFilterLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) int virNWFilterRef (virNWFilterPtr nwfilter) int virNWFilterUndefine (virNWFilterPtr nwfilter) int virNetworkCreate (virNetworkPtr network) virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
const char * xmlDesc) virNetworkPtr virNetworkDefineXML (virConnectPtr conn,
const char * xml) int virNetworkDestroy (virNetworkPtr network) int virNetworkFree (virNetworkPtr network) int virNetworkGetAutostart (virNetworkPtr network,
int * autostart) char * virNetworkGetBridgeName (virNetworkPtr network) virConnectPtr virNetworkGetConnect (virNetworkPtr net) const char * virNetworkGetName (virNetworkPtr network) int virNetworkGetUUID (virNetworkPtr network,
unsigned char * uuid) int virNetworkGetUUIDString (virNetworkPtr network,
char * buf) char * virNetworkGetXMLDesc (virNetworkPtr network,
unsigned int flags) int virNetworkIsActive (virNetworkPtr net) int virNetworkIsPersistent (virNetworkPtr net) virNetworkPtr virNetworkLookupByName (virConnectPtr conn,
const char * name) virNetworkPtr virNetworkLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virNetworkPtr virNetworkLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) int virNetworkRef (virNetworkPtr network) int virNetworkSetAutostart (virNetworkPtr network,
int autostart) int virNetworkUndefine (virNetworkPtr network) int virNetworkUpdate (virNetworkPtr network,
unsigned int command,
unsigned int section,
int parentIndex,
const char * xml,
unsigned int flags) virNodeDevicePtr virNodeDeviceCreateXML (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) int virNodeDeviceDestroy (virNodeDevicePtr dev) int virNodeDeviceDetachFlags (virNodeDevicePtr dev,
const char * driverName,
unsigned int flags) int virNodeDeviceDettach (virNodeDevicePtr dev) int virNodeDeviceFree (virNodeDevicePtr dev) const char * virNodeDeviceGetName (virNodeDevicePtr dev) const char * virNodeDeviceGetParent (virNodeDevicePtr dev) char * virNodeDeviceGetXMLDesc (virNodeDevicePtr dev,
unsigned int flags) int virNodeDeviceListCaps (virNodeDevicePtr dev,
char ** const names,
int maxnames) virNodeDevicePtr virNodeDeviceLookupByName (virConnectPtr conn,
const char * name) virNodeDevicePtr virNodeDeviceLookupSCSIHostByWWN (virConnectPtr conn,
const char * wwnn,
const char * wwpn,
unsigned int flags) int virNodeDeviceNumOfCaps (virNodeDevicePtr dev) int virNodeDeviceReAttach (virNodeDevicePtr dev) int virNodeDeviceRef (virNodeDevicePtr dev) int virNodeDeviceReset (virNodeDevicePtr dev) int virNodeGetCPUMap (virConnectPtr conn,
unsigned char ** cpumap,
unsigned int * online,
unsigned int flags) int virNodeGetCPUStats (virConnectPtr conn,
int cpuNum,
virNodeCPUStatsPtr params,
int * nparams,
unsigned int flags) int virNodeGetCellsFreeMemory (virConnectPtr conn,
unsigned long long * freeMems,
int startCell,
int maxCells) unsigned long long virNodeGetFreeMemory (virConnectPtr conn) int virNodeGetInfo (virConnectPtr conn,
virNodeInfoPtr info) int virNodeGetMemoryParameters (virConnectPtr conn,
virTypedParameterPtr params,
int * nparams,
unsigned int flags) int virNodeGetMemoryStats (virConnectPtr conn,
int cellNum,
virNodeMemoryStatsPtr params,
int * nparams,
unsigned int flags) int virNodeGetSecurityModel (virConnectPtr conn,
virSecurityModelPtr secmodel) int virNodeListDevices (virConnectPtr conn,
const char * cap,
char ** const names,
int maxnames,
unsigned int flags) int virNodeNumOfDevices (virConnectPtr conn,
const char * cap,
unsigned int flags) int virNodeSetMemoryParameters (virConnectPtr conn,
virTypedParameterPtr params,
int nparams,
unsigned int flags) int virNodeSuspendForDuration (virConnectPtr conn,
unsigned int target,
unsigned long long duration,
unsigned int flags) virSecretPtr virSecretDefineXML (virConnectPtr conn,
const char * xml,
unsigned int flags) int virSecretFree (virSecretPtr secret) virConnectPtr virSecretGetConnect (virSecretPtr secret) int virSecretGetUUID (virSecretPtr secret,
unsigned char * uuid) int virSecretGetUUIDString (virSecretPtr secret,
char * buf) const char * virSecretGetUsageID (virSecretPtr secret) int virSecretGetUsageType (virSecretPtr secret) unsigned char * virSecretGetValue (virSecretPtr secret,
size_t * value_size,
unsigned int flags) char * virSecretGetXMLDesc (virSecretPtr secret,
unsigned int flags) virSecretPtr virSecretLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virSecretPtr virSecretLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) virSecretPtr virSecretLookupByUsage (virConnectPtr conn,
int usageType,
const char * usageID) int virSecretRef (virSecretPtr secret) int virSecretSetValue (virSecretPtr secret,
const unsigned char * value,
size_t value_size,
unsigned int flags) int virSecretUndefine (virSecretPtr secret) int virStoragePoolBuild (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolCreate (virStoragePoolPtr pool,
unsigned int flags) virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn,
const char * xmlDesc,
unsigned int flags) virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn,
const char * xml,
unsigned int flags) int virStoragePoolDelete (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolDestroy (virStoragePoolPtr pool) int virStoragePoolFree (virStoragePoolPtr pool) int virStoragePoolGetAutostart (virStoragePoolPtr pool,
int * autostart) virConnectPtr virStoragePoolGetConnect (virStoragePoolPtr pool) int virStoragePoolGetInfo (virStoragePoolPtr pool,
virStoragePoolInfoPtr info) const char * virStoragePoolGetName (virStoragePoolPtr pool) int virStoragePoolGetUUID (virStoragePoolPtr pool,
unsigned char * uuid) int virStoragePoolGetUUIDString (virStoragePoolPtr pool,
char * buf) char * virStoragePoolGetXMLDesc (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolIsActive (virStoragePoolPtr pool) int virStoragePoolIsPersistent (virStoragePoolPtr pool) int virStoragePoolListAllVolumes (virStoragePoolPtr pool,
virStorageVolPtr ** vols,
unsigned int flags) int virStoragePoolListVolumes (virStoragePoolPtr pool,
char ** const names,
int maxnames) virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn,
const char * name) virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn,
const unsigned char * uuid) virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn,
const char * uuidstr) virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) int virStoragePoolRef (virStoragePoolPtr pool) int virStoragePoolRefresh (virStoragePoolPtr pool,
unsigned int flags) int virStoragePoolSetAutostart (virStoragePoolPtr pool,
int autostart) int virStoragePoolUndefine (virStoragePoolPtr pool) virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool,
const char * xmlDesc,
unsigned int flags) virStorageVolPtr virStorageVolCreateXMLFrom (virStoragePoolPtr pool,
const char * xmlDesc,
virStorageVolPtr clonevol,
unsigned int flags) int virStorageVolDelete (virStorageVolPtr vol,
unsigned int flags) int virStorageVolDownload (virStorageVolPtr vol,
virStreamPtr stream,
unsigned long long offset,
unsigned long long length,
unsigned int flags) int virStorageVolFree (virStorageVolPtr vol) virConnectPtr virStorageVolGetConnect (virStorageVolPtr vol) int virStorageVolGetInfo (virStorageVolPtr vol,
virStorageVolInfoPtr info) const char * virStorageVolGetKey (virStorageVolPtr vol) const char * virStorageVolGetName (virStorageVolPtr vol) char * virStorageVolGetPath (virStorageVolPtr vol) char * virStorageVolGetXMLDesc (virStorageVolPtr vol,
unsigned int flags) virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn,
const char * key) virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool,
const char * name) virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn,
const char * path) int virStorageVolRef (virStorageVolPtr vol) int virStorageVolResize (virStorageVolPtr vol,
unsigned long long capacity,
unsigned int flags) int virStorageVolUpload (virStorageVolPtr vol,
virStreamPtr stream,
unsigned long long offset,
unsigned long long length,
unsigned int flags) int virStorageVolWipe (virStorageVolPtr vol,
unsigned int flags) int virStorageVolWipePattern (virStorageVolPtr vol,
unsigned int algorithm,
unsigned int flags) int virStreamAbort (virStreamPtr stream) int virStreamEventAddCallback (virStreamPtr stream,
int events,
virStreamEventCallback cb,
void * opaque,
virFreeCallback ff) typedef virStreamEventCallback void virStreamEventCallback (virStreamPtr stream,
int events,
void * opaque) int virStreamEventRemoveCallback (virStreamPtr stream) int virStreamEventUpdateCallback (virStreamPtr stream,
int events) int virStreamFinish (virStreamPtr stream) int virStreamFree (virStreamPtr stream) virStreamPtr virStreamNew (virConnectPtr conn,
unsigned int flags) int virStreamRecv (virStreamPtr stream,
char * data,
size_t nbytes) int virStreamRecvAll (virStreamPtr stream,
virStreamSinkFunc handler,
void * opaque) int virStreamRef (virStreamPtr stream) int virStreamSend (virStreamPtr stream,
const char * data,
size_t nbytes) int virStreamSendAll (virStreamPtr stream,
virStreamSourceFunc handler,
void * opaque) typedef virStreamSinkFunc int virStreamSinkFunc (virStreamPtr st,
const char * data,
size_t nbytes,
void * opaque) typedef virStreamSourceFunc int virStreamSourceFunc (virStreamPtr st,
char * data,
size_t nbytes,
void * opaque) int virTypedParamsAddBoolean (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int value) int virTypedParamsAddDouble (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
double value) int virTypedParamsAddFromString (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int type,
const char * value) int virTypedParamsAddInt (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int value) int virTypedParamsAddLLong (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
long long value) int virTypedParamsAddString (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
const char * value) int virTypedParamsAddUInt (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
unsigned int value) int virTypedParamsAddULLong (virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
unsigned long long value) void virTypedParamsClear (virTypedParameterPtr params,
int nparams) void virTypedParamsFree (virTypedParameterPtr params,
int nparams) virTypedParameterPtr virTypedParamsGet (virTypedParameterPtr params,
int nparams,
const char * name) int virTypedParamsGetBoolean (virTypedParameterPtr params,
int nparams,
const char * name,
int * value) int virTypedParamsGetDouble (virTypedParameterPtr params,
int nparams,
const char * name,
double * value) int virTypedParamsGetInt (virTypedParameterPtr params,
int nparams,
const char * name,
int * value) int virTypedParamsGetLLong (virTypedParameterPtr params,
int nparams,
const char * name,
long long * value) int virTypedParamsGetString (virTypedParameterPtr params,
int nparams,
const char * name,
const char ** value) int virTypedParamsGetUInt (virTypedParameterPtr params,
int nparams,
const char * name,
unsigned int * value) int virTypedParamsGetULLong (virTypedParameterPtr params,
int nparams,
const char * name,
unsigned long long * value)
Description
Macros
LIBVIR_VERSION_NUMBER
0.0.1
#define LIBVIR_VERSION_NUMBER
Macro providing the version of the library as version * 1,000,000 + minor * 1000 + micro
VIR_COPY_CPUMAP
0.1.4
#define VIR_COPY_CPUMAP
This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_COPY_CPUMAP macro extracts the cpumap of the specified vcpu from cpumaps array and copies it into cpumap to be used later by virDomainPinVcpu() API.
VIR_CPU_MAPLEN
0.1.4
#define VIR_CPU_MAPLEN
This macro is to be used in conjunction 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.
VIR_CPU_USABLE
0.1.4
#define VIR_CPU_USABLE
This macro is to be used in conjunction with virDomainGetVcpus() API. VIR_CPU_USABLE macro returns a non-zero value (true) if the cpu is usable by the vcpu, and 0 otherwise.
VIR_CPU_USED
1.0.0
#define VIR_CPU_USED
This macro can be used in conjunction with virNodeGetCPUMap() API. It returns non-zero if the bit of the related CPU is set.
VIR_DOMAIN_BANDWIDTH_IN_AVERAGE
0.9.9
#define VIR_DOMAIN_BANDWIDTH_IN_AVERAGE
Macro represents the inbound average of NIC bandwidth, as a uint.
VIR_DOMAIN_BANDWIDTH_IN_BURST
0.9.9
#define VIR_DOMAIN_BANDWIDTH_IN_BURST
Macro represents the inbound burst of NIC bandwidth, as a uint.
VIR_DOMAIN_BANDWIDTH_IN_PEAK
0.9.9
#define VIR_DOMAIN_BANDWIDTH_IN_PEAK
Macro represents the inbound peak of NIC bandwidth, as a uint.
VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE
0.9.9
#define VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE
Macro represents the outbound average of NIC bandwidth, as a uint.
VIR_DOMAIN_BANDWIDTH_OUT_BURST
0.9.9
#define VIR_DOMAIN_BANDWIDTH_OUT_BURST
Macro represents the outbound burst of NIC bandwidth, as a uint.
VIR_DOMAIN_BANDWIDTH_OUT_PEAK
0.9.9
#define VIR_DOMAIN_BANDWIDTH_OUT_PEAK
Macro represents the outbound peak of NIC bandwidth, as a uint.
VIR_DOMAIN_BLKIO_DEVICE_WEIGHT
0.9.8
#define VIR_DOMAIN_BLKIO_DEVICE_WEIGHT
Macro for the blkio tunable weight_device: it represents the per-device weight, as a string. The string is parsed as a series of /path/to/device,weight elements, separated by ','.
VIR_DOMAIN_BLKIO_FIELD_LENGTH
0.9.0
#define VIR_DOMAIN_BLKIO_FIELD_LENGTH
Macro providing the field length of virBlkioParameter. Provided for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the preferred value since 0.9.2.
VIR_DOMAIN_BLKIO_WEIGHT
0.9.0
#define VIR_DOMAIN_BLKIO_WEIGHT
Macro for the Blkio tunable weight: it represents the io weight the guest can use, as a uint.
VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC
0.9.8
#define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC
Macro for the BlockIoTune tunable weight: it repersents the read bytes per second permitted through a block device, as a ullong.
VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC
0.9.8
#define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC
Macro for the BlockIoTune tunable weight: it repersents the read I/O operations per second permitted through a block device, as a ullong.
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC
0.9.8
#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC
Macro for the BlockIoTune tunable weight: it represents the total bytes per second permitted through a block device, as a ullong.
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC
0.9.8
#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC
Macro for the BlockIoTune tunable weight: it repersents the total I/O operations per second permitted through a block device, as a ullong.
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC
0.9.8
#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC
Macro for the BlockIoTune tunable weight: it repersents the write bytes per second permitted through a block device, as a ullong.
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC
0.9.8
#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC
Macro for the BlockIoTune tunable weight: it repersents the write I/O operations per second permitted through a block device, as a ullong.
VIR_DOMAIN_BLOCK_STATS_ERRS
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_ERRS
In Xen this returns the mysterious 'oo_req', as an llong.
VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH
Macro providing the field length of parameter names when using virDomainBlockStatsFlags().
VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ
Macro represents the total flush requests of the block device, as an llong.
VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES
Macro represents the total time spend on cache flushing in nano-seconds of the block device, as an llong.
VIR_DOMAIN_BLOCK_STATS_READ_BYTES
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_READ_BYTES
Macro represents the total number of read bytes of the block device, as an llong.
VIR_DOMAIN_BLOCK_STATS_READ_REQ
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_READ_REQ
Macro represents the total read requests of the block device, as an llong.
VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES
Macro represents the total time spend on cache reads in nano-seconds of the block device, as an llong.
VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES
Macro represents the total number of write bytes of the block device, as an llong.
VIR_DOMAIN_BLOCK_STATS_WRITE_REQ
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_WRITE_REQ
Macro represents the total write requests of the block device, as an llong.
VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES
0.9.5
#define VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES
Macro represents the total time spend on cache writes in nano-seconds of the block device, as an llong.
VIR_DOMAIN_CPU_STATS_CPUTIME
0.9.10
#define VIR_DOMAIN_CPU_STATS_CPUTIME
cpu usage (sum of both vcpu and hypervisor usage) in nanoseconds, as a ullong
VIR_DOMAIN_CPU_STATS_SYSTEMTIME
0.9.11
#define VIR_DOMAIN_CPU_STATS_SYSTEMTIME
cpu time charged to system instructions in nanoseconds, as a ullong
VIR_DOMAIN_CPU_STATS_USERTIME
0.9.11
#define VIR_DOMAIN_CPU_STATS_USERTIME
cpu time charged to user instructions in nanoseconds, as a ullong
VIR_DOMAIN_CPU_STATS_VCPUTIME
0.9.13
#define VIR_DOMAIN_CPU_STATS_VCPUTIME
vcpu usage in nanoseconds (cpu_time excluding hypervisor time), as a ullong
VIR_DOMAIN_EVENT_CALLBACK
0.8.0
#define VIR_DOMAIN_EVENT_CALLBACK
Used to cast the event specific callback into the generic one for use for virDomainEventRegister
VIR_DOMAIN_JOB_COMPRESSION_BYTES
1.0.3
#define VIR_DOMAIN_JOB_COMPRESSION_BYTES
virDomainGetJobStats field: number of compressed bytes transferred since the beginning of migration, as VIR_TYPED_PARAM_ULLONG.
VIR_DOMAIN_JOB_COMPRESSION_CACHE
1.0.3
#define VIR_DOMAIN_JOB_COMPRESSION_CACHE
virDomainGetJobStats field: size of the cache (in bytes) used for compressing repeatedly transferred memory pages during live migration, as VIR_TYPED_PARAM_ULLONG.
VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES
1.0.3
#define VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES
virDomainGetJobStats field: number of repeatedly changing pages that were not found in compression cache and thus could not be compressed, as VIR_TYPED_PARAM_ULLONG.
VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW
1.0.3
#define VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW
virDomainGetJobStats field: number of repeatedly changing pages that were found in compression cache but were sent uncompressed because the result of compression was larger than the original page as a whole, as VIR_TYPED_PARAM_ULLONG.
VIR_DOMAIN_JOB_COMPRESSION_PAGES
1.0.3
#define VIR_DOMAIN_JOB_COMPRESSION_PAGES
virDomainGetJobStats field: number of compressed pages transferred since the beginning of migration, as VIR_TYPED_PARAM_ULLONG.
VIR_DOMAIN_JOB_DATA_PROCESSED
1.0.3
#define VIR_DOMAIN_JOB_DATA_PROCESSED
virDomainGetJobStats field: number of bytes transferred from the beginning of the job, as VIR_TYPED_PARAM_ULLONG. This field corresponds to dataProcessed field in virDomainJobInfo.
VIR_DOMAIN_JOB_DATA_REMAINING
1.0.3
#define VIR_DOMAIN_JOB_DATA_REMAINING
virDomainGetJobStats field: number of bytes that still need to be transferred, as VIR_TYPED_PARAM_ULLONG. This field corresponds to dataRemaining field in virDomainJobInfo.
VIR_DOMAIN_JOB_DATA_TOTAL
1.0.3
#define VIR_DOMAIN_JOB_DATA_TOTAL
virDomainGetJobStats field: total number of bytes supposed to be transferred, as VIR_TYPED_PARAM_ULLONG. For VIR_DOMAIN_JOB_UNBOUNDED jobs, this may be less than the sum of VIR_DOMAIN_JOB_DATA_PROCESSED and VIR_DOMAIN_JOB_DATA_REMAINING in the event that the hypervisor has to repeat some data, e.g., due to dirtied pages during migration. For VIR_DOMAIN_JOB_BOUNDED jobs, VIR_DOMAIN_JOB_DATA_TOTAL shall always equal VIR_DOMAIN_JOB_DATA_PROCESSED + VIR_DOMAIN_JOB_DATA_REMAINING. This field corresponds to dataTotal field in virDomainJobInfo.
VIR_DOMAIN_JOB_DISK_PROCESSED
1.0.3
#define VIR_DOMAIN_JOB_DISK_PROCESSED
virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_PROCESSED but only tracking guest disk progress, as VIR_TYPED_PARAM_ULLONG. This field corresponds to fileProcessed field in virDomainJobInfo.
VIR_DOMAIN_JOB_DISK_REMAINING
1.0.3
#define VIR_DOMAIN_JOB_DISK_REMAINING
virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_REMAINING but only tracking guest disk progress, as VIR_TYPED_PARAM_ULLONG. This field corresponds to fileRemaining field in virDomainJobInfo.
VIR_DOMAIN_JOB_DISK_TOTAL
1.0.3
#define VIR_DOMAIN_JOB_DISK_TOTAL
virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_TOTAL but only tracking guest disk progress, as VIR_TYPED_PARAM_ULLONG. This field corresponds to fileTotal field in virDomainJobInfo.
VIR_DOMAIN_JOB_DOWNTIME
1.0.3
#define VIR_DOMAIN_JOB_DOWNTIME
virDomainGetJobStats field: downtime (ms) that is expected to happen during migration, as VIR_TYPED_PARAM_ULLONG.
VIR_DOMAIN_JOB_MEMORY_CONSTANT
1.0.3
#define VIR_DOMAIN_JOB_MEMORY_CONSTANT
virDomainGetJobStats field: number of pages filled with a constant byte (all bytes in a single page are identical) transferred since the beginning of the migration job, as VIR_TYPED_PARAM_ULLONG. The most common example of such pages are zero pages, i.e., pages filled with zero bytes.
VIR_DOMAIN_JOB_MEMORY_NORMAL
1.0.3
#define VIR_DOMAIN_JOB_MEMORY_NORMAL
virDomainGetJobStats field: number of pages that were transferred without any kind of compression (i.e., pages which were not filled with a constant byte and which could not be compressed) transferred since the beginning of the migration job, as VIR_TYPED_PARAM_ULLONG.
VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES
1.0.3
#define VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES
virDomainGetJobStats field: number of bytes transferred as normal pages, as VIR_TYPED_PARAM_ULLONG. See VIR_DOMAIN_JOB_MEMORY_NORMAL for more details.
VIR_DOMAIN_JOB_MEMORY_PROCESSED
1.0.3
#define VIR_DOMAIN_JOB_MEMORY_PROCESSED
virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_PROCESSED but only tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG. This field corresponds to memProcessed field in virDomainJobInfo.
VIR_DOMAIN_JOB_MEMORY_REMAINING
1.0.3
#define VIR_DOMAIN_JOB_MEMORY_REMAINING
virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_REMAINING but only tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG. This field corresponds to memRemaining field in virDomainJobInfo.
VIR_DOMAIN_JOB_MEMORY_TOTAL
1.0.3
#define VIR_DOMAIN_JOB_MEMORY_TOTAL
virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_TOTAL but only tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG. This field corresponds to memTotal field in virDomainJobInfo.
VIR_DOMAIN_JOB_TIME_ELAPSED
1.0.3
#define VIR_DOMAIN_JOB_TIME_ELAPSED
virDomainGetJobStats field: time (ms) since the beginning of the job, as VIR_TYPED_PARAM_ULLONG. This field corresponds to timeElapsed field in virDomainJobInfo.
VIR_DOMAIN_JOB_TIME_REMAINING
1.0.3
#define VIR_DOMAIN_JOB_TIME_REMAINING
virDomainGetJobStats field: remaining time (ms) for VIR_DOMAIN_JOB_BOUNDED jobs, as VIR_TYPED_PARAM_ULLONG. This field corresponds to timeRemaining field in virDomainJobInfo.
VIR_DOMAIN_MEMORY_FIELD_LENGTH
0.8.5
#define VIR_DOMAIN_MEMORY_FIELD_LENGTH
Macro providing the field length of virMemoryParameter. Provided for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the preferred value since 0.9.2.
VIR_DOMAIN_MEMORY_HARD_LIMIT
0.8.5
#define VIR_DOMAIN_MEMORY_HARD_LIMIT
Macro for the memory tunable hard_limit: it represents the maximum memory the guest can use, as a ullong.
VIR_DOMAIN_MEMORY_MIN_GUARANTEE
0.8.5
#define VIR_DOMAIN_MEMORY_MIN_GUARANTEE
Macro for the memory tunable min_guarantee: it represents the minimum memory guaranteed to be reserved for the guest, as a ullong.
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED
0.8.8
#define VIR_DOMAIN_MEMORY_PARAM_UNLIMITED
Macro providing the virMemoryParameter value that indicates "unlimited"
VIR_DOMAIN_MEMORY_SOFT_LIMIT
0.8.5
#define VIR_DOMAIN_MEMORY_SOFT_LIMIT
Macro for the memory tunable soft_limit: it represents the memory upper limit enforced during memory contention, as a ullong.
VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT
0.8.5
#define VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT
Macro for the swap tunable swap_hard_limit: it represents the maximum swap plus memory the guest can use, as a ullong. This limit has to be more than VIR_DOMAIN_MEMORY_HARD_LIMIT.
VIR_DOMAIN_NUMA_MODE
0.9.9
#define VIR_DOMAIN_NUMA_MODE
Macro for typed parameter name that lists the numa mode of a domain, as an int containing a virDomainNumatuneMemMode value.
VIR_DOMAIN_NUMA_NODESET
0.9.9
#define VIR_DOMAIN_NUMA_NODESET
Macro for typed parameter name that lists the numa nodeset of a domain, as a string.
VIR_DOMAIN_SCHEDULER_CAP
0.9.7
#define VIR_DOMAIN_SCHEDULER_CAP
Macro represents the maximum scheduler cap, when using the credit scheduler, as a uint.
VIR_DOMAIN_SCHEDULER_CPU_SHARES
0.9.7
#define VIR_DOMAIN_SCHEDULER_CPU_SHARES
Macro represents proportional weight of the scheduler used on the host cpu, when using the posix scheduler, as a ullong.
VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD
0.10.0
#define VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD
Macro represents the enforcement period for a quota in microseconds, when using the posix scheduler, for all emulator activity not tied to vcpus, as a ullong.
VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA
0.10.0
#define VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA
Macro represents the maximum bandwidth to be used within a period for all emulator activity not tied to vcpus, when using the posix scheduler, as an llong.
VIR_DOMAIN_SCHEDULER_LIMIT
0.9.7
#define VIR_DOMAIN_SCHEDULER_LIMIT
Macro represents the scheduler limit value, when using the allocation scheduler, as an llong.
VIR_DOMAIN_SCHEDULER_RESERVATION
0.9.7
#define VIR_DOMAIN_SCHEDULER_RESERVATION
Macro represents the scheduler reservation value, when using the allocation scheduler, as an llong.
VIR_DOMAIN_SCHEDULER_SHARES
0.9.7
#define VIR_DOMAIN_SCHEDULER_SHARES
Macro represents the scheduler shares value, when using the allocation scheduler, as an int.
VIR_DOMAIN_SCHEDULER_VCPU_PERIOD
0.9.7
#define VIR_DOMAIN_SCHEDULER_VCPU_PERIOD
Macro represents the enforcement period for a quota, in microseconds, for vcpus only, when using the posix scheduler, as a ullong.
VIR_DOMAIN_SCHEDULER_VCPU_QUOTA
0.9.7
#define VIR_DOMAIN_SCHEDULER_VCPU_QUOTA
Macro represents the maximum bandwidth to be used within a period for vcpus only, when using the posix scheduler, as an llong.
VIR_DOMAIN_SCHEDULER_WEIGHT
0.9.7
#define VIR_DOMAIN_SCHEDULER_WEIGHT
Macro represents the relative weight, when using the credit scheduler, as a uint.
VIR_DOMAIN_SCHED_FIELD_LENGTH
0.2.3
#define VIR_DOMAIN_SCHED_FIELD_LENGTH
Macro providing the field length of virSchedParameter. Provided for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the preferred value since 0.9.2.
VIR_DOMAIN_SEND_KEY_MAX_KEYS
0.9.3
#define VIR_DOMAIN_SEND_KEY_MAX_KEYS
Maximum number of keycodes that can be sent in one virDomainSendKey() call.
VIR_GET_CPUMAP
0.1.4
#define VIR_GET_CPUMAP
This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_GET_CPUMAP macro returns a pointer to the cpumap of the specified vcpu from cpumaps array.
VIR_NODEINFO_MAXCPUS
0.1.4
#define VIR_NODEINFO_MAXCPUS
This macro is to calculate the total number of CPUs supported but not necessary active in the host.
VIR_NODE_CPU_STATS_FIELD_LENGTH
0.9.3
#define VIR_NODE_CPU_STATS_FIELD_LENGTH
Macro providing the field length of virNodeCPUStats
VIR_NODE_CPU_STATS_IDLE
0.9.3
#define VIR_NODE_CPU_STATS_IDLE
The cumulative idle CPU time, since the node booting up (in nanoseconds).
VIR_NODE_CPU_STATS_IOWAIT
0.9.3
#define VIR_NODE_CPU_STATS_IOWAIT
The cumulative I/O wait CPU time, since the node booting up (in nanoseconds).
VIR_NODE_CPU_STATS_KERNEL
0.9.3
#define VIR_NODE_CPU_STATS_KERNEL
Macro for the cumulative CPU time which was spent by the kernel, since the node booting up (in nanoseconds).
VIR_NODE_CPU_STATS_USER
0.9.3
#define VIR_NODE_CPU_STATS_USER
The cumulative CPU time which was spent by user processes, since the node booting up (in nanoseconds).
VIR_NODE_CPU_STATS_UTILIZATION
0.9.3
#define VIR_NODE_CPU_STATS_UTILIZATION
The CPU utilization of a node. The usage value is in percent and 100% represents all CPUs of the node.
VIR_NODE_MEMORY_STATS_BUFFERS
0.9.3
#define VIR_NODE_MEMORY_STATS_BUFFERS
Macro for the buffer memory: On Linux, it is only returned in case of VIR_NODE_MEMORY_STATS_ALL_CELLS.
VIR_NODE_MEMORY_STATS_CACHED
0.9.3
#define VIR_NODE_MEMORY_STATS_CACHED
Macro for the cached memory: On Linux, it is only returned in case of VIR_NODE_MEMORY_STATS_ALL_CELLS.
VIR_NODE_MEMORY_STATS_FIELD_LENGTH
0.9.3
#define VIR_NODE_MEMORY_STATS_FIELD_LENGTH
Macro providing the field length of virNodeMemoryStats
VIR_NODE_MEMORY_STATS_FREE
0.9.3
#define VIR_NODE_MEMORY_STATS_FREE
Macro for the free memory of specified cell: On Linux, it includes buffer and cached memory, in case of VIR_NODE_MEMORY_STATS_ALL_CELLS.
VIR_NODE_MEMORY_STATS_TOTAL
0.9.3
#define VIR_NODE_MEMORY_STATS_TOTAL
Macro for the total memory of specified cell: it represents the maximum memory.
VIR_SECURITY_DOI_BUFLEN
0.6.1
#define VIR_SECURITY_DOI_BUFLEN
Macro providing the maximum length of the virSecurityModel doi string.
VIR_SECURITY_LABEL_BUFLEN
0.6.1
#define VIR_SECURITY_LABEL_BUFLEN
Macro providing the maximum length of the virSecurityLabel label string. Note that this value is based on that used by Labeled NFS.
VIR_SECURITY_MODEL_BUFLEN
0.6.1
#define VIR_SECURITY_MODEL_BUFLEN
Macro providing the maximum length of the virSecurityModel model string.
VIR_TYPED_PARAM_FIELD_LENGTH
0.9.2
#define VIR_TYPED_PARAM_FIELD_LENGTH
Macro providing the field length of virTypedParameter name
VIR_UNUSE_CPU
0.1.4
#define VIR_UNUSE_CPU
This macro is to be used in conjunction with virDomainPinVcpu() API. It resets the bit (CPU not usable) of the related cpu in cpumap.
VIR_USE_CPU
0.1.4
#define VIR_USE_CPU
This macro is to be used in conjunction with virDomainPinVcpu() API. It sets the bit (CPU usable) of the related cpu in cpumap.
VIR_UUID_BUFLEN
0.2.0
#define VIR_UUID_BUFLEN
This macro provides the length of the buffer required for virDomainGetUUID()
VIR_UUID_STRING_BUFLEN
0.2.0
#define VIR_UUID_STRING_BUFLEN
This macro provides the length of the buffer required for virDomainGetUUIDString()
_virBlkioParameter
0.9.2
#define _virBlkioParameter
_virMemoryParameter
0.9.2
#define _virMemoryParameter
_virSchedParameter
0.9.2
#define _virSchedParameter
Types
virBlkioParameter
0.9.0
struct virBlkioParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH] | field | parameter name | ||||||||||||||||||||
int | type | parameter type, virTypedParameterType | ||||||||||||||||||||
union { | ||||||||||||||||||||||
| ||||||||||||||||||||||
} | value | parameter value |
}
virBlkioParameterType
0.9.0
enum virBlkioParameterType {
VIR_DOMAIN_BLKIO_PARAM_BOOLEAN | = | VIR_TYPED_PARAM_BOOLEAN |
VIR_DOMAIN_BLKIO_PARAM_DOUBLE | = | VIR_TYPED_PARAM_DOUBLE |
VIR_DOMAIN_BLKIO_PARAM_INT | = | VIR_TYPED_PARAM_INT |
VIR_DOMAIN_BLKIO_PARAM_LLONG | = | VIR_TYPED_PARAM_LLONG |
VIR_DOMAIN_BLKIO_PARAM_UINT | = | VIR_TYPED_PARAM_UINT |
VIR_DOMAIN_BLKIO_PARAM_ULLONG | = | VIR_TYPED_PARAM_ULLONG |
}
virCPUCompareResult
0.7.5
enum virCPUCompareResult {
VIR_CPU_COMPARE_ERROR | = | -1 |
VIR_CPU_COMPARE_INCOMPATIBLE | = | 0 |
VIR_CPU_COMPARE_IDENTICAL | = | 1 |
VIR_CPU_COMPARE_SUPERSET | = | 2 |
VIR_CPU_COMPARE_LAST | = | 3 |
}
virConnect
0.0.1
struct virConnect {
}
virConnectAuth
0.4.0
struct virConnectAuth {
int * | credtype | List of supported virConnectCredentialType values |
unsigned int | ncredtype | |
virConnectAuthCallbackPtr | cb | Callback used to collect credentials |
void * | cbdata |
}
virConnectCloseReason
0.10.0
enum virConnectCloseReason {
VIR_CONNECT_CLOSE_REASON_ERROR | = | 0 | Misc I/O error |
VIR_CONNECT_CLOSE_REASON_EOF | = | 1 | End-of-file from server |
VIR_CONNECT_CLOSE_REASON_KEEPALIVE | = | 2 | Keepalive timer triggered |
VIR_CONNECT_CLOSE_REASON_CLIENT | = | 3 | Client requested it |
VIR_CONNECT_CLOSE_REASON_LAST | = | 4 |
}
virConnectCredential
0.4.0
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 |
}
virConnectCredentialType
0.4.0
enum virConnectCredentialType {
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 |
VIR_CRED_LAST | = | 10 | More may be added - expect the unexpected |
}
virConnectDomainEventBlockJobStatus
0.9.4
enum virConnectDomainEventBlockJobStatus {
VIR_DOMAIN_BLOCK_JOB_COMPLETED | = | 0 |
VIR_DOMAIN_BLOCK_JOB_FAILED | = | 1 |
VIR_DOMAIN_BLOCK_JOB_CANCELED | = | 2 |
VIR_DOMAIN_BLOCK_JOB_READY | = | 3 |
VIR_DOMAIN_BLOCK_JOB_LAST | = | 4 |
}
virConnectDomainEventDiskChangeReason
0.9.7
enum virConnectDomainEventDiskChangeReason {
VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START | = | 0 | oldSrcPath is set |
VIR_DOMAIN_EVENT_DISK_CHANGE_LAST | = | 1 |
}
virConnectFlags
0.4.0
enum virConnectFlags {
VIR_CONNECT_RO | = | 1 | A readonly connection |
VIR_CONNECT_NO_ALIASES | = | 2 | Don't try to resolve URI aliases |
}
virConnectListAllDomainsFlags
0.9.13
enum virConnectListAllDomainsFlags {
}
virConnectListAllInterfacesFlags
0.10.2
enum virConnectListAllInterfacesFlags {
VIR_CONNECT_LIST_INTERFACES_INACTIVE | = | 1 |
VIR_CONNECT_LIST_INTERFACES_ACTIVE | = | 2 |
}
virConnectListAllNetworksFlags
0.10.2
enum virConnectListAllNetworksFlags {
}
virConnectListAllNodeDeviceFlags
0.10.2
enum virConnectListAllNodeDeviceFlags {
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM | = | 1 | System capability |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV | = | 2 | PCI device |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV | = | 4 | USB device |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE | = | 8 | USB interface |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET | = | 16 | Network device |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST | = | 32 | SCSI Host Bus Adapter |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET | = | 64 | SCSI Target |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI | = | 128 | SCSI device |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE | = | 256 | Storage device |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST | = | 512 | FC Host Bus Adapter |
VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS | = | 1024 | Capable of vport |
}
virConnectListAllSecretsFlags
0.10.2
enum virConnectListAllSecretsFlags {
VIR_CONNECT_LIST_SECRETS_EPHEMERAL | = | 1 | kept in memory, never stored persistently |
VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL | = | 2 | |
VIR_CONNECT_LIST_SECRETS_PRIVATE | = | 4 | not revealed to any caller of libvirt, nor to any other node |
VIR_CONNECT_LIST_SECRETS_NO_PRIVATE | = | 8 |
}
virConnectListAllStoragePoolsFlags
0.10.2
enum virConnectListAllStoragePoolsFlags {
}
virDomain
0.0.1
struct virDomain {
}
virDomainBlockCommitFlags
0.10.2
enum virDomainBlockCommitFlags {
VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | = | 1 | NULL base means next backing file, not whole chain |
VIR_DOMAIN_BLOCK_COMMIT_DELETE | = | 2 | Delete any files that are now invalid after their contents have been committed |
}
virDomainBlockInfo
0.8.2
struct virDomainBlockInfo {
unsigned long long | capacity | logical size in bytes of the block device backing image |
unsigned long long | allocation | highest allocated extent in bytes of the block device backing image |
unsigned long long | physical | physical size in bytes of the container of the backing image |
}
virDomainBlockJobAbortFlags
0.9.12
enum virDomainBlockJobAbortFlags {
VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC | = | 1 |
VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT | = | 2 |
}
virDomainBlockJobInfo
0.9.4
struct virDomainBlockJobInfo {
virDomainBlockJobType | type | |
unsigned long | bandwidth | The following fields provide an indication of block job progress. @cur indicates the current position and will be between 0 and @end. @end is the final cursor position for this operation and represents completion. To approximate progress, divide @cur by @end. |
virDomainBlockJobCursor | cur | |
virDomainBlockJobCursor | end |
}
virDomainBlockJobType
0.9.4
enum virDomainBlockJobType {
VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN | = | 0 |
VIR_DOMAIN_BLOCK_JOB_TYPE_PULL | = | 1 |
VIR_DOMAIN_BLOCK_JOB_TYPE_COPY | = | 2 |
VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT | = | 3 |
VIR_DOMAIN_BLOCK_JOB_TYPE_LAST | = | 4 |
}
virDomainBlockRebaseFlags
0.9.12
enum virDomainBlockRebaseFlags {
VIR_DOMAIN_BLOCK_REBASE_SHALLOW | = | 1 | Limit copy to top of source backing chain |
VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT | = | 2 | Reuse existing external file for a copy |
VIR_DOMAIN_BLOCK_REBASE_COPY_RAW | = | 4 | Make destination file raw |
VIR_DOMAIN_BLOCK_REBASE_COPY | = | 8 | Start a copy job |
}
virDomainBlockResizeFlags
0.9.11
virDomainBlockStatsStruct
0.3.3
struct virDomainBlockStatsStruct {
long long | rd_req | number of read requests |
long long | rd_bytes | number of read bytes |
long long | wr_req | number of write requests |
long long | wr_bytes | number of written bytes |
long long | errs | In Xen this returns the mysterious 'oo_req'. |
}
virDomainBlockedReason
0.9.2
enum virDomainBlockedReason {
VIR_DOMAIN_BLOCKED_UNKNOWN | = | 0 | the reason is unknown |
VIR_DOMAIN_BLOCKED_LAST | = | 1 |
}
virDomainChannelFlags
1.0.2
enum virDomainChannelFlags {
VIR_DOMAIN_CHANNEL_FORCE | = | 1 | abort a (possibly) active channel connection to force a new connection |
}
virDomainConsoleFlags
0.9.11
enum virDomainConsoleFlags {
VIR_DOMAIN_CONSOLE_FORCE | = | 1 | abort a (possibly) active console connection to force a new connection |
VIR_DOMAIN_CONSOLE_SAFE | = | 2 | check if the console driver supports safe console operations |
}
virDomainControlInfo
0.9.3
struct virDomainControlInfo {
unsigned int | state | control state, one of virDomainControlState |
unsigned int | details | state details, currently 0 |
unsigned long long | stateTime | for how long (in msec) control interface has been in current state (except for OK and ERROR states) |
}
virDomainControlState
0.9.3
enum virDomainControlState {
VIR_DOMAIN_CONTROL_OK | = | 0 | operational, ready to accept commands |
VIR_DOMAIN_CONTROL_JOB | = | 1 | background job is running (can be monitored by virDomainGetJobInfo); only limited set of commands may be allowed |
VIR_DOMAIN_CONTROL_OCCUPIED | = | 2 | occupied by a running command |
VIR_DOMAIN_CONTROL_ERROR | = | 3 | unusable, domain cannot be fully operated |
VIR_DOMAIN_CONTROL_LAST | = | 4 |
}
virDomainCoreDumpFlags
0.7.5
enum virDomainCoreDumpFlags {
VIR_DUMP_CRASH | = | 1 | crash after dump |
VIR_DUMP_LIVE | = | 2 | live dump |
VIR_DUMP_BYPASS_CACHE | = | 4 | avoid file system cache pollution |
VIR_DUMP_RESET | = | 8 | reset domain after dump finishes |
VIR_DUMP_MEMORY_ONLY | = | 16 | use dump-guest-memory |
}
virDomainCrashedReason
0.9.2
enum virDomainCrashedReason {
VIR_DOMAIN_CRASHED_UNKNOWN | = | 0 | crashed for unknown reason |
VIR_DOMAIN_CRASHED_LAST | = | 1 |
}
virDomainCreateFlags
0.0.1
enum virDomainCreateFlags {
VIR_DOMAIN_NONE | = | 0 | Default behavior |
VIR_DOMAIN_START_PAUSED | = | 1 | Launch guest in paused state |
VIR_DOMAIN_START_AUTODESTROY | = | 2 | Automatically kill guest when virConnectPtr is closed |
VIR_DOMAIN_START_BYPASS_CACHE | = | 4 | Avoid file system cache pollution |
VIR_DOMAIN_START_FORCE_BOOT | = | 8 | Boot, discarding any managed save |
}
virDomainDestroyFlagsValues
0.9.10
enum virDomainDestroyFlagsValues {
VIR_DOMAIN_DESTROY_DEFAULT | = | 0 | Default behavior - could lead to data loss!! |
VIR_DOMAIN_DESTROY_GRACEFUL | = | 1 | only SIGTERM, no SIGKILL |
}
virDomainDeviceModifyFlags
0.7.7
enum virDomainDeviceModifyFlags {
VIR_DOMAIN_DEVICE_MODIFY_CONFIG | = | VIR_DOMAIN_AFFECT_CONFIG | Additionally, these flags may be bitwise-OR'd in. |
VIR_DOMAIN_DEVICE_MODIFY_CURRENT | = | VIR_DOMAIN_AFFECT_CURRENT | |
VIR_DOMAIN_DEVICE_MODIFY_LIVE | = | VIR_DOMAIN_AFFECT_LIVE | |
VIR_DOMAIN_DEVICE_MODIFY_FORCE | = | 4 | Forcibly modify device (ex. force eject a cdrom) |
}
virDomainDiskError
0.9.10
virDomainDiskErrorCode
0.9.10
enum virDomainDiskErrorCode {
VIR_DOMAIN_DISK_ERROR_NONE | = | 0 | no error |
VIR_DOMAIN_DISK_ERROR_UNSPEC | = | 1 | unspecified I/O error |
VIR_DOMAIN_DISK_ERROR_NO_SPACE | = | 2 | no space left on the device |
VIR_DOMAIN_DISK_ERROR_LAST | = | 3 |
}
virDomainEventDefinedDetailType
0.5.0
enum virDomainEventDefinedDetailType {
VIR_DOMAIN_EVENT_DEFINED_ADDED | = | 0 | Newly created config file |
VIR_DOMAIN_EVENT_DEFINED_UPDATED | = | 1 | Changed config file |
VIR_DOMAIN_EVENT_DEFINED_LAST | = | 2 |
}
virDomainEventGraphicsAddress
0.8.0
struct virDomainEventGraphicsAddress {
int | family | Address family, virDomainEventGraphicsAddressType |
const char * | node | Address of node (eg IP address, or UNIX path) |
const char * | service | Service name/number (eg TCP port, or NULL) |
}
virDomainEventGraphicsAddressType
0.8.0
enum virDomainEventGraphicsAddressType {
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4 | = | 1 | IPv4 address |
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6 | = | 2 | IPv6 address |
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX | = | 3 | UNIX socket path |
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST | = | 4 |
}
virDomainEventGraphicsPhase
0.8.0
enum virDomainEventGraphicsPhase {
VIR_DOMAIN_EVENT_GRAPHICS_CONNECT | = | 0 | Initial socket connection established |
VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE | = | 1 | Authentication & setup completed |
VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT | = | 2 | Final socket disconnection |
VIR_DOMAIN_EVENT_GRAPHICS_LAST | = | 3 |
}
virDomainEventGraphicsSubject
0.8.0
struct virDomainEventGraphicsSubject {
int | nidentity | Number of identities in arra |
virDomainEventGraphicsSubjectIdentityPtr | identities | Array of identities for subject |
}
virDomainEventGraphicsSubjectIdentity
0.8.0
struct virDomainEventGraphicsSubjectIdentity {
const char * | type | Type of identity |
const char * | name | Identity value |
}
virDomainEventID
0.8.0
enum virDomainEventID {
VIR_DOMAIN_EVENT_ID_LIFECYCLE | = | 0 | |
VIR_DOMAIN_EVENT_ID_REBOOT | = | 1 | |
VIR_DOMAIN_EVENT_ID_RTC_CHANGE | = | 2 | |
VIR_DOMAIN_EVENT_ID_WATCHDOG | = | 3 | |
VIR_DOMAIN_EVENT_ID_IO_ERROR | = | 4 | |
VIR_DOMAIN_EVENT_ID_GRAPHICS | = | 5 | |
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON | = | 6 | |
VIR_DOMAIN_EVENT_ID_CONTROL_ERROR | = | 7 | |
VIR_DOMAIN_EVENT_ID_BLOCK_JOB | = | 8 | |
VIR_DOMAIN_EVENT_ID_DISK_CHANGE | = | 9 | |
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE | = | 10 | |
VIR_DOMAIN_EVENT_ID_PMWAKEUP | = | 11 | |
VIR_DOMAIN_EVENT_ID_PMSUSPEND | = | 12 | |
VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE | = | 13 | |
VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK | = | 14 | |
VIR_DOMAIN_EVENT_ID_LAST | = | 15 | NB: this enum value will increase over time as new events are added to the libvirt API. It reflects the last event ID supported by this version of the libvirt API. |
}
virDomainEventIOErrorAction
0.8.0
enum virDomainEventIOErrorAction {
VIR_DOMAIN_EVENT_IO_ERROR_NONE | = | 0 | No action, IO error ignored |
VIR_DOMAIN_EVENT_IO_ERROR_PAUSE | = | 1 | Guest CPUs are pausde |
VIR_DOMAIN_EVENT_IO_ERROR_REPORT | = | 2 | IO error reported to guest OS |
VIR_DOMAIN_EVENT_IO_ERROR_LAST | = | 3 |
}
virDomainEventPMSuspendedDetailType
0.10.2
enum virDomainEventPMSuspendedDetailType {
VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY | = | 0 | Guest was PM suspended to memory |
VIR_DOMAIN_EVENT_PMSUSPENDED_DISK | = | 1 | Guest was PM suspended to disk |
VIR_DOMAIN_EVENT_PMSUSPENDED_LAST | = | 2 |
}
virDomainEventResumedDetailType
0.5.0
enum virDomainEventResumedDetailType {
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED | = | 0 | Normal resume due to admin unpause |
VIR_DOMAIN_EVENT_RESUMED_MIGRATED | = | 1 | Resumed for completion of migration |
VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT | = | 2 | Resumed from snapshot |
VIR_DOMAIN_EVENT_RESUMED_LAST | = | 3 |
}
virDomainEventShutdownDetailType
0.9.8
enum virDomainEventShutdownDetailType {
VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED | = | 0 | Guest finished shutdown sequence |
VIR_DOMAIN_EVENT_SHUTDOWN_LAST | = | 1 |
}
virDomainEventStartedDetailType
0.5.0
enum virDomainEventStartedDetailType {
VIR_DOMAIN_EVENT_STARTED_BOOTED | = | 0 | Normal startup from boot |
VIR_DOMAIN_EVENT_STARTED_MIGRATED | = | 1 | Incoming migration from another host |
VIR_DOMAIN_EVENT_STARTED_RESTORED | = | 2 | Restored from a state file |
VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT | = | 3 | Restored from snapshot |
VIR_DOMAIN_EVENT_STARTED_WAKEUP | = | 4 | Started due to wakeup event |
VIR_DOMAIN_EVENT_STARTED_LAST | = | 5 |
}
virDomainEventStoppedDetailType
0.5.0
enum virDomainEventStoppedDetailType {
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN | = | 0 | Normal shutdown |
VIR_DOMAIN_EVENT_STOPPED_DESTROYED | = | 1 | Forced poweroff from host |
VIR_DOMAIN_EVENT_STOPPED_CRASHED | = | 2 | Guest crashed |
VIR_DOMAIN_EVENT_STOPPED_MIGRATED | = | 3 | Migrated off to another host |
VIR_DOMAIN_EVENT_STOPPED_SAVED | = | 4 | Saved to a state file |
VIR_DOMAIN_EVENT_STOPPED_FAILED | = | 5 | Host emulator/mgmt failed |
VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT | = | 6 | offline snapshot loaded |
VIR_DOMAIN_EVENT_STOPPED_LAST | = | 7 |
}
virDomainEventSuspendedDetailType
0.5.0
enum virDomainEventSuspendedDetailType {
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED | = | 0 | Normal suspend due to admin pause |
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED | = | 1 | Suspended for offline migration |
VIR_DOMAIN_EVENT_SUSPENDED_IOERROR | = | 2 | Suspended due to a disk I/O error |
VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG | = | 3 | Suspended due to a watchdog firing |
VIR_DOMAIN_EVENT_SUSPENDED_RESTORED | = | 4 | Restored from paused state file |
VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT | = | 5 | Restored from paused snapshot |
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR | = | 6 | suspended after failure during libvirt API call |
VIR_DOMAIN_EVENT_SUSPENDED_LAST | = | 7 |
}
virDomainEventTrayChangeReason
0.9.11
enum virDomainEventTrayChangeReason {
VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN | = | 0 |
VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE | = | 1 |
VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST | = | 2 |
}
virDomainEventType
0.5.0
enum virDomainEventType {
}
virDomainEventUndefinedDetailType
0.5.0
enum virDomainEventUndefinedDetailType {
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED | = | 0 | Deleted the config file |
VIR_DOMAIN_EVENT_UNDEFINED_LAST | = | 1 |
}
virDomainEventWatchdogAction
0.8.0
enum virDomainEventWatchdogAction {
VIR_DOMAIN_EVENT_WATCHDOG_NONE | = | 0 | No action, watchdog ignored |
VIR_DOMAIN_EVENT_WATCHDOG_PAUSE | = | 1 | Guest CPUs are paused |
VIR_DOMAIN_EVENT_WATCHDOG_RESET | = | 2 | Guest CPUs are reset |
VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF | = | 3 | Guest is forcably powered off |
VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN | = | 4 | Guest is requested to gracefully shutdown |
VIR_DOMAIN_EVENT_WATCHDOG_DEBUG | = | 5 | No action, a debug message logged |
VIR_DOMAIN_EVENT_WATCHDOG_LAST | = | 6 |
}
virDomainInfo
0.0.1
struct virDomainInfo {
unsigned char | state | the running state, one of virDomainState |
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 |
}
virDomainInterfaceStatsStruct
0.3.3
struct virDomainInterfaceStatsStruct {
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 |
}
virDomainJobInfo
0.8.0
struct virDomainJobInfo {
int | type | Time is measured in mill-seconds |
unsigned long long | timeElapsed | Always set |
unsigned long long | timeRemaining | Only for VIR_DOMAIN_JOB_BOUNDED Data is measured in bytes unless otherwise specified and is measuring the job as a whole For VIR_DOMAIN_JOB_UNBOUNDED, dataTotal may be less than the final sum of dataProcessed + dataRemaining in the event that the hypervisor has to repeat some data eg due to dirtied pages during migration For VIR_DOMAIN_JOB_BOUNDED, dataTotal shall always equal sum of dataProcessed + dataRemaining |
unsigned long long | dataTotal | |
unsigned long long | dataProcessed | |
unsigned long long | dataRemaining | As above, but only tracking guest memory progress |
unsigned long long | memTotal | |
unsigned long long | memProcessed | |
unsigned long long | memRemaining | As above, but only tracking guest disk file progress |
unsigned long long | fileTotal | |
unsigned long long | fileProcessed | |
unsigned long long | fileRemaining |
}
virDomainJobType
0.8.0
enum virDomainJobType {
VIR_DOMAIN_JOB_NONE | = | 0 | No job is active |
VIR_DOMAIN_JOB_BOUNDED | = | 1 | Job with a finite completion time |
VIR_DOMAIN_JOB_UNBOUNDED | = | 2 | Job without a finite completion time |
VIR_DOMAIN_JOB_COMPLETED | = | 3 | Job has finished, but isn't cleaned up |
VIR_DOMAIN_JOB_FAILED | = | 4 | Job hit error, but isn't cleaned up |
VIR_DOMAIN_JOB_CANCELLED | = | 5 | Job was aborted, but isn't cleaned up |
VIR_DOMAIN_JOB_LAST | = | 6 |
}
virDomainMemoryFlags
0.4.5
enum virDomainMemoryFlags {
VIR_MEMORY_VIRTUAL | = | 1 | addresses are virtual addresses |
VIR_MEMORY_PHYSICAL | = | 2 | addresses are physical addresses |
}
virDomainMemoryModFlags
0.9.0
enum virDomainMemoryModFlags {
VIR_DOMAIN_MEM_CONFIG | = | VIR_DOMAIN_AFFECT_CONFIG | Additionally, these flags may be bitwise-OR'd in. |
VIR_DOMAIN_MEM_CURRENT | = | VIR_DOMAIN_AFFECT_CURRENT | |
VIR_DOMAIN_MEM_LIVE | = | VIR_DOMAIN_AFFECT_LIVE | |
VIR_DOMAIN_MEM_MAXIMUM | = | 4 | affect Max rather than current |
}
virDomainMemoryStatStruct
0.7.5
struct virDomainMemoryStatStruct {
int | tag |
unsigned long long | val |
}
virDomainMemoryStatTags
0.7.5
enum virDomainMemoryStatTags {
VIR_DOMAIN_MEMORY_STAT_LAST | = | VIR_DOMAIN_MEMORY_STAT_NR | |
VIR_DOMAIN_MEMORY_STAT_SWAP_IN | = | 0 | The total amount of memory written out to swap space (in kB). |
VIR_DOMAIN_MEMORY_STAT_SWAP_OUT | = | 1 | Page faults occur when a process makes a valid access to virtual memory that is not available. When servicing the page fault, if disk IO is required, it is considered a major fault. If not, it is a minor fault. These are expressed as the number of faults that have occurred. |
VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT | = | 2 | |
VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT | = | 3 | The amount of memory left completely unused by the system. Memory that is available but used for reclaimable caches should NOT be reported as free. This value is expressed in kB. |
VIR_DOMAIN_MEMORY_STAT_UNUSED | = | 4 | The total amount of usable memory as seen by the domain. This value may be less than the amount of memory assigned to the domain if a balloon driver is in use or if the guest OS does not initialize all assigned pages. This value is expressed in kB. |
VIR_DOMAIN_MEMORY_STAT_AVAILABLE | = | 5 | Current balloon value (in KB). |
VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON | = | 6 | Resident Set Size of the process running the domain. This value is in kB |
VIR_DOMAIN_MEMORY_STAT_RSS | = | 7 | The number of statistics supported by this version of the interface. To add new statistics, add them to the enum and increase this value. |
VIR_DOMAIN_MEMORY_STAT_NR | = | 8 |
}
virDomainMetadataType
0.9.10
enum virDomainMetadataType {
VIR_DOMAIN_METADATA_DESCRIPTION | = | 0 | Operate on <description> |
VIR_DOMAIN_METADATA_TITLE | = | 1 | Operate on <title> |
VIR_DOMAIN_METADATA_ELEMENT | = | 2 | Operate on <metadata> |
VIR_DOMAIN_METADATA_LAST | = | 3 |
}
virDomainMigrateFlags
0.3.2
enum virDomainMigrateFlags {
VIR_MIGRATE_LIVE | = | 1 | live migration |
VIR_MIGRATE_PEER2PEER | = | 2 | direct source -> dest host control channel Note the less-common spelling that we're stuck with: VIR_MIGRATE_TUNNELLED should be VIR_MIGRATE_TUNNELED |
VIR_MIGRATE_TUNNELLED | = | 4 | tunnel migration data over libvirtd connection |
VIR_MIGRATE_PERSIST_DEST | = | 8 | persist the VM on the destination |
VIR_MIGRATE_UNDEFINE_SOURCE | = | 16 | undefine the VM on the source |
VIR_MIGRATE_PAUSED | = | 32 | pause on remote side |
VIR_MIGRATE_NON_SHARED_DISK | = | 64 | migration with non-shared storage with full disk copy |
VIR_MIGRATE_NON_SHARED_INC | = | 128 | migration with non-shared storage with incremental copy (same base image shared between source and destination) |
VIR_MIGRATE_CHANGE_PROTECTION | = | 256 | protect for changing domain configuration through the whole migration process; this will be used automatically when supported |
VIR_MIGRATE_UNSAFE | = | 512 | force migration even if it is considered unsafe |
VIR_MIGRATE_OFFLINE | = | 1024 | offline migrate |
VIR_MIGRATE_COMPRESSED | = | 2048 | compress data during migration |
}
virDomainModificationImpact
0.9.2
enum virDomainModificationImpact {
VIR_DOMAIN_AFFECT_CURRENT | = | 0 | Affect current domain state. |
VIR_DOMAIN_AFFECT_LIVE | = | 1 | Affect running domain state. |
VIR_DOMAIN_AFFECT_CONFIG | = | 2 | Affect persistent domain state. 1 << 2 is reserved for virTypedParameterFlags |
}
virDomainNostateReason
0.9.2
virDomainNumatuneMemMode
0.9.9
enum virDomainNumatuneMemMode {
VIR_DOMAIN_NUMATUNE_MEM_STRICT | = | 0 | |
VIR_DOMAIN_NUMATUNE_MEM_PREFERRED | = | 1 | |
VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE | = | 2 | |
VIR_DOMAIN_NUMATUNE_MEM_LAST | = | 3 | This constant is subject to change |
}
virDomainOpenGraphicsFlags
0.9.7
virDomainPMSuspendedDiskReason
1.0.0
enum virDomainPMSuspendedDiskReason {
VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN | = | 0 |
VIR_DOMAIN_PMSUSPENDED_DISK_LAST | = | 1 |
}
virDomainPMSuspendedReason
0.9.11
enum virDomainPMSuspendedReason {
VIR_DOMAIN_PMSUSPENDED_UNKNOWN | = | 0 |
VIR_DOMAIN_PMSUSPENDED_LAST | = | 1 |
}
virDomainPausedReason
0.9.2
enum virDomainPausedReason {
VIR_DOMAIN_PAUSED_UNKNOWN | = | 0 | the reason is unknown |
VIR_DOMAIN_PAUSED_USER | = | 1 | paused on user request |
VIR_DOMAIN_PAUSED_MIGRATION | = | 2 | paused for offline migration |
VIR_DOMAIN_PAUSED_SAVE | = | 3 | paused for save |
VIR_DOMAIN_PAUSED_DUMP | = | 4 | paused for offline core dump |
VIR_DOMAIN_PAUSED_IOERROR | = | 5 | paused due to a disk I/O error |
VIR_DOMAIN_PAUSED_WATCHDOG | = | 6 | paused due to a watchdog event |
VIR_DOMAIN_PAUSED_FROM_SNAPSHOT | = | 7 | paused after restoring from snapshot |
VIR_DOMAIN_PAUSED_SHUTTING_DOWN | = | 8 | paused during shutdown process |
VIR_DOMAIN_PAUSED_SNAPSHOT | = | 9 | paused while creating a snapshot |
VIR_DOMAIN_PAUSED_LAST | = | 10 |
}
virDomainProcessSignal
1.0.1
enum virDomainProcessSignal {
}
virDomainRebootFlagValues
0.9.10
enum virDomainRebootFlagValues {
VIR_DOMAIN_REBOOT_DEFAULT | = | 0 | hypervisor choice |
VIR_DOMAIN_REBOOT_ACPI_POWER_BTN | = | 1 | Send ACPI event |
VIR_DOMAIN_REBOOT_GUEST_AGENT | = | 2 | Use guest agent |
VIR_DOMAIN_REBOOT_INITCTL | = | 4 | Use initctl |
VIR_DOMAIN_REBOOT_SIGNAL | = | 8 | Send a signal |
}
virDomainRunningReason
0.9.2
enum virDomainRunningReason {
VIR_DOMAIN_RUNNING_UNKNOWN | = | 0 | |
VIR_DOMAIN_RUNNING_BOOTED | = | 1 | normal startup from boot |
VIR_DOMAIN_RUNNING_MIGRATED | = | 2 | migrated from another host |
VIR_DOMAIN_RUNNING_RESTORED | = | 3 | restored from a state file |
VIR_DOMAIN_RUNNING_FROM_SNAPSHOT | = | 4 | restored from snapshot |
VIR_DOMAIN_RUNNING_UNPAUSED | = | 5 | returned from paused state |
VIR_DOMAIN_RUNNING_MIGRATION_CANCELED | = | 6 | returned from migration |
VIR_DOMAIN_RUNNING_SAVE_CANCELED | = | 7 | returned from failed save process |
VIR_DOMAIN_RUNNING_WAKEUP | = | 8 | returned from pmsuspended due to wakeup event |
VIR_DOMAIN_RUNNING_LAST | = | 9 |
}
virDomainSaveRestoreFlags
0.9.4
enum virDomainSaveRestoreFlags {
VIR_DOMAIN_SAVE_BYPASS_CACHE | = | 1 | Avoid file system cache pollution |
VIR_DOMAIN_SAVE_RUNNING | = | 2 | Favor running over paused |
VIR_DOMAIN_SAVE_PAUSED | = | 4 | Favor paused over running |
}
virDomainShutdownFlagValues
0.9.10
enum virDomainShutdownFlagValues {
VIR_DOMAIN_SHUTDOWN_DEFAULT | = | 0 | hypervisor choice |
VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN | = | 1 | Send ACPI event |
VIR_DOMAIN_SHUTDOWN_GUEST_AGENT | = | 2 | Use guest agent |
VIR_DOMAIN_SHUTDOWN_INITCTL | = | 4 | Use initctl |
VIR_DOMAIN_SHUTDOWN_SIGNAL | = | 8 | Send a signal |
}
virDomainShutdownReason
0.9.2
enum virDomainShutdownReason {
VIR_DOMAIN_SHUTDOWN_UNKNOWN | = | 0 | the reason is unknown |
VIR_DOMAIN_SHUTDOWN_USER | = | 1 | shutting down on user request |
VIR_DOMAIN_SHUTDOWN_LAST | = | 2 |
}
virDomainShutoffReason
0.9.2
enum virDomainShutoffReason {
VIR_DOMAIN_SHUTOFF_UNKNOWN | = | 0 | the reason is unknown |
VIR_DOMAIN_SHUTOFF_SHUTDOWN | = | 1 | normal shutdown |
VIR_DOMAIN_SHUTOFF_DESTROYED | = | 2 | forced poweroff |
VIR_DOMAIN_SHUTOFF_CRASHED | = | 3 | domain crashed |
VIR_DOMAIN_SHUTOFF_MIGRATED | = | 4 | migrated to another host |
VIR_DOMAIN_SHUTOFF_SAVED | = | 5 | saved to a file |
VIR_DOMAIN_SHUTOFF_FAILED | = | 6 | domain failed to start |
VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT | = | 7 | restored from a snapshot which was taken while domain was shutoff |
VIR_DOMAIN_SHUTOFF_LAST | = | 8 |
}
virDomainSnapshot
0.8.2
struct virDomainSnapshot {
}
virDomainSnapshotCreateFlags
0.9.5
enum virDomainSnapshotCreateFlags {
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE | = | 1 | Restore or alter metadata |
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT | = | 2 | With redefine, make snapshot current |
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA | = | 4 | Make snapshot without remembering it |
VIR_DOMAIN_SNAPSHOT_CREATE_HALT | = | 8 | Stop running guest after snapshot |
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY | = | 16 | disk snapshot, not system checkpoint |
VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT | = | 32 | reuse any existing external files |
VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE | = | 64 | use guest agent to quiesce all mounted file systems within the domain |
VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC | = | 128 | atomically avoid partial changes |
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE | = | 256 | create the snapshot while the guest is running |
}
virDomainSnapshotDeleteFlags
0.8.2
enum virDomainSnapshotDeleteFlags {
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN | = | 1 | Also delete children |
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY | = | 2 | Delete just metadata |
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY | = | 4 | Delete just children |
}
virDomainSnapshotListFlags
0.9.5
enum virDomainSnapshotListFlags {
VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS | = | 1 | List all descendants, not just children, when listing a snapshot For historical reasons, groups do not use contiguous bits. |
VIR_DOMAIN_SNAPSHOT_LIST_ROOTS | = | 1 | Filter by snapshots with no parents, when listing a domain |
VIR_DOMAIN_SNAPSHOT_LIST_METADATA | = | 2 | Filter by snapshots which have metadata |
VIR_DOMAIN_SNAPSHOT_LIST_LEAVES | = | 4 | Filter by snapshots with no children |
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES | = | 8 | Filter by snapshots that have children |
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA | = | 16 | Filter by snapshots with no metadata |
VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE | = | 32 | Filter by snapshots taken while guest was shut off |
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE | = | 64 | Filter by snapshots taken while guest was active, and with memory state |
VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY | = | 128 | Filter by snapshots taken while guest was active, but without memory state |
VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL | = | 256 | Filter by snapshots stored internal to disk images |
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL | = | 512 | Filter by snapshots that use files external to disk images |
}
virDomainSnapshotRevertFlags
0.9.5
enum virDomainSnapshotRevertFlags {
VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | = | 1 | Run after revert |
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED | = | 2 | Pause after revert |
VIR_DOMAIN_SNAPSHOT_REVERT_FORCE | = | 4 | Allow risky reverts |
}
virDomainState
0.0.1
enum virDomainState {
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 |
VIR_DOMAIN_SHUTOFF | = | 5 | the domain is shut off |
VIR_DOMAIN_CRASHED | = | 6 | the domain is crashed |
VIR_DOMAIN_PMSUSPENDED | = | 7 | the domain is suspended by guest power management |
VIR_DOMAIN_LAST | = | 8 | NB: this enum value will increase over time as new events are added to the libvirt API. It reflects the last state supported by this version of the libvirt API. |
}
virDomainUndefineFlagsValues
0.9.4
enum virDomainUndefineFlagsValues {
VIR_DOMAIN_UNDEFINE_MANAGED_SAVE | = | 1 | Also remove any managed save |
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA | = | 2 | If last use of domain, then also remove any snapshot metadata Future undefine control flags should come here. |
}
virDomainVcpuFlags
0.8.5
enum virDomainVcpuFlags {
VIR_DOMAIN_VCPU_CONFIG | = | VIR_DOMAIN_AFFECT_CONFIG | Additionally, these flags may be bitwise-OR'd in. |
VIR_DOMAIN_VCPU_CURRENT | = | VIR_DOMAIN_AFFECT_CURRENT | |
VIR_DOMAIN_VCPU_LIVE | = | VIR_DOMAIN_AFFECT_LIVE | |
VIR_DOMAIN_VCPU_MAXIMUM | = | 4 | Max rather than current count |
}
virDomainXMLFlags
0.3.3
enum virDomainXMLFlags {
VIR_DOMAIN_XML_SECURE | = | 1 | dump security sensitive information too |
VIR_DOMAIN_XML_INACTIVE | = | 2 | dump inactive domain information |
VIR_DOMAIN_XML_UPDATE_CPU | = | 4 | update guest CPU requirements according to host CPU |
VIR_DOMAIN_XML_MIGRATABLE | = | 8 | dump XML suitable for migration |
}
virEventHandleType
0.5.0
enum virEventHandleType {
VIR_EVENT_HANDLE_READABLE | = | 1 |
VIR_EVENT_HANDLE_WRITABLE | = | 2 |
VIR_EVENT_HANDLE_ERROR | = | 4 |
VIR_EVENT_HANDLE_HANGUP | = | 8 |
}
virInterface
0.6.4
struct virInterface {
}
virInterfaceXMLFlags
0.7.3
virKeycodeSet
0.9.3
enum virKeycodeSet {
VIR_KEYCODE_SET_LINUX | = | 0 | |
VIR_KEYCODE_SET_XT | = | 1 | |
VIR_KEYCODE_SET_ATSET1 | = | 2 | |
VIR_KEYCODE_SET_ATSET2 | = | 3 | |
VIR_KEYCODE_SET_ATSET3 | = | 4 | |
VIR_KEYCODE_SET_OSX | = | 5 | |
VIR_KEYCODE_SET_XT_KBD | = | 6 | |
VIR_KEYCODE_SET_USB | = | 7 | |
VIR_KEYCODE_SET_WIN32 | = | 8 | |
VIR_KEYCODE_SET_RFB | = | 9 | |
VIR_KEYCODE_SET_LAST | = | 10 | NB: this enum value will increase over time as new events are added to the libvirt API. It reflects the last keycode set supported by this version of the libvirt API. |
}
virMemoryParameter
0.8.5
struct virMemoryParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH] | field | parameter name | ||||||||||||||||||||
int | type | parameter type, virTypedParameterType | ||||||||||||||||||||
union { | ||||||||||||||||||||||
| ||||||||||||||||||||||
} | value | parameter value |
}
virMemoryParameterType
0.8.5
enum virMemoryParameterType {
VIR_DOMAIN_MEMORY_PARAM_BOOLEAN | = | VIR_TYPED_PARAM_BOOLEAN |
VIR_DOMAIN_MEMORY_PARAM_DOUBLE | = | VIR_TYPED_PARAM_DOUBLE |
VIR_DOMAIN_MEMORY_PARAM_INT | = | VIR_TYPED_PARAM_INT |
VIR_DOMAIN_MEMORY_PARAM_LLONG | = | VIR_TYPED_PARAM_LLONG |
VIR_DOMAIN_MEMORY_PARAM_UINT | = | VIR_TYPED_PARAM_UINT |
VIR_DOMAIN_MEMORY_PARAM_ULLONG | = | VIR_TYPED_PARAM_ULLONG |
}
virNWFilter
0.8.2
struct virNWFilter {
}
virNetwork
0.2.0
struct virNetwork {
}
virNetworkUpdateCommand
0.10.2
enum virNetworkUpdateCommand {
VIR_NETWORK_UPDATE_COMMAND_NONE | = | 0 | (invalid) |
VIR_NETWORK_UPDATE_COMMAND_MODIFY | = | 1 | modify an existing element |
VIR_NETWORK_UPDATE_COMMAND_DELETE | = | 2 | delete an existing element |
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST | = | 3 | add an element at end of list |
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST | = | 4 | add an element at start of list |
VIR_NETWORK_UPDATE_COMMAND_LAST | = | 5 |
}
virNetworkUpdateFlags
0.10.2
enum virNetworkUpdateFlags {
VIR_NETWORK_UPDATE_AFFECT_CURRENT | = | 0 | affect live if network is active, config if it's not active |
VIR_NETWORK_UPDATE_AFFECT_LIVE | = | 1 | affect live state of network only |
VIR_NETWORK_UPDATE_AFFECT_CONFIG | = | 2 | affect persistent config only |
}
virNetworkUpdateSection
0.10.2
enum virNetworkUpdateSection {
VIR_NETWORK_SECTION_NONE | = | 0 | (invalid) |
VIR_NETWORK_SECTION_BRIDGE | = | 1 | <bridge> |
VIR_NETWORK_SECTION_DOMAIN | = | 2 | <domain> |
VIR_NETWORK_SECTION_IP | = | 3 | <ip> |
VIR_NETWORK_SECTION_IP_DHCP_HOST | = | 4 | <ip>/<dhcp>/<host> |
VIR_NETWORK_SECTION_IP_DHCP_RANGE | = | 5 | <ip>/<dhcp>/<range> |
VIR_NETWORK_SECTION_FORWARD | = | 6 | <forward> |
VIR_NETWORK_SECTION_FORWARD_INTERFACE | = | 7 | <forward>/<interface> |
VIR_NETWORK_SECTION_FORWARD_PF | = | 8 | <forward>/<pf> |
VIR_NETWORK_SECTION_PORTGROUP | = | 9 | <portgroup> |
VIR_NETWORK_SECTION_DNS_HOST | = | 10 | <dns>/<host> |
VIR_NETWORK_SECTION_DNS_TXT | = | 11 | <dns>/<txt> |
VIR_NETWORK_SECTION_DNS_SRV | = | 12 | <dns>/<srv> |
VIR_NETWORK_SECTION_LAST | = | 13 |
}
virNetworkXMLFlags
0.9.10
virNodeCPUStats
0.9.3
struct virNodeCPUStats {
char field[VIR_NODE_CPU_STATS_FIELD_LENGTH] | field |
unsigned long long | value |
}
virNodeDevice
0.5.0
struct virNodeDevice {
}
virNodeGetCPUStatsAllCPUs
0.9.8
virNodeGetMemoryStatsAllCells
0.9.8
virNodeInfo
0.1.0
struct virNodeInfo {
char model[32] | model | string indicating the CPU model |
unsigned long | memory | memory size in kilobytes |
unsigned int | cpus | the number of active CPUs |
unsigned int | mhz | expected CPU frequency |
unsigned int | nodes | the number of NUMA cell, 1 for unusual NUMA topologies or uniform memory access; check capabilities XML for the actual NUMA topology |
unsigned int | sockets | number of CPU sockets per node if nodes > 1, 1 in case of unusual NUMA topology |
unsigned int | cores | number of cores per socket, total number of processors in case of unusual NUMA topolog |
unsigned int | threads | number of threads per core, 1 in case of unusual numa topology |
}
virNodeMemoryStats
0.9.3
struct virNodeMemoryStats {
char field[VIR_NODE_MEMORY_STATS_FIELD_LENGTH] | field |
unsigned long long | value |
}
virNodeSuspendTarget
0.9.8
enum virNodeSuspendTarget {
VIR_NODE_SUSPEND_TARGET_MEM | = | 0 | |
VIR_NODE_SUSPEND_TARGET_DISK | = | 1 | |
VIR_NODE_SUSPEND_TARGET_HYBRID | = | 2 | |
VIR_NODE_SUSPEND_TARGET_LAST | = | 3 | This constant is subject to change |
}
virSchedParameter
0.2.3
struct virSchedParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH] | field | parameter name | ||||||||||||||||||||
int | type | parameter type, virTypedParameterType | ||||||||||||||||||||
union { | ||||||||||||||||||||||
| ||||||||||||||||||||||
} | value | parameter value |
}
virSchedParameterType
0.2.3
enum virSchedParameterType {
VIR_DOMAIN_SCHED_FIELD_BOOLEAN | = | VIR_TYPED_PARAM_BOOLEAN |
VIR_DOMAIN_SCHED_FIELD_DOUBLE | = | VIR_TYPED_PARAM_DOUBLE |
VIR_DOMAIN_SCHED_FIELD_INT | = | VIR_TYPED_PARAM_INT |
VIR_DOMAIN_SCHED_FIELD_LLONG | = | VIR_TYPED_PARAM_LLONG |
VIR_DOMAIN_SCHED_FIELD_UINT | = | VIR_TYPED_PARAM_UINT |
VIR_DOMAIN_SCHED_FIELD_ULLONG | = | VIR_TYPED_PARAM_ULLONG |
}
virSecret
0.7.1
struct virSecret {
}
virSecretUsageType
0.7.1
enum virSecretUsageType {
VIR_SECRET_USAGE_TYPE_NONE | = | 0 | |
VIR_SECRET_USAGE_TYPE_VOLUME | = | 1 | |
VIR_SECRET_USAGE_TYPE_CEPH | = | 2 | |
VIR_SECRET_USAGE_TYPE_ISCSI | = | 3 | |
VIR_SECRET_USAGE_TYPE_LAST | = | 4 | NB: this enum value will increase over time as new events are added to the libvirt API. It reflects the last secret owner ID supported by this version of the libvirt API. |
}
virSecurityLabel
0.6.1
struct virSecurityLabel {
}
virSecurityModel
0.6.1
struct virSecurityModel {
}
virStoragePool
0.4.1
struct virStoragePool {
}
virStoragePoolBuildFlags
0.4.1
enum virStoragePoolBuildFlags {
VIR_STORAGE_POOL_BUILD_NEW | = | 0 | Regular build from scratch |
VIR_STORAGE_POOL_BUILD_REPAIR | = | 1 | Repair / reinitialize |
VIR_STORAGE_POOL_BUILD_RESIZE | = | 2 | Extend existing pool |
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE | = | 4 | Do not overwrite existing pool |
VIR_STORAGE_POOL_BUILD_OVERWRITE | = | 8 | Overwrite data |
}
virStoragePoolDeleteFlags
0.4.1
enum virStoragePoolDeleteFlags {
VIR_STORAGE_POOL_DELETE_NORMAL | = | 0 | Delete metadata only (fast) |
VIR_STORAGE_POOL_DELETE_ZEROED | = | 1 | Clear all data to zeros (slow) |
}
virStoragePoolInfo
0.4.1
struct virStoragePoolInfo {
int | state | virStoragePoolState flags |
unsigned long long | capacity | Logical size bytes |
unsigned long long | allocation | Current allocation bytes |
unsigned long long | available | Remaining free space bytes |
}
virStoragePoolState
0.4.1
enum virStoragePoolState {
VIR_STORAGE_POOL_INACTIVE | = | 0 | Not running |
VIR_STORAGE_POOL_BUILDING | = | 1 | Initializing pool, not available |
VIR_STORAGE_POOL_RUNNING | = | 2 | Running normally |
VIR_STORAGE_POOL_DEGRADED | = | 3 | Running degraded |
VIR_STORAGE_POOL_INACCESSIBLE | = | 4 | Running, but not accessible |
VIR_STORAGE_POOL_STATE_LAST | = | 5 |
}
virStorageVol
0.4.1
struct virStorageVol {
}
virStorageVolCreateFlags
1.0.1
virStorageVolDeleteFlags
0.4.1
enum virStorageVolDeleteFlags {
VIR_STORAGE_VOL_DELETE_NORMAL | = | 0 | Delete metadata only (fast) |
VIR_STORAGE_VOL_DELETE_ZEROED | = | 1 | Clear all data to zeros (slow) |
}
virStorageVolInfo
0.4.1
struct virStorageVolInfo {
int | type | virStorageVolType flags |
unsigned long long | capacity | Logical size bytes |
unsigned long long | allocation | Current allocation bytes |
}
virStorageVolResizeFlags
0.9.10
enum virStorageVolResizeFlags {
VIR_STORAGE_VOL_RESIZE_ALLOCATE | = | 1 | force allocation of new size |
VIR_STORAGE_VOL_RESIZE_DELTA | = | 2 | size is relative to current |
VIR_STORAGE_VOL_RESIZE_SHRINK | = | 4 | allow decrease in capacity |
}
virStorageVolType
0.4.1
enum virStorageVolType {
VIR_STORAGE_VOL_FILE | = | 0 | Regular file based volumes |
VIR_STORAGE_VOL_BLOCK | = | 1 | Block based volumes |
VIR_STORAGE_VOL_DIR | = | 2 | Directory-passthrough based volume |
VIR_STORAGE_VOL_NETWORK | = | 3 | Network volumes like RBD (RADOS Block Device) |
VIR_STORAGE_VOL_LAST | = | 4 |
}
virStorageVolWipeAlgorithm
0.9.10
enum virStorageVolWipeAlgorithm {
VIR_STORAGE_VOL_WIPE_ALG_ZERO | = | 0 | 1-pass, all zeroes |
VIR_STORAGE_VOL_WIPE_ALG_NNSA | = | 1 | 4-pass NNSA Policy Letter NAP-14.1-C (XVI-8) |
VIR_STORAGE_VOL_WIPE_ALG_DOD | = | 2 | 4-pass DoD 5220.22-M section 8-306 procedure |
VIR_STORAGE_VOL_WIPE_ALG_BSI | = | 3 | 9-pass method recommended by the German Center of Security in Information Technologies |
VIR_STORAGE_VOL_WIPE_ALG_GUTMANN | = | 4 | The canonical 35-pass sequence |
VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER | = | 5 | 7-pass method described by Bruce Schneier in "Applied Cryptography" (1996) |
VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7 | = | 6 | 7-pass random |
VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33 | = | 7 | 33-pass random |
VIR_STORAGE_VOL_WIPE_ALG_RANDOM | = | 8 | 1-pass random |
VIR_STORAGE_VOL_WIPE_ALG_LAST | = | 9 | NB: this enum value will increase over time as new algorithms are added to the libvirt API. It reflects the last algorithm supported by this version of the libvirt API. |
}
virStorageXMLFlags
0.9.13
virStream
0.7.2
struct virStream {
}
virStreamEventType
0.7.2
enum virStreamEventType {
VIR_STREAM_EVENT_READABLE | = | 1 |
VIR_STREAM_EVENT_WRITABLE | = | 2 |
VIR_STREAM_EVENT_ERROR | = | 4 |
VIR_STREAM_EVENT_HANGUP | = | 8 |
}
virStreamFlags
0.7.2
virTypedParameter
0.9.2
struct virTypedParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH] | field | parameter name | ||||||||||||||||||||
int | type | parameter type, virTypedParameterType | ||||||||||||||||||||
union { | ||||||||||||||||||||||
| ||||||||||||||||||||||
} | value | parameter value |
}
virTypedParameterFlags
0.9.8
virTypedParameterType
0.9.2
enum virTypedParameterType {
VIR_TYPED_PARAM_INT | = | 1 | integer case |
VIR_TYPED_PARAM_UINT | = | 2 | unsigned integer case |
VIR_TYPED_PARAM_LLONG | = | 3 | long long case |
VIR_TYPED_PARAM_ULLONG | = | 4 | unsigned long long case |
VIR_TYPED_PARAM_DOUBLE | = | 5 | double case |
VIR_TYPED_PARAM_BOOLEAN | = | 6 | boolean(character) case |
VIR_TYPED_PARAM_STRING | = | 7 | string case |
VIR_TYPED_PARAM_LAST | = | 8 |
}
virVcpuInfo
0.1.4
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 |
}
virVcpuState
0.1.4
enum virVcpuState {
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 |
VIR_VCPU_LAST | = | 3 |
}
Functions
virConnectAuthCallbackPtr
0.4.0
typedef int (*virConnectAuthCallbackPtr) (virConnectCredentialPtr cred, unsigned int ncred, void * cbdata)
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 cannot be filled, fill in NULL and 0.
- cred
- list of virConnectCredential object to fetch from user
- ncred
- size of cred list
- cbdata
- opaque data passed to virConnectOpenAuth
- Returns
- 0 if all interactions were filled, or -1 upon error
virConnectBaselineCPU
0.7.7
char * virConnectBaselineCPU (virConnectPtr conn, const char ** xmlCPUs, unsigned int ncpus, unsigned int flags)
Computes the most feature-rich CPU which is compatible with all given host CPUs.
- conn
- virConnect connection
- xmlCPUs
- array of XML descriptions of host CPUs
- ncpus
- number of CPUs in xmlCPUs
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- XML description of the computed CPU or NULL on error.
virConnectClose
0.0.1
int virConnectClose (virConnectPtr conn)
This function closes the connection to the Hypervisor. This should not be called if further interaction with the Hypervisor are needed especially if there is running domain which need further monitoring by the application.
Connections are reference counted; the count is explicitly increased by the initial open (virConnectOpen, virConnectOpenAuth, and the like) as well as virConnectRef; it is also temporarily increased by other API that depend on the connection remaining alive. The open and every virConnectRef call should have a matching virConnectClose, and all other references will be released after the corresponding operation completes.
- conn
- pointer to the hypervisor connection
- Returns
- a positive number if at least 1 reference remains on success. The returned value should not be assumed to be the total reference count. A return of 0 implies no references remain and the connection is closed and memory has been freed. A return of -1 implies a failure. It is possible for the last virConnectClose to return a positive value if some other object still has a temporary reference to the connection, but the application should not try to further use a connection after the virConnectClose that matches the initial open.
virConnectCloseFunc
0.10.0
typedef void (*virConnectCloseFunc ) (virConnectPtr conn, int reason, void * opaque)
A callback function to be registered, and called when the connection is closed.
- conn
- virConnect connection
- reason
- reason why the connection was closed (one of virConnectCloseReason)
- opaque
- opaque user data
virConnectCompareCPU
0.7.5
int virConnectCompareCPU (virConnectPtr conn, const char * xmlDesc, unsigned int flags)
Compares the given CPU description with the host CPU
- conn
- virConnect connection
- xmlDesc
- XML describing the CPU to compare with host CPU
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- comparison result according to enum virCPUCompareResult
virConnectDomainEventBalloonChangeCallback
0.10.0
typedef void (*virConnectDomainEventBalloonChangeCallback) (virConnectPtr conn, virDomainPtr dom, unsigned long long actual, void * opaque)
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- actual
- the new balloon level measured in kibibytes(blocks of 1024 bytes)
- opaque
- application specified data
virConnectDomainEventBlockJobCallback
0.9.4
typedef void (*virConnectDomainEventBlockJobCallback) (virConnectPtr conn, virDomainPtr dom, const char * disk, int type, int status, void * opaque)
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_BLOCK_JOB with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- disk
- fully-qualified filename of the affected disk
- type
- type of block job (virDomainBlockJobType)
- status
- final status of the operation (virConnectDomainEventBlockJobStatus)
- opaque
- application specified data
virConnectDomainEventCallback
0.5.0
typedef int (*virConnectDomainEventCallback) (virConnectPtr conn, virDomainPtr dom, int event, int detail, void * opaque)
A callback function to be registered, and called when a domain event occurs
- conn
- virConnect connection
- dom
- The domain on which the event occurred
- event
- The specific virDomainEventType which occurred
- detail
- event specific detail information
- opaque
- opaque user data
- Returns
- 0 (the return value is currently ignored)
virConnectDomainEventDeregister
0.5.0
int virConnectDomainEventDeregister (virConnectPtr conn, virConnectDomainEventCallback cb)
Removes a callback previously registered with the virConnectDomainEventRegister function.
Use of this method is no longer recommended. Instead applications should try virConnectDomainEventUnregisterAny which has a more flexible API contract
- conn
- pointer to the connection
- cb
- callback to the function handling domain events
- Returns
- 0 on success, -1 on failure
virConnectDomainEventDeregisterAny
0.8.0
int virConnectDomainEventDeregisterAny (virConnectPtr conn, int callbackID)
Removes an event callback. The callbackID parameter should be the vaule obtained from a previous virDomainEventRegisterAny method.
- conn
- pointer to the connection
- callbackID
- the callback identifier
- Returns
- 0 on success, -1 on failure
virConnectDomainEventDiskChangeCallback
0.9.7
typedef void (*virConnectDomainEventDiskChangeCallback) (virConnectPtr conn, virDomainPtr dom, const char * oldSrcPath, const char * newSrcPath, const char * devAlias, int reason, void * opaque)
This callback occurs when disk gets changed. However, not all @reason will cause both @oldSrcPath and @newSrcPath to be non-NULL. Please see virConnectDomainEventDiskChangeReason for more details.
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_DISK_CHANGE with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- oldSrcPath
- old source path
- newSrcPath
- new source path
- devAlias
- device alias name
- reason
- reason why this callback was called; any of virConnectDomainEventDiskChangeReason
- opaque
- application specified data
virConnectDomainEventGenericCallback
0.8.0
typedef void (*virConnectDomainEventGenericCallback) (virConnectPtr conn, virDomainPtr dom, void * opaque)
A generic domain event callback handler. Specific events usually have a customization with extra parameters
- conn
- the connection pointer
- dom
- the domain pointer
- opaque
- application specified data
virConnectDomainEventGraphicsCallback
0.8.0
typedef void (*virConnectDomainEventGraphicsCallback) (virConnectPtr conn, virDomainPtr dom, int phase, virDomainEventGraphicsAddressPtr local, virDomainEventGraphicsAddressPtr remote, const char * authScheme, virDomainEventGraphicsSubjectPtr subject, void * opaque)
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_GRAPHICS with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- phase
- the phase of the connection
- local
- the local server address
- remote
- the remote client address
- authScheme
- the authentication scheme activated
- subject
- the authenticated subject (user)
- opaque
- application specified data
virConnectDomainEventIOErrorCallback
0.8.0
typedef void (*virConnectDomainEventIOErrorCallback) (virConnectPtr conn, virDomainPtr dom, const char * srcPath, const char * devAlias, int action, void * opaque)
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_IO_ERROR with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- srcPath
- The host file on which the IO error occurred
- devAlias
- The guest device alias associated with the path
- action
- action that is to be taken due to the IO error
- opaque
- application specified data
virConnectDomainEventIOErrorReasonCallback
0.8.2
typedef void (*virConnectDomainEventIOErrorReasonCallback) (virConnectPtr conn, virDomainPtr dom, const char * srcPath, const char * devAlias, int action, const char * reason, void * opaque)
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_IO_ERROR with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- srcPath
- The host file on which the IO error occurred
- devAlias
- The guest device alias associated with the path
- action
- action that is to be taken due to the IO error
- reason
- the cause of the IO error
- opaque
- application specified data
virConnectDomainEventPMSuspendCallback
0.9.11
typedef void (*virConnectDomainEventPMSuspendCallback) (virConnectPtr conn, virDomainPtr dom, int reason, void * opaque)
This callback occurs when the guest is waken up.
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_PMSUSPEND with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- reason
- reason why the callback was called, unused currently, always passes 0
- opaque
- application specified data
virConnectDomainEventPMSuspendDiskCallback
1.0.0
typedef void (*virConnectDomainEventPMSuspendDiskCallback) (virConnectPtr conn, virDomainPtr dom, int reason, void * opaque)
This callback occurs when the guest is suspended to disk.
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- reason
- reason why the callback was called, unused currently, always passes 0
- opaque
- application specified data
virConnectDomainEventPMWakeupCallback
0.9.11
typedef void (*virConnectDomainEventPMWakeupCallback) (virConnectPtr conn, virDomainPtr dom, int reason, void * opaque)
This callback occurs when the guest is waken up.
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_PMWAKEUP with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- reason
- reason why the callback was called, unused currently, always passes 0
- opaque
- application specified data
virConnectDomainEventRTCChangeCallback
0.8.0
typedef void (*virConnectDomainEventRTCChangeCallback) (virConnectPtr conn, virDomainPtr dom, long long utcoffset, void * opaque)
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_RTC_CHANGE with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- utcoffset
- the new RTC offset from UTC, measured in seconds
- opaque
- application specified data
virConnectDomainEventRegister
0.5.0
int virConnectDomainEventRegister (virConnectPtr conn, virConnectDomainEventCallback cb, void * opaque, virFreeCallback freecb)
Adds a callback to receive notifications of domain lifecycle events occurring on a connection
Use of this method is no longer recommended. Instead applications should try virConnectDomainEventRegisterAny which has a more flexible API contract
The virDomainPtr object handle passed into the callback upon delivery of an event is only valid for the duration of execution of the callback. If the callback wishes to keep the domain object after the callback returns, it shall take a reference to it, by calling virDomainRef. The reference can be released once the object is no longer required by calling virDomainFree.
- conn
- pointer to the connection
- cb
- callback to the function handling domain events
- opaque
- opaque data to pass on to the callback
- freecb
- optional function to deallocate opaque when not used anymore
- Returns
- 0 on success, -1 on failure
virConnectDomainEventRegisterAny
0.8.0
int virConnectDomainEventRegisterAny (virConnectPtr conn, virDomainPtr dom, int eventID, virConnectDomainEventGenericCallback cb, void * opaque, virFreeCallback freecb)
Adds a callback to receive notifications of arbitrary domain events occurring on a domain.
If dom is NULL, then events will be monitored for any domain. If dom is non-NULL, then only the specific domain will be monitored
Most types of event have a callback providing a custom set of parameters for the event. When registering an event, it is thus necessary to use the VIR_DOMAIN_EVENT_CALLBACK() macro to cast the supplied function pointer to match the signature of this method.
The virDomainPtr object handle passed into the callback upon delivery of an event is only valid for the duration of execution of the callback. If the callback wishes to keep the domain object after the callback returns, it shall take a reference to it, by calling virDomainRef. The reference can be released once the object is no longer required by calling virDomainFree.
The return value from this method is a positive integer identifier for the callback. To unregister a callback, this callback ID should be passed to the virDomainEventUnregisterAny method
- conn
- pointer to the connection
- dom
- pointer to the domain
- eventID
- the event type to receive
- cb
- callback to the function handling domain events
- opaque
- opaque data to pass on to the callback
- freecb
- optional function to deallocate opaque when not used anymore
- Returns
- a callback identifier on success, -1 on failure
virConnectDomainEventTrayChangeCallback
0.9.11
typedef void (*virConnectDomainEventTrayChangeCallback) (virConnectPtr conn, virDomainPtr dom, const char * devAlias, int reason, void * opaque)
This callback occurs when the tray of a removable device is moved.
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_TRAY_CHANGE with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- devAlias
- device alias
- reason
- why the tray status was changed?
- opaque
- application specified data
virConnectDomainEventWatchdogCallback
0.8.0
typedef void (*virConnectDomainEventWatchdogCallback) (virConnectPtr conn, virDomainPtr dom, int action, void * opaque)
The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_WATCHDOG with virConnectDomainEventRegisterAny()
- conn
- connection object
- dom
- domain on which the event occurred
- action
- action that is to be taken due to watchdog firing
- opaque
- application specified data
virConnectDomainXMLFromNative
0.6.4
char * virConnectDomainXMLFromNative (virConnectPtr conn, const char * nativeFormat, const char * nativeConfig, unsigned int flags)
Reads native configuration data describing a domain, and generates libvirt domain XML. The format of the native data is hypervisor dependant.
- conn
- a connection object
- nativeFormat
- configuration format importing from
- nativeConfig
- the configuration data to import
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.
virConnectDomainXMLToNative
0.6.4
char * virConnectDomainXMLToNative (virConnectPtr conn, const char * nativeFormat, const char * domainXml, unsigned int flags)
Reads a domain XML configuration document, and generates a native configuration file describing the domain. The format of the native data is hypervisor dependant.
- conn
- a connection object
- nativeFormat
- configuration format exporting to
- domainXml
- the domain configuration to export
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a 0 terminated UTF-8 encoded native config datafile, or NULL in case of error. the caller must free() the returned value.
virConnectFindStoragePoolSources
0.4.5
char * virConnectFindStoragePoolSources (virConnectPtr conn, const char * type, const char * srcSpec, unsigned int flags)
Talks to a storage backend and attempts to auto-discover the set of available storage pool sources. e.g. For iSCSI this would be a set of iSCSI targets. For NFS this would be a list of exported paths. The srcSpec (optional for some storage pool types, e.g. local ones) is an instance of the storage pool's source element specifying where to look for the pools.
srcSpec is not required for some types (e.g., those querying local storage resources only)
- conn
- pointer to hypervisor connection
- type
- type of storage pool sources to discover
- srcSpec
- XML document specifying discovery source
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- an xml document consisting of a SourceList element containing a source document appropriate to the given pool type for each discovered source.
virConnectGetCapabilities
0.2.1
char * virConnectGetCapabilities (virConnectPtr conn)
Provides capabilities of the hypervisor / driver.
- conn
- pointer to the hypervisor connection
- Returns
- NULL in case of error, or an XML string defining the capabilities. The client must free the returned string after use.
virConnectGetHostname
0.3.0
char * virConnectGetHostname (virConnectPtr conn)
This returns the system hostname on which the hypervisor is running (the result of the gethostname system call). If we are connected to a remote system, then this returns the hostname of the remote system.
- conn
- pointer to a hypervisor connection
- Returns
- the hostname which must be freed by the caller, or NULL if there was an error.
virConnectGetLibVersion
0.7.3
int virConnectGetLibVersion (virConnectPtr conn, unsigned long * libVer)
Provides @libVer, which is the version of libvirt used by the daemon running on the @conn host
- conn
- pointer to the hypervisor connection
- libVer
- returns the libvirt library version used on the connection (OUT)
- Returns
- -1 in case of failure, 0 otherwise, and values for @libVer have the format major * 1,000,000 + minor * 1,000 + release.
virConnectGetMaxVcpus
0.2.1
int virConnectGetMaxVcpus (virConnectPtr conn, const char * type)
Provides the maximum number of virtual CPUs supported for a guest VM of a specific type. The 'type' parameter here corresponds to the 'type' attribute in the <domain> element of the XML.
- conn
- pointer to the hypervisor connection
- type
- value of the 'type' attribute in the <domain> element
- Returns
- the maximum of virtual CPU or -1 in case of error.
virConnectGetSysinfo
0.8.8
char * virConnectGetSysinfo (virConnectPtr conn, unsigned int flags)
This returns the XML description of the sysinfo details for the host on which the hypervisor is running, in the same format as the <sysinfo> element of a domain XML. This information is generally available only for hypervisors running with root privileges.
- conn
- pointer to a hypervisor connection
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the XML string which must be freed by the caller, or NULL if there was an error.
virConnectGetType
0.0.1
const char * virConnectGetType (virConnectPtr conn)
Get the name of the Hypervisor software used.
- conn
- pointer to the hypervisor connection
- Returns
- NULL in case of error, a static zero terminated string otherwise. See also: http://www.redhat.com/archives/libvir-list/2007-February/msg00096.html
virConnectGetURI
0.3.0
char * virConnectGetURI (virConnectPtr conn)
This returns the URI (name) of the hypervisor connection. Normally this is the same as or similar to the string passed to the virConnectOpen/virConnectOpenReadOnly call, but the driver may make the URI canonical. If name == NULL was passed to virConnectOpen, then the driver will return a non-NULL URI which can be used to connect to the same hypervisor later.
- conn
- pointer to a hypervisor connection
- Returns
- the URI string which must be freed by the caller, or NULL if there was an error.
virConnectGetVersion
0.0.1
int virConnectGetVersion (virConnectPtr conn, unsigned long * hvVer)
Get the version level of the Hypervisor running. This may work only with hypervisor call, i.e. with privileged access to the hypervisor, not with a Read-Only connection.
- conn
- pointer to the hypervisor connection
- hvVer
- return value for the version of the running hypervisor (OUT)
- Returns
- -1 in case of error, 0 otherwise. if the version can't be extracted by lack of capacities returns 0 and @hvVer is 0, otherwise @hvVer value is major * 1,000,000 + minor * 1,000 + release
virConnectIsAlive
0.9.8
int virConnectIsAlive (virConnectPtr conn)
Determine if the connection to the hypervisor is still alive
A connection will be classed as alive if it is either local, or running over a channel (TCP or UNIX socket) which is not closed.
- conn
- pointer to the connection object
- Returns
- 1 if alive, 0 if dead, -1 on error
virConnectIsEncrypted
0.7.3
int virConnectIsEncrypted (virConnectPtr conn)
Determine if the connection to the hypervisor is encrypted
- conn
- pointer to the connection object
- Returns
- 1 if encrypted, 0 if not encrypted, -1 on error
virConnectIsSecure
0.7.3
int virConnectIsSecure (virConnectPtr conn)
Determine if the connection to the hypervisor is secure
A connection will be classed as secure if it is either encrypted, or running over a channel which is not exposed to eavesdropping (eg a UNIX domain socket, or pipe)
- conn
- pointer to the connection object
- Returns
- 1 if secure, 0 if not secure, -1 on error
virConnectListAllDomains
0.9.13
int virConnectListAllDomains (virConnectPtr conn, virDomainPtr ** domains, unsigned int flags)
Collect a possibly-filtered list of all domains, and return an allocated array of information for each. This API solves the race inherent in virConnectListDomains() and virConnectListDefinedDomains().
Normally, all domains are returned; however, @flags can be used to filter the results for a smaller list of targeted domains. The valid flags are divided into groups, where each group contains bits that describe mutually exclusive attributes of a domain, and where all bits within a group describe all possible domains. Some hypervisors might reject explicit bits from a group where the hypervisor cannot make a distinction (for example, not all hypervisors can tell whether domains have snapshots). For a group supported by a given hypervisor, the behavior when no bits of a group are set is identical to the behavior when all bits in that group are set. When setting bits from more than one group, it is possible to select an impossible combination (such as an inactive transient domain), in that case a hypervisor may return either 0 or an error.
The first group of @flags is VIR_CONNECT_LIST_DOMAINS_ACTIVE (online domains) and VIR_CONNECT_LIST_DOMAINS_INACTIVE (offline domains).
The next group of @flags is VIR_CONNECT_LIST_DOMAINS_PERSISTENT (defined domains) and VIR_CONNECT_LIST_DOMAINS_TRANSIENT (running but not defined).
The next group of @flags covers various domain states: VIR_CONNECT_LIST_DOMAINS_RUNNING, VIR_CONNECT_LIST_DOMAINS_PAUSED, VIR_CONNECT_LIST_DOMAINS_SHUTOFF, and a catch-all for all other states (such as crashed, this catch-all covers the possibility of adding new states).
The remaining groups cover boolean attributes commonly asked about domains; they include VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE and VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE, for filtering based on whether a managed save image exists; VIR_CONNECT_LIST_DOMAINS_AUTOSTART and VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART, for filtering based on autostart; VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT and VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT, for filtering based on whether a domain has snapshots.
- conn
- Pointer to the hypervisor connection.
- domains
- Pointer to a variable to store the array containing domain objects or NULL if the list is not required (just returns number of guests).
- flags
- bitwise-OR of virConnectListAllDomainsFlags
- Returns
- the number of domains found or -1 and sets domains to NULL in case of error. On success, the array stored into @domains is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virDomainFree() on each array element, then calling free() on @domains. Example of usage: virDomainPtr *domains; int i; int ret; unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING | VIR_CONNECT_LIST_DOMAINS_PERSISTENT; ret = virConnectListAllDomains(conn, &domains, flags); if (ret < 0) error(); for (i = 0; i < ret; i++) { do_something_with_domain(domains[i]); //here or in a separate loop if needed virDomainFree(domains[i]); } free(domains);
virConnectListAllInterfaces
0.10.2
int virConnectListAllInterfaces (virConnectPtr conn, virInterfacePtr ** ifaces, unsigned int flags)
Collect the list of interfaces, and allocate an array to store those objects. This API solves the race inherent between virConnectListInterfaces and virConnectListDefinedInterfaces.
Normally, all interfaces are returned; however, @flags can be used to filter the results for a smaller list of targeted interfaces. The valid flags are divided into groups, where each group contains bits that describe mutually exclusive attributes of a interface, and where all bits within a group describe all possible interfaces.
The only group of @flags is VIR_CONNECT_LIST_INTERFACES_ACTIVE (up) and VIR_CONNECT_LIST_INTERFACES_INACTIVE (down) to filter the interfaces by state.
- conn
- Pointer to the hypervisor connection.
- ifaces
- Pointer to a variable to store the array containing the interface objects or NULL if the list is not required (just returns number of interfaces).
- flags
- bitwise-OR of virConnectListAllInterfacesFlags.
- Returns
- the number of interfaces found or -1 and sets @ifaces to NULL in case of error. On success, the array stored into @ifaces is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virStorageInterfaceFree() on each array element, then calling free() on @ifaces.
virConnectListAllNWFilters
0.10.2
int virConnectListAllNWFilters (virConnectPtr conn, virNWFilterPtr ** filters, unsigned int flags)
Collect the list of network filters, and allocate an array to store those objects.
- conn
- Pointer to the hypervisor connection.
- filters
- Pointer to a variable to store the array containing the network filter objects or NULL if the list is not required (just returns number of network filters).
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the number of network filters found or -1 and sets @filters to NULL in case of error. On success, the array stored into @filters is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virNWFilterFree() on each array element, then calling free() on @filters.
virConnectListAllNetworks
0.10.2
int virConnectListAllNetworks (virConnectPtr conn, virNetworkPtr ** nets, unsigned int flags)
Collect the list of networks, and allocate an array to store those objects. This API solves the race inherent between virConnectListNetworks and virConnectListDefinedNetworks.
Normally, all networks are returned; however, @flags can be used to filter the results for a smaller list of targeted networks. The valid flags are divided into groups, where each group contains bits that describe mutually exclusive attributes of a network, and where all bits within a group describe all possible networks.
The first group of @flags is VIR_CONNECT_LIST_NETWORKS_ACTIVE (up) and VIR_CONNECT_LIST_NETWORKS_INACTIVE (down) to filter the networks by state.
The second group of @flags is VIR_CONNECT_LIST_NETWORKS_PERSISTENT (defined) and VIR_CONNECT_LIST_NETWORKS_TRANSIENT (running but not defined), to filter the networks by whether they have persistent config or not.
The third group of @flags is VIR_CONNECT_LIST_NETWORKS_AUTOSTART and VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART, to filter the networks by whether they are marked as autostart or not.
- conn
- Pointer to the hypervisor connection.
- nets
- Pointer to a variable to store the array containing the network objects or NULL if the list is not required (just returns number of networks).
- flags
- bitwise-OR of virConnectListAllNetworksFlags.
- Returns
- the number of networks found or -1 and sets @nets to NULL in case of error. On success, the array stored into @nets is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virNetworkFree() on each array element, then calling free() on @nets.
virConnectListAllNodeDevices
0.10.2
int virConnectListAllNodeDevices (virConnectPtr conn, virNodeDevicePtr ** devices, unsigned int flags)
Collect the list of node devices, and allocate an array to store those objects.
Normally, all node devices are returned; however, @flags can be used to filter the results for a smaller list of targeted node devices. The valid flags are divided into groups, where each group contains bits that describe mutually exclusive attributes of a node device, and where all bits within a group describe all possible node devices.
Only one group of the @flags is provided to filter the node devices by capability type, flags include: VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS
- conn
- Pointer to the hypervisor connection.
- devices
- Pointer to a variable to store the array containing the node device objects or NULL if the list is not required (just returns number of node devices).
- flags
- bitwise-OR of virConnectListAllNodeDevices.
- Returns
- the number of node devices found or -1 and sets @devices to NULL in case of error. On success, the array stored into @devices is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virNodeDeviceFree() on each array element, then calling free() on @devices.
virConnectListAllSecrets
0.10.2
int virConnectListAllSecrets (virConnectPtr conn, virSecretPtr ** secrets, unsigned int flags)
Collect the list of secrets, and allocate an array to store those objects.
Normally, all secrets are returned; however, @flags can be used to filter the results for a smaller list of targeted secrets. The valid flags are divided into groups, where each group contains bits that describe mutually exclusive attributes of a secret, and where all bits within a group describe all possible secrets.
The first group of @flags is used to filter secrets by its storage location. Flag VIR_CONNECT_LIST_SECRETS_EPHEMERAL selects secrets that are kept only in memory. Flag VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL selects secrets that are kept in persistent storage.
The second group of @flags is used to filter secrets by privacy. Flag VIR_CONNECT_LIST_SECRETS_PRIVATE seclets secrets that are never revealed to any caller of libvirt nor to any other node. Flag VIR_CONNECT_LIST_SECRETS_NO_PRIVATE selects non-private secrets.
- conn
- Pointer to the hypervisor connection.
- secrets
- Pointer to a variable to store the array containing the secret objects or NULL if the list is not required (just returns the number of secrets).
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the number of secrets found or -1 and sets @secrets to NULL in case of error. On success, the array stored into @secrets is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virSecretFree() on each array element, then calling free() on @secrets.
virConnectListAllStoragePools
0.10.2
int virConnectListAllStoragePools (virConnectPtr conn, virStoragePoolPtr ** pools, unsigned int flags)
Collect the list of storage pools, and allocate an array to store those objects. This API solves the race inherent between virConnectListStoragePools and virConnectListDefinedStoragePools.
Normally, all storage pools are returned; however, @flags can be used to filter the results for a smaller list of targeted pools. The valid flags are divided into groups, where each group contains bits that describe mutually exclusive attributes of a pool, and where all bits within a group describe all possible pools.
The first group of @flags is VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE (online) and VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE (offline) to filter the pools by state.
The second group of @flags is VIR_CONNECT_LIST_STORAGE_POOLS_PERSITENT (defined) and VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT (running but not defined), to filter the pools by whether they have persistent config or not.
The third group of @flags is VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART and VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART, to filter the pools by whether they are marked as autostart or not.
The last group of @flags is provided to filter the pools by the types, the flags include: VIR_CONNECT_LIST_STORAGE_POOLS_DIR VIR_CONNECT_LIST_STORAGE_POOLS_FS VIR_CONNECT_LIST_STORAGE_POOLS_NETFS VIR_CONNECT_LIST_STORAGE_POOLS_LOGICAL VIR_CONNECT_LIST_STORAGE_POOLS_DISK VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI VIR_CONNECT_LIST_STORAGE_POOLS_SCSI VIR_CONNECT_LIST_STORAGE_POOLS_MPATH VIR_CONNECT_LIST_STORAGE_POOLS_RBD VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG
- conn
- Pointer to the hypervisor connection.
- pools
- Pointer to a variable to store the array containing storage pool objects or NULL if the list is not required (just returns number of pools).
- flags
- bitwise-OR of virConnectListAllStoragePoolsFlags.
- Returns
- the number of storage pools found or -1 and sets @pools to NULL in case of error. On success, the array stored into @pools is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virStoragePoolFree() on each array element, then calling free() on @pools.
virConnectListDefinedDomains
0.1.1
int virConnectListDefinedDomains (virConnectPtr conn, char ** const names, int maxnames)
list the defined but inactive domains, stores the pointers to the names in @names
For active domains, see virConnectListDomains(). For more control over the results, see virConnectListAllDomains().
- conn
- pointer to the hypervisor connection
- names
- pointer to an array to store the names
- maxnames
- size of the array
- Returns
- the number of names provided in the array or -1 in case of error. Note that this command is inherently racy; a domain can be defined between a call to virConnectNumOfDefinedDomains() and this call; you are only guaranteed that all currently defined domains were listed if the return is less than @maxids. The client must call free() on each returned name.
virConnectListDefinedInterfaces
0.7.0
int virConnectListDefinedInterfaces (virConnectPtr conn, char ** const names, int maxnames)
Collect the list of defined (inactive) physical host interfaces, and store their names in @names.
For more control over the results, see virConnectListAllInterfaces().
- conn
- pointer to the hypervisor connection
- names
- array to collect the list of names of interfaces
- maxnames
- size of @names
- Returns
- the number of names provided in the array or -1 in case of error. Note that this command is inherently racy; a interface can be defined between a call to virConnectNumOfDefinedInterfaces() and this call; you are only guaranteed that all currently defined interfaces were listed if the return is less than @maxnames. The client must call free() on each returned name.
virConnectListDefinedNetworks
0.2.0
int virConnectListDefinedNetworks (virConnectPtr conn, char ** const names, int maxnames)
list the inactive networks, stores the pointers to the names in @names
For more control over the results, see virConnectListAllNetworks().
- conn
- pointer to the hypervisor connection
- names
- pointer to an array to store the names
- maxnames
- size of the array
- Returns
- the number of names provided in the array or -1 in case of error. Note that this command is inherently racy; a network can be defined between a call to virConnectNumOfDefinedNetworks() and this call; you are only guaranteed that all currently defined networks were listed if the return is less than @maxnames. The client must call free() on each returned name.
virConnectListDefinedStoragePools
0.4.1
int virConnectListDefinedStoragePools (virConnectPtr conn, char ** const names, int maxnames)
Provides the list of names of inactive storage pools up to maxnames. If there are more than maxnames, the remaining names will be silently ignored.
For more control over the results, see virConnectListAllStoragePools().
- conn
- pointer to hypervisor connection
- names
- array of char * to fill with pool names (allocated by caller)
- maxnames
- size of the names array
- Returns
- the number of names provided in the array or -1 in case of error. Note that this command is inherently racy; a pool can be defined between a call to virConnectNumOfDefinedStoragePools() and this call; you are only guaranteed that all currently defined pools were listed if the return is less than @maxnames. The client must call free() on each returned name.
virConnectListDomains
0.0.1
int virConnectListDomains (virConnectPtr conn, int * ids, int maxids)
Collect the list of active domains, and store their IDs in array @ids
For inactive domains, see virConnectListDefinedDomains(). For more control over the results, see virConnectListAllDomains().
- conn
- pointer to the hypervisor connection
- ids
- array to collect the list of IDs of active domains
- maxids
- size of @ids
- Returns
- the number of domains found or -1 in case of error. Note that this command is inherently racy; a domain can be started between a call to virConnectNumOfDomains() and this call; you are only guaranteed that all currently active domains were listed if the return is less than @maxids.
virConnectListInterfaces
0.6.4
int virConnectListInterfaces (virConnectPtr conn, char ** const names, int maxnames)
Collect the list of active physical host interfaces, and store their names in @names
For more control over the results, see virConnectListAllInterfaces().
- conn
- pointer to the hypervisor connection
- names
- array to collect the list of names of interfaces
- maxnames
- size of @names
- Returns
- the number of interfaces found or -1 in case of error. Note that this command is inherently racy; a interface can be started between a call to virConnectNumOfInterfaces() and this call; you are only guaranteed that all currently active interfaces were listed if the return is less than @maxnames. The client must call free() on each returned name.
virConnectListNWFilters
0.8.2
int virConnectListNWFilters (virConnectPtr conn, char ** const names, int maxnames)
Collect the list of network filters, and store their names in @names
- conn
- pointer to the hypervisor connection
- names
- array to collect the list of names of network filters
- maxnames
- size of @names
- Returns
- the number of network filters found or -1 in case of error
virConnectListNetworks
0.2.0
int virConnectListNetworks (virConnectPtr conn, char ** const names, int maxnames)
Collect the list of active networks, and store their names in @names
For more control over the results, see virConnectListAllNetworks().
- conn
- pointer to the hypervisor connection
- names
- array to collect the list of names of active networks
- maxnames
- size of @names
- Returns
- the number of networks found or -1 in case of error. Note that this command is inherently racy; a network can be started between a call to virConnectNumOfNetworks() and this call; you are only guaranteed that all currently active networks were listed if the return is less than @maxnames. The client must call free() on each returned name.
virConnectListSecrets
0.7.1
int virConnectListSecrets (virConnectPtr conn, char ** uuids, int maxuuids)
List UUIDs of defined secrets, store pointers to names in uuids.
- conn
- virConnect connection
- uuids
- Pointer to an array to store the UUIDs
- maxuuids
- size of the array.
- Returns
- the number of UUIDs provided in the array, or -1 on failure.
virConnectListStoragePools
0.4.1
int virConnectListStoragePools (virConnectPtr conn, char ** const names, int maxnames)
Provides the list of names of active storage pools up to maxnames. If there are more than maxnames, the remaining names will be silently ignored.
For more control over the results, see virConnectListAllStoragePools().
- conn
- pointer to hypervisor connection
- names
- array of char * to fill with pool names (allocated by caller)
- maxnames
- size of the names array
- Returns
- the number of pools found or -1 in case of error. Note that this command is inherently racy; a pool can be started between a call to virConnectNumOfStoragePools() and this call; you are only guaranteed that all currently active pools were listed if the return is less than @maxnames. The client must call free() on each returned name.
virConnectNumOfDefinedDomains
0.1.5
int virConnectNumOfDefinedDomains (virConnectPtr conn)
Provides the number of defined but inactive domains.
- conn
- pointer to the hypervisor connection
- Returns
- the number of domain found or -1 in case of error
virConnectNumOfDefinedInterfaces
0.7.0
int virConnectNumOfDefinedInterfaces (virConnectPtr conn)
Provides the number of defined (inactive) interfaces on the physical host.
- conn
- pointer to the hypervisor connection
- Returns
- the number of defined interface found or -1 in case of error
virConnectNumOfDefinedNetworks
0.2.0
int virConnectNumOfDefinedNetworks (virConnectPtr conn)
Provides the number of inactive networks.
- conn
- pointer to the hypervisor connection
- Returns
- the number of networks found or -1 in case of error
virConnectNumOfDefinedStoragePools
0.4.1
int virConnectNumOfDefinedStoragePools (virConnectPtr conn)
Provides the number of inactive storage pools
- conn
- pointer to hypervisor connection
- Returns
- the number of pools found, or -1 on error
virConnectNumOfDomains
0.0.1
int virConnectNumOfDomains (virConnectPtr conn)
Provides the number of active domains.
- conn
- pointer to the hypervisor connection
- Returns
- the number of domain found or -1 in case of error
virConnectNumOfInterfaces
0.6.4
int virConnectNumOfInterfaces (virConnectPtr conn)
Provides the number of active interfaces on the physical host.
- conn
- pointer to the hypervisor connection
- Returns
- the number of active interfaces found or -1 in case of error
virConnectNumOfNWFilters
0.8.2
int virConnectNumOfNWFilters (virConnectPtr conn)
Provides the number of nwfilters.
- conn
- pointer to the hypervisor connection
- Returns
- the number of nwfilters found or -1 in case of error
virConnectNumOfNetworks
0.2.0
int virConnectNumOfNetworks (virConnectPtr conn)
Provides the number of active networks.
- conn
- pointer to the hypervisor connection
- Returns
- the number of network found or -1 in case of error
virConnectNumOfSecrets
0.7.1
int virConnectNumOfSecrets (virConnectPtr conn)
Fetch number of currently defined secrets.
- conn
- virConnect connection
- Returns
- the number currently defined secrets.
virConnectNumOfStoragePools
0.4.1
int virConnectNumOfStoragePools (virConnectPtr conn)
Provides the number of active storage pools
- conn
- pointer to hypervisor connection
- Returns
- the number of pools found, or -1 on error
virConnectOpen
0.0.1
virConnectPtr virConnectOpen (const char * name)
This function should be called first to get a connection to the Hypervisor and xen store
- name
- (optional) URI of the hypervisor
- Returns
- a pointer to the hypervisor connection or NULL in case of error If @name is NULL, if the LIBVIRT_DEFAULT_URI environment variable is set, then it will be used. Otherwise if the client configuration file has the "uri_default" parameter set, then it will be used. Finally probing will be done to determine a suitable default driver to activate. This involves trying each hypervisor in turn until one successfully opens. If connecting to an unprivileged hypervisor driver which requires the libvirtd daemon to be active, it will automatically be launched if not already running. This can be prevented by setting the environment variable LIBVIRT_AUTOSTART=0 URIs are documented at http://libvirt.org/uri.html
virConnectOpenAuth
0.4.0
virConnectPtr virConnectOpenAuth (const char * name, virConnectAuthPtr auth, unsigned int flags)
This function should be called first to get a connection to the Hypervisor. If necessary, authentication will be performed fetching credentials via the callback
See virConnectOpen for notes about environment variables which can have an effect on opening drivers
- name
- (optional) URI of the hypervisor
- auth
- Authenticate callback parameters
- flags
- bitwise-OR of virConnectFlags
- Returns
- a pointer to the hypervisor connection or NULL in case of error URIs are documented at http://libvirt.org/uri.html
virConnectOpenReadOnly
0.0.1
virConnectPtr virConnectOpenReadOnly (const char * name)
This function should be called first to get a restricted connection to the library functionalities. The set of APIs usable are then restricted on the available methods to control the domains.
See virConnectOpen for notes about environment variables which can have an effect on opening drivers
- name
- (optional) URI of the hypervisor
- Returns
- a pointer to the hypervisor connection or NULL in case of error URIs are documented at http://libvirt.org/uri.html
virConnectRef
0.6.0
int virConnectRef (virConnectPtr conn)
Increment the reference count on the connection. For each additional call to this method, there shall be a corresponding call to virConnectClose to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a connection would increment the reference count.
- conn
- the connection to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure
virConnectRegisterCloseCallback
0.10.0
int virConnectRegisterCloseCallback (virConnectPtr conn, virConnectCloseFunc cb, void * opaque, virFreeCallback freecb)
Registers a callback to be invoked when the connection is closed. This callback is invoked when there is any condition that causes the socket connection to the hypervisor to be closed.
This function is only applicable to hypervisor drivers which maintain a persistent open connection. Drivers which open a new connection for every operation will not invoke this.
The @freecb must not invoke any other libvirt public APIs, since it is not called from a re-entrant safe context.
- conn
- pointer to connection object
- cb
- callback to invoke upon close
- opaque
- user data to pass to @cb
- freecb
- callback to free @opaque
- Returns
- 0 on success, -1 on error
virConnectSetKeepAlive
0.9.8
int virConnectSetKeepAlive (virConnectPtr conn, int interval, unsigned int count)
Start sending keepalive messages after interval second of inactivity and consider the connection to be broken when no response is received after count keepalive messages sent in a row. In other words, sending count + 1 keepalive message results in closing the connection. When interval is <= 0, no keepalive messages will be sent. When count is 0, the connection will be automatically closed after interval seconds of inactivity without sending any keepalive messages.
Note: client has to implement and run event loop to be able to use keepalive messages. Failure to do so may result in connections being closed unexpectedly.
Note: This API function controls only keepalive messages sent by the client. If the server is configured to use keepalive you still need to run the event loop to respond to them, even if you disable keepalives by this function.
- conn
- pointer to a hypervisor connection
- interval
- number of seconds of inactivity before a keepalive message is sent
- count
- number of messages that can be sent in a row
- Returns
- -1 on error, 0 on success, 1 when remote party doesn't support keepalive messages.
virConnectUnregisterCloseCallback
0.10.0
int virConnectUnregisterCloseCallback (virConnectPtr conn, virConnectCloseFunc cb)
Unregisters the callback previously set with the virConnectRegisterCloseCallback method. The callback will no longer receive notifications when the connection closes. If a virFreeCallback was provided at time of registration, it will be invoked
- conn
- pointer to connection object
- cb
- pointer to the current registered callback
- Returns
- 0 on success, -1 on error
virDomainAbortJob
0.8.0
int virDomainAbortJob (virDomainPtr domain)
Requests that the current background job be aborted at the soonest opportunity.
- domain
- a domain object
- Returns
- 0 in case of success and -1 in case of failure.
virDomainAttachDevice
0.1.9
int virDomainAttachDevice (virDomainPtr domain, const char * xml)
Create a virtual device attachment to backend. This function, having hotplug semantics, is only allowed on an active domain.
For compatibility, this method can also be used to change the media in an existing CDROM/Floppy device, however, applications are recommended to use the virDomainUpdateDeviceFlag method instead.
- domain
- pointer to domain object
- xml
- pointer to XML description of one device
- Returns
- 0 in case of success, -1 in case of failure.
virDomainAttachDeviceFlags
0.7.7
int virDomainAttachDeviceFlags (virDomainPtr domain, const char * xml, unsigned int flags)
Attach a virtual device to a domain, using the flags parameter to control how the device is attached. VIR_DOMAIN_AFFECT_CURRENT specifies that the device allocation is made based on current domain state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be allocated to the active domain instance only and is not added to the persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG specifies that the device shall be allocated to the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation.
For compatibility, this method can also be used to change the media in an existing CDROM/Floppy device, however, applications are recommended to use the virDomainUpdateDeviceFlag method instead.
- domain
- pointer to domain object
- xml
- pointer to XML description of one device
- flags
- bitwise-OR of virDomainDeviceModifyFlags
- Returns
- 0 in case of success, -1 in case of failure.
virDomainBlockCommit
0.10.2
int virDomainBlockCommit (virDomainPtr dom, const char * disk, const char * base, const char * top, unsigned long bandwidth, unsigned int flags)
Commit changes that were made to temporary top-level files within a disk image backing file chain into a lower-level base file. In other words, take all the difference between @base and @top, and update @base to contain that difference; after the commit, any portion of the chain that previously depended on @top will now depend on @base, and all files after @base up to and including @top will now be invalidated. A typical use of this command is to reduce the length of a backing file chain after taking an external disk snapshot. To move data in the opposite direction, see virDomainBlockPull().
This command starts a long-running commit block job, whose status may be tracked by virDomainBlockJobInfo() with a job type of VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT, and the operation can be aborted with virDomainBlockJobAbort(). When finished, an asynchronous event is raised to indicate the final status, and the job no longer exists. If the job is aborted, it is up to the hypervisor whether starting a new job will resume from the same point, or start over.
Be aware that this command may invalidate files even if it is aborted; the user is cautioned against relying on the contents of invalidated intermediate files such as @top without manually rebasing those files to use a backing file of a read-only copy of @base prior to the point where the commit operation was started (although such a rebase cannot be safely done until the commit has successfully completed). However, the domain itself will not have any issues; the active layer remains valid throughout the entire commit operation. As a convenience, if @flags contains VIR_DOMAIN_BLOCK_COMMIT_DELETE, this command will unlink all files that were invalidated, after the commit successfully completes.
By default, if @base is NULL, the commit target will be the bottom of the backing chain; if @flags contains VIR_DOMAIN_BLOCK_COMMIT_SHALLOW, then the immediate backing file of @top will be used instead. If @top is NULL, the active image at the top of the chain will be used. Some hypervisors place restrictions on how much can be committed, and might fail if @base is not the immediate backing file of @top, or if @top is the active layer in use by a running domain, or if @top is not the top-most file; restrictions may differ for online vs. offline domains.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
The maximum bandwidth (in MiB/s) that will be used to do the commit can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0; in this case, it might still be possible for a later call to virDomainBlockJobSetSpeed() to succeed. The actual speed can be determined with virDomainGetBlockJobInfo().
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- base
- path to backing file to merge into, or NULL for default
- top
- path to file within backing chain that contains data to be merged, or NULL to merge all possible data
- bandwidth
- (optional) specify commit bandwidth limit in MiB/s
- flags
- bitwise-OR of virDomainBlockCommitFlags
- Returns
- 0 if the operation has started, -1 on failure.
virDomainBlockJobAbort
0.9.4
int virDomainBlockJobAbort (virDomainPtr dom, const char * disk, unsigned int flags)
Cancel the active block job on the given disk.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
If the current block job for @disk is VIR_DOMAIN_BLOCK_JOB_TYPE_PULL, then by default, this function performs a synchronous operation and the caller may assume that the operation has completed when 0 is returned. However, BlockJob operations may take a long time to cancel, and during this time further domain interactions may be unresponsive. To avoid this problem, pass VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC in the @flags argument to enable asynchronous behavior, returning as soon as possible. When the job has been canceled, a BlockJob event will be emitted, with status VIR_DOMAIN_BLOCK_JOB_CANCELED (even if the ABORT_ASYNC flag was not used); it is also possible to poll virDomainBlockJobInfo() to see if the job cancellation is still pending. This type of job can be restarted to pick up from where it left off.
If the current block job for @disk is VIR_DOMAIN_BLOCK_JOB_TYPE_COPY, then the default is to abort the mirroring and revert to the source disk; adding @flags of VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT causes this call to fail with VIR_ERR_BLOCK_COPY_ACTIVE if the copy is not fully populated, otherwise it will swap the disk over to the copy to end the mirroring. An event will be issued when the job is ended, and it is possible to use VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC to control whether this command waits for the completion of the job. Restarting this job requires starting over from the beginning of the first phase.
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- flags
- bitwise-OR of virDomainBlockJobAbortFlags
- Returns
- -1 in case of failure, 0 when successful.
virDomainBlockJobSetSpeed
0.9.4
int virDomainBlockJobSetSpeed (virDomainPtr dom, const char * disk, unsigned long bandwidth, unsigned int flags)
Set the maximimum allowable bandwidth that a block job may consume. If bandwidth is 0, the limit will revert to the hypervisor default.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- bandwidth
- specify bandwidth limit in MiB/s
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- -1 in case of failure, 0 when successful.
virDomainBlockPeek
0.4.5
int virDomainBlockPeek (virDomainPtr dom, const char * disk, unsigned long long offset, size_t size, void * buffer, unsigned int flags)
This function allows you to read the contents of a domain's disk device.
Typical uses for this are to determine if the domain has written a Master Boot Record (indicating that the domain has completed installation), or to try to work out the state of the domain's filesystems.
(Note that in the local case you might try to open the block device or file directly, but that won't work in the remote case, nor if you don't have sufficient permission. Hence the need for this call).
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
'offset' and 'size' represent an area which must lie entirely within the device or file. 'size' may be 0 to test if the call would succeed.
'buffer' is the return buffer and must be at least 'size' bytes.
NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes. However, with 0.9.13 this RPC limit has been raised to 1M byte.
- dom
- pointer to the domain object
- disk
- path to the block device, or device shorthand
- offset
- offset within block device
- size
- size to read
- buffer
- return buffer (must be at least size bytes)
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success or -1 in case of failure. really 64 bits
virDomainBlockPull
0.9.4
int virDomainBlockPull (virDomainPtr dom, const char * disk, unsigned long bandwidth, unsigned int flags)
Populate a disk image with data from its backing image. Once all data from its backing image has been pulled, the disk no longer depends on a backing image. This function pulls data for the entire device in the background. Progress of the operation can be checked with virDomainGetBlockJobInfo() and the operation can be aborted with virDomainBlockJobAbort(). When finished, an asynchronous event is raised to indicate the final status. To move data in the opposite direction, see virDomainBlockCommit().
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
The maximum bandwidth (in MiB/s) that will be used to do the copy can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0; in this case, it might still be possible for a later call to virDomainBlockJobSetSpeed() to succeed. The actual speed can be determined with virDomainGetBlockJobInfo().
This is shorthand for virDomainBlockRebase() with a NULL base.
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- bandwidth
- (optional) specify copy bandwidth limit in MiB/s
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 if the operation has started, -1 on failure.
virDomainBlockRebase
0.9.10
int virDomainBlockRebase (virDomainPtr dom, const char * disk, const char * base, unsigned long bandwidth, unsigned int flags)
Populate a disk image with data from its backing image chain, and setting the backing image to @base, or alternatively copy an entire backing chain to a new file @base.
When @flags is 0, this starts a pull, where @base must be the absolute path of one of the backing images further up the chain, or NULL to convert the disk image so that it has no backing image. Once all data from its backing image chain has been pulled, the disk no longer depends on those intermediate backing images. This function pulls data for the entire device in the background. Progress of the operation can be checked with virDomainGetBlockJobInfo() with a job type of VIR_DOMAIN_BLOCK_JOB_TYPE_PULL, and the operation can be aborted with virDomainBlockJobAbort(). When finished, an asynchronous event is raised to indicate the final status, and the job no longer exists. If the job is aborted, a new one can be started later to resume from the same point.
When @flags includes VIR_DOMAIN_BLOCK_REBASE_COPY, this starts a copy, where @base must be the name of a new file to copy the chain to. By default, the copy will pull the entire source chain into the destination file, but if @flags also contains VIR_DOMAIN_BLOCK_REBASE_SHALLOW, then only the top of the source chain will be copied (the source and destination have a common backing file). By default, @base will be created with the same file format as the source, but this can be altered by adding VIR_DOMAIN_BLOCK_REBASE_COPY_RAW to force the copy to be raw (does not make sense with the shallow flag unless the source is also raw), or by using VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT to reuse an existing file with initial contents identical to the backing file of the source (this allows a management app to pre-create files with relative backing file names, rather than the default of absolute backing file names; as a security precaution, you should generally only use reuse_ext with the shallow flag and a non-raw destination file).
A copy job has two parts; in the first phase, the @bandwidth parameter affects how fast the source is pulled into the destination, and the job can only be canceled by reverting to the source file; progress in this phase can be tracked via the virDomainBlockJobInfo() command, with a job type of VIR_DOMAIN_BLOCK_JOB_TYPE_COPY. The job transitions to the second phase when the job info states cur == end, and remains alive to mirror all further changes to both source and destination. The user must call virDomainBlockJobAbort() to end the mirroring while choosing whether to revert to source or pivot to the destination. An event is issued when the job ends, and depending on the hypervisor, an event may also be issued when the job transitions from pulling to mirroring. If the job is aborted, a new job will have to start over from the beginning of the first phase.
Some hypervisors will restrict certain actions, such as virDomainSave() or virDomainDetachDevice(), while a copy job is active; they may also restrict a copy job to transient domains.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
The maximum bandwidth (in MiB/s) that will be used to do the copy can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0; in this case, it might still be possible for a later call to virDomainBlockJobSetSpeed() to succeed. The actual speed can be determined with virDomainGetBlockJobInfo().
When @base is NULL and @flags is 0, this is identical to virDomainBlockPull().
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- base
- path to backing file to keep, or NULL for no backing file
- bandwidth
- (optional) specify copy bandwidth limit in MiB/s
- flags
- bitwise-OR of virDomainBlockRebaseFlags
- Returns
- 0 if the operation has started, -1 on failure.
virDomainBlockResize
0.9.8
int virDomainBlockResize (virDomainPtr dom, const char * disk, unsigned long long size, unsigned int flags)
Resize a block device of domain while the domain is running. If @flags is 0, then @size is in kibibytes (blocks of 1024 bytes); since 0.9.11, if @flags includes VIR_DOMAIN_BLOCK_RESIZE_BYTES, @size is in bytes instead. @size is taken directly as the new size. Depending on the file format, the hypervisor may round up to the next alignment boundary.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
Note that this call may fail if the underlying virtualization hypervisor does not support it; this call requires privileged access to the hypervisor.
- dom
- pointer to the domain object
- disk
- path to the block image, or shorthand
- size
- new size of the block image, see below for unit
- flags
- bitwise-OR of virDomainBlockResizeFlags
- Returns
- 0 in case of success or -1 in case of failure.
virDomainBlockStats
0.3.2
int virDomainBlockStats (virDomainPtr dom, const char * disk, virDomainBlockStatsPtr stats, size_t size)
This function returns block device (disk) stats for block devices attached to the domain.
The @disk parameter is either the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"), or (since 0.9.8) an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
Domains may have more than one block device. To get stats for each you should make multiple calls to this function.
Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic.
- dom
- pointer to the domain object
- disk
- path to the block device, or device shorthand
- stats
- block device stats (returned)
- size
- size of stats structure
- Returns
- 0 in case of success or -1 in case of failure.
virDomainBlockStatsFlags
0.9.5
int virDomainBlockStatsFlags (virDomainPtr dom, const char * disk, virTypedParameterPtr params, int * nparams, unsigned int flags)
This function is to get block stats parameters for block devices attached to the domain.
The @disk parameter is either the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"), or (since 0.9.8) an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
Domains may have more than one block device. To get stats for each you should make multiple calls to this function.
On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value.
As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. (Note that block devices of different types might support different parameters, so it might be necessary to compute @nparams for each block device). The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See virDomainGetMemoryParameters() for more details.
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- params
- pointer to block stats parameter object (return value)
- nparams
- pointer to number of block stats; input and output
- flags
- bitwise-OR of virTypedParameterFlags
- Returns
- -1 in case of error, 0 in case of success.
virDomainCoreDump
0.1.9
int virDomainCoreDump (virDomainPtr domain, const char * to, unsigned int flags)
This method will dump the core of a domain on a given file for analysis. Note that for remote Xen Daemon the file path will be interpreted in the remote host. Hypervisors may require the user to manually ensure proper permissions on the file named by @to.
If @flags includes VIR_DUMP_CRASH, then leave the guest shut off with a crashed state after the dump completes. If @flags includes VIR_DUMP_LIVE, then make the core dump while continuing to allow the guest to run; otherwise, the guest is suspended during the dump. VIR_DUMP_RESET flag forces reset of the quest after dump. The above three flags are mutually exclusive.
Additionally, if @flags includes VIR_DUMP_BYPASS_CACHE, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS.
- domain
- a domain object
- to
- path for the core file
- flags
- bitwise-OR of virDomainCoreDumpFlags
- Returns
- 0 in case of success and -1 in case of failure.
virDomainCreate
0.1.1
int virDomainCreate (virDomainPtr domain)
Launch a defined domain. If the call succeeds the domain moves from the defined to the running domains pools. The domain will be paused only if restoring from managed state created from a paused domain. For more control, see virDomainCreateWithFlags().
- domain
- pointer to a defined domain
- Returns
- 0 in case of success, -1 in case of error
virDomainCreateLinux
0.0.1
virDomainPtr virDomainCreateLinux (virConnectPtr conn, const char * xmlDesc, unsigned int flags)
Deprecated after 0.4.6. Renamed to virDomainCreateXML() providing identical functionality. This existing name will left indefinitely for API compatibility.
- conn
- pointer to the hypervisor connection
- xmlDesc
- string containing an XML description of the domain
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a new domain object or NULL in case of failure
virDomainCreateWithFlags
0.8.2
int virDomainCreateWithFlags (virDomainPtr domain, unsigned int flags)
Launch a defined domain. If the call succeeds the domain moves from the defined to the running domains pools.
If the VIR_DOMAIN_START_PAUSED flag is set, or if the guest domain has a managed save image that requested paused state (see virDomainManagedSave()) the guest domain will be started, but its CPUs will remain paused. The CPUs can later be manually started using virDomainResume(). In all other cases, the guest domain will be running.
If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest domain will be automatically destroyed when the virConnectPtr object is finally released. This will also happen if the client application crashes / loses its connection to the libvirtd daemon. Any domains marked for auto destroy will block attempts at migration, save-to-file, or snapshots.
If the VIR_DOMAIN_START_BYPASS_CACHE flag is set, and there is a managed save file for this domain (created by virDomainManagedSave()), then libvirt will attempt to bypass the file system cache while restoring the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing loads from NFS.
If the VIR_DOMAIN_START_FORCE_BOOT flag is set, then any managed save file for this domain is discarded, and the domain boots from scratch.
- domain
- pointer to a defined domain
- flags
- bitwise-OR of supported virDomainCreateFlags
- Returns
- 0 in case of success, -1 in case of error
virDomainCreateXML
0.5.0
virDomainPtr virDomainCreateXML (virConnectPtr conn, const char * xmlDesc, unsigned int flags)
Launch a new guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may require privileged access to the hypervisor. The domain is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted (see virDomainDefineXML() to define persistent domains).
If the VIR_DOMAIN_START_PAUSED flag is set, the guest domain will be started, but its CPUs will remain paused. The CPUs can later be manually started using virDomainResume.
If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest domain will be automatically destroyed when the virConnectPtr object is finally released. This will also happen if the client application crashes / loses its connection to the libvirtd daemon. Any domains marked for auto destroy will block attempts at migration, save-to-file, or snapshots.
- conn
- pointer to the hypervisor connection
- xmlDesc
- string containing an XML description of the domain
- flags
- bitwise-OR of supported virDomainCreateFlags
- Returns
- a new domain object or NULL in case of failure
virDomainDefineXML
0.1.1
virDomainPtr virDomainDefineXML (virConnectPtr conn, const char * xml)
Define a domain, but does not start it. This definition is persistent, until explicitly undefined with virDomainUndefine(). A previous definition for this domain would be overriden if it already exists.
Some hypervisors may prevent this operation if there is a current block copy operation on a transient domain with the same id as the domain being defined; in that case, use virDomainBlockJobAbort() to stop the block copy first.
- conn
- pointer to the hypervisor connection
- xml
- the XML description for the domain, preferably in UTF-8
- Returns
- NULL in case of error, a pointer to the domain otherwise
virDomainDestroy
0.0.1
int virDomainDestroy (virDomainPtr domain)
Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. This does not free the associated virDomainPtr object. This function may require privileged access.
virDomainDestroy first requests that a guest terminate (e.g. SIGTERM), then waits for it to comply. After a reasonable timeout, if the guest still exists, virDomainDestroy will forcefully terminate the guest (e.g. SIGKILL) if necessary (which may produce undesirable results, for example unflushed disk cache in the guest). To avoid this possibility, it's recommended to instead call virDomainDestroyFlags, sending the VIR_DOMAIN_DESTROY_GRACEFUL flag.
If the domain is transient and has any snapshot metadata (see virDomainSnapshotNum()), then that metadata will automatically be deleted when the domain quits.
- domain
- a domain object
- Returns
- 0 in case of success and -1 in case of failure.
virDomainDestroyFlags
0.9.4
int virDomainDestroyFlags (virDomainPtr domain, unsigned int flags)
Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. This does not free the associated virDomainPtr object. This function may require privileged access.
Calling this function with no @flags set (equal to zero) is equivalent to calling virDomainDestroy, and after a reasonable timeout will forcefully terminate the guest (e.g. SIGKILL) if necessary (which may produce undesirable results, for example unflushed disk cache in the guest). Including VIR_DOMAIN_DESTROY_GRACEFUL in the flags will prevent the forceful termination of the guest, and virDomainDestroyFlags will instead return an error if the guest doesn't terminate by the end of the timeout; at that time, the management application can decide if calling again without VIR_DOMAIN_DESTROY_GRACEFUL is appropriate.
Another alternative which may produce cleaner results for the guest's disks is to use virDomainShutdown() instead, but that depends on guest support (some hypervisor/guest combinations may ignore the shutdown request).
- domain
- a domain object
- flags
- bitwise-OR of virDomainDestroyFlagsValues
- Returns
- 0 in case of success and -1 in case of failure.
virDomainDetachDevice
0.1.9
int virDomainDetachDevice (virDomainPtr domain, const char * xml)
Destroy a virtual device attachment to backend. This function, having hot-unplug semantics, is only allowed on an active domain.
- domain
- pointer to domain object
- xml
- pointer to XML description of one device
- Returns
- 0 in case of success, -1 in case of failure.
virDomainDetachDeviceFlags
0.7.7
int virDomainDetachDeviceFlags (virDomainPtr domain, const char * xml, unsigned int flags)
Detach a virtual device from a domain, using the flags parameter to control how the device is detached. VIR_DOMAIN_AFFECT_CURRENT specifies that the device allocation is removed based on current domain state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be deallocated from the active domain instance only and is not from the persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG specifies that the device shall be deallocated from the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports removing the persisted device allocation.
Some hypervisors may prevent this operation if there is a current block copy operation on the device being detached; in that case, use virDomainBlockJobAbort() to stop the block copy first.
- domain
- pointer to domain object
- xml
- pointer to XML description of one device
- flags
- bitwise-OR of virDomainDeviceModifyFlags
- Returns
- 0 in case of success, -1 in case of failure.
virDomainFSTrim
1.0.1
int virDomainFSTrim (virDomainPtr dom, const char * mountPoint, unsigned long long minimum, unsigned int flags)
Calls FITRIM within the guest (hence guest agent may be required depending on hypervisor used). Either call it on each mounted filesystem (@mountPoint is NULL) or just on specified @mountPoint. @minimum hints that free ranges smaller than this may be ignored (this is a hint and the guest may not respect it). By increasing this value, the fstrim operation will complete more quickly for filesystems with badly fragmented free space, although not all blocks will be discarded. If @minimum is not zero, the command may fail.
- dom
- a domain object
- mountPoint
- which mount point to trim
- minimum
- Minimum contiguous free range to discard in bytes
- flags
- extra flags, not used yet, so callers should always pass 0
- Returns
- 0 on success, -1 otherwise.
virDomainFree
0.0.1
int virDomainFree (virDomainPtr domain)
Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter.
- domain
- a domain object
- Returns
- 0 in case of success and -1 in case of failure.
virDomainGetAutostart
0.2.1
int virDomainGetAutostart (virDomainPtr domain, int * autostart)
Provides a boolean value indicating whether the domain configured to be automatically started when the host machine boots.
- domain
- a domain object
- autostart
- the value returned
- Returns
- -1 in case of error, 0 in case of success
virDomainGetBlkioParameters
0.9.0
int virDomainGetBlkioParameters (virDomainPtr domain, virTypedParameterPtr params, int * nparams, unsigned int flags)
Get all blkio parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value.
As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again.
See virDomainGetMemoryParameters() for an equivalent usage example.
This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.
- domain
- pointer to domain object
- params
- pointer to blkio parameter object (return value, allocated by the caller)
- nparams
- pointer to number of blkio parameters; input and output
- flags
- bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
- Returns
- -1 in case of error, 0 in case of success.
virDomainGetBlockInfo
0.8.2
int virDomainGetBlockInfo (virDomainPtr domain, const char * disk, virDomainBlockInfoPtr info, unsigned int flags)
Extract information about a domain's block device.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
- domain
- a domain object
- disk
- path to the block device, or device shorthand
- info
- pointer to a virDomainBlockInfo structure allocated by the user
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virDomainGetBlockIoTune
0.9.8
int virDomainGetBlockIoTune (virDomainPtr dom, const char * disk, virTypedParameterPtr params, int * nparams, unsigned int flags)
Get all block IO tunable parameters for a given device. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value.
As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor, either for the given @disk (note that block devices of different types might support different parameters), or if @disk is NULL, for all possible disks. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See virDomainGetMemoryParameters() for more details.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk. This parameter cannot be NULL unless @nparams is 0 on input.
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- params
- Pointer to blkio parameter object (return value, allocated by the caller)
- nparams
- Pointer to number of blkio parameters
- flags
- bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
- Returns
- -1 in case of error, 0 in case of success.
virDomainGetBlockJobInfo
0.9.4
int virDomainGetBlockJobInfo (virDomainPtr dom, const char * disk, virDomainBlockJobInfoPtr info, unsigned int flags)
Request block job information for the given disk. If an operation is active @info will be updated with the current progress.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- info
- pointer to a virDomainBlockJobInfo structure
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- -1 in case of failure, 0 when nothing found, 1 when info was found.
virDomainGetCPUStats
0.9.10
int virDomainGetCPUStats (virDomainPtr domain, virTypedParameterPtr params, unsigned int nparams, int start_cpu, unsigned int ncpus, unsigned int flags)
Get statistics relating to CPU usage attributable to a single domain (in contrast to the statistics returned by virNodeGetCPUStats() for all processes on the host). @dom must be running (an inactive domain has no attributable cpu usage). On input, @params must contain at least @nparams * @ncpus entries, allocated by the caller.
If @start_cpu is -1, then @ncpus must be 1, and the returned results reflect the statistics attributable to the entire domain (such as user and system time for the process as a whole). Otherwise, @start_cpu represents which cpu to start with, and @ncpus represents how many consecutive processors to query, with statistics attributable per processor (such as per-cpu usage). If @ncpus is larger than the number of cpus available to query, then the trailing part of the array will be unpopulated.
The remote driver imposes a limit of 128 @ncpus and 16 @nparams; the number of parameters per cpu should not exceed 16, but if you have a host with more than 128 CPUs, your program should split the request into multiple calls.
As special cases, if @params is NULL and @nparams is 0 and @ncpus is 1, and the return value will be how many statistics are available for the given @start_cpu. This number may be different for @start_cpu of -1 than for any non-negative value, but will be the same for all non-negative @start_cpu. Likewise, if @params is NULL and @nparams is 0 and @ncpus is 0, the number of cpus available to query is returned. From the host perspective, this would typically match the cpus member of virNodeGetInfo(), but might be less due to host cpu hotplug.
For now, @flags is unused, and the statistics all relate to the usage from the host perspective. It is possible that a future version will support a flag that queries the cpu usage from the guest's perspective, where the maximum cpu to query would be related to virDomainGetVcpusFlags() rather than virNodeGetInfo(). An individual guest vcpu cannot be reliably mapped back to a specific host cpu unless a single-processor vcpu pinning was used, but when @start_cpu is -1, any difference in usage between a host and guest perspective would serve as a measure of hypervisor overhead.
Typical use sequence is below.
getting total stats: set start_cpu as -1, ncpus 1 virDomainGetCPUStats(dom, NULL, 0, -1, 1, 0) => nparams params = calloc(nparams, sizeof(virTypedParameter)) virDomainGetCPUStats(dom, params, nparams, -1, 1, 0) => total stats.
getting per-cpu stats: virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0) => ncpus virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0) => nparams params = calloc(ncpus * nparams, sizeof(virTypedParameter)) virDomainGetCPUStats(dom, params, nparams, 0, ncpus, 0) => per-cpu stats
- domain
- domain to query
- params
- array to populate on output
- nparams
- number of parameters per cpu
- start_cpu
- which cpu to start with, or -1 for summary
- ncpus
- how many cpus to query
- flags
- bitwise-OR of virTypedParameterFlags
- Returns
- -1 on failure, or the number of statistics that were populated per cpu on success (this will be less than the total number of populated @params, unless @ncpus was 1; and may be less than @nparams). The populated parameters start at each stride of @nparams, which means the results may be discontiguous; any unpopulated parameters will be zeroed on success (this includes skipped elements if @nparams is too large, and tail elements if @ncpus is too large). The caller is responsible for freeing any returned string parameters.
virDomainGetConnect
0.3.0
virConnectPtr virDomainGetConnect (virDomainPtr dom)
Provides the connection pointer associated with a domain. The reference counter on the connection is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the domain object together.
- dom
- pointer to a domain
- Returns
- the virConnectPtr or NULL in case of failure.
virDomainGetControlInfo
0.9.3
int virDomainGetControlInfo (virDomainPtr domain, virDomainControlInfoPtr info, unsigned int flags)
Extract details about current state of control interface to a domain.
- domain
- a domain object
- info
- pointer to a virDomainControlInfo structure allocated by the user
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virDomainGetDiskErrors
0.9.10
int virDomainGetDiskErrors (virDomainPtr dom, virDomainDiskErrorPtr errors, unsigned int maxerrors, unsigned int flags)
The function populates @errors array with all disks that encountered an I/O error. Disks with no error will not be returned in the @errors array. Each disk is identified by its target (the dev attribute of target subelement in domain XML), such as "vda", and accompanied with the error that was seen on it. The caller is also responsible for calling free() on each disk name returned.
In a special case when @errors is NULL and @maxerrors is 0, the function
- dom
- a domain object
- errors
- array to populate on output
- maxerrors
- size of @errors array
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- preferred size of @errors that the caller should use to get all disk errors. Since calling virDomainGetDiskErrors(dom, NULL, 0, 0) to get preferred size of @errors array and getting the errors are two separate operations, new disks may be hotplugged to the domain and new errors may be encountered between the two calls. Thus, this function may not return all disk errors because the supplied array is not large enough. Such errors may, however, be detected by listening to domain events. Returns number of disks with errors filled in the @errors array or -1 on error.
virDomainGetEmulatorPinInfo
0.10.0
int virDomainGetEmulatorPinInfo (virDomainPtr domain, unsigned char * cpumap, int maplen, unsigned int flags)
Query the CPU affinity setting of all emulator threads of domain, store it in cpumap.
- domain
- pointer to domain object, or NULL for Domain0
- cpumap
- pointer to a bit map of real CPUs for all emulator threads of this domain (in 8-bit bytes) (OUT) There is only one cpumap for all emulator threads. Must not be NULL.
- maplen
- the number of bytes in one cpumap, from 1 up to size of CPU map. Must be positive.
- flags
- bitwise-OR of virDomainModificationImpact Must not be VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG concurrently.
- Returns
- 1 in case of success, 0 in case of no emulator threads are pined to pcpus, -1 in case of failure.
virDomainGetHostname
0.10.0
char * virDomainGetHostname (virDomainPtr domain, unsigned int flags)
Get the hostname for that domain.
Dependent on hypervisor used, this may require a guest agent to be available.
- domain
- a domain object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the hostname which must be freed by the caller, or NULL if there was an error.
virDomainGetID
0.0.1
unsigned int virDomainGetID (virDomainPtr domain)
Get the hypervisor ID number for the domain
- domain
- a domain object
- Returns
- the domain ID number or (unsigned int) -1 in case of error
virDomainGetInfo
0.0.1
int virDomainGetInfo (virDomainPtr domain, virDomainInfoPtr info)
Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.
- domain
- a domain object
- info
- pointer to a virDomainInfo structure allocated by the user
- Returns
- 0 in case of success and -1 in case of failure.
virDomainGetInterfaceParameters
0.9.9
int virDomainGetInterfaceParameters (virDomainPtr domain, const char * device, virTypedParameterPtr params, int * nparams, unsigned int flags)
Get all interface parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value.
As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See virDomainGetMemoryParameters() for an equivalent usage example.
This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.
- domain
- pointer to domain object
- device
- the interface name or mac address
- params
- pointer to interface parameter objects (return value, allocated by the caller)
- nparams
- pointer to number of interface parameter; input and output
- flags
- bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
- Returns
- -1 in case of error, 0 in case of success.
virDomainGetJobInfo
0.8.0
int virDomainGetJobInfo (virDomainPtr domain, virDomainJobInfoPtr info)
Extract information about progress of a background job on a domain. Will return an error if the domain is not active.
- domain
- a domain object
- info
- pointer to a virDomainJobInfo structure allocated by the user
- Returns
- 0 in case of success and -1 in case of failure.
virDomainGetJobStats
1.0.3
int virDomainGetJobStats (virDomainPtr domain, int * type, virTypedParameterPtr * params, int * nparams, unsigned int flags)
Extract information about progress of a background job on a domain. Will return an error if the domain is not active. The function returns a superset of progress information provided by virDomainGetJobInfo. Possible fields returned in @params are defined by VIR_DOMAIN_JOB_* macros and new fields will likely be introduced in the future so callers may receive fields that they do not understand in case they talk to a newer server.
- domain
- a domain object
- type
- where to store the job type (one of virDomainJobType)
- params
- where to store job statistics
- nparams
- number of items in @params
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virDomainGetMaxMemory
0.0.1
unsigned long virDomainGetMaxMemory (virDomainPtr domain)
Retrieve the maximum amount of physical memory allocated to a domain. If domain is NULL, then this get the amount of memory reserved to Domain0 i.e. the domain where the application runs.
- domain
- a domain object or NULL
- Returns
- the memory size in kibibytes (blocks of 1024 bytes), or 0 in case of error.
virDomainGetMaxVcpus
0.2.1
int virDomainGetMaxVcpus (virDomainPtr domain)
Provides the maximum number of virtual CPUs supported for the guest VM. If the guest is inactive, this is basically the same as virConnectGetMaxVcpus(). If the guest is running this will reflect the maximum number of virtual CPUs the guest was booted with. For more details, see virDomainGetVcpusFlags().
- domain
- pointer to domain object
- Returns
- the maximum of virtual CPU or -1 in case of error.
virDomainGetMemoryParameters
0.8.5
int virDomainGetMemoryParameters (virDomainPtr domain, virTypedParameterPtr params, int * nparams, unsigned int flags)
Get all memory parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value.
As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again.
Here is a sample code snippet:
if ((virDomainGetMemoryParameters(dom, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(*params) * nparams)) == NULL) goto error; memset(params, 0, sizeof(*params) * nparams); if (virDomainGetMemoryParameters(dom, params, &nparams, 0)) goto error; }
This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.
- domain
- pointer to domain object
- params
- pointer to memory parameter object (return value, allocated by the caller)
- nparams
- pointer to number of memory parameters; input and output
- flags
- bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
- Returns
- -1 in case of error, 0 in case of success.
virDomainGetMetadata
0.9.10
char * virDomainGetMetadata (virDomainPtr domain, int type, const char * uri, unsigned int flags)
Retrieves the appropriate domain element given by @type. If VIR_DOMAIN_METADATA_ELEMENT is requested parameter @uri must be set to the name of the namespace the requested elements belong to, otherwise must be NULL.
If an element of the domain XML is not present, the resulting error will be VIR_ERR_NO_DOMAIN_METADATA. This method forms a shortcut for seeing information from virDomainSetMetadata() without having to go through virDomainGetXMLDesc().
@flags controls whether the live domain or persistent configuration will be queried.
- domain
- a domain object
- type
- type of description, from virDomainMetadataType
- uri
- XML namespace identifier
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- the metadata string on success (caller must free), or NULL in case of failure.
virDomainGetName
0.0.1
const char * virDomainGetName (virDomainPtr domain)
Get the public name for that domain
- domain
- a domain object
- Returns
- a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the domain object.
virDomainGetNumaParameters
0.9.9
int virDomainGetNumaParameters (virDomainPtr domain, virTypedParameterPtr params, int * nparams, unsigned int flags)
Get all numa parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value.
As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again.
See virDomainGetMemoryParameters() for an equivalent usage example.
This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.
- domain
- pointer to domain object
- params
- pointer to numa parameter object (return value, allocated by the caller)
- nparams
- pointer to number of numa parameters
- flags
- bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
- Returns
- -1 in case of error, 0 in case of success.
virDomainGetOSType
0.0.1
char * virDomainGetOSType (virDomainPtr domain)
Get the type of domain operation system.
- domain
- a domain object
- Returns
- the new string or NULL in case of error, the string must be freed by the caller.
virDomainGetSchedulerParameters
0.2.3
int virDomainGetSchedulerParameters (virDomainPtr domain, virTypedParameterPtr params, int * nparams)
Get all scheduler parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. @nparams cannot be 0.
It is hypervisor specific whether this returns the live or persistent state; for more control, use virDomainGetSchedulerParametersFlags().
- domain
- pointer to domain object
- params
- pointer to scheduler parameter objects (return value)
- nparams
- pointer to number of scheduler parameter objects (this value should generally be as large as the returned value nparams of virDomainGetSchedulerType()); input and output
- Returns
- -1 in case of error, 0 in case of success.
virDomainGetSchedulerParametersFlags
0.9.2
int virDomainGetSchedulerParametersFlags (virDomainPtr domain, virTypedParameterPtr params, int * nparams, unsigned int flags)
Get all scheduler parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. @nparams cannot be 0.
The value of @flags can be exactly VIR_DOMAIN_AFFECT_CURRENT, VIR_DOMAIN_AFFECT_LIVE, or VIR_DOMAIN_AFFECT_CONFIG.
Here is a sample code snippet:
char *ret = virDomainGetSchedulerType(dom, &nparams); if (ret && nparams != 0) { if ((params = malloc(sizeof(*params) * nparams)) == NULL) goto error; memset(params, 0, sizeof(*params) * nparams); if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, 0)) goto error; }
- domain
- pointer to domain object
- params
- pointer to scheduler parameter object (return value)
- nparams
- pointer to number of scheduler parameter (this value should be same than the returned value nparams of virDomainGetSchedulerType()); input and output
- flags
- bitwise-OR of virDomainModificationImpact and virTypedParameterFlags
- Returns
- -1 in case of error, 0 in case of success.
virDomainGetSchedulerType
0.2.3
char * virDomainGetSchedulerType (virDomainPtr domain, int * nparams)
Get the scheduler type and the number of scheduler parameters.
- domain
- pointer to domain object
- nparams
- pointer to number of scheduler parameters, can be NULL (return value)
- Returns
- NULL in case of error. The caller must free the returned string.
virDomainGetSecurityLabel
0.6.1
int virDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel)
Extract security label of an active domain. The 'label' field in the @seclabel argument will be initialized to the empty string if the domain is not running under a security model.
- domain
- a domain object
- seclabel
- pointer to a virSecurityLabel structure
- Returns
- 0 in case of success, -1 in case of failure
virDomainGetSecurityLabelList
0.10.0
int virDomainGetSecurityLabelList (virDomainPtr domain, virSecurityLabelPtr * seclabels)
Extract the security labels of an active domain. The 'label' field in the @seclabels argument will be initialized to the empty string if the domain is not running under a security model.
- domain
- a domain object
- seclabels
- will be auto-allocated and filled with domains' security labels. Caller must free memory on return.
- Returns
- number of elemnets in @seclabels on success, -1 in case of failure.
virDomainGetState
0.9.2
int virDomainGetState (virDomainPtr domain, int * state, int * reason, unsigned int flags)
Extract domain state. Each state can be accompanied with a reason (if known) which led to the state.
- domain
- a domain object
- state
- returned state of the domain (one of virDomainState)
- reason
- returned reason which led to @state (one of virDomain*Reason corresponding to the current state); it is allowed to be NULL
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virDomainGetUUID
0.0.5
int virDomainGetUUID (virDomainPtr domain, unsigned char * uuid)
Get the UUID for a domain
- domain
- a domain object
- uuid
- pointer to a VIR_UUID_BUFLEN bytes array
- Returns
- -1 in case of error, 0 in case of success
virDomainGetUUIDString
0.1.1
int virDomainGetUUIDString (virDomainPtr domain, char * buf)
Get the UUID for a domain as string. For more information about UUID see RFC4122.
- domain
- a domain object
- buf
- pointer to a VIR_UUID_STRING_BUFLEN bytes array
- Returns
- -1 in case of error, 0 in case of success
virDomainGetVcpuPinInfo
0.9.3
int virDomainGetVcpuPinInfo (virDomainPtr domain, int ncpumaps, unsigned char * cpumaps, int maplen, unsigned int flags)
Query the CPU affinity setting of all virtual CPUs of domain, store it in cpumaps.
- domain
- pointer to domain object, or NULL for Domain0
- ncpumaps
- the number of cpumap (listed first to match virDomainGetVcpus)
- cpumaps
- pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT) It's assumed there is <ncpumaps> cpumap in cpumaps array. The memory allocated to cpumaps must be (ncpumaps * maplen) bytes (ie: calloc(ncpumaps, maplen)). One cpumap inside cpumaps has the format described in virDomainPinVcpu() API. Must not be NULL.
- maplen
- the number of bytes in one cpumap, from 1 up to size of CPU map. Must be positive.
- flags
- bitwise-OR of virDomainModificationImpact Must not be VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG concurrently.
- Returns
- the number of virtual CPUs in case of success, -1 in case of failure.
virDomainGetVcpus
0.1.4
int virDomainGetVcpus (virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, unsigned char * cpumaps, int maplen)
Extract information about virtual CPUs of domain, store it in info array and also in cpumaps if this pointer isn't NULL. This call may fail on an inactive domain.
See also virDomainGetVcpuPinInfo for querying just cpumaps, including on an inactive domain.
- domain
- pointer to domain object, or NULL for Domain0
- info
- pointer to an array of virVcpuInfo structures (OUT)
- maxinfo
- number of structures in info array
- cpumaps
- pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT) If cpumaps is NULL, then no cpumap information is returned by the API. It's assumed there is <maxinfo> cpumap in cpumaps array. The memory allocated to cpumaps must be (maxinfo * maplen) bytes (ie: calloc(maxinfo, maplen)). One cpumap inside cpumaps has the format described in virDomainPinVcpu() API.
- maplen
- number of bytes in one cpumap, from 1 up to size of CPU map in underlying virtualization system (Xen...). Must be zero when cpumaps is NULL and positive when it is non-NULL.
- Returns
- the number of info filled in case of success, -1 in case of failure.
virDomainGetVcpusFlags
0.8.5
int virDomainGetVcpusFlags (virDomainPtr domain, unsigned int flags)
Query the number of virtual CPUs used by the domain. Note that this call may fail if the underlying virtualization hypervisor does not support it. This function may require privileged access to the hypervisor.
If @flags includes VIR_DOMAIN_AFFECT_LIVE, this will query a running domain (which will fail if domain is not active); if it includes VIR_DOMAIN_AFFECT_CONFIG, this will query the XML description of the domain. It is an error to set both flags. If neither flag is set (that is, VIR_DOMAIN_AFFECT_CURRENT), then the configuration queried depends on whether the domain is currently running.
If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then the maximum virtual CPU limit is queried. Otherwise, this call queries the current virtual CPU limit.
- domain
- pointer to domain object, or NULL for Domain0
- flags
- bitwise-OR of virDomainVcpuFlags
- Returns
- the number of vCPUs in case of success, -1 in case of failure.
virDomainGetXMLDesc
0.0.1
char * virDomainGetXMLDesc (virDomainPtr domain, unsigned int flags)
Provide an XML description of the domain. The description may be reused later to relaunch the domain with virDomainCreateXML().
No security-sensitive data will be included unless @flags contains VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only connections. If @flags includes VIR_DOMAIN_XML_INACTIVE, then the XML represents the configuration that will be used on the next boot of a persistent domain; otherwise, the configuration represents the currently running domain. If @flags contains VIR_DOMAIN_XML_UPDATE_CPU, then the portion of the domain XML describing CPU capabilities is modified to match actual capabilities of the host.
- domain
- a domain object
- flags
- bitwise-OR of virDomainXMLFlags
- Returns
- a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.
virDomainHasCurrentSnapshot
0.8.2
int virDomainHasCurrentSnapshot (virDomainPtr domain, unsigned int flags)
Determine if the domain has a current snapshot.
- domain
- pointer to the domain object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 1 if such snapshot exists, 0 if it doesn't, -1 on error.
virDomainHasManagedSaveImage
0.8.2
int virDomainHasManagedSaveImage (virDomainPtr dom, unsigned int flags)
Check if a domain has a managed save image as created by virDomainManagedSave(). Note that any running domain should not have such an image, as it should have been removed on restart.
- dom
- pointer to the domain
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 if no image is present, 1 if an image is present, and -1 in case of error
virDomainInjectNMI
0.9.2
int virDomainInjectNMI (virDomainPtr domain, unsigned int flags)
Send NMI to the guest
- domain
- pointer to domain object, or NULL for Domain0
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 in case of failure.
virDomainInterfaceStats
0.3.2
int virDomainInterfaceStats (virDomainPtr dom, const char * path, virDomainInterfaceStatsPtr stats, size_t size)
This function returns network interface stats for interfaces attached to the domain.
The path parameter is the name of the network interface.
Domains may have more than one network interface. To get stats for each you should make multiple calls to this function.
Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic.
- dom
- pointer to the domain object
- path
- path to the interface
- stats
- network interface stats (returned)
- size
- size of stats structure
- Returns
- 0 in case of success or -1 in case of failure.
virDomainIsActive
0.7.3
int virDomainIsActive (virDomainPtr dom)
Determine if the domain is currently running
- dom
- pointer to the domain object
- Returns
- 1 if running, 0 if inactive, -1 on error
virDomainIsPersistent
0.7.3
int virDomainIsPersistent (virDomainPtr dom)
Determine if the domain has a persistent configuration which means it will still exist after shutting down
- dom
- pointer to the domain object
- Returns
- 1 if persistent, 0 if transient, -1 on error
virDomainIsUpdated
0.8.6
int virDomainIsUpdated (virDomainPtr dom)
Determine if the domain has been updated.
- dom
- pointer to the domain object
- Returns
- 1 if updated, 0 if not, -1 on error
virDomainListAllSnapshots
0.9.13
int virDomainListAllSnapshots (virDomainPtr domain, virDomainSnapshotPtr ** snaps, unsigned int flags)
Collect the list of domain snapshots for the given domain, and allocate an array to store those objects. This API solves the race inherent in virDomainSnapshotListNames().
By default, this command covers all snapshots; it is also possible to limit things to just snapshots with no parents, when @flags includes VIR_DOMAIN_SNAPSHOT_LIST_ROOTS. Additional filters are provided in groups, where each group contains bits that describe mutually exclusive attributes of a snapshot, and where all bits within a group describe all possible snapshots. Some hypervisors might reject explicit bits from a group where the hypervisor cannot make a distinction. For a group supported by a given hypervisor, the behavior when no bits of a group are set is identical to the behavior when all bits in that group are set. When setting bits from more than one group, it is possible to select an impossible combination, in that case a hypervisor may return either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on whether they have metadata that would prevent the removal of the last reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, for filtering snapshots based on what domain state is tracked by the snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on whether the snapshot is stored inside the disk images or as additional files.
- domain
- a domain object
- snaps
- pointer to variable to store the array containing snapshot objects, or NULL if the list is not required (just returns number of snapshots)
- flags
- bitwise-OR of supported virDomainSnapshotListFlags
- Returns
- the number of domain snapshots found or -1 and sets @snaps to NULL in case of error. On success, the array stored into @snaps is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virDomainSnapshotFree() on each array element, then calling free() on @snaps.
virDomainLookupByID
0.0.1
virDomainPtr virDomainLookupByID (virConnectPtr conn, int id)
Try to find a domain based on the hypervisor ID number Note that this won't work for inactive domains which have an ID of -1, in that case a lookup based on the Name or UUId need to be done instead.
- conn
- pointer to the hypervisor connection
- id
- the domain ID number
- Returns
- a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.
virDomainLookupByName
0.0.1
virDomainPtr virDomainLookupByName (virConnectPtr conn, const char * name)
Try to lookup a domain on the given hypervisor based on its name.
- conn
- pointer to the hypervisor connection
- name
- name for the domain
- Returns
- a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.
virDomainLookupByUUID
0.0.5
virDomainPtr virDomainLookupByUUID (virConnectPtr conn, const unsigned char * uuid)
Try to lookup a domain on the given hypervisor based on its UUID.
- conn
- pointer to the hypervisor connection
- uuid
- the raw UUID for the domain
- Returns
- a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.
virDomainLookupByUUIDString
0.1.1
virDomainPtr virDomainLookupByUUIDString (virConnectPtr conn, const char * uuidstr)
Try to lookup a domain on the given hypervisor based on its UUID.
- conn
- pointer to the hypervisor connection
- uuidstr
- the string UUID for the domain
- Returns
- a new domain object or NULL in case of failure. If the domain cannot be found, then VIR_ERR_NO_DOMAIN error is raised.
virDomainManagedSave
0.8.2
int virDomainManagedSave (virDomainPtr dom, unsigned int flags)
This method will suspend a domain and save its memory contents to a file on disk. After the call, if successful, the domain is not listed as running anymore. The difference from virDomainSave() is that libvirt is keeping track of the saved state itself, and will reuse it once the domain is being restarted (automatically or via an explicit libvirt call). As a result any running domain is sure to not have a managed saved image. This also implies that managed save only works on persistent domains, since the domain must still exist in order to use virDomainCreate() to restart it.
If @flags includes VIR_DOMAIN_SAVE_BYPASS_CACHE, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS.
Normally, the managed saved state will remember whether the domain was running or paused, and start will resume to the same state. Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in @flags will override the default saved into the file. These two flags are mutually exclusive.
- dom
- pointer to the domain
- flags
- bitwise-OR of virDomainSaveRestoreFlags
- Returns
- 0 in case of success or -1 in case of failure
virDomainManagedSaveRemove
0.8.2
int virDomainManagedSaveRemove (virDomainPtr dom, unsigned int flags)
Remove any managed save image for this domain.
- dom
- pointer to the domain
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, and -1 in case of error
virDomainMemoryPeek
0.4.5
int virDomainMemoryPeek (virDomainPtr dom, unsigned long long start, size_t size, void * buffer, unsigned int flags)
This function allows you to read the contents of a domain's memory.
The memory which is read is controlled by the 'start', 'size' and 'flags' parameters.
If 'flags' is VIR_MEMORY_VIRTUAL then the 'start' and 'size' parameters are interpreted as virtual memory addresses for whichever task happens to be running on the domain at the moment. Although this sounds haphazard it is in fact what you want in order to read Linux kernel state, because it ensures that pointers in the kernel image can be interpreted coherently.
'buffer' is the return buffer and must be at least 'size' bytes. 'size' may be 0 to test if the call would succeed.
NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes. However, with 0.9.13 this RPC limit has been raised to 1M byte.
- dom
- pointer to the domain object
- start
- start of memory to peek
- size
- size of memory to peek
- buffer
- return buffer (must be at least size bytes)
- flags
- bitwise-OR of virDomainMemoryFlags
- Returns
- 0 in case of success or -1 in case of failure. really 64 bits
virDomainMemoryStats
0.7.5
int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats, unsigned int nr_stats, unsigned int flags)
This function provides memory statistics for the domain.
Up to 'nr_stats' elements of 'stats' will be populated with memory statistics from the domain. Only statistics supported by the domain, the driver, and this version of libvirt will be returned.
Memory Statistics:
VIR_DOMAIN_MEMORY_STAT_SWAP_IN: The total amount of data read from swap space (in kb). VIR_DOMAIN_MEMORY_STAT_SWAP_OUT: The total amount of memory written out to swap space (in kb). VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT: The number of page faults that required disk IO to service. VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT: The number of page faults serviced without disk IO. VIR_DOMAIN_MEMORY_STAT_UNUSED: The amount of memory which is not being used for any purpose (in kb). VIR_DOMAIN_MEMORY_STAT_AVAILABLE: The total amount of memory available to the domain's OS (in kb). VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON: Current balloon value (in kb).
- dom
- pointer to the domain object
- stats
- nr_stats-sized array of stat structures (returned)
- nr_stats
- number of memory statistics requested
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- The number of stats provided or -1 in case of failure.
virDomainMigrate
0.3.2
virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn, unsigned long flags, const char * dname, const char * uri, unsigned long bandwidth)
Migrate the domain object from its current host to the destination host given by dconn (a connection to the destination host).
Flags may be one of more of the following: VIR_MIGRATE_LIVE Do not pause the VM during migration VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain on the destination host. VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the domain on the source host. VIR_MIGRATE_PAUSED Leave the domain suspended on the remote side. VIR_MIGRATE_NON_SHARED_DISK Migration with non-shared storage with full disk copy VIR_MIGRATE_NON_SHARED_INC Migration with non-shared storage with incremental disk copy VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration changes during the migration process (set automatically when supported). VIR_MIGRATE_UNSAFE Force migration even if it is considered unsafe. VIR_MIGRATE_OFFLINE Migrate offline
VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set. Applications using the VIR_MIGRATE_PEER2PEER flag will probably prefer to invoke virDomainMigrateToURI, avoiding the need to open connection to the destination host themselves.
If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error.
If the VIR_MIGRATE_PEER2PEER flag is set, the uri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If omitted, the dconn connection object will be queried for its current URI.
If the VIR_MIGRATE_PEER2PEER flag is NOT set, the URI parameter takes a hypervisor specific format. The hypervisor capabilities XML includes details of the support URI schemes. If omitted the dconn will be asked for a default URI.
If you want to copy non-shared storage within migration you can use either VIR_MIGRATE_NON_SHARED_DISK or VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive.
In either case it is typically only necessary to specify a URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data.
The maximum bandwidth (in MiB/s) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0.
To see which features are supported by the current hypervisor, see virConnectGetCapabilities, /capabilities/host/migration_features.
There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor.
- domain
- a domain object
- dconn
- destination host (a connection object)
- flags
- bitwise-OR of virDomainMigrateFlags
- dname
- (optional) rename domain to this at destination
- uri
- (optional) dest hostname/URI as seen from the source host
- bandwidth
- (optional) specify migration bandwidth limit in MiB/s
- Returns
- the new domain object if the migration was successful, or NULL in case of error. Note that the new domain object exists in the scope of the destination connection (dconn).
virDomainMigrate2
0.9.2
virDomainPtr virDomainMigrate2 (virDomainPtr domain, virConnectPtr dconn, const char * dxml, unsigned long flags, const char * dname, const char * uri, unsigned long bandwidth)
Migrate the domain object from its current host to the destination host given by dconn (a connection to the destination host).
Flags may be one of more of the following: VIR_MIGRATE_LIVE Do not pause the VM during migration VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain on the destination host. VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the domain on the source host. VIR_MIGRATE_PAUSED Leave the domain suspended on the remote side. VIR_MIGRATE_NON_SHARED_DISK Migration with non-shared storage with full disk copy VIR_MIGRATE_NON_SHARED_INC Migration with non-shared storage with incremental disk copy VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration changes during the migration process (set automatically when supported). VIR_MIGRATE_UNSAFE Force migration even if it is considered unsafe. VIR_MIGRATE_OFFLINE Migrate offline
VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set. Applications using the VIR_MIGRATE_PEER2PEER flag will probably prefer to invoke virDomainMigrateToURI, avoiding the need to open connection to the destination host themselves.
If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error.
If the VIR_MIGRATE_PEER2PEER flag is set, the uri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If omitted, the dconn connection object will be queried for its current URI.
If the VIR_MIGRATE_PEER2PEER flag is NOT set, the URI parameter takes a hypervisor specific format. The hypervisor capabilities XML includes details of the support URI schemes. If omitted the dconn will be asked for a default URI.
If you want to copy non-shared storage within migration you can use either VIR_MIGRATE_NON_SHARED_DISK or VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive.
In either case it is typically only necessary to specify a URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data.
The maximum bandwidth (in MiB/s) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0.
To see which features are supported by the current hypervisor, see virConnectGetCapabilities, /capabilities/host/migration_features.
There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor.
If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used on the destination. For example, it is possible to alter the backing filename that is associated with a disk device, in order to account for naming differences between source and destination in accessing the underlying storage. The migration will fail if @dxml would cause any guest-visible changes. Pass NULL if no changes are needed to the XML between source and destination. @dxml cannot be used to rename the domain during migration (use @dname for that purpose). Domain name in @dxml must match the original domain name.
- domain
- a domain object
- dconn
- destination host (a connection object)
- dxml
- (optional) XML config for launching guest on target
- flags
- bitwise-OR of virDomainMigrateFlags
- dname
- (optional) rename domain to this at destination
- uri
- (optional) dest hostname/URI as seen from the source host
- bandwidth
- (optional) specify migration bandwidth limit in MiB/s
- Returns
- the new domain object if the migration was successful, or NULL in case of error. Note that the new domain object exists in the scope of the destination connection (dconn).
virDomainMigrateGetCompressionCache
1.0.3
int virDomainMigrateGetCompressionCache (virDomainPtr domain, unsigned long long * cacheSize, unsigned int flags)
Gets current size of the cache (in bytes) used for compressing repeatedly transferred memory pages during live migration.
- domain
- a domain object
- cacheSize
- return value of current size of the cache (in bytes)
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 otherwise.
virDomainMigrateGetMaxSpeed
0.9.5
int virDomainMigrateGetMaxSpeed (virDomainPtr domain, unsigned long * bandwidth, unsigned int flags)
Get the current maximum bandwidth (in MiB/s) that will be used if the domain is migrated. Not all hypervisors will support a bandwidth limit.
- domain
- a domain object
- bandwidth
- return value of current migration bandwidth limit in MiB/s
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 otherwise.
virDomainMigrateSetCompressionCache
1.0.3
int virDomainMigrateSetCompressionCache (virDomainPtr domain, unsigned long long cacheSize, unsigned int flags)
Sets size of the cache (in bytes) used for compressing repeatedly transferred memory pages during live migration. It's supposed to be called while the domain is being live-migrated as a reaction to migration progress and increasing number of compression cache misses obtained from virDomainGetJobStats.
- domain
- a domain object
- cacheSize
- size of the cache (in bytes) used for compression
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 otherwise.
virDomainMigrateSetMaxDowntime
0.8.0
int virDomainMigrateSetMaxDowntime (virDomainPtr domain, unsigned long long downtime, unsigned int flags)
Sets maximum tolerable time for which the domain is allowed to be paused at the end of live migration. It's supposed to be called while the domain is being live-migrated as a reaction to migration progress.
- domain
- a domain object
- downtime
- maximum tolerable downtime for live migration, in milliseconds
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 otherwise.
virDomainMigrateSetMaxSpeed
0.9.0
int virDomainMigrateSetMaxSpeed (virDomainPtr domain, unsigned long bandwidth, unsigned int flags)
The maximum bandwidth (in MiB/s) that will be used to do migration can be specified with the bandwidth parameter. Not all hypervisors will support a bandwidth cap
- domain
- a domain object
- bandwidth
- migration bandwidth limit in MiB/s
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 otherwise.
virDomainMigrateToURI
0.7.2
int virDomainMigrateToURI (virDomainPtr domain, const char * duri, unsigned long flags, const char * dname, unsigned long bandwidth)
Migrate the domain object from its current host to the destination host given by duri.
Flags may be one of more of the following: VIR_MIGRATE_LIVE Do not pause the VM during migration VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain on the destination host. VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the domain on the source host. VIR_MIGRATE_PAUSED Leave the domain suspended on the remote side. VIR_MIGRATE_NON_SHARED_DISK Migration with non-shared storage with full disk copy VIR_MIGRATE_NON_SHARED_INC Migration with non-shared storage with incremental disk copy VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration changes during the migration process (set automatically when supported). VIR_MIGRATE_UNSAFE Force migration even if it is considered unsafe. VIR_MIGRATE_OFFLINE Migrate offline
The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag. If the VIR_MIGRATE_PEER2PEER flag is NOT set, the duri parameter takes a hypervisor specific format. The uri_transports element of the hypervisor capabilities XML includes details of the supported URI schemes. Not all hypervisors will support this mode of migration, so if the VIR_MIGRATE_PEER2PEER flag is not set, then it may be necessary to use the alternative virDomainMigrate API providing and explicit virConnectPtr for the destination host.
If the VIR_MIGRATE_PEER2PEER flag IS set, the duri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt.
VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
If you want to copy non-shared storage within migration you can use either VIR_MIGRATE_NON_SHARED_DISK or VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive.
If a hypervisor supports renaming domains during migration, the dname parameter specifies the new name for the domain. Setting dname to NULL keeps the domain name the same. If domain renaming is not supported by the hypervisor, dname must be NULL or else an error will be returned.
The maximum bandwidth (in MiB/s) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0.
To see which features are supported by the current hypervisor, see virConnectGetCapabilities, /capabilities/host/migration_features.
There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor.
- domain
- a domain object
- duri
- mandatory URI for the destination host
- flags
- bitwise-OR of virDomainMigrateFlags
- dname
- (optional) rename domain to this at destination
- bandwidth
- (optional) specify migration bandwidth limit in MiB/s
- Returns
- 0 if the migration succeeded, -1 upon error.
virDomainMigrateToURI2
0.9.2
int virDomainMigrateToURI2 (virDomainPtr domain, const char * dconnuri, const char * miguri, const char * dxml, unsigned long flags, const char * dname, unsigned long bandwidth)
Migrate the domain object from its current host to the destination host given by duri.
Flags may be one of more of the following: VIR_MIGRATE_LIVE Do not pause the VM during migration VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain on the destination host. VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the domain on the source host. VIR_MIGRATE_PAUSED Leave the domain suspended on the remote side. VIR_MIGRATE_NON_SHARED_DISK Migration with non-shared storage with full disk copy VIR_MIGRATE_NON_SHARED_INC Migration with non-shared storage with incremental disk copy VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration changes during the migration process (set automatically when supported). VIR_MIGRATE_UNSAFE Force migration even if it is considered unsafe. VIR_MIGRATE_OFFLINE Migrate offline
The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag.
If the VIR_MIGRATE_PEER2PEER flag is set, the @dconnuri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If the VIR_MIGRATE_PEER2PEER flag is NOT set, then @dconnuri must be NULL.
If the VIR_MIGRATE_TUNNELLED flag is NOT set, then the @miguri parameter allows specification of a URI to use to initiate the VM migration. It takes a hypervisor specific format. The uri_transports element of the hypervisor capabilities XML includes details of the supported URI schemes.
VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
If you want to copy non-shared storage within migration you can use either VIR_MIGRATE_NON_SHARED_DISK or VIR_MIGRATE_NON_SHARED_INC as they are mutually exclusive.
If a hypervisor supports changing the configuration of the guest during migration, the @dxml parameter specifies the new config for the guest. The configuration must include an identical set of virtual devices, to ensure a stable guest ABI across migration. Only parameters related to host side configuration can be changed in the XML. Hypervisors will validate this and refuse to allow migration if the provided XML would cause a change in the guest ABI,
If a hypervisor supports renaming domains during migration, the dname parameter specifies the new name for the domain. Setting dname to NULL keeps the domain name the same. If domain renaming is not supported by the hypervisor, dname must be NULL or else an error will be returned.
The maximum bandwidth (in MiB/s) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0.
To see which features are supported by the current hypervisor, see virConnectGetCapabilities, /capabilities/host/migration_features.
There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor.
- domain
- a domain object
- dconnuri
- (optional) URI for target libvirtd if @flags includes VIR_MIGRATE_PEER2PEER
- miguri
- (optional) URI for invoking the migration, not if @flags includs VIR_MIGRATE_TUNNELLED
- dxml
- (optional) XML config for launching guest on target
- flags
- bitwise-OR of virDomainMigrateFlags
- dname
- (optional) rename domain to this at destination
- bandwidth
- (optional) specify migration bandwidth limit in MiB/s
- Returns
- 0 if the migration succeeded, -1 upon error.
virDomainOpenChannel
1.0.2
int virDomainOpenChannel (virDomainPtr dom, const char * name, virStreamPtr st, unsigned int flags)
This opens the host interface associated with a channel device on a guest, if the host interface is supported. If @name is given, it can match either the device alias (e.g. "channel0"), or the virtio target name (e.g. "org.qemu.guest_agent.0"). If @name is omitted, then the first channel is opened. The channel is associated with the passed in @st stream, which should have been opened in non-blocking mode for bi-directional I/O.
By default, when @flags is 0, the open will fail if libvirt detects that the channel is already in use by another client; passing VIR_DOMAIN_CHANNEL_FORCE will cause libvirt to forcefully remove the other client prior to opening this channel.
- dom
- a domain object
- name
- the channel name, or NULL
- st
- a stream to associate with the channel
- flags
- bitwise-OR of virDomainChannelFlags
- Returns
- 0 if the channel was opened, -1 on error
virDomainOpenConsole
0.8.6
int virDomainOpenConsole (virDomainPtr dom, const char * dev_name, virStreamPtr st, unsigned int flags)
This opens the backend associated with a console, serial or parallel port device on a guest, if the backend is supported. If the @dev_name is omitted, then the first console or serial device is opened. The console is associated with the passed in @st stream, which should have been opened in non-blocking mode for bi-directional I/O.
By default, when @flags is 0, the open will fail if libvirt detects that the console is already in use by another client; passing VIR_DOMAIN_CONSOLE_FORCE will cause libvirt to forcefully remove the other client prior to opening this console.
If flag VIR_DOMAIN_CONSOLE_SAFE the console is opened only in the case where the hypervisor driver supports safe (mutually exclusive) console handling.
Older servers did not support either flag, and also did not forbid simultaneous clients on a console, with potentially confusing results. When passing @flags of 0 in order to support a wider range of server versions, it is up to the client to ensure mutual exclusion.
- dom
- a domain object
- dev_name
- the console, serial or parallel port device alias, or NULL
- st
- a stream to associate with the console
- flags
- bitwise-OR of virDomainConsoleFlags
- Returns
- 0 if the console was opened, -1 on error
virDomainOpenGraphics
0.9.7
int virDomainOpenGraphics (virDomainPtr dom, unsigned int idx, int fd, unsigned int flags)
This will attempt to connect the file descriptor @fd, to the graphics backend of @dom. If @dom has multiple graphics backends configured, then @idx will determine which one is opened, starting from @idx 0.
To disable any authentication, pass the VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH constant for @flags.
The caller should use an anonymous socketpair to open @fd before invocation.
This method can only be used when connected to a local libvirt hypervisor, over a UNIX domain socket. Attempts to use this method over a TCP connection will always fail
- dom
- pointer to domain object
- idx
- index of graphics config to open
- fd
- file descriptor to attach graphics to
- flags
- bitwise-OR of virDomainOpenGraphicsFlags
- Returns
- 0 on success, -1 on failure
virDomainPMSuspendForDuration
0.9.10
int virDomainPMSuspendForDuration (virDomainPtr dom, unsigned int target, unsigned long long duration, unsigned int flags)
Attempt to have the guest enter the given @target power management suspension level. If @duration is non-zero, also schedule the guest to resume normal operation after that many seconds, if nothing else has resumed it earlier. Some hypervisors require that @duration be 0, for an indefinite suspension.
Dependent on hypervisor used, this may require a guest agent to be available, e.g. QEMU.
- dom
- a domain object
- target
- a value from virNodeSuspendTarget
- duration
- duration in seconds to suspend, or 0 for indefinite
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 on success, -1 on failure.
virDomainPMWakeup
0.9.11
int virDomainPMWakeup (virDomainPtr dom, unsigned int flags)
Inject a wakeup into the guest that previously used virDomainPMSuspendForDuration, rather than waiting for the previously requested duration (if any) to elapse.
- dom
- a domain object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 on success, -1 on failure.
virDomainPinEmulator
0.10.0
int virDomainPinEmulator (virDomainPtr domain, unsigned char * cpumap, int maplen, unsigned int flags)
Dynamically change the real CPUs which can be allocated to all emulator threads. This function may require privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG. Both flags may be set. If VIR_DOMAIN_AFFECT_LIVE is set, the change affects a running domain and may fail if domain is not alive. If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state, and will fail for transient domains. If neither flag is specified (that is, @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. Not all hypervisors can support all flag combinations.
See also virDomainGetEmulatorPinInfo for querying this information.
- domain
- pointer to domain object, or NULL for Domain0
- cpumap
- pointer to a bit map of real CPUs (in 8-bit bytes) (IN) Each bit set to 1 means that corresponding CPU is usable. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit.
- maplen
- number of bytes in cpumap, from 1 up to size of CPU map in underlying virtualization system (Xen...). If maplen < size, missing bytes are set to zero. If maplen > size, failure code is returned.
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- 0 in case of success, -1 in case of failure.
virDomainPinVcpu
0.1.4
int virDomainPinVcpu (virDomainPtr domain, unsigned int vcpu, unsigned char * cpumap, int maplen)
Dynamically change the real CPUs which can be allocated to a virtual CPU. This function may require privileged access to the hypervisor.
This command only changes the runtime configuration of the domain, so can only be called on an active domain.
- domain
- pointer to domain object, or NULL for Domain0
- vcpu
- virtual CPU number
- cpumap
- pointer to a bit map of real CPUs (in 8-bit bytes) (IN) Each bit set to 1 means that corresponding CPU is usable. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit.
- maplen
- number of bytes in cpumap, from 1 up to size of CPU map in underlying virtualization system (Xen...). If maplen < size, missing bytes are set to zero. If maplen > size, failure code is returned.
- Returns
- 0 in case of success, -1 in case of failure.
virDomainPinVcpuFlags
0.9.3
int virDomainPinVcpuFlags (virDomainPtr domain, unsigned int vcpu, unsigned char * cpumap, int maplen, unsigned int flags)
Dynamically change the real CPUs which can be allocated to a virtual CPU. This function may require privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG. Both flags may be set. If VIR_DOMAIN_AFFECT_LIVE is set, the change affects a running domain and may fail if domain is not alive. If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state, and will fail for transient domains. If neither flag is specified (that is, @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. Not all hypervisors can support all flag combinations.
See also virDomainGetVcpuPinInfo for querying this information.
- domain
- pointer to domain object, or NULL for Domain0
- vcpu
- virtual CPU number
- cpumap
- pointer to a bit map of real CPUs (in 8-bit bytes) (IN) Each bit set to 1 means that corresponding CPU is usable. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit.
- maplen
- number of bytes in cpumap, from 1 up to size of CPU map in underlying virtualization system (Xen...). If maplen < size, missing bytes are set to zero. If maplen > size, failure code is returned.
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- 0 in case of success, -1 in case of failure.
virDomainReboot
0.1.0
int virDomainReboot (virDomainPtr domain, unsigned int flags)
Reboot a domain, the domain object is still usable there after but the domain OS is being stopped for a restart. Note that the guest OS may ignore the request.
If @flags is set to zero, then the hypervisor will choose the method of shutdown it considers best. To have greater control pass one or more of the virDomainShutdownFlagValues. The order in which the hypervisor tries each shutdown method is undefined, and a hypervisor is not required to support all methods.
To use guest agent (VIR_DOMAIN_REBOOT_GUEST_AGENT) the domain XML must have <channel> configured.
- domain
- a domain object
- flags
- bitwise-OR of virDomainRebootFlagValues
- Returns
- 0 in case of success and -1 in case of failure.
virDomainRef
0.6.0
int virDomainRef (virDomainPtr domain)
Increment the reference count on the domain. For each additional call to this method, there shall be a corresponding call to virDomainFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a domain would increment the reference count.
- domain
- the domain to hold a reference on
- Returns
- 0 in case of success and -1 in case of failure.
virDomainReset
0.9.7
int virDomainReset (virDomainPtr domain, unsigned int flags)
Reset a domain immediately without any guest OS shutdown. Reset emulates the power reset button on a machine, where all hardware sees the RST line set and reinitializes internal state.
Note that there is a risk of data loss caused by reset without any guest OS shutdown.
- domain
- a domain object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virDomainRestore
0.0.2
int virDomainRestore (virConnectPtr conn, const char * from)
This method will restore a domain saved to disk by virDomainSave().
See virDomainRestoreFlags() for more control.
- conn
- pointer to the hypervisor connection
- from
- path to the input file
- Returns
- 0 in case of success and -1 in case of failure.
virDomainRestoreFlags
0.9.4
int virDomainRestoreFlags (virConnectPtr conn, const char * from, const char * dxml, unsigned int flags)
This method will restore a domain saved to disk by virDomainSave().
If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used when restoring an image. For example, it is possible to alter the backing filename that is associated with a disk device, in order to prepare for file renaming done as part of backing up the disk device while the domain is stopped.
If @flags includes VIR_DOMAIN_SAVE_BYPASS_CACHE, then libvirt will attempt to bypass the file system cache while restoring the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS.
Normally, the saved state file will remember whether the domain was running or paused, and restore defaults to the same state. Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in @flags will override the default read from the file. These two flags are mutually exclusive.
- conn
- pointer to the hypervisor connection
- from
- path to the input file
- dxml
- (optional) XML config for adjusting guest xml used on restore
- flags
- bitwise-OR of virDomainSaveRestoreFlags
- Returns
- 0 in case of success and -1 in case of failure.
virDomainResume
0.0.1
int virDomainResume (virDomainPtr domain)
Resume a suspended domain, the process is restarted from the state where it was frozen by calling virDomainSuspend(). This function may require privileged access Moreover, resume may not be supported if domain is in some special state like VIR_DOMAIN_PMSUSPENDED.
- domain
- a domain object
- Returns
- 0 in case of success and -1 in case of failure.
virDomainRevertToSnapshot
0.8.2
int virDomainRevertToSnapshot (virDomainSnapshotPtr snapshot, unsigned int flags)
Revert the domain to a given snapshot.
Normally, the domain will revert to the same state the domain was in while the snapshot was taken (whether inactive, running, or paused), except that disk snapshots default to reverting to inactive state. Including VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING in @flags overrides the snapshot state to guarantee a running domain after the revert; or including VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED in @flags guarantees a paused domain after the revert. These two flags are mutually exclusive. While a persistent domain does not need either flag, it is not possible to revert a transient domain into an inactive state, so transient domains require the use of one of these two flags.
Reverting to any snapshot discards all configuration changes made since the last snapshot. Additionally, reverting to a snapshot from a running domain is a form of data loss, since it discards whatever is in the guest's RAM at the time. Since the very nature of keeping snapshots implies the intent to roll back state, no additional confirmation is normally required for these lossy effects.
However, there are two particular situations where reverting will be refused by default, and where @flags must include VIR_DOMAIN_SNAPSHOT_REVERT_FORCE to acknowledge the risks. 1) Any attempt to revert to a snapshot that lacks the metadata to perform ABI compatibility checks (generally the case for snapshots that lack a full <domain> when listed by virDomainSnapshotGetXMLDesc(), such as those created prior to libvirt 0.9.5). 2) Any attempt to revert a running domain to an active state that requires starting a new hypervisor instance rather than reusing the existing hypervisor (since this would terminate all connections to the domain, such as such as VNC or Spice graphics) - this condition arises from active snapshots that are provably ABI incomaptible, as well as from inactive snapshots with a @flags request to start the domain after the revert.
- snapshot
- a domain snapshot object
- flags
- bitwise-OR of virDomainSnapshotRevertFlags
- Returns
- 0 if the creation is successful, -1 on error.
virDomainSave
0.0.2
int virDomainSave (virDomainPtr domain, const char * to)
This method will suspend a domain and save its memory contents to a file on disk. After the call, if successful, the domain is not listed as running anymore (this ends the life of a transient domain). Use virDomainRestore() to restore a domain after saving.
See virDomainSaveFlags() for more control. Also, a save file can be inspected or modified slightly with virDomainSaveImageGetXMLDesc() and virDomainSaveImageDefineXML().
- domain
- a domain object
- to
- path for the output file
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSaveFlags
0.9.4
int virDomainSaveFlags (virDomainPtr domain, const char * to, const char * dxml, unsigned int flags)
This method will suspend a domain and save its memory contents to a file on disk. After the call, if successful, the domain is not listed as running anymore (this ends the life of a transient domain). Use virDomainRestore() to restore a domain after saving.
If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used when restoring an image. For example, it is possible to alter the backing filename that is associated with a disk device, in order to prepare for file renaming done as part of backing up the disk device while the domain is stopped.
If @flags includes VIR_DOMAIN_SAVE_BYPASS_CACHE, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS.
Normally, the saved state file will remember whether the domain was running or paused, and restore defaults to the same state. Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in @flags will override what state gets saved into the file. These two flags are mutually exclusive.
A save file can be inspected or modified slightly with virDomainSaveImageGetXMLDesc() and virDomainSaveImageDefineXML().
Some hypervisors may prevent this operation if there is a current block copy operation; in that case, use virDomainBlockJobAbort() to stop the block copy first.
- domain
- a domain object
- to
- path for the output file
- dxml
- (optional) XML config for adjusting guest xml used on restore
- flags
- bitwise-OR of virDomainSaveRestoreFlags
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSaveImageDefineXML
0.9.4
int virDomainSaveImageDefineXML (virConnectPtr conn, const char * file, const char * dxml, unsigned int flags)
This updates the definition of a domain stored in a saved state file. @file must be a file created previously by virDomainSave() or virDomainSaveFlags().
@dxml can be used to alter host-specific portions of the domain XML that will be used when restoring an image. For example, it is possible to alter the backing filename that is associated with a disk device, to match renaming done as part of backing up the disk device while the domain is stopped.
Normally, the saved state file will remember whether the domain was running or paused, and restore defaults to the same state. Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in @flags will override the default saved into the file; omitting both leaves the file's default unchanged. These two flags are mutually exclusive.
- conn
- pointer to the hypervisor connection
- file
- path to saved state file
- dxml
- XML config for adjusting guest xml used on restore
- flags
- bitwise-OR of virDomainSaveRestoreFlags
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSaveImageGetXMLDesc
0.9.4
char * virDomainSaveImageGetXMLDesc (virConnectPtr conn, const char * file, unsigned int flags)
This method will extract the XML describing the domain at the time a saved state file was created. @file must be a file created previously by virDomainSave() or virDomainSaveFlags().
No security-sensitive data will be included unless @flags contains VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only connections. For this API, @flags should not contain either VIR_DOMAIN_XML_INACTIVE or VIR_DOMAIN_XML_UPDATE_CPU.
- conn
- pointer to the hypervisor connection
- file
- path to saved state file
- flags
- bitwise-OR of subset of virDomainXMLFlags
- Returns
- a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. The caller must free() the returned value.
virDomainScreenshot
0.9.2
char * virDomainScreenshot (virDomainPtr domain, virStreamPtr stream, unsigned int screen, unsigned int flags)
Take a screenshot of current domain console as a stream. The image format is hypervisor specific. Moreover, some hypervisors supports multiple displays per domain. These can be distinguished by @screen argument.
This call sets up a stream; subsequent use of stream API is necessary to transfer actual data, determine how much data is successfully transferred, and detect any errors.
The screen ID is the sequential number of screen. In case of multiple graphics cards, heads are enumerated before devices, e.g. having two graphics cards, both with four heads, screen ID 5 addresses the second head on the second card.
- domain
- a domain object
- stream
- stream to use as output
- screen
- monitor ID to take screenshot from
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a string representing the mime-type of the image format, or NULL upon error. The caller must free() the returned value.
virDomainSendKey
0.9.3
int virDomainSendKey (virDomainPtr domain, unsigned int codeset, unsigned int holdtime, unsigned int * keycodes, int nkeycodes, unsigned int flags)
Send key(s) to the guest.
- domain
- pointer to domain object, or NULL for Domain0
- codeset
- the code set of keycodes, from virKeycodeSet
- holdtime
- the duration (in milliseconds) that the keys will be held
- keycodes
- array of keycodes
- nkeycodes
- number of keycodes, up to VIR_DOMAIN_SEND_KEY_MAX_KEYS
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 in case of failure.
virDomainSendProcessSignal
1.0.1
int virDomainSendProcessSignal (virDomainPtr domain, long long pid_value, unsigned int signum, unsigned int flags)
Send a signal to the designated process in the guest
The signal numbers must be taken from the virDomainProcessSignal enum. These will be translated to the corresponding signal number for the guest OS, by the guest agent delivering the signal. If there is no mapping from virDomainProcessSignal to the native OS signals, this API will report an error.
If @pid_value is an integer greater than zero, it is treated as a process ID. If @pid_value is an integer less than zero, it is treated as a process group ID. All the @pid_value numbers are from the container/guest namespace. The value zero is not valid.
Not all hypervisors will support sending signals to arbitrary processes or process groups. If this API is implemented the minimum requirement is to be able to use @pid_value==1 (i.e. kill init). No other value is required to be supported.
If the @signum is VIR_DOMAIN_PROCESS_SIGNAL_NOP then this API will simply report whether the process is running in the container/guest.
- domain
- pointer to domain object
- pid_value
- a positive integer process ID, or negative integer process group ID
- signum
- a signal from the virDomainProcessSignal enum
- flags
- one of the virDomainProcessSignalFlag values
- Returns
- 0 in case of success, -1 in case of failure.
virDomainSetAutostart
0.2.1
int virDomainSetAutostart (virDomainPtr domain, int autostart)
Configure the domain to be automatically started when the host machine boots.
- domain
- a domain object
- autostart
- whether the domain should be automatically started 0 or 1
- Returns
- -1 in case of error, 0 in case of success
virDomainSetBlkioParameters
0.9.0
int virDomainSetBlkioParameters (virDomainPtr domain, virTypedParameterPtr params, int nparams, unsigned int flags)
Change all or a subset of the blkio tunables. This function may require privileged access to the hypervisor.
- domain
- pointer to domain object
- params
- pointer to blkio parameter objects
- nparams
- number of blkio parameters (this value can be the same or less than the number of parameters supported)
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- -1 in case of error, 0 in case of success.
virDomainSetBlockIoTune
0.9.8
int virDomainSetBlockIoTune (virDomainPtr dom, const char * disk, virTypedParameterPtr params, int nparams, unsigned int flags)
Change all or a subset of the per-device block IO tunables.
The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling virDomainGetXMLDesc() and inspecting elements within //domain/devices/disk.
- dom
- pointer to domain object
- disk
- path to the block device, or device shorthand
- params
- Pointer to blkio parameter objects
- nparams
- Number of blkio parameters (this value can be the same or less than the number of parameters supported)
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- -1 in case of error, 0 in case of success.
virDomainSetInterfaceParameters
0.9.9
int virDomainSetInterfaceParameters (virDomainPtr domain, const char * device, virTypedParameterPtr params, int nparams, unsigned int flags)
Change a subset or all parameters of interface; currently this includes bandwidth parameters. The value of @flags should be either VIR_DOMAIN_AFFECT_CURRENT, or a bitwise-or of values VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CONFIG, although hypervisors vary in which flags are supported.
This function may require privileged access to the hypervisor.
- domain
- pointer to domain object
- device
- the interface name or mac address
- params
- pointer to interface parameter objects
- nparams
- number of interface parameter (this value can be the same or less than the number of parameters supported)
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- -1 in case of error, 0 in case of success.
virDomainSetMaxMemory
0.0.1
int virDomainSetMaxMemory (virDomainPtr domain, unsigned long memory)
Dynamically change the maximum amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. This function may require privileged access to the hypervisor.
This command is hypervisor-specific for whether active, persistent, or both configurations are changed; for more control, use virDomainSetMemoryFlags().
- domain
- a domain object or NULL
- memory
- the memory size in kibibytes (blocks of 1024 bytes)
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSetMemory
0.1.1
int virDomainSetMemory (virDomainPtr domain, unsigned long memory)
Dynamically change the target amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. This function may require privileged access to the hypervisor.
This command only changes the runtime configuration of the domain, so can only be called on an active domain.
- domain
- a domain object or NULL
- memory
- the memory size in kibibytes (blocks of 1024 bytes)
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSetMemoryFlags
0.9.0
int virDomainSetMemoryFlags (virDomainPtr domain, unsigned long memory, unsigned int flags)
Dynamically change the target amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. This function may require privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG. Both flags may be set. If VIR_DOMAIN_AFFECT_LIVE is set, the change affects a running domain and will fail if domain is not active. If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state, and will fail for transient domains. If neither flag is specified (that is, @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. If VIR_DOMAIN_MEM_MAXIMUM is set, the change affects domain's maximum memory size rather than current memory size. Not all hypervisors can support all flag combinations.
- domain
- a domain object or NULL
- memory
- the memory size in kibibytes (blocks of 1024 bytes)
- flags
- bitwise-OR of virDomainMemoryModFlags
- Returns
- 0 in case of success, -1 in case of failure.
virDomainSetMemoryParameters
0.8.5
int virDomainSetMemoryParameters (virDomainPtr domain, virTypedParameterPtr params, int nparams, unsigned int flags)
Change all or a subset of the memory tunables. This function may require privileged access to the hypervisor.
- domain
- pointer to domain object
- params
- pointer to memory parameter objects
- nparams
- number of memory parameter (this value can be the same or less than the number of parameters supported)
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- -1 in case of error, 0 in case of success.
virDomainSetMetadata
0.9.10
int virDomainSetMetadata (virDomainPtr domain, int type, const char * metadata, const char * key, const char * uri, unsigned int flags)
Sets the appropriate domain element given by @type to the value of @description. A @type of VIR_DOMAIN_METADATA_DESCRIPTION is free-form text; VIR_DOMAIN_METADATA_TITLE is free-form, but no newlines are permitted, and should be short (although the length is not enforced). For these two options @key and @uri are irrelevant and must be set to NULL.
For type VIR_DOMAIN_METADATA_ELEMENT @metadata must be well-formed XML belonging to namespace defined by @uri with local name @key.
Passing NULL for @metadata says to remove that element from the domain XML (passing the empty string leaves the element present).
The resulting metadata will be present in virDomainGetXMLDesc(), as well as quick access through virDomainGetMetadata().
@flags controls whether the live domain, persistent configuration, or both will be modified.
- domain
- a domain object
- type
- type of description, from virDomainMetadataType
- metadata
- new metadata text
- key
- XML namespace key, or NULL
- uri
- XML namespace URI, or NULL
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- 0 on success, -1 in case of failure.
virDomainSetNumaParameters
0.9.9
int virDomainSetNumaParameters (virDomainPtr domain, virTypedParameterPtr params, int nparams, unsigned int flags)
Change all or a subset of the numa tunables. This function may require privileged access to the hypervisor.
- domain
- pointer to domain object
- params
- pointer to numa parameter objects
- nparams
- number of numa parameters (this value can be the same or less than the number of parameters supported)
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- -1 in case of error, 0 in case of success.
virDomainSetSchedulerParameters
0.2.3
int virDomainSetSchedulerParameters (virDomainPtr domain, virTypedParameterPtr params, int nparams)
Change all or a subset or the scheduler parameters. It is hypervisor-specific whether this sets live, persistent, or both settings; for more control, use virDomainSetSchedulerParametersFlags.
- domain
- pointer to domain object
- params
- pointer to scheduler parameter objects
- nparams
- number of scheduler parameter objects (this value can be the same or less than the returned value nparams of virDomainGetSchedulerType)
- Returns
- -1 in case of error, 0 in case of success.
virDomainSetSchedulerParametersFlags
0.9.2
int virDomainSetSchedulerParametersFlags (virDomainPtr domain, virTypedParameterPtr params, int nparams, unsigned int flags)
Change a subset or all scheduler parameters. The value of @flags should be either VIR_DOMAIN_AFFECT_CURRENT, or a bitwise-or of values from VIR_DOMAIN_AFFECT_LIVE and VIR_DOMAIN_AFFECT_CURRENT, although hypervisors vary in which flags are supported.
- domain
- pointer to domain object
- params
- pointer to scheduler parameter objects
- nparams
- number of scheduler parameter objects (this value can be the same or less than the returned value nparams of virDomainGetSchedulerType)
- flags
- bitwise-OR of virDomainModificationImpact
- Returns
- -1 in case of error, 0 in case of success.
virDomainSetVcpus
0.1.4
int virDomainSetVcpus (virDomainPtr domain, unsigned int nvcpus)
Dynamically change the number of virtual CPUs used by the domain. Note that this call may fail if the underlying virtualization hypervisor does not support it or if growing the number is arbitrary limited. This function may require privileged access to the hypervisor.
This command only changes the runtime configuration of the domain, so can only be called on an active domain. It is hypervisor-dependent whether it also affects persistent configuration; for more control, use virDomainSetVcpusFlags().
- domain
- pointer to domain object, or NULL for Domain0
- nvcpus
- the new number of virtual CPUs for this domain
- Returns
- 0 in case of success, -1 in case of failure.
virDomainSetVcpusFlags
0.8.5
int virDomainSetVcpusFlags (virDomainPtr domain, unsigned int nvcpus, unsigned int flags)
Dynamically change the number of virtual CPUs used by the domain. Note that this call may fail if the underlying virtualization hypervisor does not support it or if growing the number is arbitrary limited. This function may require privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE to affect a running domain (which may fail if domain is not active), or VIR_DOMAIN_AFFECT_CONFIG to affect the next boot via the XML description of the domain. Both flags may be set. If neither flag is specified (that is, @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed.
If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then VIR_DOMAIN_AFFECT_LIVE must be clear, and only the maximum virtual CPU limit is altered; generally, this value must be less than or equal to virConnectGetMaxVcpus(). Otherwise, this call affects the current virtual CPU limit, which must be less than or equal to the maximum limit. Not all hypervisors can support all flag combinations.
- domain
- pointer to domain object, or NULL for Domain0
- nvcpus
- the new number of virtual CPUs for this domain, must be at least 1
- flags
- bitwise-OR of virDomainVcpuFlags
- Returns
- 0 in case of success, -1 in case of failure.
virDomainShutdown
0.0.1
int virDomainShutdown (virDomainPtr domain)
Shutdown a domain, the domain object is still usable thereafter but the domain OS is being stopped. Note that the guest OS may ignore the request. For guests that react to a shutdown request, the differences from virDomainDestroy() are that the guests disk storage will be in a stable state rather than having the (virtual) power cord pulled, and this command returns as soon as the shutdown request is issued rather than blocking until the guest is no longer running.
If the domain is transient and has any snapshot metadata (see virDomainSnapshotNum()), then that metadata will automatically be deleted when the domain quits.
- domain
- a domain object
- Returns
- 0 in case of success and -1 in case of failure.
virDomainShutdownFlags
0.9.10
int virDomainShutdownFlags (virDomainPtr domain, unsigned int flags)
Shutdown a domain, the domain object is still usable thereafter but the domain OS is being stopped. Note that the guest OS may ignore the request. For guests that react to a shutdown request, the differences from virDomainDestroy() are that the guest's disk storage will be in a stable state rather than having the (virtual) power cord pulled, and this command returns as soon as the shutdown request is issued rather than blocking until the guest is no longer running.
If the domain is transient and has any snapshot metadata (see virDomainSnapshotNum()), then that metadata will automatically be deleted when the domain quits.
If @flags is set to zero, then the hypervisor will choose the method of shutdown it considers best. To have greater control pass one or more of the virDomainShutdownFlagValues. The order in which the hypervisor tries each shutdown method is undefined, and a hypervisor is not required to support all methods.
- domain
- a domain object
- flags
- bitwise-OR of virDomainShutdownFlagValues
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSnapshotCreateXML
0.8.2
virDomainSnapshotPtr virDomainSnapshotCreateXML (virDomainPtr domain, const char * xmlDesc, unsigned int flags)
Creates a new snapshot of a domain based on the snapshot xml contained in xmlDesc.
If @flags is 0, the domain can be active, in which case the snapshot will be a system checkpoint (both disk state and runtime VM state such as RAM contents), where reverting to the snapshot is the same as resuming from hibernation (TCP connections may have timed out, but everything else picks up where it left off); or the domain can be inactive, in which case the snapshot includes just the disk state prior to booting. The newly created snapshot becomes current (see virDomainSnapshotCurrent()), and is a child of any previous current snapshot.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, then this is a request to reinstate snapshot metadata that was previously discarded, rather than creating a new snapshot. This can be used to recreate a snapshot hierarchy on a destination, then remove it on the source, in order to allow migration (since migration normally fails if snapshot metadata still remains on the source machine). When redefining snapshot metadata, the current snapshot will not be altered unless the VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT flag is also present. It is an error to request the VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT flag without VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE. On some hypervisors, redefining an existing snapshot can be used to alter host-specific portions of the domain XML to be used during revert (such as backing filenames associated with disk devices), but must not alter guest-visible layout. When redefining a snapshot name that does not exist, the hypervisor may validate that reverting to the snapshot appears to be possible (for example, disk images have snapshot contents by the requested name). Not all hypervisors support these flags.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, then the domain's disk images are modified according to @xmlDesc, but then the just-created snapshot has its metadata deleted. This flag is incompatible with VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_HALT, then the domain will be inactive after the snapshot completes, regardless of whether it was active before; otherwise, a running domain will still be running after the snapshot. This flag is invalid on transient domains, and is incompatible with VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, then the domain is not paused while creating the snapshot. This increases the size of the memory dump file, but reduces downtime of the guest while taking the snapshot. Some hypervisors only support this flag during external checkpoints.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, then the snapshot will be limited to the disks described in @xmlDesc, and no VM state will be saved. For an active guest, the disk image may be inconsistent (as if power had been pulled), and specifying this with the VIR_DOMAIN_SNAPSHOT_CREATE_HALT flag risks data loss.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, then the libvirt will attempt to use guest agent to freeze and thaw all file systems in use within domain OS. However, if the guest agent is not present, an error is thrown. Moreover, this flag requires VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY to be passed as well.
By default, if the snapshot involves external files, and any of the destination files already exist as a non-empty regular file, the snapshot is rejected to avoid losing contents of those files. However, if @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT, then the destination files must already exist and contain content identical to the source files (this allows a management app to pre-create files with relative backing file names, rather than the default of creating with absolute backing file names).
Be aware that although libvirt prefers to report errors up front with no other effect, some hypervisors have certain types of failures where the overall command can easily fail even though the guest configuration was partially altered (for example, if a disk snapshot request for two disks fails on the second disk, but the first disk alteration cannot be rolled back). If this API call fails, it is therefore normally necessary to follow up with virDomainGetXMLDesc() and check each disk to determine if any partial changes occurred. However, if @flags contains VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC, then libvirt guarantees that this command will not alter any disks unless the entire set of changes can be done atomically, making failure recovery simpler (note that it is still possible to fail after disks have changed, but only in the much rarer cases of running out of memory or disk space).
Some hypervisors may prevent this operation if there is a current block copy operation; in that case, use virDomainBlockJobAbort() to stop the block copy first.
- domain
- a domain object
- xmlDesc
- string containing an XML description of the domain
- flags
- bitwise-OR of virDomainSnapshotCreateFlags
- Returns
- an (opaque) virDomainSnapshotPtr on success, NULL on failure.
virDomainSnapshotCurrent
0.8.2
virDomainSnapshotPtr virDomainSnapshotCurrent (virDomainPtr domain, unsigned int flags)
Get the current snapshot for a domain, if any.
- domain
- a domain object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a domain snapshot object or NULL in case of failure. If the current domain snapshot cannot be found, then the VIR_ERR_NO_DOMAIN_SNAPSHOT error is raised.
virDomainSnapshotDelete
0.8.2
int virDomainSnapshotDelete (virDomainSnapshotPtr snapshot, unsigned int flags)
Delete the snapshot.
If @flags is 0, then just this snapshot is deleted, and changes from this snapshot are automatically merged into children snapshots. If @flags includes VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, then this snapshot and any descendant snapshots are deleted. If @flags includes VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, then any descendant snapshots are deleted, but this snapshot remains. These two flags are mutually exclusive.
If @flags includes VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, then any snapshot metadata tracked by libvirt is removed while keeping the snapshot contents intact; if a hypervisor does not require any libvirt metadata to track snapshots, then this flag is silently ignored.
- snapshot
- a domain snapshot object
- flags
- bitwise-OR of supported virDomainSnapshotDeleteFlags
- Returns
- 0 if the selected snapshot(s) were successfully deleted, -1 on error.
virDomainSnapshotFree
0.8.2
int virDomainSnapshotFree (virDomainSnapshotPtr snapshot)
Free the domain snapshot object. The snapshot itself is not modified. The data structure is freed and should not be used thereafter.
- snapshot
- a domain snapshot object
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSnapshotGetConnect
0.9.5
virConnectPtr virDomainSnapshotGetConnect (virDomainSnapshotPtr snapshot)
Provides the connection pointer associated with a snapshot. The reference counter on the connection is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the snapshot object together.
- snapshot
- a snapshot object
- Returns
- the connection or NULL.
virDomainSnapshotGetDomain
0.9.5
virDomainPtr virDomainSnapshotGetDomain (virDomainSnapshotPtr snapshot)
Provides the domain pointer associated with a snapshot. The reference counter on the domain is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the domain and the snapshot object together.
- snapshot
- a snapshot object
- Returns
- the domain or NULL.
virDomainSnapshotGetName
0.9.5
const char * virDomainSnapshotGetName (virDomainSnapshotPtr snapshot)
Get the public name for that snapshot
- snapshot
- a snapshot object
- Returns
- a pointer to the name or NULL, the string need not be deallocated as its lifetime will be the same as the snapshot object.
virDomainSnapshotGetParent
0.9.7
virDomainSnapshotPtr virDomainSnapshotGetParent (virDomainSnapshotPtr snapshot, unsigned int flags)
Get the parent snapshot for @snapshot, if any.
- snapshot
- a snapshot object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a domain snapshot object or NULL in case of failure. If the given snapshot is a root (no parent), then the VIR_ERR_NO_DOMAIN_SNAPSHOT error is raised.
virDomainSnapshotGetXMLDesc
0.8.2
char * virDomainSnapshotGetXMLDesc (virDomainSnapshotPtr snapshot, unsigned int flags)
Provide an XML description of the domain snapshot.
No security-sensitive data will be included unless @flags contains VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only connections. For this API, @flags should not contain either VIR_DOMAIN_XML_INACTIVE or VIR_DOMAIN_XML_UPDATE_CPU.
- snapshot
- a domain snapshot object
- flags
- bitwise-OR of subset of virDomainXMLFlags
- Returns
- a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.
virDomainSnapshotHasMetadata
0.9.13
int virDomainSnapshotHasMetadata (virDomainSnapshotPtr snapshot, unsigned int flags)
Determine if the given snapshot is associated with libvirt metadata that would prevent the deletion of the domain.
- snapshot
- a snapshot object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 1 if the snapshot has metadata, 0 if the snapshot exists without help from libvirt, or -1 on error.
virDomainSnapshotIsCurrent
0.9.13
int virDomainSnapshotIsCurrent (virDomainSnapshotPtr snapshot, unsigned int flags)
Determine if the given snapshot is the domain's current snapshot. See also virDomainHasCurrentSnapshot().
- snapshot
- a snapshot object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 1 if current, 0 if not current, or -1 on error.
virDomainSnapshotListAllChildren
0.9.13
int virDomainSnapshotListAllChildren (virDomainSnapshotPtr snapshot, virDomainSnapshotPtr ** snaps, unsigned int flags)
Collect the list of domain snapshots that are children of the given snapshot, and allocate an array to store those objects. This API solves the race inherent in virDomainSnapshotListChildrenNames().
By default, this command covers only direct children; it is also possible to expand things to cover all descendants, when @flags includes VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS. Also, some filters are provided in groups, where each group contains bits that describe mutually exclusive attributes of a snapshot, and where all bits within a group describe all possible snapshots. Some hypervisors might reject explicit bits from a group where the hypervisor cannot make a distinction. For a group supported by a given hypervisor, the behavior when no bits of a group are set is identical to the behavior when all bits in that group are set. When setting bits from more than one group, it is possible to select an impossible combination, in that case a hypervisor may return either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on whether they have metadata that would prevent the removal of the last reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, for filtering snapshots based on what domain state is tracked by the snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on whether the snapshot is stored inside the disk images or as additional files.
- snapshot
- a domain snapshot object
- snaps
- pointer to variable to store the array containing snapshot objects, or NULL if the list is not required (just returns number of snapshots)
- flags
- bitwise-OR of supported virDomainSnapshotListFlags
- Returns
- the number of domain snapshots found or -1 and sets @snaps to NULL in case of error. On success, the array stored into @snaps is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virDomainSnapshotFree() on each array element, then calling free() on @snaps.
virDomainSnapshotListChildrenNames
0.9.7
int virDomainSnapshotListChildrenNames (virDomainSnapshotPtr snapshot, char ** names, int nameslen, unsigned int flags)
Collect the list of domain snapshots that are children of the given snapshot, and store their names in @names. The value to use for @nameslen can be determined by virDomainSnapshotNumChildren() with the same @flags.
By default, this command covers only direct children; it is also possible to expand things to cover all descendants, when @flags includes VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS. Also, some filters are provided in groups, where each group contains bits that describe mutually exclusive attributes of a snapshot, and where all bits within a group describe all possible snapshots. Some hypervisors might reject explicit bits from a group where the hypervisor cannot make a distinction. For a group supported by a given hypervisor, the behavior when no bits of a group are set is identical to the behavior when all bits in that group are set. When setting bits from more than one group, it is possible to select an impossible combination, in that case a hypervisor may return either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on whether they have metadata that would prevent the removal of the last reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, for filtering snapshots based on what domain state is tracked by the snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on whether the snapshot is stored inside the disk images or as additional files.
- snapshot
- a domain snapshot object
- names
- array to collect the list of names of snapshots
- nameslen
- size of @names
- flags
- bitwise-OR of supported virDomainSnapshotListFlags
- Returns
- the number of domain snapshots found or -1 in case of error. Note that this command is inherently racy: another connection can define a new snapshot between a call to virDomainSnapshotNumChildren() and this call. You are only guaranteed that all currently defined snapshots were listed if the return is less than @nameslen. Likewise, you should be prepared for virDomainSnapshotLookupByName() to fail when converting a name from this call into a snapshot object, if another connection deletes the snapshot in the meantime. For more control over the results, see virDomainSnapshotListAllChildren(). Returns the number of domain snapshots found or -1 in case of error. The caller is responsible to call free() for each member of the array.
virDomainSnapshotListNames
0.8.2
int virDomainSnapshotListNames (virDomainPtr domain, char ** names, int nameslen, unsigned int flags)
Collect the list of domain snapshots for the given domain, and store their names in @names. The value to use for @nameslen can be determined by virDomainSnapshotNum() with the same @flags.
By default, this command covers all snapshots; it is also possible to limit things to just snapshots with no parents, when @flags includes VIR_DOMAIN_SNAPSHOT_LIST_ROOTS. Additional filters are provided in groups, where each group contains bits that describe mutually exclusive attributes of a snapshot, and where all bits within a group describe all possible snapshots. Some hypervisors might reject explicit bits from a group where the hypervisor cannot make a distinction. For a group supported by a given hypervisor, the behavior when no bits of a group are set is identical to the behavior when all bits in that group are set. When setting bits from more than one group, it is possible to select an impossible combination, in that case a hypervisor may return either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on whether they have metadata that would prevent the removal of the last reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, for filtering snapshots based on what domain state is tracked by the snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on whether the snapshot is stored inside the disk images or as additional files.
Note that this command is inherently racy: another connection can define a new snapshot between a call to virDomainSnapshotNum() and this call. You are only guaranteed that all currently defined snapshots were listed if the return is less than @nameslen. Likewise, you should be prepared for virDomainSnapshotLookupByName() to fail when converting a name from this call into a snapshot object, if another connection deletes the snapshot in the meantime. For more control over the results, see virDomainListAllSnapshots().
- domain
- a domain object
- names
- array to collect the list of names of snapshots
- nameslen
- size of @names
- flags
- bitwise-OR of supported virDomainSnapshotListFlags
- Returns
- the number of domain snapshots found or -1 in case of error. The caller is responsible to call free() for each member of the array.
virDomainSnapshotLookupByName
0.8.2
virDomainSnapshotPtr virDomainSnapshotLookupByName (virDomainPtr domain, const char * name, unsigned int flags)
Try to lookup a domain snapshot based on its name.
- domain
- a domain object
- name
- name for the domain snapshot
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a domain snapshot object or NULL in case of failure. If the domain snapshot cannot be found, then the VIR_ERR_NO_DOMAIN_SNAPSHOT error is raised.
virDomainSnapshotNum
0.8.2
int virDomainSnapshotNum (virDomainPtr domain, unsigned int flags)
Provides the number of domain snapshots for this domain.
By default, this command covers all snapshots; it is also possible to limit things to just snapshots with no parents, when @flags includes VIR_DOMAIN_SNAPSHOT_LIST_ROOTS. Additional filters are provided in groups, where each group contains bits that describe mutually exclusive attributes of a snapshot, and where all bits within a group describe all possible snapshots. Some hypervisors might reject explicit bits from a group where the hypervisor cannot make a distinction. For a group supported by a given hypervisor, the behavior when no bits of a group are set is identical to the behavior when all bits in that group are set. When setting bits from more than one group, it is possible to select an impossible combination, in that case a hypervisor may return either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on whether they have metadata that would prevent the removal of the last reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, for filtering snapshots based on what domain state is tracked by the snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on whether the snapshot is stored inside the disk images or as additional files.
- domain
- a domain object
- flags
- bitwise-OR of supported virDomainSnapshotListFlags
- Returns
- the number of domain snapshots found or -1 in case of error.
virDomainSnapshotNumChildren
0.9.7
int virDomainSnapshotNumChildren (virDomainSnapshotPtr snapshot, unsigned int flags)
Provides the number of child snapshots for this domain snapshot.
By default, this command covers only direct children; it is also possible to expand things to cover all descendants, when @flags includes VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS. Also, some filters are provided in groups, where each group contains bits that describe mutually exclusive attributes of a snapshot, and where all bits within a group describe all possible snapshots. Some hypervisors might reject explicit bits from a group where the hypervisor cannot make a distinction. For a group supported by a given hypervisor, the behavior when no bits of a group are set is identical to the behavior when all bits in that group are set. When setting bits from more than one group, it is possible to select an impossible combination, in that case a hypervisor may return either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on whether they have metadata that would prevent the removal of the last reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, for filtering snapshots based on what domain state is tracked by the snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on whether the snapshot is stored inside the disk images or as additional files.
- snapshot
- a domain snapshot object
- flags
- bitwise-OR of supported virDomainSnapshotListFlags
- Returns
- the number of domain snapshots found or -1 in case of error.
virDomainSnapshotRef
0.9.13
int virDomainSnapshotRef (virDomainSnapshotPtr snapshot)
Increment the reference count on the snapshot. For each additional call to this method, there shall be a corresponding call to virDomainSnapshotFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection and domain remain open until all threads have finished using the snapshot. ie, each new thread using a snapshot would increment the reference count.
- snapshot
- the snapshot to hold a reference on
- Returns
- 0 in case of success and -1 in case of failure.
virDomainSuspend
0.0.1
int virDomainSuspend (virDomainPtr domain)
Suspends an active domain, the process is frozen without further access to CPU resources and I/O but the memory used by the domain at the hypervisor level will stay allocated. Use virDomainResume() to reactivate the domain. This function may require privileged access. Moreover, suspend may not be supported if domain is in some special state like VIR_DOMAIN_PMSUSPENDED.
- domain
- a domain object
- Returns
- 0 in case of success and -1 in case of failure.
virDomainUndefine
0.1.1
int virDomainUndefine (virDomainPtr domain)
Undefine a domain. If the domain is running, it's converted to transient domain, without stopping it. If the domain is inactive, the domain configuration is removed.
If the domain has a managed save image (see virDomainHasManagedSaveImage()), or if it is inactive and has any snapshot metadata (see virDomainSnapshotNum()), then the undefine will fail. See virDomainUndefineFlags() for more control.
- domain
- pointer to a defined domain
- Returns
- 0 in case of success, -1 in case of error
virDomainUndefineFlags
0.9.4
int virDomainUndefineFlags (virDomainPtr domain, unsigned int flags)
Undefine a domain. If the domain is running, it's converted to transient domain, without stopping it. If the domain is inactive, the domain configuration is removed.
If the domain has a managed save image (see virDomainHasManagedSaveImage()), then including VIR_DOMAIN_UNDEFINE_MANAGED_SAVE in @flags will also remove that file, and omitting the flag will cause the undefine process to fail.
If the domain is inactive and has any snapshot metadata (see virDomainSnapshotNum()), then including VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA in @flags will also remove that metadata. Omitting the flag will cause the undefine of an inactive domain to fail. Active snapshots will retain snapshot metadata until the (now-transient) domain halts, regardless of whether this flag is present. On hypervisors where snapshots do not use libvirt metadata, this flag has no effect.
- domain
- pointer to a defined domain
- flags
- bitwise-OR of supported virDomainUndefineFlagsValues
- Returns
- 0 in case of success, -1 in case of error
virDomainUpdateDeviceFlags
0.8.0
int virDomainUpdateDeviceFlags (virDomainPtr domain, const char * xml, unsigned int flags)
Change a virtual device on a domain, using the flags parameter to control how the device is changed. VIR_DOMAIN_AFFECT_CURRENT specifies that the device change is made based on current domain state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be changed on the active domain instance only and is not added to the persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG specifies that the device shall be changed on the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation.
This method is used for actions such changing CDROM/Floppy device media, altering the graphics configuration such as password, reconfiguring the NIC device backend connectivity, etc.
- domain
- pointer to domain object
- xml
- pointer to XML description of one device
- flags
- bitwise-OR of virDomainDeviceModifyFlags
- Returns
- 0 in case of success, -1 in case of failure.
virEventAddHandle
0.9.3
int virEventAddHandle (int fd, int events, virEventHandleCallback cb, void * opaque, virFreeCallback ff)
Register a callback for monitoring file handle events.
- fd
- file handle to monitor for events
- events
- bitset of events to watch from virEventHandleType constants
- cb
- callback to invoke when an event occurs
- opaque
- user data to pass to callback
- ff
- callback to free opaque when handle is removed
- Returns
- -1 if the file handle cannot be registered, 0 upon success
virEventAddHandleFunc
0.5.0
typedef int (*virEventAddHandleFunc ) (int fd, int event, virEventHandleCallback cb, void * opaque, virFreeCallback ff)
Part of the EventImpl, this callback adds a file handle callback to listen for specific events. The same file handle can be registered multiple times provided the requested event sets are non-overlapping
If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose. This callback needs to be invoked from a clean stack. If 'ff' callbacks are invoked directly from the virEventRemoveHandleFunc they will likely deadlock in libvirt.
- fd
- file descriptor to listen on
- event
- bitset of events on which to fire the callback
- cb
- the callback to be called when an event occurrs
- opaque
- user data to pass to the callback
- ff
- the callback invoked to free opaque data blob
- Returns
- a handle watch number to be used for updating and unregistering for events
virEventAddTimeout
0.9.3
int virEventAddTimeout (int timeout, virEventTimeoutCallback cb, void * opaque, virFreeCallback ff)
Register a callback for a timer event.
Setting timeout to -1 will disable the timer. Setting the timeout to zero will cause it to fire on every event loop iteration.
- timeout
- time between events in milliseconds
- cb
- callback to invoke when an event occurs
- opaque
- user data to pass to callback
- ff
- callback to free opaque when timeout is removed
- Returns
- -1 if the timer cannot be registered, a positive integer timer id upon success.
virEventAddTimeoutFunc
0.5.0
typedef int (*virEventAddTimeoutFunc ) (int timeout, virEventTimeoutCallback cb, void * opaque, virFreeCallback ff)
Part of the EventImpl, this user-defined callback handles adding an event timeout.
If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose.
- timeout
- The timeout to monitor
- cb
- the callback to call when timeout has expired
- opaque
- user data to pass to the callback
- ff
- the callback invoked to free opaque data blob
- Returns
- a timer value
virEventHandleCallback
0.5.0
typedef void (*virEventHandleCallback ) (int watch, int fd, int events, void * opaque)
Callback for receiving file handle events. The callback will be invoked once for each event which is pending.
- watch
- watch on which the event occurred
- fd
- file handle on which the event occurred
- events
- bitset of events from virEventHandleType constants
- opaque
- user data registered with handle
virEventRegisterDefaultImpl
0.9.0
int virEventRegisterDefaultImpl (void)
Registers a default event implementation based on the poll() system call. This is a generic implementation that can be used by any client application which does not have a need to integrate with an external event loop impl.
Once registered, the application has to invoke virEventRunDefaultImpl in a loop to process events. Failure to do so may result in connections being closed unexpectedly as a result of keepalive timeout.
- Returns
- 0 on success, -1 on failure.
virEventRegisterImpl
0.5.0
void virEventRegisterImpl (virEventAddHandleFunc addHandle, virEventUpdateHandleFunc updateHandle, virEventRemoveHandleFunc removeHandle, virEventAddTimeoutFunc addTimeout, virEventUpdateTimeoutFunc updateTimeout, virEventRemoveTimeoutFunc removeTimeout)
Registers an event implementation, to allow integration with an external event loop. Applications would use this to integrate with the libglib2 event loop, or libevent or the QT event loop.
If an application does not need to integrate with an existing event loop implementation, then the virEventRegisterDefaultImpl method can be used to setup the generic libvirt implementation.
- addHandle
- the callback to add fd handles
- updateHandle
- the callback to update fd handles
- removeHandle
- the callback to remove fd handles
- addTimeout
- the callback to add a timeout
- updateTimeout
- the callback to update a timeout
- removeTimeout
- the callback to remove a timeout
virEventRemoveHandle
0.9.3
int virEventRemoveHandle (int watch)
Unregister a callback from a file handle.
- watch
- watch whose file handle to remove
- Returns
- -1 if the file handle was not registered, 0 upon success.
virEventRemoveHandleFunc
0.5.0
typedef int (*virEventRemoveHandleFunc) (int watch)
Part of the EventImpl, this user-provided callback is notified when an fd is no longer being listened on.
If a virEventHandleFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data.
- watch
- file descriptor watch to stop listening on
- Returns
- -1 if the file handle was not registered, 0 upon success
virEventRemoveTimeout
0.9.3
int virEventRemoveTimeout (int timer)
Unregister a callback for a timer.
- timer
- the timer id to remove
- Returns
- -1 if the timer was not registered, 0 upon success.
virEventRemoveTimeoutFunc
0.5.0
typedef int (*virEventRemoveTimeoutFunc) (int timer)
Part of the EventImpl, this user-defined callback removes a timer
If a virEventTimeoutFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data.
- timer
- the timer to remove
- Returns
- 0 on success, -1 on failure
virEventRunDefaultImpl
0.9.0
int virEventRunDefaultImpl (void)
Run one iteration of the event loop. Applications will generally want to have a thread which invokes this method in an infinite loop
static bool quit = false;
while (!quit) { if (virEventRunDefaultImpl() < 0) ...print error... }
- Returns
- 0 on success, -1 on failure.
virEventTimeoutCallback
0.5.0
typedef void (*virEventTimeoutCallback ) (int timer, void * opaque)
callback for receiving timer events
- timer
- timer id emitting the event
- opaque
- user data registered with handle
virEventUpdateHandle
0.9.3
void virEventUpdateHandle (int watch, int events)
Change event set for a monitored file handle.
Will not fail if fd exists
- watch
- watch whose file handle to update
- events
- bitset of events to watch from virEventHandleType constants
virEventUpdateHandleFunc
0.5.0
typedef void (*virEventUpdateHandleFunc) (int watch, int event)
Part of the EventImpl, this user-provided callback is notified when events to listen on change
- watch
- file descriptor watch to modify
- event
- new events to listen on
virEventUpdateTimeout
0.9.3
void virEventUpdateTimeout (int timer, int timeout)
Change frequency for a timer.
Setting frequency to -1 will disable the timer. Setting the frequency to zero will cause it to fire on every event loop iteration.
Will not fail if timer exists
- timer
- timer id to change
- timeout
- time between events in milliseconds
virEventUpdateTimeoutFunc
0.5.0
typedef void (*virEventUpdateTimeoutFunc) (int timer, int timeout)
Part of the EventImpl, this user-defined callback updates an event timeout.
- timer
- the timer to modify
- timeout
- the new timeout value
virFreeCallback
0.5.0
typedef void (*virFreeCallback ) (void * opaque)
Type for a callback cleanup function to be paired with a callback. This function will be called as a final chance to clean up the @opaque registered with the primary callback, at the time when the primary callback is deregistered.
It is forbidden to call any other libvirt APIs from an implementation of this callback, since it can be invoked from a context which is not re-entrant safe. Failure to abide by this requirement may lead to application deadlocks or crashes.
- opaque
- opaque user data provided at registration
virGetVersion
0.0.1
int virGetVersion (unsigned long * libVer, const char * type, unsigned long * typeVer)
Provides version information. @libVer is the version of the library and will always be set unless an error occurs, in which case an error code will be returned. @typeVer exists for historical compatibility; if it is not NULL it will duplicate @libVer (it was originally intended to return hypervisor information based on @type, but due to the design of remote clients this is not reliable). To get the version of the running hypervisor use the virConnectGetVersion function instead. To get the libvirt library version used by a connection use the virConnectGetLibVersion instead.
- libVer
- return value for the library version (OUT)
- type
- ignored; pass NULL
- typeVer
- pass NULL; for historical purposes duplicates @libVer if non-NULL
- Returns
- -1 in case of failure, 0 otherwise, and values for @libVer and @typeVer have the format major * 1,000,000 + minor * 1,000 + release.
virInitialize
0.1.0
int virInitialize (void)
Initialize the library.
This method is invoked automatically by any of the virConnectOpen API calls. Since release 1.0.0, there is no need to call this method even in a multithreaded application, since initialization is performed in a thread safe manner.
The only time it would be necessary to call virInitialize is if the application did not invoke virConnectOpen as its first API call.
- Returns
- 0 in case of success, -1 in case of error
virInterfaceChangeBegin
0.9.2
int virInterfaceChangeBegin (virConnectPtr conn, unsigned int flags)
This function creates a restore point to which one can return later by calling virInterfaceChangeRollback(). This function should be called before any transaction with interface configuration. Once it is known that a new configuration works, it can be committed via virInterfaceChangeCommit(), which frees the restore point.
If virInterfaceChangeBegin() is called when a transaction is already opened, this function will fail, and a VIR_ERR_INVALID_OPERATION will be logged.
- conn
- pointer to hypervisor connection
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virInterfaceChangeCommit
0.9.2
int virInterfaceChangeCommit (virConnectPtr conn, unsigned int flags)
This commits the changes made to interfaces and frees the restore point created by virInterfaceChangeBegin().
If virInterfaceChangeCommit() is called when a transaction is not opened, this function will fail, and a VIR_ERR_INVALID_OPERATION will be logged.
- conn
- pointer to hypervisor connection
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virInterfaceChangeRollback
0.9.2
int virInterfaceChangeRollback (virConnectPtr conn, unsigned int flags)
This cancels changes made to interfaces settings by restoring previous state created by virInterfaceChangeBegin().
If virInterfaceChangeRollback() is called when a transaction is not opened, this function will fail, and a VIR_ERR_INVALID_OPERATION will be logged.
- conn
- pointer to hypervisor connection
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virInterfaceCreate
0.6.4
int virInterfaceCreate (virInterfacePtr iface, unsigned int flags)
Activate an interface (i.e. call "ifup").
If there was an open network config transaction at the time this interface was defined (that is, if virInterfaceChangeBegin() had been called), the interface will be brought back down (and then undefined) if virInterfaceChangeRollback() is called. p *
- iface
- pointer to a defined interface
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 in case of error
virInterfaceDefineXML
0.6.4
virInterfacePtr virInterfaceDefineXML (virConnectPtr conn, const char * xml, unsigned int flags)
Define an interface (or modify existing interface configuration).
Normally this change in the interface configuration is immediately permanent/persistent, but if virInterfaceChangeBegin() has been previously called (i.e. if an interface config transaction is open), the new interface definition will only become permanent if virInterfaceChangeCommit() is called prior to the next reboot of the system running libvirtd. Prior to that time, it can be explicitly removed using virInterfaceChangeRollback(), or will be automatically removed during the next reboot of the system running libvirtd.
- conn
- pointer to the hypervisor connection
- xml
- the XML description for the interface, preferably in UTF-8
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- NULL in case of error, a pointer to the interface otherwise
virInterfaceDestroy
0.6.4
int virInterfaceDestroy (virInterfacePtr iface, unsigned int flags)
deactivate an interface (ie call "ifdown") This does not remove the interface from the config, and does not free the associated virInterfacePtr object.
If there is an open network config transaction at the time this interface is destroyed (that is, if virInterfaceChangeBegin() had been called), and if the interface is later undefined and then virInterfaceChangeRollback() is called, the restoral of the interface definition will also bring the interface back up.
- iface
- an interface object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success and -1 in case of failure.
virInterfaceFree
0.6.4
int virInterfaceFree (virInterfacePtr iface)
Free the interface object. The interface itself is unaltered. The data structure is freed and should not be used thereafter.
- iface
- an interface object
- Returns
- 0 in case of success and -1 in case of failure.
virInterfaceGetConnect
0.6.4
virConnectPtr virInterfaceGetConnect (virInterfacePtr iface)
Provides the connection pointer associated with an interface. The reference counter on the connection is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the interface object together.
- iface
- pointer to an interface
- Returns
- the virConnectPtr or NULL in case of failure.
virInterfaceGetMACString
0.6.4
const char * virInterfaceGetMACString (virInterfacePtr iface)
Get the MAC for an interface as string. For more information about MAC see RFC4122.
- iface
- an interface object
- Returns
- a pointer to the MAC address (in null-terminated ASCII format) or NULL, the string need not be deallocated its lifetime will be the same as the interface object.
virInterfaceGetName
0.6.4
const char * virInterfaceGetName (virInterfacePtr iface)
Get the public name for that interface
- iface
- an interface object
- Returns
- a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the interface object.
virInterfaceGetXMLDesc
0.6.4
char * virInterfaceGetXMLDesc (virInterfacePtr iface, unsigned int flags)
VIR_INTERFACE_XML_INACTIVE - return the static configuration, suitable for use redefining the interface via virInterfaceDefineXML()
Provide an XML description of the interface. If VIR_INTERFACE_XML_INACTIVE is set, the description may be reused later to redefine the interface with virInterfaceDefineXML(). If it is not set, the ip address and netmask will be the current live setting of the interface, not the settings from the config files.
- iface
- an interface object
- flags
- bitwise-OR of extraction flags. Current valid bits:
- Returns
- a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.
virInterfaceIsActive
0.7.3
int virInterfaceIsActive (virInterfacePtr iface)
Determine if the interface is currently running
- iface
- pointer to the interface object
- Returns
- 1 if running, 0 if inactive, -1 on error
virInterfaceLookupByMACString
0.6.4
virInterfacePtr virInterfaceLookupByMACString (virConnectPtr conn, const char * macstr)
Try to lookup an interface on the given hypervisor based on its MAC.
- conn
- pointer to the hypervisor connection
- macstr
- the MAC for the interface (null-terminated ASCII format)
- Returns
- a new interface object or NULL in case of failure. If the interface cannot be found, then VIR_ERR_NO_INTERFACE error is raised.
virInterfaceLookupByName
0.6.4
virInterfacePtr virInterfaceLookupByName (virConnectPtr conn, const char * name)
Try to lookup an interface on the given hypervisor based on its name.
- conn
- pointer to the hypervisor connection
- name
- name for the interface
- Returns
- a new interface object or NULL in case of failure. If the interface cannot be found, then VIR_ERR_NO_INTERFACE error is raised.
virInterfaceRef
0.6.4
int virInterfaceRef (virInterfacePtr iface)
Increment the reference count on the interface. For each additional call to this method, there shall be a corresponding call to virInterfaceFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using an interface would increment the reference count.
- iface
- the interface to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure.
virInterfaceUndefine
0.6.4
int virInterfaceUndefine (virInterfacePtr iface)
Undefine an interface, ie remove it from the config. This does not free the associated virInterfacePtr object.
Normally this change in the interface configuration is permanent/persistent, but if virInterfaceChangeBegin() has been previously called (i.e. if an interface config transaction is open), the removal of the interface definition will only become permanent if virInterfaceChangeCommit() is called prior to the next reboot of the system running libvirtd. Prior to that time, the definition can be explicitly restored using virInterfaceChangeRollback(), or will be automatically restored during the next reboot of the system running libvirtd.
- iface
- pointer to a defined interface
- Returns
- 0 in case of success, -1 in case of error
virNWFilterDefineXML
0.8.2
virNWFilterPtr virNWFilterDefineXML (virConnectPtr conn, const char * xmlDesc)
Define a new network filter, based on an XML description similar to the one returned by virNWFilterGetXMLDesc()
- conn
- pointer to the hypervisor connection
- xmlDesc
- an XML description of the nwfilter
- Returns
- a new nwfilter object or NULL in case of failure
virNWFilterFree
0.8.2
int virNWFilterFree (virNWFilterPtr nwfilter)
Free the nwfilter object. The running instance is kept alive. The data structure is freed and should not be used thereafter.
- nwfilter
- a nwfilter object
- Returns
- 0 in case of success and -1 in case of failure.
virNWFilterGetName
0.8.2
const char * virNWFilterGetName (virNWFilterPtr nwfilter)
Get the public name for the network filter
- nwfilter
- a nwfilter object
- Returns
- a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the nwfilter object.
virNWFilterGetUUID
0.8.2
int virNWFilterGetUUID (virNWFilterPtr nwfilter, unsigned char * uuid)
Get the UUID for a network filter
- nwfilter
- a nwfilter object
- uuid
- pointer to a VIR_UUID_BUFLEN bytes array
- Returns
- -1 in case of error, 0 in case of success
virNWFilterGetUUIDString
0.8.2
int virNWFilterGetUUIDString (virNWFilterPtr nwfilter, char * buf)
Get the UUID for a network filter as string. For more information about UUID see RFC4122.
- nwfilter
- a nwfilter object
- buf
- pointer to a VIR_UUID_STRING_BUFLEN bytes array
- Returns
- -1 in case of error, 0 in case of success
virNWFilterGetXMLDesc
0.8.2
char * virNWFilterGetXMLDesc (virNWFilterPtr nwfilter, unsigned int flags)
Provide an XML description of the network filter. The description may be reused later to redefine the network filter with virNWFilterCreateXML().
- nwfilter
- a nwfilter object
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.
virNWFilterLookupByName
0.8.2
virNWFilterPtr virNWFilterLookupByName (virConnectPtr conn, const char * name)
Try to lookup a network filter on the given hypervisor based on its name.
- conn
- pointer to the hypervisor connection
- name
- name for the network filter
- Returns
- a new nwfilter object or NULL in case of failure. If the network filter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.
virNWFilterLookupByUUID
0.8.2
virNWFilterPtr virNWFilterLookupByUUID (virConnectPtr conn, const unsigned char * uuid)
Try to lookup a network filter on the given hypervisor based on its UUID.
- conn
- pointer to the hypervisor connection
- uuid
- the raw UUID for the network filter
- Returns
- a new nwfilter object or NULL in case of failure. If the nwfdilter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.
virNWFilterLookupByUUIDString
0.8.2
virNWFilterPtr virNWFilterLookupByUUIDString (virConnectPtr conn, const char * uuidstr)
Try to lookup an nwfilter on the given hypervisor based on its UUID.
- conn
- pointer to the hypervisor connection
- uuidstr
- the string UUID for the nwfilter
- Returns
- a new nwfilter object or NULL in case of failure. If the nwfilter cannot be found, then VIR_ERR_NO_NWFILTER error is raised.
virNWFilterRef
0.8.2
int virNWFilterRef (virNWFilterPtr nwfilter)
Increment the reference count on the nwfilter. For each additional call to this method, there shall be a corresponding call to virNWFilterFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using an nwfilter would increment the reference count.
- nwfilter
- the nwfilter to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure.
virNWFilterUndefine
0.8.2
int virNWFilterUndefine (virNWFilterPtr nwfilter)
Undefine the nwfilter object. This call will not succeed if a running VM is referencing the filter. This does not free the associated virNWFilterPtr object.
- nwfilter
- a nwfilter object
- Returns
- 0 in case of success and -1 in case of failure.
virNetworkCreate
0.2.0
int virNetworkCreate (virNetworkPtr network)
Create and start a defined network. If the call succeed the network moves from the defined to the running networks pools.
- network
- pointer to a defined network
- Returns
- 0 in case of success, -1 in case of error
virNetworkCreateXML
0.2.0
virNetworkPtr virNetworkCreateXML (virConnectPtr conn, const char * xmlDesc)
Create and start a new virtual network, based on an XML description similar to the one returned by virNetworkGetXMLDesc()
- conn
- pointer to the hypervisor connection
- xmlDesc
- an XML description of the network
- Returns
- a new network object or NULL in case of failure
virNetworkDefineXML
0.2.0
virNetworkPtr virNetworkDefineXML (virConnectPtr conn, const char * xml)
Define a network, but does not create it
- conn
- pointer to the hypervisor connection
- xml
- the XML description for the network, preferably in UTF-8
- Returns
- NULL in case of error, a pointer to the network otherwise
virNetworkDestroy
0.2.0
int virNetworkDestroy (virNetworkPtr network)
Destroy the network object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. This does not free the associated virNetworkPtr object. This function may require privileged access
- network
- a network object
- Returns
- 0 in case of success and -1 in case of failure.
virNetworkFree
0.2.0
int virNetworkFree (virNetworkPtr network)
Free the network object. The running instance is kept alive. The data structure is freed and should not be used thereafter.
- network
- a network object
- Returns
- 0 in case of success and -1 in case of failure.
virNetworkGetAutostart
0.2.1
int virNetworkGetAutostart (virNetworkPtr network, int * autostart)
Provides a boolean value indicating whether the network configured to be automatically started when the host machine boots.
- network
- a network object
- autostart
- the value returned
- Returns
- -1 in case of error, 0 in case of success
virNetworkGetBridgeName
0.2.0
char * virNetworkGetBridgeName (virNetworkPtr network)
Provides a bridge interface name to which a domain may connect a network interface in order to join the network.
- network
- a network object
- Returns
- a 0 terminated interface name, or NULL in case of error. the caller must free() the returned value.
virNetworkGetConnect
0.3.0
virConnectPtr virNetworkGetConnect (virNetworkPtr net)
Provides the connection pointer associated with a network. The reference counter on the connection is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the network object together.
- net
- pointer to a network
- Returns
- the virConnectPtr or NULL in case of failure.
virNetworkGetName
0.2.0
const char * virNetworkGetName (virNetworkPtr network)
Get the public name for that network
- network
- a network object
- Returns
- a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the network object.
virNetworkGetUUID
0.2.0
int virNetworkGetUUID (virNetworkPtr network, unsigned char * uuid)
Get the UUID for a network
- network
- a network object
- uuid
- pointer to a VIR_UUID_BUFLEN bytes array
- Returns
- -1 in case of error, 0 in case of success
virNetworkGetUUIDString
0.2.0
int virNetworkGetUUIDString (virNetworkPtr network, char * buf)
Get the UUID for a network as string. For more information about UUID see RFC4122.
- network
- a network object
- buf
- pointer to a VIR_UUID_STRING_BUFLEN bytes array
- Returns
- -1 in case of error, 0 in case of success
virNetworkGetXMLDesc
0.2.0
char * virNetworkGetXMLDesc (virNetworkPtr network, unsigned int flags)
Provide an XML description of the network. The description may be reused later to relaunch the network with virNetworkCreateXML().
Normally, if a network included a physical function, the output includes all virtual functions tied to that physical interface. If @flags includes VIR_NETWORK_XML_INACTIVE, then the expansion of virtual interfaces is not performed.
- network
- a network object
- flags
- bitwise-OR of virNetworkXMLFlags
- Returns
- a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.
virNetworkIsActive
0.7.3
int virNetworkIsActive (virNetworkPtr net)
Determine if the network is currently running
- net
- pointer to the network object
- Returns
- 1 if running, 0 if inactive, -1 on error
virNetworkIsPersistent
0.7.3
int virNetworkIsPersistent (virNetworkPtr net)
Determine if the network has a persistent configuration which means it will still exist after shutting down
- net
- pointer to the network object
- Returns
- 1 if persistent, 0 if transient, -1 on error
virNetworkLookupByName
0.2.0
virNetworkPtr virNetworkLookupByName (virConnectPtr conn, const char * name)
Try to lookup a network on the given hypervisor based on its name.
- conn
- pointer to the hypervisor connection
- name
- name for the network
- Returns
- a new network object or NULL in case of failure. If the network cannot be found, then VIR_ERR_NO_NETWORK error is raised.
virNetworkLookupByUUID
0.2.0
virNetworkPtr virNetworkLookupByUUID (virConnectPtr conn, const unsigned char * uuid)
Try to lookup a network on the given hypervisor based on its UUID.
- conn
- pointer to the hypervisor connection
- uuid
- the raw UUID for the network
- Returns
- a new network object or NULL in case of failure. If the network cannot be found, then VIR_ERR_NO_NETWORK error is raised.
virNetworkLookupByUUIDString
0.2.0
virNetworkPtr virNetworkLookupByUUIDString (virConnectPtr conn, const char * uuidstr)
Try to lookup a network on the given hypervisor based on its UUID.
- conn
- pointer to the hypervisor connection
- uuidstr
- the string UUID for the network
- Returns
- a new network object or NULL in case of failure. If the network cannot be found, then VIR_ERR_NO_NETWORK error is raised.
virNetworkRef
0.6.0
int virNetworkRef (virNetworkPtr network)
Increment the reference count on the network. For each additional call to this method, there shall be a corresponding call to virNetworkFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a network would increment the reference count.
- network
- the network to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure.
virNetworkSetAutostart
0.2.1
int virNetworkSetAutostart (virNetworkPtr network, int autostart)
Configure the network to be automatically started when the host machine boots.
- network
- a network object
- autostart
- whether the network should be automatically started 0 or 1
- Returns
- -1 in case of error, 0 in case of success
virNetworkUndefine
0.2.0
int virNetworkUndefine (virNetworkPtr network)
Undefine a network but does not stop it if it is running
- network
- pointer to a defined network
- Returns
- 0 in case of success, -1 in case of error
virNetworkUpdate
0.10.2
int virNetworkUpdate (virNetworkPtr network, unsigned int command, unsigned int section, int parentIndex, const char * xml, unsigned int flags)
Update the definition of an existing network, either its live running state, its persistent configuration, or both.
- network
- pointer to a defined network
- command
- what action to perform (add/delete/modify) (see virNetworkUpdateCommand for descriptions)
- section
- which section of the network to update (see virNetworkUpdateSection for descriptions)
- parentIndex
- which parent element, if there are multiple parents of the same type (e.g. which <ip> element when modifying a <dhcp>/<host> element), or "-1" for "don't care" or "automatically find appropriate one".
- xml
- the XML description for the network, preferably in UTF-8
- flags
- bitwise OR of virNetworkUpdateFlags.
- Returns
- 0 in case of success, -1 in case of error virNetworkUpdateCommand virNetworkUpdateSection
virNodeDeviceCreateXML
0.6.3
virNodeDevicePtr virNodeDeviceCreateXML (virConnectPtr conn, const char * xmlDesc, unsigned int flags)
Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.
- conn
- pointer to the hypervisor connection
- xmlDesc
- string containing an XML description of the device to be created
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a node device object if successful, NULL in case of failure
virNodeDeviceDestroy
0.6.3
int virNodeDeviceDestroy (virNodeDevicePtr dev)
Destroy the device object. The virtual device is removed from the host operating system. This function may require privileged access
- dev
- a device object
- Returns
- 0 in case of success and -1 in case of failure.
virNodeDeviceDetachFlags
1.0.5
int virNodeDeviceDetachFlags (virNodeDevicePtr dev, const char * driverName, unsigned int flags)
Detach the node device from the node itself so that it may be assigned to a guest domain.
Depending on the hypervisor, this may involve operations such as unbinding any device drivers from the device, binding the device to a dummy device driver and resetting the device. Different backend drivers expect the device to be bound to different dummy devices. For example, QEMU's "kvm" backend driver (the default) expects the device to be bound to "pci-stub", but its "vfio" backend driver expects the device to be bound to "vfio-pci".
If the device is currently in use by the node, this method may fail.
Once the device is not assigned to any guest, it may be re-attached to the node using the virNodeDeviceReAttach() method.
- dev
- pointer to the node device
- driverName
- name of backend driver that will be used for later device assignment to a domain. NULL means "use the hypervisor default driver"
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 in case of failure.
virNodeDeviceDettach
0.6.1
int virNodeDeviceDettach (virNodeDevicePtr dev)
Dettach the node device from the node itself so that it may be assigned to a guest domain.
Depending on the hypervisor, this may involve operations such as unbinding any device drivers from the device, binding the device to a dummy device driver and resetting the device.
If the device is currently in use by the node, this method may fail.
Once the device is not assigned to any guest, it may be re-attached to the node using the virNodeDeviceReattach() method.
If the caller needs control over which backend driver will be used during PCI device assignment (to use something other than the default, for example VFIO), the newer virNodeDeviceDetachFlags() API should be used instead.
- dev
- pointer to the node device
- Returns
- 0 in case of success, -1 in case of failure.
virNodeDeviceFree
0.5.0
int virNodeDeviceFree (virNodeDevicePtr dev)
Drops a reference to the node device, freeing it if this was the last reference.
- dev
- pointer to the node device
- Returns
- the 0 for success, -1 for error.
virNodeDeviceGetName
0.5.0
const char * virNodeDeviceGetName (virNodeDevicePtr dev)
Just return the device name
- dev
- the device
- Returns
- the device name or NULL in case of error
virNodeDeviceGetParent
0.5.0
const char * virNodeDeviceGetParent (virNodeDevicePtr dev)
Accessor for the parent of the device
- dev
- the device
- Returns
- the name of the device's parent, or NULL if the device has no parent.
virNodeDeviceGetXMLDesc
0.5.0
char * virNodeDeviceGetXMLDesc (virNodeDevicePtr dev, unsigned int flags)
Fetch an XML document describing all aspects of the device.
- dev
- pointer to the node device
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the XML document, or NULL on error
virNodeDeviceListCaps
0.5.0
int virNodeDeviceListCaps (virNodeDevicePtr dev, char ** const names, int maxnames)
Lists the names of the capabilities supported by the device.
- dev
- the device
- names
- array to collect the list of capability names
- maxnames
- size of @names
- Returns
- the number of capability names listed in @names.
virNodeDeviceLookupByName
0.5.0
virNodeDevicePtr virNodeDeviceLookupByName (virConnectPtr conn, const char * name)
Lookup a node device by its name.
- conn
- pointer to the hypervisor connection
- name
- unique device name
- Returns
- a virNodeDevicePtr if found, NULL otherwise.
virNodeDeviceLookupSCSIHostByWWN
1.0.3
virNodeDevicePtr virNodeDeviceLookupSCSIHostByWWN (virConnectPtr conn, const char * wwnn, const char * wwpn, unsigned int flags)
Lookup SCSI Host which is capable with 'fc_host' by its WWNN and WWPN.
- conn
- pointer to the hypervisor connection
- wwnn
- WWNN of the SCSI Host.
- wwpn
- WWPN of the SCSI Host.
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a virNodeDevicePtr if found, NULL otherwise.
virNodeDeviceNumOfCaps
0.5.0
int virNodeDeviceNumOfCaps (virNodeDevicePtr dev)
Accessor for the number of capabilities supported by the device.
- dev
- the device
- Returns
- the number of capabilities supported by the device.
virNodeDeviceReAttach
0.6.1
int virNodeDeviceReAttach (virNodeDevicePtr dev)
Re-attach a previously dettached node device to the node so that it may be used by the node again.
Depending on the hypervisor, this may involve operations such as resetting the device, unbinding it from a dummy device driver and binding it to its appropriate driver.
If the device is currently in use by a guest, this method may fail.
- dev
- pointer to the node device
- Returns
- 0 in case of success, -1 in case of failure.
virNodeDeviceRef
0.6.0
int virNodeDeviceRef (virNodeDevicePtr dev)
Increment the reference count on the dev. For each additional call to this method, there shall be a corresponding call to virNodeDeviceFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a dev would increment the reference count.
- dev
- the dev to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure.
virNodeDeviceReset
0.6.1
int virNodeDeviceReset (virNodeDevicePtr dev)
Reset a previously dettached node device to the node before or after assigning it to a guest.
The exact reset semantics depends on the hypervisor and device type but, for example, KVM will attempt to reset PCI devices with a Function Level Reset, Secondary Bus Reset or a Power Management D-State reset.
If the reset will affect other devices which are currently in use, this function may fail.
- dev
- pointer to the node device
- Returns
- 0 in case of success, -1 in case of failure.
virNodeGetCPUMap
1.0.0
int virNodeGetCPUMap (virConnectPtr conn, unsigned char ** cpumap, unsigned int * online, unsigned int flags)
Get CPU map of host node CPUs.
- conn
- pointer to the hypervisor connection
- cpumap
- optional pointer to a bit map of real CPUs on the host node (in 8-bit bytes) (OUT) In case of success each bit set to 1 means that corresponding CPU is online. Bytes are stored in little-endian order: CPU0-7, 8-15... In each byte, lowest CPU number is least significant bit. The bit map is allocated by virNodeGetCPUMap and needs to be released using free() by the caller.
- online
- optional number of online CPUs in cpumap (OUT) Contains the number of online CPUs if the call was successful.
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- number of CPUs present on the host node, or -1 if there was an error.
virNodeGetCPUStats
0.9.3
int virNodeGetCPUStats (virConnectPtr conn, int cpuNum, virNodeCPUStatsPtr params, int * nparams, unsigned int flags)
This function provides individual cpu statistics of the node. If you want to get total cpu statistics of the node, you must specify VIR_NODE_CPU_STATS_ALL_CPUS to @cpuNum. The @params array will be filled with the values equal to the number of parameters suggested by @nparams
As the value of @nparams is dynamic, call the API setting @nparams to 0 and @params as NULL, the API returns the number of parameters supported by the HV by updating @nparams on SUCCESS. The caller should then allocate @params array, i.e. (sizeof(@virNodeCPUStats) * @nparams) bytes and call the API again.
Here is a sample code snippet:
if ((virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL) goto error; memset(params, 0, sizeof(virNodeCPUStats) * nparams); if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0)) goto error; }
This function doesn't require privileged access to the hypervisor. This function expects the caller to allocate the @params.
CPU time Statistics:
VIR_NODE_CPU_STATS_KERNEL: The cumulative CPU time which spends by kernel, when the node booting up.(nanoseconds) VIR_NODE_CPU_STATS_USER: The cumulative CPU time which spends by user processes, when the node booting up.(nanoseconds) VIR_NODE_CPU_STATS_IDLE: The cumulative idle CPU time, when the node booting up.(nanoseconds) VIR_NODE_CPU_STATS_IOWAIT: The cumulative I/O wait CPU time, when the node booting up.(nanoseconds) VIR_NODE_CPU_STATS_UTILIZATION: The CPU utilization. The usage value is in percent and 100% represents all CPUs on the server.
- conn
- pointer to the hypervisor connection.
- cpuNum
- number of node cpu. (VIR_NODE_CPU_STATS_ALL_CPUS means total cpu statistics)
- params
- pointer to node cpu time parameter objects
- nparams
- number of node cpu time parameter (this value should be same or less than the number of parameters supported)
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- -1 in case of error, 0 in case of success.
virNodeGetCellsFreeMemory
0.3.3
int virNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long * freeMems, int startCell, int maxCells)
This call returns the amount of free memory in one or more NUMA cells. The @freeMems array must be allocated by the caller and will be filled with the amount of free memory in bytes for each cell requested, starting with startCell (in freeMems[0]), up to either (startCell + maxCells), or the number of additional cells in the node, whichever is smaller.
- conn
- pointer to the hypervisor connection
- freeMems
- pointer to the array of unsigned long long
- startCell
- index of first cell to return freeMems info on.
- maxCells
- Maximum number of cells for which freeMems information can be returned.
- Returns
- the number of entries filled in freeMems, or -1 in case of error.
virNodeGetFreeMemory
0.3.3
unsigned long long virNodeGetFreeMemory (virConnectPtr conn)
provides the free memory available on the Node Note: most libvirt APIs provide memory sizes in kibibytes, but in this function the returned value is in bytes. Divide by 1024 as necessary.
- conn
- pointer to the hypervisor connection
- Returns
- the available free memory in bytes or 0 in case of error
virNodeGetInfo
0.1.0
int virNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
Extract hardware information about the node.
- conn
- pointer to the hypervisor connection
- info
- pointer to a virNodeInfo structure allocated by the user
- Returns
- 0 in case of success and -1 in case of failure.
virNodeGetMemoryParameters
0.10.2
int virNodeGetMemoryParameters (virConnectPtr conn, virTypedParameterPtr params, int * nparams, unsigned int flags)
Get all node memory parameters (parameters unsupported by OS will be omitted). On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value.
As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See virDomainGetMemoryParameters() for an equivalent usage example.
- conn
- pointer to the hypervisor connection
- params
- pointer to memory parameter object (return value, allocated by the caller)
- nparams
- pointer to number of memory parameters; input and output
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, and -1 in case of failure.
virNodeGetMemoryStats
0.9.3
int virNodeGetMemoryStats (virConnectPtr conn, int cellNum, virNodeMemoryStatsPtr params, int * nparams, unsigned int flags)
This function provides memory stats of the node. If you want to get total cpu statistics of the node, you must specify VIR_NODE_MEMORY_STATS_ALL_CELLS to @cellNum. The @params array will be filled with the values equal to the number of stats suggested by @nparams
As the value of @nparams is dynamic, call the API setting @nparams to 0 and @params as NULL, the API returns the number of parameters supported by the HV by updating @nparams on SUCCESS. The caller should then allocate @params array, i.e. (sizeof(@virNodeMemoryStats) * @nparams) bytes and call the API again.
Here is the sample code snippet:
if ((virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL) goto error; memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams); if (virNodeGetMemoryStats(conn, params, &nparams, 0)) goto error; }
This function doesn't require privileged access to the hypervisor. This function expects the caller to allocate the @params.
Memory Stats:
VIR_NODE_MEMORY_STATS_TOTAL: The total memory usage.(KB) VIR_NODE_MEMORY_STATS_FREE: The free memory usage.(KB) On linux, this usage includes buffers and cached. VIR_NODE_MEMORY_STATS_BUFFERS: The buffers memory usage.(KB) VIR_NODE_MEMORY_STATS_CACHED: The cached memory usage.(KB)
- conn
- pointer to the hypervisor connection.
- cellNum
- number of node cell. (VIR_NODE_MEMORY_STATS_ALL_CELLS means total cell statistics)
- params
- pointer to node memory stats objects
- nparams
- number of node memory stats (this value should be same or less than the number of stats supported)
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- -1 in case of error, 0 in case of success.
virNodeGetSecurityModel
0.6.1
int virNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
Extract the security model of a hypervisor. The 'model' field in the @secmodel argument may be initialized to the empty string if the driver has not activated a security model.
- conn
- a connection object
- secmodel
- pointer to a virSecurityModel structure
- Returns
- 0 in case of success, -1 in case of failure
virNodeListDevices
0.5.0
int virNodeListDevices (virConnectPtr conn, const char * cap, char ** const names, int maxnames, unsigned int flags)
Collect the list of node devices, and store their names in @names
For more control over the results, see virConnectListAllNodeDevices().
If the optional 'cap' argument is non-NULL, then the count will be restricted to devices with the specified capability
- conn
- pointer to the hypervisor connection
- cap
- capability name
- names
- array to collect the list of node device names
- maxnames
- size of @names
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the number of node devices found or -1 in case of error
virNodeNumOfDevices
0.5.0
int virNodeNumOfDevices (virConnectPtr conn, const char * cap, unsigned int flags)
Provides the number of node devices.
If the optional 'cap' argument is non-NULL, then the count will be restricted to devices with the specified capability
- conn
- pointer to the hypervisor connection
- cap
- capability name
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the number of node devices or -1 in case of error
virNodeSetMemoryParameters
0.10.2
int virNodeSetMemoryParameters (virConnectPtr conn, virTypedParameterPtr params, int nparams, unsigned int flags)
Change all or a subset of the node memory tunables. The function fails if not all of the tunables are supported.
Note that it's not recommended to use this function while the outside tuning program is running (such as ksmtuned under Linux), as they could change the tunables in parallel, which could cause conflicts.
This function may require privileged access to the hypervisor.
- conn
- pointer to the hypervisor connection
- params
- pointer to scheduler parameter objects
- nparams
- number of scheduler parameter objects (this value can be the same or less than the returned value nparams of virDomainGetSchedulerType)
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 in case of success, -1 in case of failure.
virNodeSuspendForDuration
0.9.8
int virNodeSuspendForDuration (virConnectPtr conn, unsigned int target, unsigned long long duration, unsigned int flags)
Attempt to suspend the node (host machine) for the given duration of time in the specified state (Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend). Schedule the node's Real-Time-Clock interrupt to resume the node after the duration is complete.
- conn
- pointer to the hypervisor connection
- target
- the state to which the host must be suspended to, such as: VIR_NODE_SUSPEND_TARGET_MEM (Suspend-to-RAM) VIR_NODE_SUSPEND_TARGET_DISK (Suspend-to-Disk) VIR_NODE_SUSPEND_TARGET_HYBRID (Hybrid-Suspend, which is a combination of the former modes).
- duration
- the time duration in seconds for which the host has to be suspended
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 on success (i.e., the node will be suspended after a short delay), -1 on failure (the operation is not supported, or an attempted suspend is already underway).
virSecretDefineXML
0.7.1
virSecretPtr virSecretDefineXML (virConnectPtr conn, const char * xml, unsigned int flags)
If XML specifies a UUID, locates the specified secret and replaces all attributes of the secret specified by UUID by attributes specified in xml (any attributes not specified in xml are discarded).
Otherwise, creates a new secret with an automatically chosen UUID, and initializes its attributes from xml.
- conn
- virConnect connection
- xml
- XML describing the secret.
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a the secret on success, NULL on failure.
virSecretFree
0.7.1
int virSecretFree (virSecretPtr secret)
Release the secret handle. The underlying secret continues to exist.
- secret
- pointer to a secret
- Returns
- 0 on success, or -1 on error
virSecretGetConnect
0.7.1
virConnectPtr virSecretGetConnect (virSecretPtr secret)
Provides the connection pointer associated with a secret. The reference counter on the connection is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the secret object together.
- secret
- A virSecret secret
- Returns
- the virConnectPtr or NULL in case of failure.
virSecretGetUUID
0.7.1
int virSecretGetUUID (virSecretPtr secret, unsigned char * uuid)
Fetches the UUID of the secret.
- secret
- A virSecret secret
- uuid
- buffer of VIR_UUID_BUFLEN bytes in size
- Returns
- 0 on success with the uuid buffer being filled, or -1 upon failure.
virSecretGetUUIDString
0.7.1
int virSecretGetUUIDString (virSecretPtr secret, char * buf)
Get the UUID for a secret as string. For more information about UUID see RFC4122.
- secret
- a secret object
- buf
- pointer to a VIR_UUID_STRING_BUFLEN bytes array
- Returns
- -1 in case of error, 0 in case of success
virSecretGetUsageID
0.7.1
const char * virSecretGetUsageID (virSecretPtr secret)
Get the unique identifier of the object with which this secret is to be used. The format of the identifier is dependant on the usage type of the secret. For a secret with a usage type of VIR_SECRET_USAGE_TYPE_VOLUME the identifier will be a fully qualfied path name. The identifiers are intended to be unique within the set of all secrets sharing the same usage type. ie, there shall only ever be one secret for each volume path.
- secret
- a secret object
- Returns
- a string identifying the object using the secret, or NULL upon error
virSecretGetUsageType
0.7.1
int virSecretGetUsageType (virSecretPtr secret)
Get the type of object which uses this secret. The returned value is one of the constants defined in the virSecretUsageType enumeration. More values may be added to this enumeration in the future, so callers should expect to see usage types they do not explicitly know about.
- secret
- a secret object
- Returns
- a positive integer identifying the type of object, or -1 upon error.
virSecretGetValue
0.7.1
unsigned char * virSecretGetValue (virSecretPtr secret, size_t * value_size, unsigned int flags)
Fetches the value of a secret.
- secret
- A virSecret connection
- value_size
- Place for storing size of the secret value
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the secret value on success, NULL on failure. The caller must free() the secret value.
virSecretGetXMLDesc
0.7.1
char * virSecretGetXMLDesc (virSecretPtr secret, unsigned int flags)
Fetches an XML document describing attributes of the secret.
- secret
- A virSecret secret
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the XML document on success, NULL on failure. The caller must free() the XML.
virSecretLookupByUUID
0.7.1
virSecretPtr virSecretLookupByUUID (virConnectPtr conn, const unsigned char * uuid)
Try to lookup a secret on the given hypervisor based on its UUID. Uses the 16 bytes of raw data to describe the UUID
- conn
- pointer to the hypervisor connection
- uuid
- the raw UUID for the secret
- Returns
- a new secret object or NULL in case of failure. If the secret cannot be found, then VIR_ERR_NO_SECRET error is raised.
virSecretLookupByUUIDString
0.7.1
virSecretPtr virSecretLookupByUUIDString (virConnectPtr conn, const char * uuidstr)
Try to lookup a secret on the given hypervisor based on its UUID. Uses the printable string value to describe the UUID
- conn
- pointer to the hypervisor connection
- uuidstr
- the string UUID for the secret
- Returns
- a new secret object or NULL in case of failure. If the secret cannot be found, then VIR_ERR_NO_SECRET error is raised.
virSecretLookupByUsage
0.7.1
virSecretPtr virSecretLookupByUsage (virConnectPtr conn, int usageType, const char * usageID)
Try to lookup a secret on the given hypervisor based on its usage The usageID is unique within the set of secrets sharing the same usageType value.
- conn
- pointer to the hypervisor connection
- usageType
- the type of secret usage
- usageID
- identifier of the object using the secret
- Returns
- a new secret object or NULL in case of failure. If the secret cannot be found, then VIR_ERR_NO_SECRET error is raised.
virSecretRef
0.7.1
int virSecretRef (virSecretPtr secret)
Increment the reference count on the secret. For each additional call to this method, there shall be a corresponding call to virSecretFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a secret would increment the reference count.
- secret
- the secret to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure.
virSecretSetValue
0.7.1
int virSecretSetValue (virSecretPtr secret, const unsigned char * value, size_t value_size, unsigned int flags)
Sets the value of a secret.
- secret
- A virSecret secret
- value
- Value of the secret
- value_size
- Size of the value
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 on success, -1 on failure.
virSecretUndefine
0.7.1
int virSecretUndefine (virSecretPtr secret)
Deletes the specified secret. This does not free the associated virSecretPtr object.
- secret
- A virSecret secret
- Returns
- 0 on success, -1 on failure.
virStoragePoolBuild
0.4.1
int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int flags)
Currently only filesystem pool accepts flags VIR_STORAGE_POOL_BUILD_OVERWRITE and VIR_STORAGE_POOL_BUILD_NO_OVERWRITE.
Build the underlying storage pool
- pool
- pointer to storage pool
- flags
- bitwise-OR of virStoragePoolBuildFlags
- Returns
- 0 on success, or -1 upon failure
virStoragePoolCreate
0.4.1
int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags)
Starts an inactive storage pool
- pool
- pointer to storage pool
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 on success, or -1 if it could not be started
virStoragePoolCreateXML
0.4.1
virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char * xmlDesc, unsigned int flags)
Create a new storage based on its XML description. The pool is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted
- conn
- pointer to hypervisor connection
- xmlDesc
- XML description for new pool
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a virStoragePoolPtr object, or NULL if creation failed
virStoragePoolDefineXML
0.4.1
virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char * xml, unsigned int flags)
Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined.
- conn
- pointer to hypervisor connection
- xml
- XML description for new pool
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- a virStoragePoolPtr object, or NULL if creation failed
virStoragePoolDelete
0.4.1
int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int flags)
Delete the underlying pool resources. This is a non-recoverable operation. The virStoragePoolPtr object itself is not free'd.
- pool
- pointer to storage pool
- flags
- bitwise-OR of virStoragePoolDeleteFlags
- Returns
- 0 on success, or -1 if it could not be obliterate
virStoragePoolDestroy
0.4.1
int virStoragePoolDestroy (virStoragePoolPtr pool)
Destroy an active storage pool. This will deactivate the pool on the host, but keep any persistent config associated with it. If it has a persistent config it can later be restarted with virStoragePoolCreate(). This does not free the associated virStoragePoolPtr object.
- pool
- pointer to storage pool
- Returns
- 0 on success, or -1 if it could not be destroyed
virStoragePoolFree
0.4.1
int virStoragePoolFree (virStoragePoolPtr pool)
Free a storage pool object, releasing all memory associated with it. Does not change the state of the pool on the host.
- pool
- pointer to storage pool
- Returns
- 0 on success, or -1 if it could not be free'd.
virStoragePoolGetAutostart
0.4.1
int virStoragePoolGetAutostart (virStoragePoolPtr pool, int * autostart)
Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot time
- pool
- pointer to storage pool
- autostart
- location in which to store autostart flag
- Returns
- 0 on success, -1 on failure
virStoragePoolGetConnect
0.4.1
virConnectPtr virStoragePoolGetConnect (virStoragePoolPtr pool)
Provides the connection pointer associated with a storage pool. The reference counter on the connection is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the pool object together.
- pool
- pointer to a pool
- Returns
- the virConnectPtr or NULL in case of failure.
virStoragePoolGetInfo
0.4.1
int virStoragePoolGetInfo (virStoragePoolPtr pool, virStoragePoolInfoPtr info)
Get volatile information about the storage pool such as free space / usage summary
- pool
- pointer to storage pool
- info
- pointer at which to store info
- Returns
- 0 on success, or -1 on failure.
virStoragePoolGetName
0.4.1
const char * virStoragePoolGetName (virStoragePoolPtr pool)
Fetch the locally unique name of the storage pool
- pool
- pointer to storage pool
- Returns
- the name of the pool, or NULL on error
virStoragePoolGetUUID
0.4.1
int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char * uuid)
Fetch the globally unique ID of the storage pool
- pool
- pointer to storage pool
- uuid
- buffer of VIR_UUID_BUFLEN bytes in size
- Returns
- 0 on success, or -1 on error;
virStoragePoolGetUUIDString
0.4.1
int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char * buf)
Fetch the globally unique ID of the storage pool as a string
- pool
- pointer to storage pool
- buf
- buffer of VIR_UUID_STRING_BUFLEN bytes in size
- Returns
- 0 on success, or -1 on error;
virStoragePoolGetXMLDesc
0.4.1
char * virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags)
Fetch an XML document describing all aspects of the storage pool. This is suitable for later feeding back into the virStoragePoolCreateXML method.
- pool
- pointer to storage pool
- flags
- bitwise-OR of virStorageXMLFlags
- Returns
- a XML document, or NULL on error
virStoragePoolIsActive
0.7.3
int virStoragePoolIsActive (virStoragePoolPtr pool)
Determine if the storage pool is currently running
- pool
- pointer to the storage pool object
- Returns
- 1 if running, 0 if inactive, -1 on error
virStoragePoolIsPersistent
0.7.3
int virStoragePoolIsPersistent (virStoragePoolPtr pool)
Determine if the storage pool has a persistent configuration which means it will still exist after shutting down
- pool
- pointer to the storage pool object
- Returns
- 1 if persistent, 0 if transient, -1 on error
virStoragePoolListAllVolumes
0.10.2
int virStoragePoolListAllVolumes (virStoragePoolPtr pool, virStorageVolPtr ** vols, unsigned int flags)
Collect the list of storage volumes, and allocate an array to store those objects.
- pool
- Pointer to storage pool
- vols
- Pointer to a variable to store the array containing storage volume objects or NULL if the list is not required (just returns number of volumes).
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the number of storage volumes found or -1 and sets @vols to NULL in case of error. On success, the array stored into @vols is guaranteed to have an extra allocated element set to NULL but not included in the return count, to make iteration easier. The caller is responsible for calling virStorageVolFree() on each array element, then calling free() on @vols.
virStoragePoolListVolumes
0.4.1
int virStoragePoolListVolumes (virStoragePoolPtr pool, char ** const names, int maxnames)
Fetch list of storage volume names, limiting to at most maxnames.
To list the volume objects directly, see virStoragePoolListAllVolumes().
- pool
- pointer to storage pool
- names
- array in which to storage volume names
- maxnames
- size of names array
- Returns
- the number of names fetched, or -1 on error
virStoragePoolLookupByName
0.4.1
virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char * name)
Fetch a storage pool based on its unique name
- conn
- pointer to hypervisor connection
- name
- name of pool to fetch
- Returns
- a virStoragePoolPtr object, or NULL if no matching pool is found
virStoragePoolLookupByUUID
0.4.1
virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char * uuid)
Fetch a storage pool based on its globally unique id
- conn
- pointer to hypervisor connection
- uuid
- globally unique id of pool to fetch
- Returns
- a virStoragePoolPtr object, or NULL if no matching pool is found
virStoragePoolLookupByUUIDString
0.4.1
virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char * uuidstr)
Fetch a storage pool based on its globally unique id
- conn
- pointer to hypervisor connection
- uuidstr
- globally unique id of pool to fetch
- Returns
- a virStoragePoolPtr object, or NULL if no matching pool is found
virStoragePoolLookupByVolume
0.4.1
virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol)
Fetch a storage pool which contains a particular volume
- vol
- pointer to storage volume
- Returns
- a virStoragePoolPtr object, or NULL if no matching pool is found
virStoragePoolNumOfVolumes
0.4.1
int virStoragePoolNumOfVolumes (virStoragePoolPtr pool)
Fetch the number of storage volumes within a pool
- pool
- pointer to storage pool
- Returns
- the number of storage pools, or -1 on failure
virStoragePoolRef
0.6.0
int virStoragePoolRef (virStoragePoolPtr pool)
Increment the reference count on the pool. For each additional call to this method, there shall be a corresponding call to virStoragePoolFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a pool would increment the reference count.
- pool
- the pool to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure.
virStoragePoolRefresh
0.4.1
int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags)
Request that the pool refresh its list of volumes. This may involve communicating with a remote server, and/or initializing new devices at the OS layer
- pool
- pointer to storage pool
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 if the volume list was refreshed, -1 on failure
virStoragePoolSetAutostart
0.4.1
int virStoragePoolSetAutostart (virStoragePoolPtr pool, int autostart)
Sets the autostart flag
- pool
- pointer to storage pool
- autostart
- new flag setting
- Returns
- 0 on success, -1 on failure
virStoragePoolUndefine
0.4.1
int virStoragePoolUndefine (virStoragePoolPtr pool)
Undefine an inactive storage pool
- pool
- pointer to storage pool
- Returns
- 0 on success, -1 on failure
virStorageVolCreateXML
0.4.1
virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char * xmlDesc, unsigned int flags)
Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes.
Since 1.0.1 VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA in flags can be used to get higher performance with qcow2 image files which don't support full preallocation, by creating a sparse image file with metadata.
- pool
- pointer to storage pool
- xmlDesc
- description of volume to create
- flags
- bitwise-OR of virStorageVolCreateFlags
- Returns
- the storage volume, or NULL on error
virStorageVolCreateXMLFrom
0.6.4
virStorageVolPtr virStorageVolCreateXMLFrom (virStoragePoolPtr pool, const char * xmlDesc, virStorageVolPtr clonevol, unsigned int flags)
Create a storage volume in the parent pool, using the 'clonevol' volume as input. Information for the new volume (name, perms) are passed via a typical volume XML description.
Since 1.0.1 VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA in flags can be used to get higher performance with qcow2 image files which don't support full preallocation, by creating a sparse image file with metadata.
- pool
- pointer to parent pool for the new volume
- xmlDesc
- description of volume to create
- clonevol
- storage volume to use as input
- flags
- bitwise-OR of virStorageVolCreateFlags
- Returns
- the storage volume, or NULL on error
virStorageVolDelete
0.4.1
int virStorageVolDelete (virStorageVolPtr vol, unsigned int flags)
Delete the storage volume from the pool
- vol
- pointer to storage volume
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 on success, or -1 on error
virStorageVolDownload
0.9.0
int virStorageVolDownload (virStorageVolPtr vol, virStreamPtr stream, unsigned long long offset, unsigned long long length, unsigned int flags)
Download the content of the volume as a stream. If @length is zero, then the remaining contents of the volume after @offset will be downloaded.
This call sets up an asynchronous stream; subsequent use of stream APIs is necessary to transfer the actual data, determine how much data is successfully transferred, and detect any errors. The results will be unpredictable if another active stream is writing to the storage volume.
- vol
- pointer to volume to download from
- stream
- stream to use as output
- offset
- position in @vol to start reading from
- length
- limit on amount of data to download
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0, or -1 upon error.
virStorageVolFree
0.4.1
int virStorageVolFree (virStorageVolPtr vol)
Release the storage volume handle. The underlying storage volume continues to exist.
- vol
- pointer to storage volume
- Returns
- 0 on success, or -1 on error
virStorageVolGetConnect
0.4.1
virConnectPtr virStorageVolGetConnect (virStorageVolPtr vol)
Provides the connection pointer associated with a storage volume. The reference counter on the connection is not increased by this call.
WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the volume object together.
- vol
- pointer to a pool
- Returns
- the virConnectPtr or NULL in case of failure.
virStorageVolGetInfo
0.4.1
int virStorageVolGetInfo (virStorageVolPtr vol, virStorageVolInfoPtr info)
Fetches volatile information about the storage volume such as its current allocation
- vol
- pointer to storage volume
- info
- pointer at which to store info
- Returns
- 0 on success, or -1 on failure
virStorageVolGetKey
0.4.1
const char * virStorageVolGetKey (virStorageVolPtr vol)
Fetch the storage volume key. This is globally unique, so the same volume will have the same key no matter what host it is accessed from
- vol
- pointer to storage volume
- Returns
- the volume key, or NULL on error
virStorageVolGetName
0.4.1
const char * virStorageVolGetName (virStorageVolPtr vol)
Fetch the storage volume name. This is unique within the scope of a pool
- vol
- pointer to storage volume
- Returns
- the volume name, or NULL on error
virStorageVolGetPath
0.4.1
char * virStorageVolGetPath (virStorageVolPtr vol)
Fetch the storage volume path. Depending on the pool configuration this is either persistent across hosts, or dynamically assigned at pool startup. Consult pool documentation for information on getting the persistent naming
- vol
- pointer to storage volume
- Returns
- the storage volume path, or NULL on error. The caller must free() the returned path after use.
virStorageVolGetXMLDesc
0.4.1
char * virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags)
Fetch an XML document describing all aspects of the storage volume
- vol
- pointer to storage volume
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- the XML document, or NULL on error
virStorageVolLookupByKey
0.4.1
virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char * key)
Fetch a pointer to a storage volume based on its globally unique key
- conn
- pointer to hypervisor connection
- key
- globally unique key
- Returns
- a storage volume, or NULL if not found / error
virStorageVolLookupByName
0.4.1
virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char * name)
Fetch a pointer to a storage volume based on its name within a pool
- pool
- pointer to storage pool
- name
- name of storage volume
- Returns
- a storage volume, or NULL if not found / error
virStorageVolLookupByPath
0.4.1
virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char * path)
Fetch a pointer to a storage volume based on its locally (host) unique path
- conn
- pointer to hypervisor connection
- path
- locally unique path
- Returns
- a storage volume, or NULL if not found / error
virStorageVolRef
0.6.0
int virStorageVolRef (virStorageVolPtr vol)
Increment the reference count on the vol. For each additional call to this method, there shall be a corresponding call to virStorageVolFree to release the reference count, once the caller no longer needs the reference to this object.
This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a vol would increment the reference count.
- vol
- the vol to hold a reference on
- Returns
- 0 in case of success, -1 in case of failure.
virStorageVolResize
0.9.10
int virStorageVolResize (virStorageVolPtr vol, unsigned long long capacity, unsigned int flags)
Changes the capacity of the storage volume @vol to @capacity. The operation will fail if the new capacity requires allocation that would exceed the remaining free space in the parent pool. The contents of the new capacity will appear as all zero bytes.
Normally, the operation will attempt to affect capacity with a minimum impact on allocation (that is, the default operation favors a sparse resize). If @flags contains VIR_STORAGE_VOL_RESIZE_ALLOCATE, then the operation will ensure that allocation is sufficient for the new capacity; this may make the operation take noticeably longer.
Normally, the operation treats @capacity as the new size in bytes; but if @flags contains VIR_STORAGE_VOL_RESIZE_DELTA, then @capacity represents the size difference to add to the current size. It is up to the storage pool implementation whether unaligned requests are rounded up to the next valid boundary, or rejected.
Normally, this operation should only be used to enlarge capacity; but if @flags contains VIR_STORAGE_VOL_RESIZE_SHRINK, it is possible to attempt a reduction in capacity even though it might cause data loss. If VIR_STORAGE_VOL_RESIZE_DELTA is also present, then @capacity is subtracted from the current size; without it, @capacity represents the absolute new size regardless of whether it is larger or smaller than the current size.
- vol
- pointer to storage volume
- capacity
- new capacity, in bytes
- flags
- bitwise-OR of virStorageVolResizeFlags
- Returns
- 0 on success, or -1 on error.
virStorageVolUpload
0.9.0
int virStorageVolUpload (virStorageVolPtr vol, virStreamPtr stream, unsigned long long offset, unsigned long long length, unsigned int flags)
Upload new content to the volume from a stream. This call will fail if @offset + @length exceeds the size of the volume. Otherwise, if @length is non-zero, an error will be raised if an attempt is made to upload greater than @length bytes of data.
This call sets up an asynchronous stream; subsequent use of stream APIs is necessary to transfer the actual data, determine how much data is successfully transferred, and detect any errors. The results will be unpredictable if another active stream is writing to the storage volume.
- vol
- pointer to volume to upload
- stream
- stream to use as input
- offset
- position to start writing to
- length
- limit on amount of data to upload
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0, or -1 upon error.
virStorageVolWipe
0.8.0
int virStorageVolWipe (virStorageVolPtr vol, unsigned int flags)
Ensure data previously on a volume is not accessible to future reads
- vol
- pointer to storage volume
- flags
- extra flags; not used yet, so callers should always pass 0
- Returns
- 0 on success, or -1 on error
virStorageVolWipePattern
0.9.10
int virStorageVolWipePattern (virStorageVolPtr vol, unsigned int algorithm, unsigned int flags)
Similar to virStorageVolWipe, but one can choose between different wiping algorithms.
- vol
- pointer to storage volume
- algorithm
- one of virStorageVolWipeAlgorithm
- flags
- future flags, use 0 for now
- Returns
- 0 on success, or -1 on error.
virStreamAbort
0.7.2
int virStreamAbort (virStreamPtr stream)
Request that the in progress data transfer be cancelled abnormally before the end of the stream has been reached. For output streams this can be used to inform the driver that the stream is being terminated early. For input streams this can be used to inform the driver that it should stop sending data.
- stream
- pointer to the stream object
- Returns
- 0 on success, -1 upon error
virStreamEventAddCallback
0.7.2
int virStreamEventAddCallback (virStreamPtr stream, int events, virStreamEventCallback cb, void * opaque, virFreeCallback ff)
Register a callback to be notified when a stream becomes writable, or readable. This is most commonly used in conjunction with non-blocking data streams to integrate into an event loop
- stream
- pointer to the stream object
- events
- set of events to monitor
- cb
- callback to invoke when an event occurs
- opaque
- application defined data
- ff
- callback to free @opaque data
- Returns
- 0 on success, -1 upon error
virStreamEventCallback
0.7.2
typedef void (*virStreamEventCallback ) (virStreamPtr stream, int events, void * opaque)
Callback for receiving stream events. The callback will be invoked once for each event which is pending.
- stream
- stream on which the event occurred
- events
- bitset of events from virEventHandleType constants
- opaque
- user data registered with handle
virStreamEventRemoveCallback
0.7.2
int virStreamEventRemoveCallback (virStreamPtr stream)
Remove an event callback from the stream
- stream
- pointer to the stream object
- Returns
- 0 on success, -1 on error
virStreamEventUpdateCallback
0.7.2
int virStreamEventUpdateCallback (virStreamPtr stream, int events)
Changes the set of events to monitor for a stream. This allows for event notification to be changed without having to unregister & register the callback completely. This method is guaranteed to succeed if a callback is already registered
- stream
- pointer to the stream object
- events
- set of events to monitor
- Returns
- 0 on success, -1 if no callback is registered
virStreamFinish
0.7.2
int virStreamFinish (virStreamPtr stream)
Indicate that there is no further data is to be transmitted on the stream. For output streams this should be called once all data has been written. For input streams this should be called once virStreamRecv returns end-of-file.
This method is a synchronization point for all asynchronous errors, so if this returns a success code the application can be sure that all data has been successfully processed.
- stream
- pointer to the stream object
- Returns
- 0 on success, -1 upon error
virStreamFree
0.7.2
int virStreamFree (virStreamPtr stream)
Decrement the reference count on a stream, releasing the stream object if the reference count has hit zero.
There must not be an active data transfer in progress when releasing the stream. If a stream needs to be disposed of prior to end of stream being reached, then the virStreamAbort function should be called first.
- stream
- pointer to the stream object
- Returns
- 0 upon success, or -1 on error
virStreamNew
0.7.2
virStreamPtr virStreamNew (virConnectPtr conn, unsigned int flags)
Creates a new stream object which can be used to perform streamed I/O with other public API function.
When no longer needed, a stream object must be released with virStreamFree. If a data stream has been used, then the application must call virStreamFinish or virStreamAbort before free'ing to, in order to notify the driver of termination.
If a non-blocking data stream is required passed VIR_STREAM_NONBLOCK for flags, otherwise pass 0.
- conn
- pointer to the connection
- flags
- bitwise-OR of virStreamFlags
- Returns
- the new stream, or NULL upon error
virStreamRecv
0.7.2
int virStreamRecv (virStreamPtr stream, char * data, size_t nbytes)
Reads a series of bytes from the stream. This method may block the calling application for an arbitrary amount of time.
Errors are not guaranteed to be reported synchronously with the call, but may instead be delayed until a subsequent call.
An example using this with a hypothetical file download API looks like
virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_WRONLY, 0600)
virConnectDownloadFile(conn, "demo.iso", st);
while (1) { char buf[1024]; int got = virStreamRecv(st, buf, 1024); if (got < 0) break; if (got == 0) { virStreamFinish(st); break; } int offset = 0; while (offset < got) { int sent = write(fd, buf+offset, got-offset) if (sent < 0) { virStreamAbort(st); goto done; } offset += sent; } } if (virStreamFinish(st) < 0) ... report an error .... done: virStreamFree(st); close(fd);
- stream
- pointer to the stream object
- data
- buffer to read into from stream
- nbytes
- size of @data buffer
- Returns
- the number of bytes read, which may be less than requested. Returns 0 when the end of the stream is reached, at which time the caller should invoke virStreamFinish() to get confirmation of stream completion. Returns -1 upon error, at which time the stream will be marked as aborted, and the caller should now release the stream with virStreamFree. Returns -2 if there is no data pending to be read & the stream is marked as non-blocking.
virStreamRecvAll
0.7.2
int virStreamRecvAll (virStreamPtr stream, virStreamSinkFunc handler, void * opaque)
Receive the entire data stream, sending the data to the requested data sink. This is simply a convenient alternative to virStreamRecv, for apps that do blocking-I/o.
An example using this with a hypothetical file download API looks like
int mysink(virStreamPtr st, const char *buf, int nbytes, void *opaque) { int *fd = opaque;
return write(*fd, buf, nbytes); }
virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_WRONLY)
virConnectUploadFile(conn, st); if (virStreamRecvAll(st, mysink, &fd) < 0) { ...report an error ... goto done; } if (virStreamFinish(st) < 0) ...report an error... virStreamFree(st); close(fd);
- stream
- pointer to the stream object
- handler
- sink callback for writing data to application
- opaque
- application defined data
- Returns
- 0 if all the data was successfully received. The caller should invoke virStreamFinish(st) to flush the stream upon success and then virStreamFree Returns -1 upon any error, with virStreamAbort() already having been called, so the caller need only call virStreamFree()
virStreamRef
0.7.2
int virStreamRef (virStreamPtr stream)
Increment the reference count on the stream. For each additional call to this method, there shall be a corresponding call to virStreamFree to release the reference count, once the caller no longer needs the reference to this object.
- stream
- pointer to the stream
- Returns
- 0 in case of success, -1 in case of failure
virStreamSend
0.7.2
int virStreamSend (virStreamPtr stream, const char * data, size_t nbytes)
Write a series of bytes to the stream. This method may block the calling application for an arbitrary amount of time. Once an application has finished sending data it should call virStreamFinish to wait for successful confirmation from the driver, or detect any error.
This method may not be used if a stream source has been registered.
Errors are not guaranteed to be reported synchronously with the call, but may instead be delayed until a subsequent call.
An example using this with a hypothetical file upload API looks like
virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_RDONLY)
virConnectUploadFile(conn, "demo.iso", st);
while (1) { char buf[1024]; int got = read(fd, buf, 1024); if (got < 0) { virStreamAbort(st); break; } if (got == 0) { virStreamFinish(st); break; } int offset = 0; while (offset < got) { int sent = virStreamSend(st, buf+offset, got-offset) if (sent < 0) { virStreamAbort(st); goto done; } offset += sent; } } if (virStreamFinish(st) < 0) ... report an error .... done: virStreamFree(st); close(fd);
- stream
- pointer to the stream object
- data
- buffer to write to stream
- nbytes
- size of @data buffer
- Returns
- the number of bytes written, which may be less than requested. Returns -1 upon error, at which time the stream will be marked as aborted, and the caller should now release the stream with virStreamFree. Returns -2 if the outgoing transmit buffers are full & the stream is marked as non-blocking.
virStreamSendAll
0.7.2
int virStreamSendAll (virStreamPtr stream, virStreamSourceFunc handler, void * opaque)
Send the entire data stream, reading the data from the requested data source. This is simply a convenient alternative to virStreamSend, for apps that do blocking-I/o.
An example using this with a hypothetical file upload API looks like
int mysource(virStreamPtr st, char *buf, int nbytes, void *opaque) { int *fd = opaque;
return read(*fd, buf, nbytes); }
virStreamPtr st = virStreamNew(conn, 0); int fd = open("demo.iso", O_RDONLY)
virConnectUploadFile(conn, st); if (virStreamSendAll(st, mysource, &fd) < 0) { ...report an error ... goto done; } if (virStreamFinish(st) < 0) ...report an error... virStreamFree(st); close(fd);
- stream
- pointer to the stream object
- handler
- source callback for reading data from application
- opaque
- application defined data
- Returns
- 0 if all the data was successfully sent. The caller should invoke virStreamFinish(st) to flush the stream upon success and then virStreamFree Returns -1 upon any error, with virStreamAbort() already having been called, so the caller need only call virStreamFree()
virStreamSinkFunc
0.7.2
typedef int (*virStreamSinkFunc ) (virStreamPtr st, const char * data, size_t nbytes, void * opaque)
The virStreamSinkFunc callback is used together with the virStreamRecvAll function for libvirt to provide the data that has been received.
The callback will be invoked multiple times, providing data in small chunks. The application should consume up 'nbytes' from the 'data' array of data and then return the number actual number of bytes consumed. The callback will continue to be invoked until it indicates the end of the stream has been reached. A return value of -1 at any time will abort the receive operation
- st
- the stream object
- data
- preallocated array to be filled with data
- nbytes
- size of the data array
- opaque
- optional application provided data
- Returns
- the number of bytes consumed or -1 upon error
virStreamSourceFunc
0.7.2
typedef int (*virStreamSourceFunc ) (virStreamPtr st, char * data, size_t nbytes, void * opaque)
The virStreamSourceFunc callback is used together with the virStreamSendAll function for libvirt to obtain the data that is to be sent.
The callback will be invoked multiple times, fetching data in small chunks. The application should fill the 'data' array with up to 'nbytes' of data and then return the number actual number of bytes. The callback will continue to be invoked until it indicates the end of the source has been reached by returning 0. A return value of -1 at any time will abort the send operation
- st
- the stream object
- data
- preallocated array to be filled with data
- nbytes
- size of the data array
- opaque
- optional application provided data
- Returns
- the number of bytes filled, 0 upon end of file, or -1 upon error
virTypedParamsAddBoolean
1.0.2
int virTypedParamsAddBoolean (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, int value)
Adds new parameter called @name with boolean type and sets its value to @value. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- value
- the value to store into the new parameter
- Returns
- 0 on success, -1 on error.
virTypedParamsAddDouble
1.0.2
int virTypedParamsAddDouble (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, double value)
Adds new parameter called @name with double type and sets its value to @value. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- value
- the value to store into the new parameter
- Returns
- 0 on success, -1 on error.
virTypedParamsAddFromString
1.0.2
int virTypedParamsAddFromString (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, int type, const char * value)
Adds new parameter called @name with the requested @type and parses its value from the @value string. If the requested type is string, the function creates its own copy of the @value string, which needs to be freed using virTypedParamsFree or virTypedParamsClear. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- type
- type of the parameter
- value
- the value to store into the new parameter encoded as a string
- Returns
- 0 on success, -1 on error.
virTypedParamsAddInt
1.0.2
int virTypedParamsAddInt (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, int value)
Adds new parameter called @name with int type and sets its value to @value. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- value
- the value to store into the new parameter
- Returns
- 0 on success, -1 on error.
virTypedParamsAddLLong
1.0.2
int virTypedParamsAddLLong (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, long long value)
Adds new parameter called @name with long long int type and sets its value to @value. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- value
- the value to store into the new parameter
- Returns
- 0 on success, -1 on error.
virTypedParamsAddString
1.0.2
int virTypedParamsAddString (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, const char * value)
Adds new parameter called @name with char * type and sets its value to @value. The function creates its own copy of @value string, which needs to be freed using virTypedParamsFree or virTypedParamsClear. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- value
- the value to store into the new parameter
- Returns
- 0 on success, -1 on error.
virTypedParamsAddUInt
1.0.2
int virTypedParamsAddUInt (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, unsigned int value)
Adds new parameter called @name with unsigned int type and sets its value to @value. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- value
- the value to store into the new parameter
- Returns
- 0 on success, -1 on error.
virTypedParamsAddULLong
1.0.2
int virTypedParamsAddULLong (virTypedParameterPtr * params, int * nparams, int * maxparams, const char * name, unsigned long long value)
Adds new parameter called @name with unsigned long long type and sets its value to @value. If @params array points to NULL or to a space that is not large enough to accommodate the new parameter (@maxparams < @nparams + 1), the function allocates more space for it and updates @maxparams. On success, @nparams is incremented by one. The function fails with VIR_ERR_INVALID_ARG error if the parameter already exists in @params.
- params
- pointer to the array of typed parameters
- nparams
- number of parameters in the @params array
- maxparams
- maximum number of parameters that can be stored in @params array without allocating more memory
- name
- name of the parameter to find
- value
- the value to store into the new parameter
- Returns
- 0 on success, -1 on error.
virTypedParamsClear
1.0.2
void virTypedParamsClear (virTypedParameterPtr params, int nparams)
Frees all memory used by string parameters. The memory occupied by @params is not freed; use virTypedParamsFree if you want it to be freed too.
- params
- the array of typed parameters
- nparams
- number of parameters in the @params array
virTypedParamsFree
1.0.2
void virTypedParamsFree (virTypedParameterPtr params, int nparams)
Frees all memory used by string parameters and the memory occupied by @params.
- params
- the array of typed parameters
- nparams
- number of parameters in the @params array
virTypedParamsGet
1.0.2
virTypedParameterPtr virTypedParamsGet (virTypedParameterPtr params, int nparams, const char * name)
Finds typed parameter called @name.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- Returns
- pointer to the parameter or NULL if it does not exist in @params.
virTypedParamsGetBoolean
1.0.2
int virTypedParamsGetBoolean (virTypedParameterPtr params, int nparams, const char * name, int * value)
Finds typed parameter called @name and store its boolean value in @value. The function fails with VIR_ERR_INVALID_ARG error if the parameter does not have the expected type. By passing NULL as @value, the function may be used to check presence and type of the parameter.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- value
- where to store the parameter's value
- Returns
- 1 on success, 0 when the parameter does not exist in @params, or -1 on error.
virTypedParamsGetDouble
1.0.2
int virTypedParamsGetDouble (virTypedParameterPtr params, int nparams, const char * name, double * value)
Finds typed parameter called @name and store its double value in @value. The function fails with VIR_ERR_INVALID_ARG error if the parameter does not have the expected type. By passing NULL as @value, the function may be used to check presence and type of the parameter.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- value
- where to store the parameter's value
- Returns
- 1 on success, 0 when the parameter does not exist in @params, or -1 on error.
virTypedParamsGetInt
1.0.2
int virTypedParamsGetInt (virTypedParameterPtr params, int nparams, const char * name, int * value)
Finds typed parameter called @name and store its int value in @value. The function fails with VIR_ERR_INVALID_ARG error if the parameter does not have the expected type. By passing NULL as @value, the function may be used to check presence and type of the parameter.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- value
- where to store the parameter's value
- Returns
- 1 on success, 0 when the parameter does not exist in @params, or -1 on error.
virTypedParamsGetLLong
1.0.2
int virTypedParamsGetLLong (virTypedParameterPtr params, int nparams, const char * name, long long * value)
Finds typed parameter called @name and store its long long int value in @value. The function fails with VIR_ERR_INVALID_ARG error if the parameter does not have the expected type. By passing NULL as @value, the function may be used to check presence and type of the parameter.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- value
- where to store the parameter's value
- Returns
- 1 on success, 0 when the parameter does not exist in @params, or -1 on error.
virTypedParamsGetString
1.0.2
int virTypedParamsGetString (virTypedParameterPtr params, int nparams, const char * name, const char ** value)
Finds typed parameter called @name and store its char * value in @value. The function does not create a copy of the string and the caller must not free the string @value points to. The function fails with VIR_ERR_INVALID_ARG error if the parameter does not have the expected type. By passing NULL as @value, the function may be used to check presence and type of the parameter.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- value
- where to store the parameter's value
- Returns
- 1 on success, 0 when the parameter does not exist in @params, or -1 on error.
virTypedParamsGetUInt
1.0.2
int virTypedParamsGetUInt (virTypedParameterPtr params, int nparams, const char * name, unsigned int * value)
Finds typed parameter called @name and store its unsigned int value in @value. The function fails with VIR_ERR_INVALID_ARG error if the parameter does not have the expected type. By passing NULL as @value, the function may be used to check presence and type of the parameter.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- value
- where to store the parameter's value
- Returns
- 1 on success, 0 when the parameter does not exist in @params, or -1 on error.
virTypedParamsGetULLong
1.0.2
int virTypedParamsGetULLong (virTypedParameterPtr params, int nparams, const char * name, unsigned long long * value)
Finds typed parameter called @name and store its unsigned long long int value in @value. The function fails with VIR_ERR_INVALID_ARG error if the parameter does not have the expected type. By passing NULL as @value, the function may be used to check presence and type of the parameter.
- params
- array of typed parameters
- nparams
- number of parameters in the @params array
- name
- name of the parameter to find
- value
- where to store the parameter's value
- Returns
- 1 on success, 0 when the parameter does not exist in @params, or -1 on error.