libvirt: Module libvirt-host from libvirt
Description: libvirt, virtualization, virtualization API

# Module libvirt-host from libvirt

Provides APIs for the management of hosts

## Table of Contents

### Macros

    #define VIR_CONNECT_IDENTITY_GROUP_NAME
    #define VIR_CONNECT_IDENTITY_PROCESS_ID
    #define VIR_CONNECT_IDENTITY_PROCESS_TIME
    #define VIR_CONNECT_IDENTITY_SASL_USER_NAME
    #define VIR_CONNECT_IDENTITY_SELINUX_CONTEXT
    #define VIR_CONNECT_IDENTITY_UNIX_GROUP_ID
    #define VIR_CONNECT_IDENTITY_UNIX_USER_ID
    #define VIR_CONNECT_IDENTITY_USER_NAME
    #define VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME
    #define VIR_NODEINFO_MAXCPUS
    #define VIR_NODE_CPU_STATS_FIELD_LENGTH
    #define VIR_NODE_CPU_STATS_GUEST
    #define VIR_NODE_CPU_STATS_IDLE
    #define VIR_NODE_CPU_STATS_INTR
    #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_SHARED_FULL_SCANS
    #define VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES
    #define VIR_NODE_MEMORY_SHARED_PAGES_SHARED
    #define VIR_NODE_MEMORY_SHARED_PAGES_SHARING
    #define VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN
    #define VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED
    #define VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE
    #define VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS
    #define VIR_NODE_MEMORY_STATS_AVAILABLE
    #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_NODE_SEV_CBITPOS
    #define VIR_NODE_SEV_CERT_CHAIN
    #define VIR_NODE_SEV_CPU0_ID
    #define VIR_NODE_SEV_MAX_ES_GUESTS
    #define VIR_NODE_SEV_MAX_GUESTS
    #define VIR_NODE_SEV_PDH
    #define VIR_NODE_SEV_REDUCED_PHYS_BITS
    #define VIR_SECURITY_DOI_BUFLEN
    #define VIR_SECURITY_LABEL_BUFLEN
    #define VIR_SECURITY_MODEL_BUFLEN
    #define VIR_UUID_BUFLEN
    #define VIR_UUID_STRING_BUFLEN

### Types

    typedef enum virCPUCompareResult
    typedef struct _virConnect virConnect
    typedef struct _virConnectAuth virConnectAuth
    typedef virConnectAuth * virConnectAuthPtr
    typedef enum virConnectBaselineCPUFlags
    typedef enum virConnectCompareCPUFlags
    typedef struct _virConnectCredential virConnectCredential
    typedef virConnectCredential * virConnectCredentialPtr
    typedef enum virConnectCredentialType
    typedef enum virConnectFlags
    typedef virConnect * virConnectPtr
    typedef enum virNodeAllocPagesFlags
    typedef struct _virNodeCPUStats virNodeCPUStats
    typedef virNodeCPUStats * virNodeCPUStatsPtr
    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 _virSecurityLabel virSecurityLabel
    typedef virSecurityLabel * virSecurityLabelPtr
    typedef struct _virSecurityModel virSecurityModel
    typedef virSecurityModel * virSecurityModelPtr
    typedef struct _virStream virStream
    typedef virStream * virStreamPtr

### 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)
    char *	virConnectBaselineHypervisorCPU	(virConnectPtr conn,
    					 const char * emulator,
    					 const char * arch,
    					 const char * machine,
    					 const char * virttype,
    					 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)
    int	virConnectCompareHypervisorCPU	(virConnectPtr conn,
    					 const char * emulator,
    					 const char * arch,
    					 const char * machine,
    					 const char * virttype,
    					 const char * xmlCPU,
    					 unsigned int flags)
    int	virConnectGetCPUModelNames	(virConnectPtr conn,
    					 const char * arch,
    					 char *** models,
    					 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)
    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	virConnectSetIdentity		(virConnectPtr conn,
    					 virTypedParameterPtr params,
    					 int nparams,
    					 unsigned int flags)
    int	virConnectSetKeepAlive		(virConnectPtr conn,
    					 int interval,
    					 unsigned int count)
    int	virConnectUnregisterCloseCallback	(virConnectPtr conn,
    						 virConnectCloseFunc cb)
    int	virGetVersion			(unsigned long * libVer,
    					 const char * type,
    					 unsigned long * typeVer)
    int	virInitialize			(void)
    int	virNodeAllocPages		(virConnectPtr conn,
    					 unsigned int npages,
    					 unsigned int * pageSizes,
    					 unsigned long long * pageCounts,
    					 int startCell,
    					 unsigned int cellCount,
    					 unsigned int flags)
    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	virNodeGetFreePages		(virConnectPtr conn,
    					 unsigned int npages,
    					 unsigned int * pages,
    					 int startCell,
    					 unsigned int cellCount,
    					 unsigned long long * counts,
    					 unsigned int flags)
    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	virNodeGetSEVInfo		(virConnectPtr conn,
    					 virTypedParameterPtr * params,
    					 int * nparams,
    					 unsigned int flags)
    int	virNodeGetSecurityModel		(virConnectPtr conn,
    					 virSecurityModelPtr secmodel)
    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)

