core interfaces for the libvirt library Provides the interfaces of the libvirt library to handle Xen domains from a process running in domain 0 Daniel Veillard <veillard@redhat.com> error handling interfaces for the libvirt library Provides the interfaces of the libvirt library to handle errors raised while using the library. Daniel Veillard <veillard@redhat.com> Macro providing the version of the library as version * 1,000,000 + minor * 1000 + micro This macro is to be used in conjonction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_COPY_CPUMAP macro extract the cpumap of the specified vcpu from cpumaps array and copy it into cpumap to be used later by virDomainPinVcpu() API. This macro is to be used in conjonction with virDomainPinVcpu() API. It returns the length (in bytes) required to store the complete CPU map between a single virtual & all physical CPUs of a domain. This macro is to be used in conjonction with virDomainGetVcpus() API. VIR_CPU_USABLE macro returns a non zero value (true) if the cpu is usable by the vcpu, and 0 otherwise. Macro providing the field length of virSchedParameter This macro is to be used in conjonction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_GET_CPUMAP macro returns a pointer to the cpumap of the specified vcpu from cpumaps array. This macro is to calculate the total number of CPUs supported but not neccessarily active in the host. This macro is to be used in conjonction with virDomainPinVcpu() API. USE_CPU macro reset the bit (CPU not usable) of the related cpu in cpumap. This macro is to be used in conjonction with virDomainPinVcpu() API. USE_CPU macro set the bit (CPU usable) of the related cpu in cpumap. This macro provides the length of the buffer required for virDomainGetUUID() This macro provides the length of the buffer required for virDomainGetUUIDString() a virConnectPtr is pointer to a virConnect private structure, this is the type used to reference a connection to the Xen Hypervisor in the API. a virDomainInfoPtr is a pointer to a virDomainInfo structure. a virDomainPtr is pointer to a virDomain private structure, this is the type used to reference a Xen domain in the API. a virNetworkPtr is pointer to a virNetwork private structure, this is the type used to reference a virtual network in the API. a virNodeInfoPtr is a pointer to a virNodeInfo structure. a virSchedParameterPtr is a pointer to a virSchedParameter structure. Copy the content of the last error caught on that connection One will need to free the result with virResetError() Provide a pointer to the last error caught on that connection Simpler but may not be suitable for multithreaded accesses, in which case use virConnCopyLastError() Reset the last error caught on that connection Set a connection error handling function, if @handler is NULL it will reset to default which is to pass error back to the global library handler. 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. Provides capabilities of the hypervisor / driver. This returns the system hostname on which the hypervisor is running (the result of the gethostname(2) system call). If we are connected to a remote system, then this returns the hostname of the remote system. 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. Get the name of the Hypervisor software used. 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. Get the version level of the Hypervisor running. This may work only with hypervisor call, i.e. with priviledged access to the hypervisor, not with a Read-Only connection. list the defined domains, stores the pointers to the names in @names list the inactive networks, stores the pointers to the names in @names Collect the list of active domains, and store their ID in @maxids Collect the list of active networks, and store their names in @names Provides the number of inactive domains. Provides the number of inactive networks. Provides the number of active domains. Provides the number of active networks. This function should be called first to get a connection to the Hypervisor and xen store This function should be called first to get a restricted connection to the libbrary functionalities. The set of APIs usable are then restricted on the available methods to control the domains. Copy the content of the last error caught at the library level One will need to free the result with virResetError() Default routine reporting an error to stderr. Create a virtual device attachment to backend. 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. launch a defined domain. If the call succeed the domain moves from the defined to the running domains pools. Launch a new Linux guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires priviledged access to the hypervisor. define a domain, but does not start it 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. The data structure is freed and should not be used thereafter if the call does not return an error. This function may requires priviledged access Destroy a virtual device attachment to backend. Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter. Provides a boolean value indicating whether the domain configured to be automatically started when the host machine boots. 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. Get the hypervisor ID number for the domain 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. 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. 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. Get the public name for that domain Get the type of domain operation system. Get the scheduler parameters, the @params array will be filled with the values. Get the scheduler type. Get the UUID for a domain Get the UUID for a domain as string. For more information about UUID see RFC4122. Extract information about virtual CPUs of domain, store it in info array and also in cpumaps if this pointer is'nt NULL. Provide an XML description of the domain. The description may be reused later to relaunch the domain with virDomainCreateLinux(). Try to find a domain based on the hypervisor ID number Try to lookup a domain on the given hypervisor based on its name. Try to lookup a domain on the given hypervisor based on its UUID. Try to lookup a domain on the given hypervisor based on its UUID. Dynamically change the real CPUs which can be allocated to a virtual CPU. This function requires priviledged access to the hypervisor. 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. This method will restore a domain saved to disk by virDomainSave(). Resume an suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain(). This function may requires priviledged access 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 may be a problem). Use virDomainRestore() to restore a domain after saving. Configure the domain to be automatically started when the host machine boots. 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 requires priviledged access to the hypervisor. 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 requires priviledged access to the hypervisor. Change the scheduler parameters 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 requires priviledged access to the hypervisor. Shutdown a domain, the domain object is still usable there after but the domain OS is being stopped. Note that the guest OS may ignore the request. TODO: should we add an option for reboot, knowing it may not be doable in the general case ? 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 requires priviledged access. undefine a domain but does not stop it if it is running Signature of a function to use when there is an error raised by the library. Provide a pointer to the last error caught at the library level Simpler but may not be suitable for multithreaded accesses, in which case use virCopyLastError() Provides two information back, @libVer is the version of the library while @typeVer will be the version of the hypervisor type @type against which the library was compiled. If @type is NULL, "Xen" is assumed, if @type is unknown or not availble, an error code will be returned and @typeVer will be 0. Initialize the library. It's better to call this routine at startup in multithreaded applications to avoid potential race when initializing the library. Create and start a defined network. If the call succeed the network moves from the defined to the running networks pools. Create and start a new virtual network, based on an XML description similar to the one returned by virNetworkGetXMLDesc() Define a network, but does not create it 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. The data structure is freed and should not be used thereafter if the call does not return an error. This function may requires priviledged access Free the network object. The running instance is kept alive. The data structure is freed and should not be used thereafter. Provides a boolean value indicating whether the network configured to be automatically started when the host machine boots. Provides a bridge interface name to which a domain may connect a network interface in order to join the network. 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. Get the public name for that network Get the UUID for a network Get the UUID for a network as string. For more information about UUID see RFC4122. Provide an XML description of the network. The description may be reused later to relaunch the network with virNetworkCreateXML(). Try to lookup a network on the given hypervisor based on its name. Try to lookup a network on the given hypervisor based on its UUID. Try to lookup a network on the given hypervisor based on its UUID. Configure the network to be automatically started when the host machine boots. Undefine a network but does not stop it if it is running Extract hardware information about the node. Reset the error being pointed to Reset the last error caught at the library level. Set a library global error handling function, if @handler is NULL, it will reset to default printing on stderr. The error raised there are those for which no handler at the connection level could caught.