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. 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. 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 virDomainKernelPtr is a pointer to a virDomainKernel structure. a virDomainPtr is pointer to a virDomain private structure, this is the type used to reference a Xen domain in the API. a virNodeInfoPtr is a pointer to a virNodeInfo 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. Get the name of the Hypervisor software used. 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 Collect the list of active domains, and store their ID in @maxids Provides the number of active domains. 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. 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 Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter. 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. Get the public name for that domain Get the type of domain operation system. 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. 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. 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. 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.