## Description

### Macros

### `VIR_CONNECT_IDENTITY_GROUP_NAME`

    #define VIR_CONNECT_IDENTITY_GROUP_NAME

The operating system group name as VIR_TYPED_PARAM_STRING.

### `VIR_CONNECT_IDENTITY_PROCESS_ID`

    #define VIR_CONNECT_IDENTITY_PROCESS_ID

The operating system process ID as VIR_TYPED_PARAM_LLONG.

### `VIR_CONNECT_IDENTITY_PROCESS_TIME`

    #define VIR_CONNECT_IDENTITY_PROCESS_TIME

The operating system process start time as VIR_TYPED_PARAM_ULLONG. The units the time is measured in vary according to the host operating system. On Linux this is usually clock ticks (as reported in /proc/$PID/stat field 22).

### `VIR_CONNECT_IDENTITY_SASL_USER_NAME`

    #define VIR_CONNECT_IDENTITY_SASL_USER_NAME

The SASL authenticated username as VIR_TYPED_PARAM_STRING

### `VIR_CONNECT_IDENTITY_SELINUX_CONTEXT`

    #define VIR_CONNECT_IDENTITY_SELINUX_CONTEXT

The application's SELinux context as VIR_TYPED_PARAM_STRING.

### `VIR_CONNECT_IDENTITY_UNIX_GROUP_ID`

    #define VIR_CONNECT_IDENTITY_UNIX_GROUP_ID

The UNIX group ID as VIR_TYPED_PARAM_ULLONG.

### `VIR_CONNECT_IDENTITY_UNIX_USER_ID`

    #define VIR_CONNECT_IDENTITY_UNIX_USER_ID

The UNIX user ID as VIR_TYPED_PARAM_ULLONG.

### `VIR_CONNECT_IDENTITY_USER_NAME`

    #define VIR_CONNECT_IDENTITY_USER_NAME

The operating system user name as VIR_TYPED_PARAM_STRING.

### `VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME`

    #define VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME

The TLS x509 certificate distinguished named as VIR_TYPED_PARAM_STRING

### `VIR_NODEINFO_MAXCPUS`

    #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`

    #define VIR_NODE_CPU_STATS_FIELD_LENGTH

Macro providing the field length of virNodeCPUStats

### `VIR_NODE_CPU_STATS_GUEST`

    #define VIR_NODE_CPU_STATS_GUEST

The cumulative CPU time spent running guest virtual CPUs, since the node booting up (in nanoseconds).

### `VIR_NODE_CPU_STATS_IDLE`

    #define VIR_NODE_CPU_STATS_IDLE

The cumulative idle CPU time, since the node booting up (in nanoseconds).

### `VIR_NODE_CPU_STATS_INTR`

    #define VIR_NODE_CPU_STATS_INTR

The cumulative interrupt CPU time, since the node booting up (in nanoseconds).

### `VIR_NODE_CPU_STATS_IOWAIT`

    #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`

    #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`

    #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`

    #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_SHARED_FULL_SCANS`

    #define VIR_NODE_MEMORY_SHARED_FULL_SCANS

Macro for typed parameter that represents how many times all mergeable areas have been scanned.

### `VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES`

    #define VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES

Macro for typed parameter that represents whether pages from different NUMA nodes can be merged. The parameter has type int, when its value is 0, only pages which physically reside in the memory area of same NUMA node are merged; When its value is 1, pages from all nodes can be merged. Other values are reserved for future use.

### `VIR_NODE_MEMORY_SHARED_PAGES_SHARED`

    #define VIR_NODE_MEMORY_SHARED_PAGES_SHARED

Macro for typed parameter that represents how many the shared memory pages are being used.

### `VIR_NODE_MEMORY_SHARED_PAGES_SHARING`

    #define VIR_NODE_MEMORY_SHARED_PAGES_SHARING

Macro for typed parameter that represents how many sites are sharing the pages i.e. how much saved.

### `VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN`

    #define VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN

