--><head><metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1"/><linkrel="stylesheet"type="text/css"href="../main.css"/><linkrel="SHORTCUT ICON"href="../32favicon.png"/><title>libvirt: Module libvirt from libvirt</title><metaname="description"content="libvirt, virtualization, virtualization API"/></head><body><divid="header"><divid="headerLogo"></div><divid="headerSearch"><formaction="../search.php"enctype="application/x-www-form-urlencoded"method="get"><div><inputid="query"name="query"type="text"size="12"value=""/><inputid="submit"name="submit"type="submit"value="Search"/></div></form></div></div><divid="body"><divid="menu"><ulclass="l0"><li><div><atitle="Front page of the libvirt website"class="inactive"href="../index.html">Home</a></div></li><li><div><atitle="Details of new features and bugs fixed in each release"class="inactive"href="../news.html">News</a></div></li><li><div><atitle="Get the latest source releases, binary builds and get access to the source repository"class="inactive"href="../downloads.html">Downloads</a></div></li><li><div><atitle="Information for users, administrators and developers"class="active"href="../docs.html">Documentation</a><ulclass="l1"><li><div><atitle="Information about deploying and using libvirt"class="inactive"href="../deployment.html">Deployment</a></div></li><li><div><atitle="Overview of the logical subsystems in the libvirt API"class="inactive"href="../intro.html">Architecture</a></div></li><li><div><atitle="Description of the XML formats used in libvirt"class="inactive"href="../format.html">XML format</a></div></li><li><div><atitle="Hypervisor specific driver information"class="inactive"href="../drivers.html">Drivers</a></div></li><li><div><atitle="Reference manual for the C public API"class="active"href="../html/index.html">API reference</a><ulclass="l2"><li><div><spanclass="active">libvirt</span></div></li><li><div><atitle="error handling interfaces for the libvirt library"class="inactive"href="../html/libvirt-virterror.html">virterror</a></div></li><li><div><atitle="matrix of API support per hypervisor per release"class="inactive"href="../hvsupport.html">Driver support</a></div></li></ul></div></li><li><div><atitle="Bindings of the libvirt API for other languages"class="inactive"href="../bindings.html">Language bindings</a></div></li><li><div><atitle="Working on the internals of libvirt API, driver and daemon code"class="inactive"href="../internals.html">Internals</a></div></li></ul></div></li><li><div><atitle="User contributed content"class="inactive"href="http://wiki.libvirt.org">Wiki</a></div></li><li><div><atitle="Frequently asked questions"class="inactive"href="../FAQ.html">FAQ</a></div></li><li><div><atitle="How and where to report bugs and request features"class="inactive"href="../bugs.html">Bug reports</a></div></li><li><div><atitle="How to contact the developers via email and IRC"class="inactive"href="../contact.html">Contact</a></div></li><li><div><atitle="Miscellaneous links of interest related to libvirt"class="inactive"href="../relatedlinks.html">Related Links</a></div></li><li><div><atitle="Overview of all content on the website"class="inactive"href="../sitemap.html">Sitemap</a></div></li></ul></div><divid="content"><h1>Module libvirt from libvirt</h1><p>Provides the interfaces of the libvirt library to handle virtualized domains </p><h2>Table of Contents</h2><h3><ahref="#macros">Macros</a></h3><pre>#define <ahref="#LIBVIR_VERSION_NUMBER">LIBVIR_VERSION_NUMBER</a>
int <ahref="#virConnectGetVersion">virConnectGetVersion</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> unsigned long * hvVer)
int <ahref="#virConnectListDefinedDomains">virConnectListDefinedDomains</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)
int <ahref="#virConnectListDefinedNetworks">virConnectListDefinedNetworks</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)
int <ahref="#virConnectListDefinedStoragePools">virConnectListDefinedStoragePools</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)
int <ahref="#virConnectListDomains">virConnectListDomains</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int * ids, <br/> int maxids)
int <ahref="#virConnectNumOfDefinedInterfaces">virConnectNumOfDefinedInterfaces</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)
int <ahref="#virConnectNumOfDefinedNetworks">virConnectNumOfDefinedNetworks</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)
int <ahref="#virConnectNumOfDefinedStoragePools">virConnectNumOfDefinedStoragePools</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)
int <ahref="#virConnectNumOfDomains">virConnectNumOfDomains</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)
int <ahref="#virDomainCoreDump">virDomainCoreDump</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * to, <br/> int flags)
int <ahref="#virDomainCreate">virDomainCreate</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)
int <ahref="#virDomainDestroy">virDomainDestroy</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)
int <ahref="#virDomainDetachDevice">virDomainDetachDevice</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * xml)
int <ahref="#virDomainFree">virDomainFree</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)
int <ahref="#virDomainGetAutostart">virDomainGetAutostart</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int * autostart)
int <ahref="#virDomainGetSchedulerParameters">virDomainGetSchedulerParameters</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virSchedParameterPtr">virSchedParameterPtr</a> params, <br/> int * nparams)
char * <ahref="#virDomainGetSchedulerType">virDomainGetSchedulerType</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int * nparams)
int <ahref="#virDomainMemoryPeek">virDomainMemoryPeek</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> unsigned long long start, <br/> size_t size, <br/> void * buffer, <br/> unsigned int flags)
int <ahref="#virDomainRestore">virDomainRestore</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * from)
int <ahref="#virDomainResume">virDomainResume</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)
int <ahref="#virDomainSave">virDomainSave</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * to)
int <ahref="#virDomainSetAutostart">virDomainSetAutostart</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int autostart)
int <ahref="#virDomainSetMaxMemory">virDomainSetMaxMemory</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory)
int <ahref="#virDomainSetMemory">virDomainSetMemory</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory)
int <ahref="#virDomainSetSchedulerParameters">virDomainSetSchedulerParameters</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virSchedParameterPtr">virSchedParameterPtr</a> params, <br/> int nparams)
int <ahref="#virDomainSetVcpus">virDomainSetVcpus</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned int nvcpus)
int <ahref="#virDomainShutdown">virDomainShutdown</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)
int <ahref="#virDomainSuspend">virDomainSuspend</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)
int <ahref="#virDomainUndefine">virDomainUndefine</a> (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)
int <ahref="#virInterfaceCreate">virInterfaceCreate</a> (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface, <br/> unsigned int flags)
int <ahref="#virInterfaceDestroy">virInterfaceDestroy</a> (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface, <br/> unsigned int flags)
int <ahref="#virInterfaceFree">virInterfaceFree</a> (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface)
int <ahref="#virNetworkDestroy">virNetworkDestroy</a> (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)
int <ahref="#virNetworkFree">virNetworkFree</a> (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)
int <ahref="#virNetworkGetAutostart">virNetworkGetAutostart</a> (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br/> int * autostart)
int <ahref="#virNetworkSetAutostart">virNetworkSetAutostart</a> (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br/> int autostart)
int <ahref="#virNetworkUndefine">virNetworkUndefine</a> (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)
int <ahref="#virNodeGetCellsFreeMemory">virNodeGetCellsFreeMemory</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> unsigned long long * freeMems, <br/> int startCell, <br/> int maxCells)
unsigned long long <ahref="#virNodeGetFreeMemory">virNodeGetFreeMemory</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)
int <ahref="#virNodeGetInfo">virNodeGetInfo</a> (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/><ahref="libvirt-libvirt.html#virNodeInfoPtr">virNodeInfoPtr</a> info)
int <ahref="#virStoragePoolBuild">virStoragePoolBuild</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)
int <ahref="#virStoragePoolCreate">virStoragePoolCreate</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)
int <ahref="#virStoragePoolDelete">virStoragePoolDelete</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)
int <ahref="#virStoragePoolDestroy">virStoragePoolDestroy</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)
int <ahref="#virStoragePoolFree">virStoragePoolFree</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)
int <ahref="#virStoragePoolGetAutostart">virStoragePoolGetAutostart</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> int * autostart)
int <ahref="#virStoragePoolGetInfo">virStoragePoolGetInfo</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/><ahref="libvirt-libvirt.html#virStoragePoolInfoPtr">virStoragePoolInfoPtr</a> info)
int <ahref="#virStoragePoolGetUUID">virStoragePoolGetUUID</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned char * uuid)
int <ahref="#virStoragePoolGetUUIDString">virStoragePoolGetUUIDString</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> char * buf)
char * <ahref="#virStoragePoolGetXMLDesc">virStoragePoolGetXMLDesc</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)
int <ahref="#virStoragePoolListVolumes">virStoragePoolListVolumes</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> char ** const names, <br/> int maxnames)
int <ahref="#virStoragePoolRefresh">virStoragePoolRefresh</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)
int <ahref="#virStoragePoolSetAutostart">virStoragePoolSetAutostart</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> int autostart)
int <ahref="#virStoragePoolUndefine">virStoragePoolUndefine</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)
<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a><ahref="#virStorageVolCreateXML">virStorageVolCreateXML</a> (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> const char * xmldesc, <br/> unsigned int flags)
int <ahref="#virStorageVolDelete">virStorageVolDelete</a> (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br/> unsigned int flags)
int <ahref="#virStorageVolFree">virStorageVolFree</a> (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)
</pre><h2>Description</h2><h3><aname="macros"id="macros">Macros</a></h3><h3><aname="LIBVIR_VERSION_NUMBER"id="LIBVIR_VERSION_NUMBER"><code>LIBVIR_VERSION_NUMBER</code></a></h3><pre>#define LIBVIR_VERSION_NUMBER</pre><p>Macro providing the version of the library as version * 1,000,000 + minor * 1000 + micro</p><h3><aname="VIR_COPY_CPUMAP"id="VIR_COPY_CPUMAP"><code>VIR_COPY_CPUMAP</code></a></h3><pre>#define VIR_COPY_CPUMAP</pre><p>This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. <ahref="libvirt-libvirt.html#VIR_COPY_CPUMAP">VIR_COPY_CPUMAP</a> macro extract the cpumap of the specified vcpu from cpumaps array and copy it into cpumap to be used later by virDomainPinVcpu() API.</p><h3><aname="VIR_CPU_MAPLEN"id="VIR_CPU_MAPLEN"><code>VIR_CPU_MAPLEN</code></a></h3><pre>#define VIR_CPU_MAPLEN</pre><p>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.</p><h3><aname="VIR_CPU_USABLE"id="VIR_CPU_USABLE"><code>VIR_CPU_USABLE</code></a></h3><pre>#define VIR_CPU_USABLE</pre><p>This macro is to be used in conjunction with virDomainGetVcpus() API. <ahref="libvirt-libvirt.html#VIR_CPU_USABLE">VIR_CPU_USABLE</a> macro returns a non zero value (true) if the cpu is usable by the vcpu, and 0 otherwise.</p><h3><aname="VIR_DOMAIN_SCHED_FIELD_LENGTH"id="VIR_DOMAIN_SCHED_FIELD_LENGTH"><code>VIR_DOMAIN_SCHED_FIELD_LENGTH</code></a></h3><pre>#define VIR_DOMAIN_SCHED_FIELD_LENGTH</pre><p>Macro providing the field length of <ahref="libvirt-libvirt.html#virSchedParameter">virSchedParameter</a></p><h3><aname="VIR_GET_CPUMAP"id="VIR_GET_CPUMAP"><code>VIR_GET_CPUMAP</code></a></h3><pre>#define VIR_GET_CPUMAP</pre><p>This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. <ahref="libvirt-libvirt.html#VIR_GET_CPUMAP">VIR_GET_CPUMAP</a> macro returns a pointer to the cpumap of the specified vcpu from cpumaps array.</p><h3><aname="VIR_NODEINFO_MAXCPUS"id="VIR_NODEINFO_MAXCPUS"><code>VIR_NODEINFO_MAXCPUS</code></a></h3><pre>#define VIR_NODEINFO_MAXCPUS</pre><p>This macro is to calculate the total number of CPUs supported but not necessary active in the host.</p><h3><aname="VIR_SECURITY_DOI_BUFLEN"id="VIR_SECURITY_DOI_BUFLEN"><code>VIR_SECURITY_DOI_BUFLEN</code></a></h3><pre>#define VIR_SECURITY_DOI_BUFLEN</pre><p>Macro providing the maximum length of the <ahref="libvirt-libvirt.html#virSecurityModel">virSecurityModel</a> doi string.</p><h3><aname="VIR_SECURITY_LABEL_BUFLEN"id="VIR_SECURITY_LABEL_BUFLEN"><code>VIR_SECURITY_LABEL_BUFLEN</code></a></h3><pre>#define VIR_SECURITY_LABEL_BUFLEN</pre><p>Macro providing the maximum length of the <ahref="libvirt-libvirt.html#virSecurityLabel">virSecurityLabel</a> label string. Note that this value is based on that used by Labeled NFS.</p><h3><aname="VIR_SECURITY_MODEL_BUFLEN"id="VIR_SECURITY_MODEL_BUFLEN"><code>VIR_SECURITY_MODEL_BUFLEN</code></a></h3><pre>#define VIR_SECURITY_MODEL_BUFLEN</pre><p>Macro providing the maximum length of the <ahref="libvirt-libvirt.html#virSecurityModel">virSecurityModel</a> model string.</p><h3><aname="VIR_UNUSE_CPU"id="VIR_UNUSE_CPU"><code>VIR_UNUSE_CPU</code></a></h3><pre>#define VIR_UNUSE_CPU</pre><p>This macro is to be used in conjunction with virDomainPinVcpu() API. USE_CPU macro reset the bit (CPU not usable) of the related cpu in cpumap.</p><h3><aname="VIR_USE_CPU"id="VIR_USE_CPU"><code>VIR_USE_CPU</code></a></h3><pre>#define VIR_USE_CPU</pre><p>This macro is to be used in conjunction with virDomainPinVcpu() API. USE_CPU macro set the bit (CPU usable) of the related cpu in cpumap.</p><h3><aname="VIR_UUID_BUFLEN"id="VIR_UUID_BUFLEN"><code>VIR_UUID_BUFLEN</code></a></h3><pre>#define VIR_UUID_BUFLEN</pre><p>This macro provides the length of the buffer required for virDomainGetUUID()</p><h3><aname="VIR_UUID_STRING_BUFLEN"id="VIR_UUID_STRING_BUFLEN"><code>VIR_UUID_STRING_BUFLEN</code></a></h3><pre>#define VIR_UUID_ST
</pre><table><tr><td>int *</td><td>credtype</td><td> : List of supported <ahref="libvirt-libvirt.html#virConnectCredentialType">virConnectCredentialType</a> values</td></tr><tr><td>unsigned int</td><td>ncredtype</td></tr><tr><td><ahref="libvirt-libvirt.html#virConnectAuthCallbackPtr">virConnectAuthCallbackPtr</a></td><td>cb</td><td> : Callback used to collect credentials</td></tr><tr><td>void *</td><td>cbdata</td></tr></table><pre>
</pre><table><tr><td>int</td><td>type</td><td> : One of <ahref="libvirt-libvirt.html#virConnectCredentialType">virConnectCredentialType</a> constants</td></tr><tr><td>const char *</td><td>prompt</td><td> : Prompt to show to user</td></tr><tr><td>const char *</td><td>challenge</td><td> : Additional challenge to show</td></tr><tr><td>const char *</td><td>defresult</td><td> : Optional default result</td></tr><tr><td>char *</td><td>result</td><td> : Result to be filled with user response (or defresult)</td></tr><tr><td>unsigned int</td><td>resultlen</td><td> : Length of the result</td></tr></table><pre>
</pre><table><tr><td>long long</td><td>rd_req</td><td> : number of read requests</td></tr><tr><td>long long</td><td>rd_bytes</td><td> : number of read bytes</td></tr><tr><td>long long</td><td>wr_req</td><td> : number of write requests</td></tr><tr><td>long long</td><td>wr_bytes</td><td> : number of written bytes</td></tr><tr><td>long long</td><td>errs</td><td> : In Xen this returns the mysterious 'oo_req'.</td></tr></table><pre>
</pre><table><tr><td><aname="VIR_DOMAIN_EVENT_RESUMED_UNPAUSED"id="VIR_DOMAIN_EVENT_RESUMED_UNPAUSED">VIR_DOMAIN_EVENT_RESUMED_UNPAUSED</a></td><td> = </td><td>0</td><td> : Normal resume due to admin unpause</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_RESUMED_MIGRATED"id="VIR_DOMAIN_EVENT_RESUMED_MIGRATED">VIR_DOMAIN_EVENT_RESUMED_MIGRATED</a></td><td> = </td><td>1</td><td> : Resumed for completion of migration</td></tr></table><pre>}
</pre><table><tr><td><aname="VIR_DOMAIN_EVENT_STARTED_BOOTED"id="VIR_DOMAIN_EVENT_STARTED_BOOTED">VIR_DOMAIN_EVENT_STARTED_BOOTED</a></td><td> = </td><td>0</td><td> : Normal startup from boot</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_STARTED_MIGRATED"id="VIR_DOMAIN_EVENT_STARTED_MIGRATED">VIR_DOMAIN_EVENT_STARTED_MIGRATED</a></td><td> = </td><td>1</td><td> : Incoming migration from another host</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_STARTED_RESTORED"id="VIR_DOMAIN_EVENT_STARTED_RESTORED">VIR_DOMAIN_EVENT_STARTED_RESTORED</a></td><td> = </td><td>2</td><td> : Restored from a state file</td></tr></table><pre>}
</pre><table><tr><td><aname="VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN"id="VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN">VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN</a></td><td> = </td><td>0</td><td> : Normal shutdown</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_STOPPED_DESTROYED"id="VIR_DOMAIN_EVENT_STOPPED_DESTROYED">VIR_DOMAIN_EVENT_STOPPED_DESTROYED</a></td><td> = </td><td>1</td><td> : Forced poweroff from host</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_STOPPED_CRASHED"id="VIR_DOMAIN_EVENT_STOPPED_CRASHED">VIR_DOMAIN_EVENT_STOPPED_CRASHED</a></td><td> = </td><td>2</td><td> : Guest crashed</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_STOPPED_MIGRATED"id="VIR_DOMAIN_EVENT_STOPPED_MIGRATED">VIR_DOMAIN_EVENT_STOPPED_MIGRATED</a></td><td> = </td><td>3</td><td> : Migrated off to another host</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_STOPPED_SAVED"id="VIR_DOMAIN_EVENT_STOPPED_SAVED">VIR_DOMAIN_EVENT_STOPPED_SAVED</a></td><td> = </td><td>4</td><td> : Saved to a state file</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_STOPPED_FAILED"id="VIR_DOMAIN_EVENT_STOPPED_FAILED">VIR_DOMAIN_EVENT_STOPPED_FAILED</a></td><td> = </td><td>5</td><td> : Host emulator/mgmt failed</td></tr></table><pre>}
</pre><table><tr><td><aname="VIR_DOMAIN_EVENT_SUSPENDED_PAUSED"id="VIR_DOMAIN_EVENT_SUSPENDED_PAUSED">VIR_DOMAIN_EVENT_SUSPENDED_PAUSED</a></td><td> = </td><td>0</td><td> : Normal suspend due to admin pause</td></tr><tr><td><aname="VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED"id="VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED">VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED</a></td><td> = </td><td>1</td><td> : Suspended for offline migration</td></tr></table><pre>}
</pre><table><tr><td>unsigned char</td><td>state</td><td> : the running state, one of <ahref="libvirt-libvirt.html#virDomainState">virDomainState</a></td></tr><tr><td>unsigned long</td><td>maxMem</td><td> : the maximum memory in KBytes allowed</td></tr><tr><td>unsigned long</td><td>memory</td><td> : the memory in KBytes used by the domain</td></tr><tr><td>unsigned short</td><td>nrVirtCpu</td><td> : the number of virtual CPUs for the domain</td></tr><tr><td>unsigned long long</td><td>cpuTime</td><td> : the CPU time used in nanoseconds</td></tr></table><pre>
</pre><table><tr><td><aname="VIR_DOMAIN_NOSTATE"id="VIR_DOMAIN_NOSTATE">VIR_DOMAIN_NOSTATE</a></td><td> = </td><td>0</td><td> : no state</td></tr><tr><td><aname="VIR_DOMAIN_RUNNING"id="VIR_DOMAIN_RUNNING">VIR_DOMAIN_RUNNING</a></td><td> = </td><td>1</td><td> : the domain is running</td></tr><tr><td><aname="VIR_DOMAIN_BLOCKED"id="VIR_DOMAIN_BLOCKED">VIR_DOMAIN_BLOCKED</a></td><td> = </td><td>2</td><td> : the domain is blocked on resource</td></tr><tr><td><aname="VIR_DOMAIN_PAUSED"id="VIR_DOMAIN_PAUSED">VIR_DOMAIN_PAUSED</a></td><td> = </td><td>3</td><td> : the domain is paused by user</td></tr><tr><td><aname="VIR_DOMAIN_SHUTDOWN"id="VIR_DOMAIN_SHUTDOWN">VIR_DOMAIN_SHUTDOWN</a></td><td> = </td><td>4</td><td> : the domain is being shut down</td></tr><tr><td><aname="VIR_DOMAIN_SHUTOFF"id="VIR_DOMAIN_SHUTOFF">VIR_DOMAIN_SHUTOFF</a></td><td> = </td><td>5</td><td> : the domain is shut off</td></tr><tr><td><aname="VIR_DOMAIN_CRASHED"id="VIR_DOMAIN_CRASHED">VIR_DOMAIN_CRASHED</a></td><td> = </td><td>6</td><td> : the domain is crashed</td></tr></table><pre>}
</pre><table><tr><td>charmodel[32]</td><td>model</td><td> : string indicating the CPU model</td></tr><tr><td>unsigned long</td><td>memory</td><td> : memory size in kilobytes</td></tr><tr><td>unsigned int</td><td>cpus</td><td> : the number of active CPUs</td></tr><tr><td>unsigned int</td><td>mhz</td><td> : expected CPU frequency</td></tr><tr><td>unsigned int</td><td>nodes</td><td> : the number of NUMA cell, 1 for uniform mem access</td></tr><tr><td>unsigned int</td><td>sockets</td><td> : number of CPU socket per node</td></tr><tr><td>unsigned int</td><td>cores</td><td> : number of core per socket</td></tr><tr><td>unsigned int</td><td>threads</td><td> : number of threads per core</td></tr></table><pre>
</pre><table><tr><td><aname="VIR_STORAGE_POOL_DELETE_NORMAL"id="VIR_STORAGE_POOL_DELETE_NORMAL">VIR_STORAGE_POOL_DELETE_NORMAL</a></td><td> = </td><td>0</td><td> : Delete metadata only (fast)</td></tr><tr><td><aname="VIR_STORAGE_POOL_DELETE_ZEROED"id="VIR_STORAGE_POOL_DELETE_ZEROED">VIR_STORAGE_POOL_DELETE_ZEROED</a></td><td> = </td><td>1</td><td> : Clear all data to zeros (slow)</td></tr></table><pre>}
</pre><table><tr><td>int</td><td>state</td><td> : <ahref="libvirt-libvirt.html#virStoragePoolState">virStoragePoolState</a> flags</td></tr><tr><td>unsigned long long</td><td>capacity</td><td> : Logical size bytes</td></tr><tr><td>unsigned long long</td><td>allocation</td><td> : Current allocation bytes</td></tr><tr><td>unsigned long long</td><td>available</td><td> : Remaining free space bytes</td></tr></table><pre>
</pre><table><tr><td><aname="VIR_STORAGE_VOL_DELETE_NORMAL"id="VIR_STORAGE_VOL_DELETE_NORMAL">VIR_STORAGE_VOL_DELETE_NORMAL</a></td><td> = </td><td>0</td><td> : Delete metadata only (fast)</td></tr><tr><td><aname="VIR_STORAGE_VOL_DELETE_ZEROED"id="VIR_STORAGE_VOL_DELETE_ZEROED">VIR_STORAGE_VOL_DELETE_ZEROED</a></td><td> = </td><td>1</td><td> : Clear all data to zeros (slow)</td></tr></table><pre>}
</pre><table><tr><td>unsigned int</td><td>number</td><td> : virtual CPU number</td></tr><tr><td>int</td><td>state</td><td> : value from <ahref="libvirt-libvirt.html#virVcpuState">virVcpuState</a></td></tr><tr><td>unsigned long long</td><td>cpuTime</td><td> : CPU time used, in nanoseconds</td></tr><tr><td>int</td><td>cpu</td><td> : real CPU number, or -1 if offline</td></tr></table><pre>
</pre><table><tr><td><aname="VIR_VCPU_OFFLINE"id="VIR_VCPU_OFFLINE">VIR_VCPU_OFFLINE</a></td><td> = </td><td>0</td><td> : the virtual CPU is offline</td></tr><tr><td><aname="VIR_VCPU_RUNNING"id="VIR_VCPU_RUNNING">VIR_VCPU_RUNNING</a></td><td> = </td><td>1</td><td> : the virtual CPU is running</td></tr><tr><td><aname="VIR_VCPU_BLOCKED"id="VIR_VCPU_BLOCKED">VIR_VCPU_BLOCKED</a></td><td> = </td><td>2</td><td> : the virtual CPU is blocked on resource</td></tr></table><pre>}
</pre></div><h3><aname="functions"id="functions">Functions</a></h3><h3><aname="virConnectAuthCallbackPtr"id="virConnectAuthCallbackPtr"><code>virConnectAuthCallbackPtr</code></a></h3><preclass="programlisting">typedef int (*virConnectAuthCallbackPtr) (<ahref="libvirt-libvirt.html#virConnectCredentialPtr">virConnectCredentialPtr</a> cred, <br/> unsigned int ncred, <br/> void * cbdata)
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success or -1 in case of error.</td></tr></tbody></table></div><h3><aname="virConnectDomainEventCallback"id="virConnectDomainEventCallback"><code>virConnectDomainEventCallback</code></a></h3><preclass="programlisting">typedef int (*virConnectDomainEventCallback) (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> int event, <br/> int detail, <br/> void * opaque)
</pre><p>A callback function to be registered, and called when a domain event occurs</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td><ahref="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><spanclass="term"><i><tt>dom</tt></i>:</span></td><td>The domain on which the event occured</td></tr><tr><td><spanclass="term"><i><tt>event</tt></i>:</span></td><td>The specfic <ahref="libvirt-libvirt.html#virDomainEventType">virDomainEventType</a> which occured</td></tr><tr><td><spanclass="term"><i><tt>detail</tt></i>:</span></td><td>event specific detail information</td></tr><tr><td><spanclass="term"><i><tt>opaque</tt></i>:</span></td><td>opaque user data</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><br/><h3><aname="virConnectDomainEventDeregister"id="virConnectDomainEventDeregister"><code>virConnectDomainEventDeregister</code></a></h3><preclass="programlisting">int virConnectDomainEventDeregister (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/><ahref="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb)<br/>
</pre><p>Removes a Domain Event Callback. De-registering for a domain callback will disable delivery of this event type</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><spanclass="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><aname="virConnectDomainEventRegister"id="virConnectDomainEventRegister"><code>virConnectDomainEventRegister</code></a></h3><preclass="programlisting">int virConnectDomainEventRegister (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/><ahref="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb, <br/> void * opaque, <br/><ahref="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> freecb)<br/>
</pre><p>Adds a Domain Event Callback. Registering for a domain callback will enable delivery of the events The <ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> 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</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><spanclass="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><spanclass="term"><i><tt>opaque</tt></i>:</span></td><td>opaque data to pass on to the callback</td></tr><tr><td><spanclass="term"><i><tt>freecb</tt></i>:</span></td><td>optional function to deallocate opaque when not used anymore</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>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. Returns 0 on success, -1 on failure</td></tr></tbody></table></div><h3><aname="virConnectDomainXMLFromNative"id="virConnectDomainXMLFromNative"><code>virConnectDomainXMLFromNative</code></a></h3><preclass="programlisting">char * virConnectDomainXMLFromNative (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * nativeFormat, <br/> const char * nativeConfig, <br/> unsigned int flags)<br/>
</pre><p>Reads native configuration data describing a domain, and generates libvirt domain XML. The format of the native data is hypervisor dependant.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><spanclass="term"><i><tt>nativeFormat</tt></i>:</span></td><td>configuration format importing from</td></tr><tr><td><spanclass="term"><i><tt>nativeConfig</tt></i>:</span></td><td>the configuration data to import</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, pass 0</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div><h3><aname="virConnectDomainXMLToNative"id="virConnectDomainXMLToNative"><code>virConnectDomainXMLToNative</code></a></h3><preclass="programlisting">char * virConnectDomainXMLToNative (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * nativeFormat, <br/> const char * domainXml, <br/> unsigned int flags)<br/>
</pre><p>Reads a domain XML configuration document, and generates generates a native configuration file describing the domain. The format of the native data is hypervisor dependant.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><spanclass="term"><i><tt>nativeFormat</tt></i>:</span></td><td>configuration format exporting to</td></tr><tr><td><spanclass="term"><i><tt>domainXml</tt></i>:</span></td><td>the domain configuration to export</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, pass 0</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated UTF-8 encoded native config datafile, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div><h3><aname="virConnectFindStoragePoolSources"id="virConnectFindStoragePoolSources"><code>virConnectFindStoragePoolSources</code></a></h3><preclass="programlisting">char * virConnectFindStoragePoolSources (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * type, <br/> const char * srcSpec, <br/> unsigned int flags)<br/>
</pre><p>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)</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>type</tt></i>:</span></td><td>type of storage pool sources to discover</td></tr><tr><td><spanclass="term"><i><tt>srcSpec</tt></i>:</span></td><td>XML document specifying discovery source</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags for discovery (unused, pass 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>an xml document consisting of a SourceList element containing a source document appropriate to the given pool type for each discovered source.</td></tr></tbody></table></div><h3><aname="virConnectGetCapabilities"id="virConnectGetCapabilities"><code>virConnectGetCapabilities</code></a></h3><preclass="programlisting">char * virConnectGetCapabilities (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides capabilities of the hypervisor / driver.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>NULL in case of error, or an XML string defining the capabilities. The client must free the returned string after use.</td></tr></tbody></table></div><h3><aname="virConnectGetHostname"id="virConnectGetHostname"><code>virConnectGetHostname</code></a></h3><preclass="programlisting">char * virConnectGetHostname (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the hostname which must be freed by the caller, or NULL if there was an error.</td></tr></tbody></table></div><h3><aname="virConnectGetMaxVcpus"id="virConnectGetMaxVcpus"><code>virConnectGetMaxVcpus</code></a></h3><preclass="programlisting">int virConnectGetMaxVcpus (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * type)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>type</tt></i>:</span></td><td>value of the 'type' attribute in the <domain> element</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the maximum of virtual CPU or -1 in case of error.</td></tr></tbody></table></div><h3><aname="virConnectGetType"id="virConnectGetType"><code>virConnectGetType</code></a></h3><preclass="programlisting">const char * virConnectGetType (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Get the name of the Hypervisor software used.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>NULL in case of error, a static zero terminated string otherwise. See also: http://www.redhat.com/archives/libvir-list/2007-February/msg00096.html</td></tr></tbody></table></div><h3><aname="virConnectGetURI"id="virConnectGetURI"><code>virConnectGetURI</code></a></h3><preclass="programlisting">char * virConnectGetURI (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the URI string which must be freed by the caller, or NULL if there was an error.</td></tr></tbody></table></div><h3><aname="virConnectGetVersion"id="virConnectGetVersion"><code>virConnectGetVersion</code></a></h3><preclass="programlisting">int virConnectGetVersion (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> unsigned long * hvVer)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>hvVer</tt></i>:</span></td><td>return value for the version of the running hypervisor (OUT)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-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</td></tr></tbody></table></div><h3><aname="virConnectListDefinedDomains"id="virConnectListDefinedDomains"><code>virConnectListDefinedDomains</code></a></h3><preclass="programlisting">int virConnectListDefinedDomains (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>list the defined but inactive domains, stores the pointers to the names in @names</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>pointer to an array to store the names</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of the array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of names provided in the array or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectListDefinedInterfaces"id="virConnectListDefinedInterfaces"><code>virConnectListDefinedInterfaces</code></a></h3><preclass="programlisting">int virConnectListDefinedInterfaces (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>Collect the list of defined (inactive) physical host interfaces, and store their names in @names.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of names of interfaces</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of interfaces found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectListDefinedNetworks"id="virConnectListDefinedNetworks"><code>virConnectListDefinedNetworks</code></a></h3><preclass="programlisting">int virConnectListDefinedNetworks (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>list the inactive networks, stores the pointers to the names in @names</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>pointer to an array to store the names</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of the array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of names provided in the array or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectListDefinedStoragePools"id="virConnectListDefinedStoragePools"><code>virConnectListDefinedStoragePools</code></a></h3><preclass="programlisting">int virConnectListDefinedStoragePools (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>Provides the list of names of inactive storage pools upto maxnames. If there are more than maxnames, the remaining names will be silently ignored.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array of char * to fill with pool names (allocated by caller)</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of the names array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on error</td></tr></tbody></table></div><h3><aname="virConnectListDomains"id="virConnectListDomains"><code>virConnectListDomains</code></a></h3><preclass="programlisting">int virConnectListDomains (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int * ids, <br/> int maxids)<br/>
</pre><p>Collect the list of active domains, and store their ID in @maxids</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>ids</tt></i>:</span></td><td>array to collect the list of IDs of active domains</td></tr><tr><td><spanclass="term"><i><tt>maxids</tt></i>:</span></td><td>size of @ids</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectListInterfaces"id="virConnectListInterfaces"><code>virConnectListInterfaces</code></a></h3><preclass="programlisting">int virConnectListInterfaces (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>Collect the list of active physical host interfaces, and store their names in @names</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of names of interfaces</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of interfaces found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectListNetworks"id="virConnectListNetworks"><code>virConnectListNetworks</code></a></h3><preclass="programlisting">int virConnectListNetworks (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>Collect the list of active networks, and store their names in @names</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of names of active networks</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of networks found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectListStoragePools"id="virConnectListStoragePools"><code>virConnectListStoragePools</code></a></h3><preclass="programlisting">int virConnectListStoragePools (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>Provides the list of names of active storage pools upto maxnames. If there are more than maxnames, the remaining names will be silently ignored.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array of char * to fill with pool names (allocated by caller)</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of the names array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on error</td></tr></tbody></table></div><h3><aname="virConnectNumOfDefinedDomains"id="virConnectNumOfDefinedDomains"><code>virConnectNumOfDefinedDomains</code></a></h3><preclass="programlisting">int virConnectNumOfDefinedDomains (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of defined but inactive domains.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectNumOfDefinedInterfaces"id="virConnectNumOfDefinedInterfaces"><code>virConnectNumOfDefinedInterfaces</code></a></h3><preclass="programlisting">int virConnectNumOfDefinedInterfaces (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of defined (inactive) interfaces on the physical host.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of defined interface found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectNumOfDefinedNetworks"id="virConnectNumOfDefinedNetworks"><code>virConnectNumOfDefinedNetworks</code></a></h3><preclass="programlisting">int virConnectNumOfDefinedNetworks (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of inactive networks.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of networks found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectNumOfDefinedStoragePools"id="virConnectNumOfDefinedStoragePools"><code>virConnectNumOfDefinedStoragePools</code></a></h3><preclass="programlisting">int virConnectNumOfDefinedStoragePools (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of inactive storage pools</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of pools found, or -1 on error</td></tr></tbody></table></div><h3><aname="virConnectNumOfDomains"id="virConnectNumOfDomains"><code>virConnectNumOfDomains</code></a></h3><preclass="programlisting">int virConnectNumOfDomains (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of active domains.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectNumOfInterfaces"id="virConnectNumOfInterfaces"><code>virConnectNumOfInterfaces</code></a></h3><preclass="programlisting">int virConnectNumOfInterfaces (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of active interfaces on the physical host.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of active interfaces found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectNumOfNetworks"id="virConnectNumOfNetworks"><code>virConnectNumOfNetworks</code></a></h3><preclass="programlisting">int virConnectNumOfNetworks (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of active networks.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of network found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virConnectNumOfStoragePools"id="virConnectNumOfStoragePools"><code>virConnectNumOfStoragePools</code></a></h3><preclass="programlisting">int virConnectNumOfStoragePools (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Provides the number of active storage pools</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of pools found, or -1 on error</td></tr></tbody></table></div><h3><aname="virConnectOpen"id="virConnectOpen"><code>virConnectOpen</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpen (const char * name)<br/>
</pre><p>This function should be called first to get a connection to the Hypervisor and xen store</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the hypervisor connection or NULL in case of error If @name is NULL then probing will be done to determine a suitable default driver to activate. This involves trying each hypervisor in turn until one successfully opens. If the LIBVIRT_DEFAULT_URI environment variable is set, then it will be used in preference to probing for a driver. 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</td></tr></tbody></table></div><h3><aname="virConnectOpenAuth"id="virConnectOpenAuth"><code>virConnectOpenAuth</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpenAuth (const char * name, <br/><ahref="libvirt-libvirt.html#virConnectAuthPtr">virConnectAuthPtr</a> auth, <br/> int flags)<br/>
</pre><p>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 <ahref="libvirt-libvirt.html#virConnectOpen">virConnectOpen</a> for notes about environment variables which can have an effect on opening drivers</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><spanclass="term"><i><tt>auth</tt></i>:</span></td><td>Authenticate callback parameters</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>Open flags</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the hypervisor connection or NULL in case of error URIs are documented at http://libvirt.org/uri.html</td></tr></tbody></table></div><h3><aname="virConnectOpenReadOnly"id="virConnectOpenReadOnly"><code>virConnectOpenReadOnly</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpenReadOnly (const char * name)<br/>
</pre><p>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 <ahref="libvirt-libvirt.html#virConnectOpen">virConnectOpen</a> for notes about environment variables which can have an effect on opening drivers</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the hypervisor connection or NULL in case of error URIs are documented at http://libvirt.org/uri.html</td></tr></tbody></table></div><h3><aname="virConnectRef"id="virConnectRef"><code>virConnectRef</code></a></h3><preclass="programlisting">int virConnectRef (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>Increment the reference count on the connection. For each additional call to this method, there shall be a corresponding call to <ahref="libvirt-libvirt.html#virConnectClose">virConnectClose</a> 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>the connection to hold a reference on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure</td></tr></tbody></table></div><h3><aname="virDomainAttachDevice"id="virDomainAttachDevice"><code>virDomainAttachDevice</code></a></h3><preclass="programlisting">int virDomainAttachDevice (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * xml)<br/>
</pre><p>Create a virtual device attachment to backend.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><spanclass="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainBlockPeek"id="virDomainBlockPeek"><code>virDomainBlockPeek</code></a></h3><preclass="programlisting">int virDomainBlockPeek (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> const char * path, <br/> unsigned long long offset, <br/> size_t size, <br/> void * buffer, <br/> unsigned int flags)<br/>
</pre><p>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). 'path' must be a device or file corresponding to the domain. In other words it must be the precise string returned in a <disk><source dev='...'/></disk> from virDomainGetXMLDesc. '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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><spanclass="term"><i><tt>path</tt></i>:</span></td><td>path to the block device</td></tr><tr><td><spanclass="term"><i><tt>offset</tt></i>:</span></td><td>offset within block device</td></tr><tr><td><spanclass="term"><i><tt>size</tt></i>:</span></td><td>size to read</td></tr><tr><td><spanclass="term"><i><tt>buffer</tt></i>:</span></td><td>return buffer (must be at least size bytes)</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>unused, always pass 0</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success or -1 in case of failure. really 64 bits</td></tr></tbody></table></div><h3><aname="virDomainBlockStats"id="virDomainBlockStats"><code>virDomainBlockStats</code></a></h3><preclass="programlisting">int virDomainBlockStats (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> const char * path, <br/><ahref="libvirt-libvirt.html#virDomainBlockStatsPtr">virDomainBlockStatsPtr</a> stats, <br/> size_t size)<br/>
</pre><p>This function returns block device (disk) stats for block devices attached to the domain. The path parameter is the name of the block device. Get this by calling <ahref="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a> and finding the <target dev='...'> attribute within //domain/devices/disk. (For example, "xvda"). 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><spanclass="term"><i><tt>path</tt></i>:</span></td><td>path to the block device</td></tr><tr><td><spanclass="term"><i><tt>stats</tt></i>:</span></td><td>block device stats (returned)</td></tr><tr><td><spanclass="term"><i><tt>size</tt></i>:</span></td><td>size of stats structure</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success or -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainCoreDump"id="virDomainCoreDump"><code>virDomainCoreDump</code></a></h3><preclass="programlisting">int virDomainCoreDump (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * to, <br/> int flags)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>to</tt></i>:</span></td><td>path for the core file</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>extra flags, currently unused</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainCreate"id="virDomainCreate"><code>virDomainCreate</code></a></h3><preclass="programlisting">int virDomainCreate (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>launch a defined domain. If the call succeed the domain moves from the defined to the running domains pools.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of error</td></tr></tbody></table></div><h3><aname="virDomainCreateLinux"id="virDomainCreateLinux"><code>virDomainCreateLinux</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainCreateLinux (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xmlDesc, <br/> unsigned int flags)<br/>
</pre><p>Deprecated after 0.4.6. Renamed to virDomainCreateXML() providing identical functionality. This existing name will left indefinitely for API compatability.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>callers should always pass 0</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new domain object or NULL in case of failure</td></tr></tbody></table></div><h3><aname="virDomainCreateXML"id="virDomainCreateXML"><code>virDomainCreateXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainCreateXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xmlDesc, <br/> unsigned int flags)<br/>
</pre><p>Launch a new guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires 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).</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>callers should always pass 0</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new domain object or NULL in case of failure</td></tr></tbody></table></div><h3><aname="virDomainDefineXML"id="virDomainDefineXML"><code>virDomainDefineXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainDefineXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xml)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xml</tt></i>:</span></td><td>the XML description for the domain, preferably in UTF-8</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>NULL in case of error, a pointer to the domain otherwise</td></tr></tbody></table></div><h3><aname="virDomainDestroy"id="virDomainDestroy"><code>virDomainDestroy</code></a></h3><preclass="programlisting">int virDomainDestroy (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>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 <ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> object. This function may require privileged access</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainDetachDevice"id="virDomainDetachDevice"><code>virDomainDetachDevice</code></a></h3><preclass="programlisting">int virDomainDetachDevice (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * xml)<br/>
</pre><p>Destroy a virtual device attachment to backend.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><spanclass="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainFree"id="virDomainFree"><code>virDomainFree</code></a></h3><preclass="programlisting">int virDomainFree (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainGetAutostart"id="virDomainGetAutostart"><code>virDomainGetAutostart</code></a></h3><preclass="programlisting">int virDomainGetAutostart (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int * autostart)<br/>
</pre><p>Provides a boolean value indicating whether the domain configured to be automatically started when the host machine boots.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>autostart</tt></i>:</span></td><td>the value returned</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virDomainGetConnect"id="virDomainGetConnect"><code>virDomainGetConnect</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virDomainGetConnect (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dom</tt></i>:</span></td><td>pointer to a domain</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the <ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainGetID"id="virDomainGetID"><code>virDomainGetID</code></a></h3><preclass="programlisting">unsigned int virDomainGetID (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Get the hypervisor ID number for the domain</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the domain ID number or (unsigned int) -1 in case of error</td></tr></tbody></table></div><h3><aname="virDomainGetInfo"id="virDomainGetInfo"><code>virDomainGetInfo</code></a></h3><preclass="programlisting">int virDomainGetInfo (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virDomainInfoPtr">virDomainInfoPtr</a> info)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#virDomainInfo">virDomainInfo</a> structure allocated by the user</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainGetMaxMemory"id="virDomainGetMaxMemory"><code>virDomainGetMaxMemory</code></a></h3><preclass="programlisting">unsigned long virDomainGetMaxMemory (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the memory size in kilobytes or 0 in case of error.</td></tr></tbody></table></div><h3><aname="virDomainGetMaxVcpus"id="virDomainGetMaxVcpus"><code>virDomainGetMaxVcpus</code></a></h3><preclass="programlisting">int virDomainGetMaxVcpus (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the maximum of virtual CPU or -1 in case of error.</td></tr></tbody></table></div><h3><aname="virDomainGetName"id="virDomainGetName"><code>virDomainGetName</code></a></h3><preclass="programlisting">const char * virDomainGetName (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Get the public name for that domain</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the domain object.</td></tr></tbody></table></div><h3><aname="virDomainGetOSType"id="virDomainGetOSType"><code>virDomainGetOSType</code></a></h3><preclass="programlisting">char * virDomainGetOSType (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Get the type of domain operation system.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the new string or NULL in case of error, the string must be freed by the caller.</td></tr></tbody></table></div><h3><aname="virDomainGetSchedulerParameters"id="virDomainGetSchedulerParameters"><code>virDomainGetSchedulerParameters</code></a></h3><preclass="programlisting">int virDomainGetSchedulerParameters (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virSchedParameterPtr">virSchedParameterPtr</a> params, <br/> int * nparams)<br/>
</pre><p>Get the scheduler parameters, the @params array will be filled with the values.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><spanclass="term"><i><tt>params</tt></i>:</span></td><td>pointer to scheduler parameter object (return value)</td></tr><tr><td><spanclass="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of scheduler parameter (this value should be same than the returned value nparams of virDomainGetSchedulerType)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success.</td></tr></tbody></table></div><h3><aname="virDomainGetSchedulerType"id="virDomainGetSchedulerType"><code>virDomainGetSchedulerType</code></a></h3><preclass="programlisting">char * virDomainGetSchedulerType (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int * nparams)<br/>
</pre><p>Get the scheduler type.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><spanclass="term"><i><tt>nparams</tt></i>:</span></td><td>number of scheduler parameters(return value)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>NULL in case of error. The caller must free the returned string.</td></tr></tbody></table></div><h3><aname="virDomainGetSecurityLabel"id="virDomainGetSecurityLabel"><code>virDomainGetSecurityLabel</code></a></h3><preclass="programlisting">int virDomainGetSecurityLabel (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virSecurityLabelPtr">virSecurityLabelPtr</a> seclabel)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>seclabel</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#virSecurityLabel">virSecurityLabel</a> structure</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure</td></tr></tbody></table></div><h3><aname="virDomainGetUUID"id="virDomainGetUUID"><code>virDomainGetUUID</code></a></h3><preclass="programlisting">int virDomainGetUUID (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned char * uuid)<br/>
</pre><p>Get the UUID for a domain</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>uuid</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#VIR_UUID_BUFLEN">VIR_UUID_BUFLEN</a> bytes array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virDomainGetUUIDString"id="virDomainGetUUIDString"><code>virDomainGetUUIDString</code></a></h3><preclass="programlisting">int virDomainGetUUIDString (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> char * buf)<br/>
</pre><p>Get the UUID for a domain as string. For more information about UUID see RFC4122.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>buf</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#VIR_UUID_STRING_BUFLEN">VIR_UUID_STRING_BUFLEN</a> bytes array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virDomainGetVcpus"id="virDomainGetVcpus"><code>virDomainGetVcpus</code></a></h3><preclass="programlisting">int virDomainGetVcpus (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virVcpuInfoPtr">virVcpuInfoPtr</a> info, <br/> int maxinfo, <br/> unsigned char * cpumaps, <br/> int maplen)<br/>
</pre><p>Extract information about virtual CPUs of domain, store it in info array and also in cpumaps if this pointer isn't NULL.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><spanclass="term"><i><tt>info</tt></i>:</span></td><td>pointer to an array of <ahref="libvirt-libvirt.html#virVcpuInfo">virVcpuInfo</a> structures (OUT)</td></tr><tr><td><spanclass="term"><i><tt>maxinfo</tt></i>:</span></td><td>number of structures in info array</td></tr><tr><td><spanclass="term"><i><tt>cpumaps</tt></i>:</span></td><td>pointer to an 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.</td></tr><tr><td><spanclass="term"><i><tt>maplen</tt></i>:</span></td><td>number of bytes in one cpumap, from 1 up to size of CPU map in underlying virtualization system (Xen...).</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of info filled in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainGetXMLDesc"id="virDomainGetXMLDesc"><code>virDomainGetXMLDesc</code></a></h3><preclass="programlisting">char * virDomainGetXMLDesc (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int flags)<br/>
</pre><p>Provide an XML description of the domain. The description may be reused later to relaunch the domain with virDomainCreateXML().</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <ahref="libvirt-libvirt.html#virDomainXMLFlags">virDomainXMLFlags</a></td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div><h3><aname="virDomainInterfaceStats"id="virDomainInterfaceStats"><code>virDomainInterfaceStats</code></a></h3><preclass="programlisting">int virDomainInterfaceStats (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> const char * path, <br/><ahref="libvirt-libvirt.html#virDomainInterfaceStatsPtr">virDomainInterfaceStatsPtr</a> stats, <br/> size_t size)<br/>
</pre><p>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 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><spanclass="term"><i><tt>path</tt></i>:</span></td><td>path to the interface</td></tr><tr><td><spanclass="term"><i><tt>stats</tt></i>:</span></td><td>network interface stats (returned)</td></tr><tr><td><spanclass="term"><i><tt>size</tt></i>:</span></td><td>size of stats structure</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success or -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainLookupByID"id="virDomainLookupByID"><code>virDomainLookupByID</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByID (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int id)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>id</tt></i>:</span></td><td>the domain ID number</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new domain object or NULL in case of failure. If the domain cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_DOMAIN">VIR_ERR_NO_DOMAIN</a> error is raised.</td></tr></tbody></table></div><h3><aname="virDomainLookupByName"id="virDomainLookupByName"><code>virDomainLookupByName</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByName (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * name)<br/>
</pre><p>Try to lookup a domain on the given hypervisor based on its name.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>name for the domain</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new domain object or NULL in case of failure. If the domain cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_DOMAIN">VIR_ERR_NO_DOMAIN</a> error is raised.</td></tr></tbody></table></div><h3><aname="virDomainLookupByUUID"id="virDomainLookupByUUID"><code>virDomainLookupByUUID</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByUUID (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const unsigned char * uuid)<br/>
</pre><p>Try to lookup a domain on the given hypervisor based on its UUID.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>uuid</tt></i>:</span></td><td>the raw UUID for the domain</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new domain object or NULL in case of failure. If the domain cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_DOMAIN">VIR_ERR_NO_DOMAIN</a> error is raised.</td></tr></tbody></table></div><h3><aname="virDomainLookupByUUIDString"id="virDomainLookupByUUIDString"><code>virDomainLookupByUUIDString</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByUUIDString (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * uuidstr)<br/>
</pre><p>Try to lookup a domain on the given hypervisor based on its UUID.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>uuidstr</tt></i>:</span></td><td>the string UUID for the domain</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new domain object or NULL in case of failure. If the domain cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_DOMAIN">VIR_ERR_NO_DOMAIN</a> error is raised.</td></tr></tbody></table></div><h3><aname="virDomainMemoryPeek"id="virDomainMemoryPeek"><code>virDomainMemoryPeek</code></a></h3><preclass="programlisting">int virDomainMemoryPeek (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br/> unsigned long long start, <br/> size_t size, <br/> void * buffer, <br/> unsigned int flags)<br/>
</pre><p>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 <ahref="libvirt-libvirt.html#VIR_MEMORY_VIRTUAL">VIR_MEMORY_VIRTUAL</a> 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><spanclass="term"><i><tt>start</tt></i>:</span></td><td>start of memory to peek</td></tr><tr><td><spanclass="term"><i><tt>size</tt></i>:</span></td><td>size of memory to peek</td></tr><tr><td><spanclass="term"><i><tt>buffer</tt></i>:</span></td><td>return buffer (must be at least size bytes)</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags, see below</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success or -1 in case of failure. really 64 bits</td></tr></tbody></table></div><h3><aname="virDomainMigrate"id="virDomainMigrate"><code>virDomainMigrate</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainMigrate (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> dconn, <br/> unsigned long flags, <br/> const char * dname, <br/> const char * uri, <br/> unsigned long bandwidth)<br/>
</pre><p>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: <ahref="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Attempt a live migration. 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. Since typically the two hypervisors connect directly to each other in order to perform the migration, you may need to specify a path from the source to the destination. This is the purpose of the uri parameter. If uri is NULL, then libvirt will try to find the best method. Uri may specify the hostname or IP address of the destination host as seen from the source. Or uri may be a URI giving transport, hostname, user, port, etc. in the usual form. Refer to driver documentation for the particular URIs supported. The maximum bandwidth (in Mbps) 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>dconn</tt></i>:</span></td><td>destination host (a connection object)</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags</td></tr><tr><td><spanclass="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><spanclass="term"><i><tt>uri</tt></i>:</span></td><td>(optional) dest hostname/URI as seen from the source host</td></tr><tr><td><spanclass="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>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).</td></tr></tbody></table></div><h3><aname="virDomainPinVcpu"id="virDomainPinVcpu"><code>virDomainPinVcpu</code></a></h3><preclass="programlisting">int virDomainPinVcpu (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned int vcpu, <br/> unsigned char * cpumap, <br/> int maplen)<br/>
</pre><p>Dynamically change the real CPUs which can be allocated to a virtual CPU. This function requires privileged access to the hypervisor.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><spanclass="term"><i><tt>vcpu</tt></i>:</span></td><td>virtual CPU number</td></tr><tr><td><spanclass="term"><i><tt>cpumap</tt></i>:</span></td><td>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.</td></tr><tr><td><spanclass="term"><i><tt>maplen</tt></i>:</span></td><td>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.</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainReboot"id="virDomainReboot"><code>virDomainReboot</code></a></h3><preclass="programlisting">int virDomainReboot (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned int flags)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>extra flags for the reboot operation, not used yet</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainRef"id="virDomainRef"><code>virDomainRef</code></a></h3><preclass="programlisting">int virDomainRef (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Increment the reference count on the domain. For each additional call to this method, there shall be a corresponding call to <ahref="libvirt-libvirt.html#virDomainFree">virDomainFree</a> 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>the domain to hold a reference on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainRestore"id="virDomainRestore"><code>virDomainRestore</code></a></h3><preclass="programlisting">int virDomainRestore (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * from)<br/>
</pre><p>This method will restore a domain saved to disk by virDomainSave().</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>from</tt></i>:</span></td><td>path to the</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainResume"id="virDomainResume"><code>virDomainResume</code></a></h3><preclass="programlisting">int virDomainResume (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Resume an suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain(). This function may requires privileged access</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainSave"id="virDomainSave"><code>virDomainSave</code></a></h3><preclass="programlisting">int virDomainSave (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * to)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>to</tt></i>:</span></td><td>path for the output file</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainSetAutostart"id="virDomainSetAutostart"><code>virDomainSetAutostart</code></a></h3><preclass="programlisting">int virDomainSetAutostart (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int autostart)<br/>
</pre><p>Configure the domain to be automatically started when the host machine boots.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>autostart</tt></i>:</span></td><td>whether the domain should be automatically started 0 or 1</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virDomainSetMaxMemory"id="virDomainSetMaxMemory"><code>virDomainSetMaxMemory</code></a></h3><preclass="programlisting">int virDomainSetMaxMemory (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory)<br/>
</pre><p>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 privileged access to the hypervisor.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><spanclass="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kilobytes</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainSetMemory"id="virDomainSetMemory"><code>virDomainSetMemory</code></a></h3><preclass="programlisting">int virDomainSetMemory (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory)<br/>
</pre><p>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 privileged access to the hypervisor.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><spanclass="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kilobytes</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainSetSchedulerParameters"id="virDomainSetSchedulerParameters"><code>virDomainSetSchedulerParameters</code></a></h3><preclass="programlisting">int virDomainSetSchedulerParameters (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/><ahref="libvirt-libvirt.html#virSchedParameterPtr">virSchedParameterPtr</a> params, <br/> int nparams)<br/>
</pre><p>Change the scheduler parameters</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><spanclass="term"><i><tt>params</tt></i>:</span></td><td>pointer to scheduler parameter objects</td></tr><tr><td><spanclass="term"><i><tt>nparams</tt></i>:</span></td><td>number of scheduler parameter (this value should be same or less than the returned value nparams of virDomainGetSchedulerType)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success.</td></tr></tbody></table></div><h3><aname="virDomainSetVcpus"id="virDomainSetVcpus"><code>virDomainSetVcpus</code></a></h3><preclass="programlisting">int virDomainSetVcpus (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned int nvcpus)<br/>
</pre><p>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 privileged access to the hypervisor.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><spanclass="term"><i><tt>nvcpus</tt></i>:</span></td><td>the new number of virtual CPUs for this domain</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainShutdown"id="virDomainShutdown"><code>virDomainShutdown</code></a></h3><preclass="programlisting">int virDomainShutdown (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>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 ?</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainSuspend"id="virDomainSuspend"><code>virDomainSuspend</code></a></h3><preclass="programlisting">int virDomainSuspend (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>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 privileged access.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virDomainUndefine"id="virDomainUndefine"><code>virDomainUndefine</code></a></h3><preclass="programlisting">int virDomainUndefine (<ahref="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
</pre><p>Undefine a domain but does not stop it if it is running</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of error</td></tr></tbody></table></div><h3><aname="virEventAddHandleFunc"id="virEventAddHandleFunc"><code>virEventAddHandleFunc</code></a></h3><preclass="programlisting">typedef int (*virEventAddHandleFunc ) (int fd, <br/> int event, <br/><ahref="libvirt-libvirt.html#virEventHandleCallback">virEventHandleCallback</a> cb, <br/> void * opaque, <br/><ahref="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>fd</tt></i>:</span></td><td>file descriptor to listen on</td></tr><tr><td><spanclass="term"><i><tt>event</tt></i>:</span></td><td>bitset of events on which to fire the callback</td></tr><tr><td><spanclass="term"><i><tt>cb</tt></i>:</span></td><td>the callback to be called when an event occurrs</td></tr><tr><td><spanclass="term"><i><tt>opaque</tt></i>:</span></td><td>user data to pass to the callback</td></tr><tr><td><spanclass="term"><i><tt>ff</tt></i>:</span></td><td>the callback invoked to free opaque data blob</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a handle watch number to be used for updating and unregistering for events</td></tr></tbody></table></div><br/><h3><aname="virEventAddTimeoutFunc"id="virEventAddTimeoutFunc"><code>virEventAddTimeoutFunc</code></a></h3><preclass="programlisting">typedef int (*virEventAddTimeoutFunc ) (int timeout, <br/><ahref="libvirt-libvirt.html#virEventTimeoutCallback">virEventTimeoutCallback</a> cb, <br/> void * opaque, <br/><ahref="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>timeout</tt></i>:</span></td><td>The timeout to monitor</td></tr><tr><td><spanclass="term"><i><tt>cb</tt></i>:</span></td><td>the callback to call when timeout has expired</td></tr><tr><td><spanclass="term"><i><tt>opaque</tt></i>:</span></td><td>user data to pass to the callback</td></tr><tr><td><spanclass="term"><i><tt>ff</tt></i>:</span></td><td>the callback invoked to free opaque data blob</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a timer value</td></tr></tbody></table></div><br/><h3><aname="virEventHandleCallback"id="virEventHandleCallback"><code>virEventHandleCallback</code></a></h3><preclass="programlisting">typedef void (*virEventHandleCallback ) (int watch, <br/> int fd, <br/> int events, <br/> void * opaque)
</pre><p>Callback for receiving file handle events. The callback will be invoked once for each event which is pending.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>watch</tt></i>:</span></td><td>watch on which the event occurred</td></tr><tr><td><spanclass="term"><i><tt>fd</tt></i>:</span></td><td>file handle on which the event occurred</td></tr><tr><td><spanclass="term"><i><tt>events</tt></i>:</span></td><td>bitset of events from <ahref="libvirt-libvirt.html#virEventHandleType">virEventHandleType</a> constants</td></tr><tr><td><spanclass="term"><i><tt>opaque</tt></i>:</span></td><td>user data registered with handle</td></tr></tbody></table></div><br/><h3><aname="virEventRegisterImpl"id="virEventRegisterImpl"><code>virEventRegisterImpl</code></a></h3><preclass="programlisting">void virEventRegisterImpl (<ahref="libvirt-libvirt.html#virEventAddHandleFunc">virEventAddHandleFunc</a> addHandle, <br/><ahref="libvirt-libvirt.html#virEventUpdateHandleFunc">virEventUpdateHandleFunc</a> updateHandle, <br/><ahref="libvirt-libvirt.html#virEventRemoveHandleFunc">virEventRemoveHandleFunc</a> removeHandle, <br/><ahref="libvirt-libvirt.html#virEventAddTimeoutFunc">virEventAddTimeoutFunc</a> addTimeout, <br/><ahref="libvirt-libvirt.html#virEventUpdateTimeoutFunc">virEventUpdateTimeoutFunc</a> updateTimeout, <br/><ahref="libvirt-libvirt.html#virEventRemoveTimeoutFunc">virEventRemoveTimeoutFunc</a> removeTimeout)<br/>
</pre><p></p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>addHandle</tt></i>:</span></td><td></td></tr><tr><td><spanclass="term"><i><tt>updateHandle</tt></i>:</span></td><td></td></tr><tr><td><spanclass="term"><i><tt>removeHandle</tt></i>:</span></td><td></td></tr><tr><td><spanclass="term"><i><tt>addTimeout</tt></i>:</span></td><td></td></tr><tr><td><spanclass="term"><i><tt>updateTimeout</tt></i>:</span></td><td></td></tr><tr><td><spanclass="term"><i><tt>removeTimeout</tt></i>:</span></td><td></td></tr></tbody></table></div><h3><aname="virEventRemoveHandleFunc"id="virEventRemoveHandleFunc"><code>virEventRemoveHandleFunc</code></a></h3><preclass="programlisting">typedef int (*virEventRemoveHandleFunc) (int watch)
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>watch</tt></i>:</span></td><td>file descriptor watch to stop listening on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><br/><h3><aname="virEventRemoveTimeoutFunc"id="virEventRemoveTimeoutFunc"><code>virEventRemoveTimeoutFunc</code></a></h3><preclass="programlisting">typedef int (*virEventRemoveTimeoutFunc) (int timer)
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>timer</tt></i>:</span></td><td>the timer to remove</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><br/><h3><aname="virEventTimeoutCallback"id="virEventTimeoutCallback"><code>virEventTimeoutCallback</code></a></h3><preclass="programlisting">typedef void (*virEventTimeoutCallback ) (int timer, <br/> void * opaque)
</pre><p>callback for receiving timer events</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>timer</tt></i>:</span></td><td>timer id emitting the event</td></tr><tr><td><spanclass="term"><i><tt>opaque</tt></i>:</span></td><td>user data registered with handle</td></tr></tbody></table></div><br/><h3><aname="virEventUpdateHandleFunc"id="virEventUpdateHandleFunc"><code>virEventUpdateHandleFunc</code></a></h3><preclass="programlisting">typedef void (*virEventUpdateHandleFunc) (int watch, <br/> int event)
</pre><p>Part of the EventImpl, this user-provided callback is notified when events to listen on change</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>watch</tt></i>:</span></td><td>file descriptor watch to modify</td></tr><tr><td><spanclass="term"><i><tt>event</tt></i>:</span></td><td>new events to listen on</td></tr></tbody></table></div><br/><h3><aname="virEventUpdateTimeoutFunc"id="virEventUpdateTimeoutFunc"><code>virEventUpdateTimeoutFunc</code></a></h3><preclass="programlisting">typedef void (*virEventUpdateTimeoutFunc) (int timer, <br/> int timeout)
</pre><p>Part of the EventImpl, this user-defined callback updates an event timeout.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>timer</tt></i>:</span></td><td>the timer to modify</td></tr><tr><td><spanclass="term"><i><tt>timeout</tt></i>:</span></td><td>the new timeout value</td></tr></tbody></table></div><br/><h3><aname="virFreeCallback"id="virFreeCallback"><code>virFreeCallback</code></a></h3><preclass="programlisting">typedef void (*virFreeCallback ) (void * opaque)
</pre><p></p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>opaque</tt></i>:</span></td><td></td></tr></tbody></table></div><br/><h3><aname="virGetVersion"id="virGetVersion"><code>virGetVersion</code></a></h3><preclass="programlisting">int virGetVersion (unsigned long * libVer, <br/> const char * type, <br/> unsigned long * typeVer)<br/>
</pre><p>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 available, an error code will be returned and @typeVer will be 0.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>libVer</tt></i>:</span></td><td>return value for the library version (OUT)</td></tr><tr><td><spanclass="term"><i><tt>type</tt></i>:</span></td><td>the type of connection/driver looked at</td></tr><tr><td><spanclass="term"><i><tt>typeVer</tt></i>:</span></td><td>return value for the version of the hypervisor (OUT)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 otherwise, and values for @libVer and @typeVer have the format major * 1,000,000 + minor * 1,000 + release.</td></tr></tbody></table></div><h3><aname="virInitialize"id="virInitialize"><code>virInitialize</code></a></h3><preclass="programlisting">int virInitialize (void)<br/>
</pre><p>Initialize the library. It's better to call this routine at startup in multithreaded applications to avoid potential race when initializing the library.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of error</td></tr></tbody></table></div><h3><aname="virInterfaceCreate"id="virInterfaceCreate"><code>virInterfaceCreate</code></a></h3><preclass="programlisting">int virInterfaceCreate (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface, <br/> unsigned int flags)<br/>
</pre><p>Activate an interface (ie call "ifup")</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>pointer to a defined interface</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>and OR'ed set of extraction flags, not used yet</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of error</td></tr></tbody></table></div><h3><aname="virInterfaceDefineXML"id="virInterfaceDefineXML"><code>virInterfaceDefineXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> virInterfaceDefineXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xml, <br/> unsigned int flags)<br/>
</pre><p>Define an interface (or modify existing interface configuration)</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xml</tt></i>:</span></td><td>the XML description for the interface, preferably in UTF-8</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>and OR'ed set of extraction flags, not used yet</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>NULL in case of error, a pointer to the interface otherwise</td></tr></tbody></table></div><h3><aname="virInterfaceDestroy"id="virInterfaceDestroy"><code>virInterfaceDestroy</code></a></h3><preclass="programlisting">int virInterfaceDestroy (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface, <br/> unsigned int flags)<br/>
</pre><p>deactivate an interface (ie call "ifdown") This does not remove the interface from the config, and does not free the associated <ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> object.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>an interface object</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>and OR'ed set of extraction flags, not used yet</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virInterfaceFree"id="virInterfaceFree"><code>virInterfaceFree</code></a></h3><preclass="programlisting">int virInterfaceFree (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface)<br/>
</pre><p>Free the interface object. The interface itself is unaltered. The data structure is freed and should not be used thereafter.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>a interface object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virInterfaceGetConnect"id="virInterfaceGetConnect"><code>virInterfaceGetConnect</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virInterfaceGetConnect (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>pointer to a interface</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the <ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><aname="virInterfaceGetMACString"id="virInterfaceGetMACString"><code>virInterfaceGetMACString</code></a></h3><preclass="programlisting">const char * virInterfaceGetMACString (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface)<br/>
</pre><p>Get the MAC for a interface as string. For more information about MAC see RFC4122.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>a interface object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>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.</td></tr></tbody></table></div><h3><aname="virInterfaceGetName"id="virInterfaceGetName"><code>virInterfaceGetName</code></a></h3><preclass="programlisting">const char * virInterfaceGetName (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface)<br/>
</pre><p>Get the public name for that interface</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>a interface object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the interface object.</td></tr></tbody></table></div><h3><aname="virInterfaceGetXMLDesc"id="virInterfaceGetXMLDesc"><code>virInterfaceGetXMLDesc</code></a></h3><preclass="programlisting">char * virInterfaceGetXMLDesc (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface, <br/> unsigned int flags)<br/>
</pre><p>Provide an XML description of the interface. The description may be reused later to recreate the interface with virInterfaceCreateXML().</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>a interface object</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>and OR'ed set of extraction flags, not used yet</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div><h3><aname="virInterfaceLookupByMACString"id="virInterfaceLookupByMACString"><code>virInterfaceLookupByMACString</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> virInterfaceLookupByMACString (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * macstr)<br/>
</pre><p>Try to lookup an interface on the given hypervisor based on its MAC.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>macstr</tt></i>:</span></td><td>the MAC for the interface (null-terminated ASCII format)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new interface object or NULL in case of failure. If the interface cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_INTERFACE">VIR_ERR_NO_INTERFACE</a> error is raised.</td></tr></tbody></table></div><h3><aname="virInterfaceLookupByName"id="virInterfaceLookupByName"><code>virInterfaceLookupByName</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> virInterfaceLookupByName (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * name)<br/>
</pre><p>Try to lookup an interface on the given hypervisor based on its name.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>name for the interface</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new interface object or NULL in case of failure. If the interface cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_INTERFACE">VIR_ERR_NO_INTERFACE</a> error is raised.</td></tr></tbody></table></div><h3><aname="virInterfaceRef"id="virInterfaceRef"><code>virInterfaceRef</code></a></h3><preclass="programlisting">int virInterfaceRef (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface)<br/>
</pre><p>Increment the reference count on the interface. For each additional call to this method, there shall be a corresponding call to <ahref="libvirt-libvirt.html#virInterfaceFree">virInterfaceFree</a> 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 interface would increment the reference count.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>the interface to hold a reference on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virInterfaceUndefine"id="virInterfaceUndefine"><code>virInterfaceUndefine</code></a></h3><preclass="programlisting">int virInterfaceUndefine (<ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> iface)<br/>
</pre><p>Undefine an interface, ie remove it from the config. This does not free the associated <ahref="libvirt-libvirt.html#virInterfacePtr">virInterfacePtr</a> object.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>iface</tt></i>:</span></td><td>pointer to a defined interface</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of error</td></tr></tbody></table></div><h3><aname="virNetworkCreate"id="virNetworkCreate"><code>virNetworkCreate</code></a></h3><preclass="programlisting">int virNetworkCreate (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>Create and start a defined network. If the call succeed the network moves from the defined to the running networks pools.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>pointer to a defined network</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of error</td></tr></tbody></table></div><h3><aname="virNetworkCreateXML"id="virNetworkCreateXML"><code>virNetworkCreateXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> virNetworkCreateXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xmlDesc)<br/>
</pre><p>Create and start a new virtual network, based on an XML description similar to the one returned by virNetworkGetXMLDesc()</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xmlDesc</tt></i>:</span></td><td>an XML description of the network</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new network object or NULL in case of failure</td></tr></tbody></table></div><h3><aname="virNetworkDefineXML"id="virNetworkDefineXML"><code>virNetworkDefineXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> virNetworkDefineXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xml)<br/>
</pre><p>Define a network, but does not create it</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xml</tt></i>:</span></td><td>the XML description for the network, preferably in UTF-8</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>NULL in case of error, a pointer to the network otherwise</td></tr></tbody></table></div><h3><aname="virNetworkDestroy"id="virNetworkDestroy"><code>virNetworkDestroy</code></a></h3><preclass="programlisting">int virNetworkDestroy (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>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 <ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> object. This function may require privileged access</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNetworkFree"id="virNetworkFree"><code>virNetworkFree</code></a></h3><preclass="programlisting">int virNetworkFree (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>Free the network object. The running instance is kept alive. The data structure is freed and should not be used thereafter.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNetworkGetAutostart"id="virNetworkGetAutostart"><code>virNetworkGetAutostart</code></a></h3><preclass="programlisting">int virNetworkGetAutostart (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br/> int * autostart)<br/>
</pre><p>Provides a boolean value indicating whether the network configured to be automatically started when the host machine boots.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>autostart</tt></i>:</span></td><td>the value returned</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virNetworkGetBridgeName"id="virNetworkGetBridgeName"><code>virNetworkGetBridgeName</code></a></h3><preclass="programlisting">char * virNetworkGetBridgeName (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>Provides a bridge interface name to which a domain may connect a network interface in order to join the network.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated interface name, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div><h3><aname="virNetworkGetConnect"id="virNetworkGetConnect"><code>virNetworkGetConnect</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virNetworkGetConnect (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> net)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>net</tt></i>:</span></td><td>pointer to a network</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the <ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><aname="virNetworkGetName"id="virNetworkGetName"><code>virNetworkGetName</code></a></h3><preclass="programlisting">const char * virNetworkGetName (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>Get the public name for that network</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the name or NULL, the string need not be deallocated its lifetime will be the same as the network object.</td></tr></tbody></table></div><h3><aname="virNetworkGetUUID"id="virNetworkGetUUID"><code>virNetworkGetUUID</code></a></h3><preclass="programlisting">int virNetworkGetUUID (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br/> unsigned char * uuid)<br/>
</pre><p>Get the UUID for a network</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>uuid</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#VIR_UUID_BUFLEN">VIR_UUID_BUFLEN</a> bytes array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virNetworkGetUUIDString"id="virNetworkGetUUIDString"><code>virNetworkGetUUIDString</code></a></h3><preclass="programlisting">int virNetworkGetUUIDString (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br/> char * buf)<br/>
</pre><p>Get the UUID for a network as string. For more information about UUID see RFC4122.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>buf</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#VIR_UUID_STRING_BUFLEN">VIR_UUID_STRING_BUFLEN</a> bytes array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virNetworkGetXMLDesc"id="virNetworkGetXMLDesc"><code>virNetworkGetXMLDesc</code></a></h3><preclass="programlisting">char * virNetworkGetXMLDesc (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br/> int flags)<br/>
</pre><p>Provide an XML description of the network. The description may be reused later to relaunch the network with virNetworkCreateXML().</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>and OR'ed set of extraction flags, not used yet</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a 0 terminated UTF-8 encoded XML instance, or NULL in case of error. the caller must free() the returned value.</td></tr></tbody></table></div><h3><aname="virNetworkLookupByName"id="virNetworkLookupByName"><code>virNetworkLookupByName</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> virNetworkLookupByName (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * name)<br/>
</pre><p>Try to lookup a network on the given hypervisor based on its name.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>name for the network</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new network object or NULL in case of failure. If the network cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_NETWORK">VIR_ERR_NO_NETWORK</a> error is raised.</td></tr></tbody></table></div><h3><aname="virNetworkLookupByUUID"id="virNetworkLookupByUUID"><code>virNetworkLookupByUUID</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> virNetworkLookupByUUID (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const unsigned char * uuid)<br/>
</pre><p>Try to lookup a network on the given hypervisor based on its UUID.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>uuid</tt></i>:</span></td><td>the raw UUID for the network</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new network object or NULL in case of failure. If the network cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_NETWORK">VIR_ERR_NO_NETWORK</a> error is raised.</td></tr></tbody></table></div><h3><aname="virNetworkLookupByUUIDString"id="virNetworkLookupByUUIDString"><code>virNetworkLookupByUUIDString</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> virNetworkLookupByUUIDString (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * uuidstr)<br/>
</pre><p>Try to lookup a network on the given hypervisor based on its UUID.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>uuidstr</tt></i>:</span></td><td>the string UUID for the network</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a new network object or NULL in case of failure. If the network cannot be found, then <ahref="libvirt-virterror.html#VIR_ERR_NO_NETWORK">VIR_ERR_NO_NETWORK</a> error is raised.</td></tr></tbody></table></div><h3><aname="virNetworkRef"id="virNetworkRef"><code>virNetworkRef</code></a></h3><preclass="programlisting">int virNetworkRef (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>Increment the reference count on the network. For each additional call to this method, there shall be a corresponding call to <ahref="libvirt-libvirt.html#virNetworkFree">virNetworkFree</a> 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>the network to hold a reference on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNetworkSetAutostart"id="virNetworkSetAutostart"><code>virNetworkSetAutostart</code></a></h3><preclass="programlisting">int virNetworkSetAutostart (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br/> int autostart)<br/>
</pre><p>Configure the network to be automatically started when the host machine boots.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><spanclass="term"><i><tt>autostart</tt></i>:</span></td><td>whether the network should be automatically started 0 or 1</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 in case of success</td></tr></tbody></table></div><h3><aname="virNetworkUndefine"id="virNetworkUndefine"><code>virNetworkUndefine</code></a></h3><preclass="programlisting">int virNetworkUndefine (<ahref="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br/>
</pre><p>Undefine a network but does not stop it if it is running</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>network</tt></i>:</span></td><td>pointer to a defined network</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of error</td></tr></tbody></table></div><h3><aname="virNodeDeviceCreateXML"id="virNodeDeviceCreateXML"><code>virNodeDeviceCreateXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> virNodeDeviceCreateXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xmlDesc, <br/> unsigned int flags)<br/>
</pre><p>Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the device to be created</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>callers should always pass 0</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a node device object if successful, NULL in case of failure</td></tr></tbody></table></div><h3><aname="virNodeDeviceDestroy"id="virNodeDeviceDestroy"><code>virNodeDeviceDestroy</code></a></h3><preclass="programlisting">int virNodeDeviceDestroy (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>Destroy the device object. The virtual device is removed from the host operating system. This function may require privileged access</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>a device object</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNodeDeviceDettach"id="virNodeDeviceDettach"><code>virNodeDeviceDettach</code></a></h3><preclass="programlisting">int virNodeDeviceDettach (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNodeDeviceFree"id="virNodeDeviceFree"><code>virNodeDeviceFree</code></a></h3><preclass="programlisting">int virNodeDeviceFree (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>Drops a reference to the node device, freeing it if this was the last reference.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the 0 for success, -1 for error.</td></tr></tbody></table></div><h3><aname="virNodeDeviceGetName"id="virNodeDeviceGetName"><code>virNodeDeviceGetName</code></a></h3><preclass="programlisting">const char * virNodeDeviceGetName (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>Just return the device name</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the device name or NULL in case of error</td></tr></tbody></table></div><h3><aname="virNodeDeviceGetParent"id="virNodeDeviceGetParent"><code>virNodeDeviceGetParent</code></a></h3><preclass="programlisting">const char * virNodeDeviceGetParent (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>Accessor for the parent of the device</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the name of the device's parent, or NULL if the device has no parent.</td></tr></tbody></table></div><h3><aname="virNodeDeviceGetXMLDesc"id="virNodeDeviceGetXMLDesc"><code>virNodeDeviceGetXMLDesc</code></a></h3><preclass="programlisting">char * virNodeDeviceGetXMLDesc (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev, <br/> unsigned int flags)<br/>
</pre><p>Fetch an XML document describing all aspects of the device.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags for XML generation (unused, pass 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document, or NULL on error</td></tr></tbody></table></div><h3><aname="virNodeDeviceListCaps"id="virNodeDeviceListCaps"><code>virNodeDeviceListCaps</code></a></h3><preclass="programlisting">int virNodeDeviceListCaps (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>Lists the names of the capabilities supported by the device.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of capability names</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of capability names listed in @names.</td></tr></tbody></table></div><h3><aname="virNodeDeviceLookupByName"id="virNodeDeviceLookupByName"><code>virNodeDeviceLookupByName</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> virNodeDeviceLookupByName (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * name)<br/>
</pre><p>Lookup a node device by its name.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>unique device name</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a <ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> if found, NULL otherwise.</td></tr></tbody></table></div><h3><aname="virNodeDeviceNumOfCaps"id="virNodeDeviceNumOfCaps"><code>virNodeDeviceNumOfCaps</code></a></h3><preclass="programlisting">int virNodeDeviceNumOfCaps (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>Accessor for the number of capabilities supported by the device.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of capabilities supported by the device.</td></tr></tbody></table></div><h3><aname="virNodeDeviceReAttach"id="virNodeDeviceReAttach"><code>virNodeDeviceReAttach</code></a></h3><preclass="programlisting">int virNodeDeviceReAttach (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNodeDeviceRef"id="virNodeDeviceRef"><code>virNodeDeviceRef</code></a></h3><preclass="programlisting">int virNodeDeviceRef (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>Increment the reference count on the dev. For each additional call to this method, there shall be a corresponding call to <ahref="libvirt-libvirt.html#virNodeDeviceFree">virNodeDeviceFree</a> 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>the dev to hold a reference on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNodeDeviceReset"id="virNodeDeviceReset"><code>virNodeDeviceReset</code></a></h3><preclass="programlisting">int virNodeDeviceReset (<ahref="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNodeGetCellsFreeMemory"id="virNodeGetCellsFreeMemory"><code>virNodeGetCellsFreeMemory</code></a></h3><preclass="programlisting">int virNodeGetCellsFreeMemory (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> unsigned long long * freeMems, <br/> int startCell, <br/> int maxCells)<br/>
</pre><p>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 kilobytes 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>freeMems</tt></i>:</span></td><td>pointer to the array of unsigned long long</td></tr><tr><td><spanclass="term"><i><tt>startCell</tt></i>:</span></td><td>index of first cell to return freeMems info on.</td></tr><tr><td><spanclass="term"><i><tt>maxCells</tt></i>:</span></td><td>Maximum number of cells for which freeMems information can be returned.</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of entries filled in freeMems, or -1 in case of error.</td></tr></tbody></table></div><h3><aname="virNodeGetFreeMemory"id="virNodeGetFreeMemory"><code>virNodeGetFreeMemory</code></a></h3><preclass="programlisting">unsigned long long virNodeGetFreeMemory (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
</pre><p>provides the free memory available on the Node Note: most libvirt APIs provide memory sizes in kilobytes, but in this function the returned value is in bytes. Divide by 1024 as necessary.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the available free memory in bytes or 0 in case of error</td></tr></tbody></table></div><h3><aname="virNodeGetInfo"id="virNodeGetInfo"><code>virNodeGetInfo</code></a></h3><preclass="programlisting">int virNodeGetInfo (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/><ahref="libvirt-libvirt.html#virNodeInfoPtr">virNodeInfoPtr</a> info)<br/>
</pre><p>Extract hardware information about the node.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#virNodeInfo">virNodeInfo</a> structure allocated by the user</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virNodeGetSecurityModel"id="virNodeGetSecurityModel"><code>virNodeGetSecurityModel</code></a></h3><preclass="programlisting">int virNodeGetSecurityModel (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/><ahref="libvirt-libvirt.html#virSecurityModelPtr">virSecurityModelPtr</a> secmodel)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><spanclass="term"><i><tt>secmodel</tt></i>:</span></td><td>pointer to a <ahref="libvirt-libvirt.html#virSecurityModel">virSecurityModel</a> structure</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure</td></tr></tbody></table></div><h3><aname="virNodeListDevices"id="virNodeListDevices"><code>virNodeListDevices</code></a></h3><preclass="programlisting">int virNodeListDevices (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * cap, <br/> char ** const names, <br/> int maxnames, <br/> unsigned int flags)<br/>
</pre><p>Collect the list of node devices, and store their names in @names If the optional 'cap' argument is non-NULL, then the count will be restricted to devices with the specified capability</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>cap</tt></i>:</span></td><td>capability name</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of node device names</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags (unused, pass 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of node devices found or -1 in case of error</td></tr></tbody></table></div><h3><aname="virNodeNumOfDevices"id="virNodeNumOfDevices"><code>virNodeNumOfDevices</code></a></h3><preclass="programlisting">int virNodeNumOfDevices (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * cap, <br/> unsigned int flags)<br/>
</pre><p>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</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>cap</tt></i>:</span></td><td>capability name</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags (unused, pass 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of node devices or -1 in case of error</td></tr></tbody></table></div><h3><aname="virStoragePoolBuild"id="virStoragePoolBuild"><code>virStoragePoolBuild</code></a></h3><preclass="programlisting">int virStoragePoolBuild (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)<br/>
</pre><p>Build the underlying storage pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 upon failure</td></tr></tbody></table></div><h3><aname="virStoragePoolCreate"id="virStoragePoolCreate"><code>virStoragePoolCreate</code></a></h3><preclass="programlisting">int virStoragePoolCreate (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)<br/>
</pre><p>Starts an inactive storage pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 if it could not be started</td></tr></tbody></table></div><h3><aname="virStoragePoolCreateXML"id="virStoragePoolCreateXML"><code>virStoragePoolCreateXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolCreateXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xmlDesc, <br/> unsigned int flags)<br/>
</pre><p>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</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xmlDesc</tt></i>:</span></td><td>XML description for new pool</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if creation failed</td></tr></tbody></table></div><h3><aname="virStoragePoolDefineXML"id="virStoragePoolDefineXML"><code>virStoragePoolDefineXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolDefineXML (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xml, <br/> unsigned int flags)<br/>
</pre><p>Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>xml</tt></i>:</span></td><td>XML description for new pool</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if creation failed</td></tr></tbody></table></div><h3><aname="virStoragePoolDelete"id="virStoragePoolDelete"><code>virStoragePoolDelete</code></a></h3><preclass="programlisting">int virStoragePoolDelete (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)<br/>
</pre><p>Delete the underlying pool resources. This is a non-recoverable operation. The <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object itself is not free'd.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags for obliteration process</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 if it could not be obliterate</td></tr></tbody></table></div><h3><aname="virStoragePoolDestroy"id="virStoragePoolDestroy"><code>virStoragePoolDestroy</code></a></h3><preclass="programlisting">int virStoragePoolDestroy (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br/>
</pre><p>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 <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 if it could not be destroyed</td></tr></tbody></table></div><h3><aname="virStoragePoolFree"id="virStoragePoolFree"><code>virStoragePoolFree</code></a></h3><preclass="programlisting">int virStoragePoolFree (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br/>
</pre><p>Free a storage pool object, releasing all memory associated with it. Does not change the state of the pool on the host.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 if it could not be free'd.</td></tr></tbody></table></div><h3><aname="virStoragePoolGetAutostart"id="virStoragePoolGetAutostart"><code>virStoragePoolGetAutostart</code></a></h3><preclass="programlisting">int virStoragePoolGetAutostart (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> int * autostart)<br/>
</pre><p>Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot time</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>autostart</tt></i>:</span></td><td>location in which to store autostart flag</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><aname="virStoragePoolGetConnect"id="virStoragePoolGetConnect"><code>virStoragePoolGetConnect</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virStoragePoolGetConnect (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to a pool</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the <ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><aname="virStoragePoolGetInfo"id="virStoragePoolGetInfo"><code>virStoragePoolGetInfo</code></a></h3><preclass="programlisting">int virStoragePoolGetInfo (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/><ahref="libvirt-libvirt.html#virStoragePoolInfoPtr">virStoragePoolInfoPtr</a> info)<br/>
</pre><p>Get volatile information about the storage pool such as free space / usage summary</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>info</tt></i>:</span></td><td>pointer at which to store info</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on failure.</td></tr></tbody></table></div><h3><aname="virStoragePoolGetName"id="virStoragePoolGetName"><code>virStoragePoolGetName</code></a></h3><preclass="programlisting">const char * virStoragePoolGetName (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br/>
</pre><p>Fetch the locally unique name of the storage pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the name of the pool, or NULL on error</td></tr></tbody></table></div><h3><aname="virStoragePoolGetUUID"id="virStoragePoolGetUUID"><code>virStoragePoolGetUUID</code></a></h3><preclass="programlisting">int virStoragePoolGetUUID (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned char * uuid)<br/>
</pre><p>Fetch the globally unique ID of the storage pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>uuid</tt></i>:</span></td><td>buffer of <ahref="libvirt-libvirt.html#VIR_UUID_BUFLEN">VIR_UUID_BUFLEN</a> bytes in size</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error;</td></tr></tbody></table></div><h3><aname="virStoragePoolGetUUIDString"id="virStoragePoolGetUUIDString"><code>virStoragePoolGetUUIDString</code></a></h3><preclass="programlisting">int virStoragePoolGetUUIDString (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> char * buf)<br/>
</pre><p>Fetch the globally unique ID of the storage pool as a string</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>buf</tt></i>:</span></td><td>buffer of <ahref="libvirt-libvirt.html#VIR_UUID_STRING_BUFLEN">VIR_UUID_STRING_BUFLEN</a> bytes in size</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error;</td></tr></tbody></table></div><h3><aname="virStoragePoolGetXMLDesc"id="virStoragePoolGetXMLDesc"><code>virStoragePoolGetXMLDesc</code></a></h3><preclass="programlisting">char * virStoragePoolGetXMLDesc (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)<br/>
</pre><p>Fetch an XML document describing all aspects of the storage pool. This is suitable for later feeding back into the <ahref="libvirt-libvirt.html#virStoragePoolCreateXML">virStoragePoolCreateXML</a> method.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags for XML format options (set of virDomainXMLFlags)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a XML document, or NULL on error</td></tr></tbody></table></div><h3><aname="virStoragePoolListVolumes"id="virStoragePoolListVolumes"><code>virStoragePoolListVolumes</code></a></h3><preclass="programlisting">int virStoragePoolListVolumes (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> char ** const names, <br/> int maxnames)<br/>
</pre><p>Fetch list of storage volume names, limiting to at most maxnames.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>names</tt></i>:</span></td><td>array in which to storage volume names</td></tr><tr><td><spanclass="term"><i><tt>maxnames</tt></i>:</span></td><td>size of names array</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of names fetched, or -1 on error</td></tr></tbody></table></div><h3><aname="virStoragePoolLookupByName"id="virStoragePoolLookupByName"><code>virStoragePoolLookupByName</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolLookupByName (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * name)<br/>
</pre><p>Fetch a storage pool based on its unique name</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>name of pool to fetch</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if no matching pool is found</td></tr></tbody></table></div><h3><aname="virStoragePoolLookupByUUID"id="virStoragePoolLookupByUUID"><code>virStoragePoolLookupByUUID</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolLookupByUUID (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const unsigned char * uuid)<br/>
</pre><p>Fetch a storage pool based on its globally unique id</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>uuid</tt></i>:</span></td><td>globally unique id of pool to fetch</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if no matching pool is found</td></tr></tbody></table></div><h3><aname="virStoragePoolLookupByUUIDString"id="virStoragePoolLookupByUUIDString"><code>virStoragePoolLookupByUUIDString</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolLookupByUUIDString (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * uuidstr)<br/>
</pre><p>Fetch a storage pool based on its globally unique id</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>uuidstr</tt></i>:</span></td><td>globally unique id of pool to fetch</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if no matching pool is found</td></tr></tbody></table></div><h3><aname="virStoragePoolLookupByVolume"id="virStoragePoolLookupByVolume"><code>virStoragePoolLookupByVolume</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolLookupByVolume (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br/>
</pre><p>Fetch a storage pool which contains a particular volume</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a <ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if no matching pool is found</td></tr></tbody></table></div><h3><aname="virStoragePoolNumOfVolumes"id="virStoragePoolNumOfVolumes"><code>virStoragePoolNumOfVolumes</code></a></h3><preclass="programlisting">int virStoragePoolNumOfVolumes (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br/>
</pre><p>Fetch the number of storage volumes within a pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the number of storage pools, or -1 on failure</td></tr></tbody></table></div><h3><aname="virStoragePoolRef"id="virStoragePoolRef"><code>virStoragePoolRef</code></a></h3><preclass="programlisting">int virStoragePoolRef (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br/>
</pre><p>Increment the reference count on the pool. For each additional call to this method, there shall be a corresponding call to <ahref="libvirt-libvirt.html#virStoragePoolFree">virStoragePoolFree</a> 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>the pool to hold a reference on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><aname="virStoragePoolRefresh"id="virStoragePoolRefresh"><code>virStoragePoolRefresh</code></a></h3><preclass="programlisting">int virStoragePoolRefresh (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> unsigned int flags)<br/>
</pre><p>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</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags to control refresh behaviour (currently unused, use 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the volume list was refreshed, -1 on failure</td></tr></tbody></table></div><h3><aname="virStoragePoolSetAutostart"id="virStoragePoolSetAutostart"><code>virStoragePoolSetAutostart</code></a></h3><preclass="programlisting">int virStoragePoolSetAutostart (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> int autostart)<br/>
</pre><p>Sets the autostart flag</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>autostart</tt></i>:</span></td><td>new flag setting</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><aname="virStoragePoolUndefine"id="virStoragePoolUndefine"><code>virStoragePoolUndefine</code></a></h3><preclass="programlisting">int virStoragePoolUndefine (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br/>
</pre><p>Undefine an inactive storage pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><aname="virStorageVolCreateXML"id="virStorageVolCreateXML"><code>virStorageVolCreateXML</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolCreateXML (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> const char * xmldesc, <br/> unsigned int flags)<br/>
</pre><p>Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>xmldesc</tt></i>:</span></td><td>description of volume to create</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags for creation (unused, pass 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume, or NULL on error</td></tr></tbody></table></div><h3><aname="virStorageVolCreateXMLFrom"id="virStorageVolCreateXMLFrom"><code>virStorageVolCreateXMLFrom</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolCreateXMLFrom (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> const char * xmldesc, <br/><ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> clonevol, <br/> unsigned int flags)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to parent pool for the new volume</td></tr><tr><td><spanclass="term"><i><tt>xmldesc</tt></i>:</span></td><td>description of volume to create</td></tr><tr><td><spanclass="term"><i><tt>clonevol</tt></i>:</span></td><td>storage volume to use as input</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags for creation (unused, pass 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume, or NULL on error</td></tr></tbody></table></div><h3><aname="virStorageVolDelete"id="virStorageVolDelete"><code>virStorageVolDelete</code></a></h3><preclass="programlisting">int virStorageVolDelete (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br/> unsigned int flags)<br/>
</pre><p>Delete the storage volume from the pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><aname="virStorageVolFree"id="virStorageVolFree"><code>virStorageVolFree</code></a></h3><preclass="programlisting">int virStorageVolFree (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br/>
</pre><p>Release the storage volume handle. The underlying storage volume continues to exist.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><aname="virStorageVolGetConnect"id="virStorageVolGetConnect"><code>virStorageVolGetConnect</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virStorageVolGetConnect (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br/>
</pre><p>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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to a pool</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the <ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><aname="virStorageVolGetInfo"id="virStorageVolGetInfo"><code>virStorageVolGetInfo</code></a></h3><preclass="programlisting">int virStorageVolGetInfo (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br/><ahref="libvirt-libvirt.html#virStorageVolInfoPtr">virStorageVolInfoPtr</a> info)<br/>
</pre><p>Fetches volatile information about the storage volume such as its current allocation</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>info</tt></i>:</span></td><td>pointer at which to store info</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on failure</td></tr></tbody></table></div><h3><aname="virStorageVolGetKey"id="virStorageVolGetKey"><code>virStorageVolGetKey</code></a></h3><preclass="programlisting">const char * virStorageVolGetKey (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br/>
</pre><p>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</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the volume key, or NULL on error</td></tr></tbody></table></div><h3><aname="virStorageVolGetName"id="virStorageVolGetName"><code>virStorageVolGetName</code></a></h3><preclass="programlisting">const char * virStorageVolGetName (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br/>
</pre><p>Fetch the storage volume name. This is unique within the scope of a pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the volume name, or NULL on error</td></tr></tbody></table></div><h3><aname="virStorageVolGetPath"id="virStorageVolGetPath"><code>virStorageVolGetPath</code></a></h3><preclass="programlisting">char * virStorageVolGetPath (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br/>
</pre><p>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</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume path, or NULL on error</td></tr></tbody></table></div><h3><aname="virStorageVolGetXMLDesc"id="virStorageVolGetXMLDesc"><code>virStorageVolGetXMLDesc</code></a></h3><preclass="programlisting">char * virStorageVolGetXMLDesc (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br/> unsigned int flags)<br/>
</pre><p>Fetch an XML document describing all aspects of the storage volume</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><spanclass="term"><i><tt>flags</tt></i>:</span></td><td>flags for XML generation (unused, pass 0)</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document, or NULL on error</td></tr></tbody></table></div><h3><aname="virStorageVolLookupByKey"id="virStorageVolLookupByKey"><code>virStorageVolLookupByKey</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolLookupByKey (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * key)<br/>
</pre><p>Fetch a pointer to a storage volume based on its globally unique key</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>key</tt></i>:</span></td><td>globally unique key</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a storage volume, or NULL if not found / error</td></tr></tbody></table></div><h3><aname="virStorageVolLookupByName"id="virStorageVolLookupByName"><code>virStorageVolLookupByName</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolLookupByName (<ahref="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br/> const char * name)<br/>
</pre><p>Fetch a pointer to a storage volume based on its name within a pool</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><spanclass="term"><i><tt>name</tt></i>:</span></td><td>name of storage volume</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a storage volume, or NULL if not found / error</td></tr></tbody></table></div><h3><aname="virStorageVolLookupByPath"id="virStorageVolLookupByPath"><code>virStorageVolLookupByPath</code></a></h3><preclass="programlisting"><ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolLookupByPath (<ahref="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * path)<br/>
</pre><p>Fetch a pointer to a storage volume based on its locally (host) unique path</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><spanclass="term"><i><tt>path</tt></i>:</span></td><td>locally unique path</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>a storage volume, or NULL if not found / error</td></tr></tbody></table></div><h3><aname="virStorageVolRef"id="virStorageVolRef"><code>virStorageVolRef</code></a></h3><preclass="programlisting">int virStorageVolRef (<ahref="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br/>
</pre><p>Increment the reference count on the vol. For each additional call to this method, there shall be a corresponding call to <ahref="libvirt-libvirt.html#virStorageVolFree">virStorageVolFree</a> 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.</p><divclass="variablelist"><tableborder="0"><colalign="left"/><tbody><tr><td><spanclass="term"><i><tt>vol</tt></i>:</span></td><td>the vol to hold a reference on</td></tr><tr><td><spanclass="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of failure.</td></tr></tbody></table></div></div></div><divid="footer"><pid="sponsor">
Sponsored by:<br/><ahref="http://et.redhat.com/"><imgsrc="../et.png"alt="Project sponsored by Red Hat Emerging Technology"/></a></p></div></body></html>