Macro for typed parameter that represents how many present pages to scan before the shared memory service goes to sleep.

### `VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED`

    #define VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED

Macro for typed parameter that represents how many pages unique but repeatedly checked for merging.

### `VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE`

    #define VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE

Macro for typed parameter that represents how many pages changing too fast to be placed in a tree.

### `VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS`

    #define VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS

Macro for typed parameter that represents how many milliseconds the shared memory service should sleep before next scan.

### `VIR_NODE_MEMORY_STATS_AVAILABLE`

    #define VIR_NODE_MEMORY_STATS_AVAILABLE

Macro for the available memory: On Linux, it is only returned in case of VIR_NODE_MEMORY_STATS_ALL_CELLS.

### `VIR_NODE_MEMORY_STATS_BUFFERS`

    #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`

    #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`

    #define VIR_NODE_MEMORY_STATS_FIELD_LENGTH

Macro providing the field length of virNodeMemoryStats

### `VIR_NODE_MEMORY_STATS_FREE`

    #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`

    #define VIR_NODE_MEMORY_STATS_TOTAL

Macro for the total memory of specified cell: it represents the maximum memory.

### `VIR_NODE_SEV_CBITPOS`

    #define VIR_NODE_SEV_CBITPOS

Macro represents the CBit Position used by hypervisor when SEV is enabled.

### `VIR_NODE_SEV_CERT_CHAIN`

    #define VIR_NODE_SEV_CERT_CHAIN

Macro represents the platform certificate chain that includes the platform endorsement key (PEK), owner certificate authority (OCD) and chip endorsement key (CEK), as VIR_TYPED_PARAMS_STRING.

### `VIR_NODE_SEV_CPU0_ID`

    #define VIR_NODE_SEV_CPU0_ID

Macro represents the unique ID of CPU0 (socket 0) needed to retrieve the signed CEK of the CPU from AMD's Key Distribution Service (KDS), as VIR_TYPED_PARAMS_STRING.

### `VIR_NODE_SEV_MAX_ES_GUESTS`

    #define VIR_NODE_SEV_MAX_ES_GUESTS

Macro represents the number of SEV-ES guests that can be run on the host, as a VIR_TYPED_PARAM_UINT.

### `VIR_NODE_SEV_MAX_GUESTS`

    #define VIR_NODE_SEV_MAX_GUESTS

Macro represents the number of SEV guests that can be run on the host, as a VIR_TYPED_PARAM_UINT.

### `VIR_NODE_SEV_PDH`

    #define VIR_NODE_SEV_PDH

Macro represents the Platform Diffie-Hellman key, as VIR_TYPED_PARAMS_STRING.

### `VIR_NODE_SEV_REDUCED_PHYS_BITS`

    #define VIR_NODE_SEV_REDUCED_PHYS_BITS

Macro represents the number of bits we lose in physical address space when SEV is enabled in the guest.

### `VIR_SECURITY_DOI_BUFLEN`

    #define VIR_SECURITY_DOI_BUFLEN

Macro providing the maximum length of the virSecurityModel doi string.

### `VIR_SECURITY_LABEL_BUFLEN`

    #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`

    #define VIR_SECURITY_MODEL_BUFLEN

Macro providing the maximum length of the virSecurityModel model string.

### `VIR_UUID_BUFLEN`

    #define VIR_UUID_BUFLEN

This macro provides the length of the buffer required for virDomainGetUUID()

### `VIR_UUID_STRING_BUFLEN`

    #define VIR_UUID_STRING_BUFLEN

This macro provides the length of the buffer required for virDomainGetUUIDString()

### Types

### `virCPUCompareResult`

    enum virCPUCompareResult {

VIR_CPU_COMPARE_ERROR | = | -1 (-0x1) |
VIR_CPU_COMPARE_INCOMPATIBLE | = | 0 (0x0) |
VIR_CPU_COMPARE_IDENTICAL | = | 1 (0x1) |
VIR_CPU_COMPARE_SUPERSET | = | 2 (0x2) |
VIR_CPU_COMPARE_LAST | = | 3 (0x3) |

    }

### `virConnect`

    struct virConnect {

The content of this structure is not made public by the API

    }

### `virConnectAuth`

    struct virConnectAuth {

int * | credtype | List of supported virConnectCredentialType values
unsigned int | ncredtype |
virConnectAuthCallbackPtr | cb | Callback used to collect credentials
void * | cbdata |

    }

### `virConnectAuthPtr`

    typedef virConnectAuth * virConnectAuthPtr;

### `virConnectBaselineCPUFlags`

Flags when getting XML description of a computed CPU

    enum virConnectBaselineCPUFlags {

VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | = | 1 (0x1; 1 << 0) | show all features
VIR_CONNECT_BASELINE_CPU_MIGRATABLE | = | 2 (0x2; 1 << 1) | filter out non-migratable features
VIR_CONNECT_BASELINE_CPU_IGNORE_HOST | = | 4 (0x4; 1 << 2) | when computing a baseline from several CPUs, do not make the result dependent on the current host

    }

### `virConnectCompareCPUFlags`

    enum virConnectCompareCPUFlags {

VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE | = | 1 (0x1; 1 << 0) | treat incompatible CPUs as failure
VIR_CONNECT_COMPARE_CPU_VALIDATE_XML | = | 2 (0x2; 1 << 1) | validate the xml document

    }

### `virConnectCredential`

    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

    }

### `virConnectCredentialPtr`

    typedef virConnectCredential * virConnectCredentialPtr;

### `virConnectCredentialType`

    enum virConnectCredentialType {

VIR_CRED_USERNAME | = | 1 (0x1) | Identity to act as
VIR_CRED_AUTHNAME | = | 2 (0x2) | Identify to authorize as
VIR_CRED_LANGUAGE | = | 3 (0x3) | RFC 1766 languages, comma separated
VIR_CRED_CNONCE | = | 4 (0x4) | client supplies a nonce
VIR_CRED_PASSPHRASE | = | 5 (0x5) | Passphrase secret
VIR_CRED_ECHOPROMPT | = | 6 (0x6) | Challenge response
VIR_CRED_NOECHOPROMPT | = | 7 (0x7) | Challenge response
VIR_CRED_REALM | = | 8 (0x8) | Authentication realm
VIR_CRED_EXTERNAL | = | 9 (0x9) | Externally managed credential
VIR_CRED_LAST | = | 10 (0xa) | More may be added - expect the unexpected

    }

### `virConnectFlags`

Flags when opening a connection to a hypervisor

    enum virConnectFlags {

VIR_CONNECT_RO | = | 1 (0x1; 1 << 0) | A readonly connection
VIR_CONNECT_NO_ALIASES | = | 2 (0x2; 1 << 1) | Don't try to resolve URI aliases

    }

### `virConnectPtr`

    typedef virConnect * virConnectPtr;

a virConnectPtr is pointer to a virConnect private structure, this is the type used to reference a connection to the Hypervisor in the API.

### `virNodeAllocPagesFlags`

    enum virNodeAllocPagesFlags {

VIR_NODE_ALLOC_PAGES_ADD | = | 0 (0x0) | Add `pageCounts` to the pages pool. This can be used only to size up the pool.
VIR_NODE_ALLOC_PAGES_SET | = | 1 (0x1; 1 << 0) | Don't add `pageCounts`, instead set passed number of pages. This can be used to free allocated pages.

    }

### `virNodeCPUStats`

    struct virNodeCPUStats {

char field[VIR_NODE_CPU_STATS_FIELD_LENGTH] | field |
unsigned long long | value |

    }

### `virNodeCPUStatsPtr`

    typedef virNodeCPUStats * virNodeCPUStatsPtr;

a virNodeCPUStatsPtr is a pointer to a virNodeCPUStats structure.

### `virNodeGetCPUStatsAllCPUs`

Value for specifying request for the total CPU time/utilization

    enum virNodeGetCPUStatsAllCPUs {

VIR_NODE_CPU_STATS_ALL_CPUS | = | -1 (-0x1) |

    }

### `virNodeGetMemoryStatsAllCells`

Value for specifying request for the total memory of all cells.

    enum virNodeGetMemoryStatsAllCells {

VIR_NODE_MEMORY_STATS_ALL_CELLS | = | -1 (-0x1) |

    }

### `virNodeInfo`

    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, 0 if not known or on unusual architectures
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 topology
unsigned int | threads | number of threads per core, 1 in case of unusual numa topology

    }

### `virNodeInfoPtr`

    typedef virNodeInfo * virNodeInfoPtr;

a virNodeInfoPtr is a pointer to a virNodeInfo structure.

### `virNodeMemoryStats`

    struct virNodeMemoryStats {

char field[VIR_NODE_MEMORY_STATS_FIELD_LENGTH] | field |
unsigned long long | value |

    }

### `virNodeMemoryStatsPtr`

    typedef virNodeMemoryStats * virNodeMemoryStatsPtr;

a virNodeMemoryStatsPtr is a pointer to a virNodeMemoryStats structure.

### `virNodeSuspendTarget`

Flags to indicate which system-wide sleep state the host must be transitioned to.

    enum virNodeSuspendTarget {

VIR_NODE_SUSPEND_TARGET_MEM | = | 0 (0x0) |
VIR_NODE_SUSPEND_TARGET_DISK | = | 1 (0x1) |
VIR_NODE_SUSPEND_TARGET_HYBRID | = | 2 (0x2) |
VIR_NODE_SUSPEND_TARGET_LAST | = | 3 (0x3) | This constant is subject to change

    }

### `virSecurityLabel`

    struct virSecurityLabel {

char label[VIR_SECURITY_LABEL_BUFLEN] | label | security label string
int | enforcing | 1 if security policy is being enforced for domain

    }

### `virSecurityLabelPtr`

    typedef virSecurityLabel * virSecurityLabelPtr;

a virSecurityLabelPtr is a pointer to a virSecurityLabel.

### `virSecurityModel`

    struct virSecurityModel {

char model[VIR_SECURITY_MODEL_BUFLEN] | model | security model string
char doi[VIR_SECURITY_DOI_BUFLEN] | doi | domain of interpretation

    }

### `virSecurityModelPtr`

    typedef virSecurityModel * virSecurityModelPtr;

a virSecurityModelPtr is a pointer to a virSecurityModel.

### `virStream`

    struct virStream {

The content of this structure is not made public by the API

    }

### `virStreamPtr`

    typedef virStream * virStreamPtr;

a virStreamPtr is pointer to a virStream private structure, this is the type used to reference a data stream in the API.

### Functions

### `virConnectAuthCallbackPtr`

    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`

    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.

See virConnectBaselineHypervisorCPU() to get a CPU which can be provided by the hypervisor.

If `flags` includes VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES then libvirt will explicitly list all CPU features that are part of the host CPU, without this flag features that are part of the CPU model will not be listed.

If `flags` includes VIR_CONNECT_BASELINE_CPU_MIGRATABLE, the resulting CPU will not include features that block migration.

conn
  virConnect connection
xmlCPUs
  array of XML descriptions of host CPUs
ncpus
  number of CPUs in xmlCPUs
flags
  bitwise-OR of virConnectBaselineCPUFlags
Returns
  XML description of the computed CPU (caller frees) or NULL on error.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virConnectBaselineHypervisorCPU`

    char *	virConnectBaselineHypervisorCPU	(virConnectPtr conn,
    					 const char * emulator,
    					 const char * arch,
    					 const char * machine,
    					 const char * virttype,
    					 const char ** xmlCPUs,
    					 unsigned int ncpus,
    					 unsigned int flags)

Computes the most feature-rich CPU which is compatible with all given CPUs. This API must be called on one of the hosts specified in `xmlCPUs`. Calling it on another host results in an undefined behavior as the computed CPU model is influenced by the hypervisor (the result may use an unexpected CPU model or some features may disabled even though they are supported on all input CPUs). The undefined behavior can be avoided using VIR_CONNECT_BASELINE_CPU_IGNORE_HOST flag (see below).

This is different from virConnectBaselineCPU() which doesn't consider any hypervisor abilities when computing the best CPU.

The `xmlCPUs` array should contain guest CPU definitions created from the host CPU model description as advertised by virConnectGetDomainCapabilities() in <mode name="host-model"> element. Any of `emulator`, `arch`, `machine`, and `virttype` parameters may be NULL; libvirt will choose sensible defaults tailored to the host and its current configuration.

If `ncpus` == 1, the result will be the first (and only) CPU in `xmlCPUs` tailored to what the hypervisor can support on the current host. Specifically if this single CPU definition contains no feature elements and a CPU model listed as usable='no' in domain capabilities XML, the result will contain a list usability blockers, i.e., a list of features that would need to be disabled for the model to be usable on this host. This list may contain more features than what the hypervisor reports as blockers in case the CPU model definition in libvirt differs from QEMU definition.

If `flags` includes VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES then libvirt will explicitly list all CPU features that are part of the computed CPU, without this flag features that are part of the CPU model will not be listed.

If `flags` includes VIR_CONNECT_BASELINE_CPU_MIGRATABLE, the resulting CPU will not include features that block migration.

If `flags` contains VIR_CONNECT_BASELINE_CPU_IGNORE_HOST and `ncpus` > 1, the API will not consider hypervisor abilities when computing the baseline. With this flag baseline can be safely computed on any host (even those not described in `xmlCPUs`).

conn
  pointer to the hypervisor connection
emulator
  path to the emulator binary
arch
  CPU architecture
machine
  machine type
virttype
  virtualization type
xmlCPUs
  array of XML descriptions of CPUs
ncpus
  number of CPUs in xmlCPUs
flags
  bitwise-OR of virConnectBaselineCPUFlags
Returns
  XML description of the computed CPU (caller frees) or NULL on error.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | write | -

### `virConnectClose`

    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`

    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`

    int	virConnectCompareCPU		(virConnectPtr conn,
    					 const char * xmlDesc,
    					 unsigned int flags)

Compares the given CPU description with the host CPU.

See virConnectCompareHypervisorCPU() if you want to consider hypervisor abilities and compare the CPU to the CPU which a hypervisor is able to provide on the host.

conn
  virConnect connection
xmlDesc
  XML describing the CPU to compare with host CPU
flags
  bitwise-OR of virConnectCompareCPUFlags
Returns
  comparison result according to enum virCPUCompareResult. If VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE is used and `xmlDesc` CPU is incompatible with host CPU, this function will return VIR_CPU_COMPARE_ERROR (instead of VIR_CPU_COMPARE_INCOMPATIBLE) and the error will use the VIR_ERR_CPU_INCOMPATIBLE code with a message providing more details about the incompatibility.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virConnectCompareHypervisorCPU`

    int	virConnectCompareHypervisorCPU	(virConnectPtr conn,
    					 const char * emulator,
    					 const char * arch,
    					 const char * machine,
    					 const char * virttype,
    					 const char * xmlCPU,
    					 unsigned int flags)

Compares the given CPU description with the CPU the specified hypervisor is able to provide on the host. Any of `emulator`, `arch`, `machine`, and `virttype` parameters may be NULL; libvirt will choose sensible defaults tailored to the host and its current configuration.

This is different from virConnectCompareCPU() which compares the CPU definition with the host CPU without considering any specific hypervisor and its abilities.

conn
  pointer to the hypervisor connection
emulator
  path to the emulator binary
arch
  CPU architecture
machine
  machine type
virttype
  virtualization type
xmlCPU
  XML describing the CPU to be compared
flags
  bitwise-OR of virConnectCompareCPUFlags
Returns
  comparison result according to enum virCPUCompareResult. If VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE is used and `xmlCPU` is incompatible with the CPU the specified hypervisor is able to provide on the host, this function will return VIR_CPU_COMPARE_ERROR (instead of VIR_CPU_COMPARE_INCOMPATIBLE) and the error will use the VIR_ERR_CPU_INCOMPATIBLE code with a message providing more details about the incompatibility.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | write | -

### `virConnectGetCPUModelNames`

    int	virConnectGetCPUModelNames	(virConnectPtr conn,
    					 const char * arch,
    					 char *** models,
    					 unsigned int flags)

Get the list of CPU models supported by libvirt for a specific architecture.

The returned list limits CPU models usable with libvirt (empty list means there's no limit imposed by libvirt) and it does not reflect capabilities of any particular hypervisor. See the XML returned by virConnectGetDomainCapabilities() for a list of CPU models supported by libvirt for domains created on a specific hypervisor.

conn
  virConnect connection
arch
  Architecture
models
  Pointer to a variable to store the NULL-terminated array of the CPU models supported for the specified architecture. Each element and the array itself must be freed by the caller with free. Pass NULL if only the list length is needed.
flags
  extra flags; not used yet, so callers should always pass 0.
Returns
  -1 on error, number of elements in `models` on success (0 means libvirt accepts any CPU model).

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virConnectGetCapabilities`

    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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virConnectGetHostname`

    char *	virConnectGetHostname		(virConnectPtr conn)

This returns a system hostname on which the hypervisor is running (based on the result of the gethostname system call, but possibly expanded to a fully-qualified domain name via getaddrinfo). 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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virConnectGetLibVersion`

    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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virConnectGetMaxVcpus`

    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. This API doesn't take emulator limits into consideration, hence the returned value is not guaranteed to be usable. It is recommended to use virConnectGetDomainCapabilities() and look for "<vcpu max='...'>" in its output instead.

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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virConnectGetSysinfo`

    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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virConnectGetType`

    const char *	virConnectGetType	(virConnectPtr conn)

Get the name of the Hypervisor driver used. This is merely the driver name; for example, both KVM and QEMU guests are serviced by the driver for the qemu:// URI, so a return of "QEMU" does not indicate whether KVM acceleration is present. For more details about the hypervisor, use virConnectGetCapabilities().

conn
  pointer to the hypervisor connection
Returns
  NULL in case of error, a static zero terminated string otherwise.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virConnectGetURI`

    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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virConnectGetVersion`

    int	virConnectGetVersion		(virConnectPtr conn,
    					 unsigned long * hvVer)

Get the version level of the Hypervisor running.

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

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virConnectIsAlive`

    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`

    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`

    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

### `virConnectOpen`

    virConnectPtr	virConnectOpen		(const char * name)

This function should be called first to get a connection to the Hypervisor and xen store

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 https://libvirt.org/uri.html

virConnectClose should be used to release the resources after the connection is no longer needed.

name
  (optional) URI of the hypervisor
Returns
  a pointer to the hypervisor connection or NULL in case of error

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virConnectOpenAuth`

    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 and freeing the connection resources

URIs are documented at https://libvirt.org/uri.html

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

### `virConnectOpenReadOnly`

    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 and freeing the connection resources

URIs are documented at https://libvirt.org/uri.html

name
  (optional) URI of the hypervisor
Returns
  a pointer to the hypervisor connection or NULL in case of error

### `virConnectRef`

    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`

    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

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virConnectSetIdentity`

    int	virConnectSetIdentity		(virConnectPtr conn,
    					 virTypedParameterPtr params,
    					 int nparams,
    					 unsigned int flags)

Override the default identity information associated with the connection. When connecting to a stateful driver over a UNIX socket, the daemon will interrogate the remote end of the UNIX socket to acquire the application's identity. This identity is used for the fine grained access control checks on API calls.

There may be times when application is operating on behalf of a variety of users, and thus the identity that the application runs as is not appropriate for access control checks. In this case, if the application is considered trustworthy, it can supply alternative identity information.

The driver may reject the request to change the identity on a connection if the application is not trustworthy.

conn
  pointer to the hypervisor connection
params
  parameters containing the identity attributes
nparams
  size of `params` array
flags
  currently unused, pass 0
Returns
  0 if the identity change was accepted, -1 on error

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | write | -

### `virConnectSetKeepAlive`

    int	virConnectSetKeepAlive		(virConnectPtr conn,
    					 int interval,
    					 unsigned int count)

Start sending keepalive messages after `interval` seconds 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: The client has to implement and run an event loop with virEventRegisterImpl() or virEventRegisterDefaultImpl() 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`

    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

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | getattr | -

### `virGetVersion`

    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.

This function includes a call to virInitialize() when necessary.

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`

    int	virInitialize			(void)

Initialize the library.

This method is invoked automatically by any of the virConnectOpen() API calls, and by virGetVersion(). 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; but applications using an older version of the library should manually call this before setting up competing threads that attempt virConnectOpen in parallel.

The only other time it would be necessary to call virInitialize is if the application did not invoke virConnectOpen as its first API call, such as when calling virEventRegisterImpl() before setting up connections, or when using virSetErrorFunc() to alter error reporting of the first connection attempt.

Returns
  0 in case of success, -1 in case of error

### `virNodeAllocPages`

    int	virNodeAllocPages		(virConnectPtr conn,
    					 unsigned int npages,
    					 unsigned int * pageSizes,
    					 unsigned long long * pageCounts,
    					 int startCell,
    					 unsigned int cellCount,
    					 unsigned int flags)

Sometimes, when trying to start a new domain, it may be necessary to reserve some huge pages in the system pool which can be then allocated by the domain. This API serves that purpose. On its input, `pageSizes` and `pageCounts` are arrays of the same cardinality of `npages`. The `pageSizes` contains page sizes which are to be allocated in the system (the size unit is kibibytes), and `pageCounts` then contains the number of pages to reserve. If `flags` is 0 (VIR_NODE_ALLOC_PAGES_ADD), each pool corresponding to `pageSizes` grows by the number of pages specified in the corresponding `pageCounts`. If `flags` contains VIR_NODE_ALLOC_PAGES_SET, each pool mentioned is resized to the given number of pages. The pages pool can be allocated over several NUMA nodes at once, just point at `startCell` and tell how many subsequent NUMA nodes should be taken in. As a special case, if `startCell` is equal to negative one, then kernel is instructed to allocate the pages over all NUMA nodes proportionally.

conn
  pointer to the hypervisor connection
npages
  number of items in the `pageSizes` and `pageCounts` arrays
pageSizes
  which huge page sizes to allocate
pageCounts
  how many pages should be allocated
startCell
  index of first cell to allocate pages on
cellCount
  number of consecutive cells to allocate pages on
flags
  extra flags; binary-OR of virNodeAllocPagesFlags
Returns
  the number of nodes successfully adjusted or -1 in case of an error.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | write | -

### `virNodeGetCPUMap`

    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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetCPUStats`

    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(`sizeofvirNodeCPUStats` * `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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetCellsFreeMemory`

    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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetFreeMemory`

    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

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetFreePages`

    int	virNodeGetFreePages		(virConnectPtr conn,
    					 unsigned int npages,
    					 unsigned int * pages,
    					 int startCell,
    					 unsigned int cellCount,
    					 unsigned long long * counts,
    					 unsigned int flags)

This calls queries the host system on free pages of specified size. For the input, `pages` is expected to be filled with pages that caller is interested in (the size unit is kibibytes, so e.g. pass 2048 for 2MB), then `startcell` refers to the first NUMA node that info should be collected from, and `cellcount` tells how many consecutive nodes should be queried. On the function output, `counts` is filled with desired information, where items are grouped by NUMA node. So from `counts[0]` till `counts[npages`s - 1] you'll find count for the first node (`startcell`), then from `counts[npages]`] till `count[2` * `npages` - 1] you'll find info for the (`startcell` + 1) node, and so on. It's callers responsibility to allocate the `counts` array.

Example how to use this API:

    unsigned int pages[] = { 4, 2048, 1048576}
    unsigned int npages = G_N_ELEMENTS(pages);
    int startcell = 0;
    unsigned int cellcount = 2;

    unsigned long long counts = malloc(sizeof(long long) * npages * cellcount);

    virNodeGetFreePages(conn, pages, npages,
                        startcell, cellcount, counts, 0);

    for (i = 0 ; i < cellcount ; i++) {
        fprintf(stdout, "Cell %d\n", startcell + i);
        for (j = 0 ; j < npages ; j++) {
           fprintf(stdout, "  Page size=%d count=%d bytes=%llu\n",
                   pages[j], counts[(i * npages) +  j],
                   pages[j] * counts[(i * npages) +  j]);
        }
    }

    This little code snippet will produce something like this:
    Cell 0
     Page size=4096 count=300 bytes=1228800
     Page size=2097152 count=0 bytes=0
     Page size=1073741824 count=1 bytes=1073741824
    Cell 1
     Page size=4096 count=0 bytes=0
     Page size=2097152 count=20 bytes=41943040
     Page size=1073741824 count=0 bytes=0

conn
  pointer to the hypervisor connection
npages
  number of items in the `pages` array
pages
  page sizes to query
startCell
  index of first cell to return free pages info on.
cellCount
  maximum number of cells for which free pages information can be returned.
counts
  returned counts of free pages
flags
  extra flags; not used yet, so callers should always pass 0
Returns
  the number of entries filled in `counts` or -1 in case of error.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetInfo`

    int	virNodeGetInfo			(virConnectPtr conn,
    					 virNodeInfoPtr info)

Extract hardware information about the node.

Use of this API is strongly discouraged as the information provided is not guaranteed to be accurate on all hardware platforms.

The CPU frequency value (field 'mhz' in virNodeInfo) merely reflects the speed that the first CPU in the machine is currently running at. This speed may vary across CPUs and changes continually as the host OS throttles.

The virNodeInfo structure is not extensible thus only supports global nodes/sockets/cores/threads (sockets/cores/threads is per NUMA node) topology information. If the host CPU has any further groupings (e.g. dies, clusters, etc) or the NUMA topology is non-symmetrical the structure can't faithfully represent the system. In such cases a fake topology (nodes = 1, sockets = 1, cores = number of host cpus, threads = 1) which only correctly represents the total host CPU count is reported.

Applications are recommended to use the virConnectGetCapabilities() call instead, which provides all the information except CPU frequency, in a more accurate representation.

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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetMemoryParameters`

    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(`sizeofvirTypedParameter` * `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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetMemoryStats`

    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 memory 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(`sizeofvirNodeMemoryStats` * `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, cellNum, 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) VIR_NODE_MEMORY_STATS_AVAILABLE: The available 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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeGetSEVInfo`

    int	virNodeGetSEVInfo		(virConnectPtr conn,
    					 virTypedParameterPtr * params,
    					 int * nparams,
    					 unsigned int flags)

If hypervisor supports AMD's SEV feature, then `params` will contain various platform specific information like PDH and certificate chain. Caller is responsible for freeing `params`.

conn
  pointer to the hypervisor connection
params
  where to store SEV information
nparams
  pointer to number of SEV parameters returned 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.

### `virNodeGetSecurityModel`

    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

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | read | -

### `virNodeSetMemoryParameters`

    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.

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | write | -

### `virNodeSuspendForDuration`

    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).

##### Access control parameter checks

Object | Permission | Condition
--- | --- | ---
connect | pm-control | -