818
902
</pre></div><h3><a name="virTypedParameterFlags" id="virTypedParameterFlags"><code>virTypedParameterFlags</code></a></h3><div class="api"><pre>enum virTypedParameterFlags {
819
903
</pre><table><tr><td><a name="VIR_TYPED_PARAM_STRING_OKAY" id="VIR_TYPED_PARAM_STRING_OKAY">VIR_TYPED_PARAM_STRING_OKAY</a></td><td> = </td><td>4</td></tr></table><pre>}
820
904
</pre></div><h3><a name="virTypedParameterType" id="virTypedParameterType"><code>virTypedParameterType</code></a></h3><div class="api"><pre>enum virTypedParameterType {
821
</pre><table><tr><td><a name="VIR_TYPED_PARAM_INT" id="VIR_TYPED_PARAM_INT">VIR_TYPED_PARAM_INT</a></td><td> = </td><td>1</td><td> : integer case</td></tr><tr><td><a name="VIR_TYPED_PARAM_UINT" id="VIR_TYPED_PARAM_UINT">VIR_TYPED_PARAM_UINT</a></td><td> = </td><td>2</td><td> : unsigned integer case</td></tr><tr><td><a name="VIR_TYPED_PARAM_LLONG" id="VIR_TYPED_PARAM_LLONG">VIR_TYPED_PARAM_LLONG</a></td><td> = </td><td>3</td><td> : long long case</td></tr><tr><td><a name="VIR_TYPED_PARAM_ULLONG" id="VIR_TYPED_PARAM_ULLONG">VIR_TYPED_PARAM_ULLONG</a></td><td> = </td><td>4</td><td> : unsigned long long case</td></tr><tr><td><a name="VIR_TYPED_PARAM_DOUBLE" id="VIR_TYPED_PARAM_DOUBLE">VIR_TYPED_PARAM_DOUBLE</a></td><td> = </td><td>5</td><td> : double case</td></tr><tr><td><a name="VIR_TYPED_PARAM_BOOLEAN" id="VIR_TYPED_PARAM_BOOLEAN">VIR_TYPED_PARAM_BOOLEAN</a></td><td> = </td><td>6</td><td> : boolean(character) case</td></tr><tr><td><a name="VIR_TYPED_PARAM_STRING" id="VIR_TYPED_PARAM_STRING">VIR_TYPED_PARAM_STRING</a></td><td> = </td><td>7</td><td> : string case</td></tr></table><pre>}
905
</pre><table><tr><td><a name="VIR_TYPED_PARAM_INT" id="VIR_TYPED_PARAM_INT">VIR_TYPED_PARAM_INT</a></td><td> = </td><td>1</td><td> : integer case</td></tr><tr><td><a name="VIR_TYPED_PARAM_UINT" id="VIR_TYPED_PARAM_UINT">VIR_TYPED_PARAM_UINT</a></td><td> = </td><td>2</td><td> : unsigned integer case</td></tr><tr><td><a name="VIR_TYPED_PARAM_LLONG" id="VIR_TYPED_PARAM_LLONG">VIR_TYPED_PARAM_LLONG</a></td><td> = </td><td>3</td><td> : long long case</td></tr><tr><td><a name="VIR_TYPED_PARAM_ULLONG" id="VIR_TYPED_PARAM_ULLONG">VIR_TYPED_PARAM_ULLONG</a></td><td> = </td><td>4</td><td> : unsigned long long case</td></tr><tr><td><a name="VIR_TYPED_PARAM_DOUBLE" id="VIR_TYPED_PARAM_DOUBLE">VIR_TYPED_PARAM_DOUBLE</a></td><td> = </td><td>5</td><td> : double case</td></tr><tr><td><a name="VIR_TYPED_PARAM_BOOLEAN" id="VIR_TYPED_PARAM_BOOLEAN">VIR_TYPED_PARAM_BOOLEAN</a></td><td> = </td><td>6</td><td> : boolean(character) case</td></tr><tr><td><a name="VIR_TYPED_PARAM_STRING" id="VIR_TYPED_PARAM_STRING">VIR_TYPED_PARAM_STRING</a></td><td> = </td><td>7</td><td> : string case</td></tr><tr><td><a name="VIR_TYPED_PARAM_LAST" id="VIR_TYPED_PARAM_LAST">VIR_TYPED_PARAM_LAST</a></td><td> = </td><td>8</td></tr></table><pre>}
822
906
</pre></div><h3><a name="virVcpuInfo" id="virVcpuInfo"><code>virVcpuInfo</code></a></h3><div class="api"><pre>struct virVcpuInfo{
823
907
</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 <a href="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>
825
909
</pre></div><h3><a name="virVcpuState" id="virVcpuState"><code>virVcpuState</code></a></h3><div class="api"><pre>enum virVcpuState {
826
</pre><table><tr><td><a name="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><a name="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><a name="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>}
910
</pre><table><tr><td><a name="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><a name="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><a name="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><tr><td><a name="VIR_VCPU_LAST" id="VIR_VCPU_LAST">VIR_VCPU_LAST</a></td><td> = </td><td>3</td></tr></table><pre>}
827
911
</pre></div><h3><a name="functions" id="functions">Functions</a></h3><h3><a name="virConnectAuthCallbackPtr" id="virConnectAuthCallbackPtr"><code>virConnectAuthCallbackPtr</code></a></h3><pre class="programlisting">typedef int (*virConnectAuthCallbackPtr) (<a href="libvirt-libvirt.html#virConnectCredentialPtr">virConnectCredentialPtr</a> cred, <br /> unsigned int ncred, <br /> void * cbdata)
828
912
</pre><p>When authentication requires one or more interactions, this callback is invoked. For each interaction supplied, data must be gathered from the user and filled in to the 'result' and 'resultlen' fields. If an interaction cannot be filled, fill in NULL and 0.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>cred</tt></i>:</span></td><td>list of <a href="libvirt-libvirt.html#virConnectCredential">virConnectCredential</a> object to fetch from user</td></tr><tr><td><span class="term"><i><tt>ncred</tt></i>:</span></td><td>size of cred list</td></tr><tr><td><span class="term"><i><tt>cbdata</tt></i>:</span></td><td>opaque data passed to <a href="libvirt-libvirt.html#virConnectOpenAuth">virConnectOpenAuth</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if all interactions were filled, or -1 upon error</td></tr></tbody></table></div><br /><h3><a name="virConnectBaselineCPU" id="virConnectBaselineCPU"><code>virConnectBaselineCPU</code></a></h3><pre class="programlisting">char * virConnectBaselineCPU (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char ** xmlCPUs, <br /> unsigned int ncpus, <br /> unsigned int flags)<br />
829
</pre><p>Computes the most feature-rich CPU which is compatible with all given host CPUs.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>xmlCPUs</tt></i>:</span></td><td>array of XML descriptions of host CPUs</td></tr><tr><td><span class="term"><i><tt>ncpus</tt></i>:</span></td><td>number of CPUs in xmlCPUs</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>fine-tuning flags, currently unused, pass 0.</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>XML description of the computed CPU or NULL on error.</td></tr></tbody></table></div><h3><a name="virConnectClose" id="virConnectClose"><code>virConnectClose</code></a></h3><pre class="programlisting">int virConnectClose (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
913
</pre><p>Computes the most feature-rich CPU which is compatible with all given host CPUs.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>xmlCPUs</tt></i>:</span></td><td>array of XML descriptions of host CPUs</td></tr><tr><td><span class="term"><i><tt>ncpus</tt></i>:</span></td><td>number of CPUs in xmlCPUs</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>XML description of the computed CPU or NULL on error.</td></tr></tbody></table></div><h3><a name="virConnectClose" id="virConnectClose"><code>virConnectClose</code></a></h3><pre class="programlisting">int virConnectClose (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
830
914
</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. Connections are reference counted; the count is explicitly increased by the initial open (<a href="libvirt-libvirt.html#virConnectOpen">virConnectOpen</a>, <a href="libvirt-libvirt.html#virConnectOpenAuth">virConnectOpenAuth</a>, and the like) as well as <a href="libvirt-libvirt.html#virConnectRef">virConnectRef</a>; it is also temporarily increased by other API that depend on the connection remaining alive. The open and every <a href="libvirt-libvirt.html#virConnectRef">virConnectRef</a> call should have a matching <a href="libvirt-libvirt.html#virConnectClose">virConnectClose</a>, and all other references will be released after the corresponding operation completes.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of remaining references on success (positive implies that some other call still has a reference open, 0 implies that no references remain and the connection is closed), or -1 on failure. It is possible for the last <a href="libvirt-libvirt.html#virConnectClose">virConnectClose</a> to return a positive value if some other object still has a temporary reference to the connection, but the application should not try to further use a connection after the <a href="libvirt-libvirt.html#virConnectClose">virConnectClose</a> that matches the initial open.</td></tr></tbody></table></div><h3><a name="virConnectCompareCPU" id="virConnectCompareCPU"><code>virConnectCompareCPU</code></a></h3><pre class="programlisting">int virConnectCompareCPU (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
831
</pre><p>Compares the given CPU description with the host CPU</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>XML describing the CPU to compare with host CPU</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>comparison result according to enum <a href="libvirt-libvirt.html#virCPUCompareResult">virCPUCompareResult</a></td></tr></tbody></table></div><h3><a name="virConnectDomainEventBlockJobCallback" id="virConnectDomainEventBlockJobCallback"><code>virConnectDomainEventBlockJobCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventBlockJobCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> int type, <br /> int status, <br /> void * opaque)
915
</pre><p>Compares the given CPU description with the host CPU</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>XML describing the CPU to compare with host CPU</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>comparison result according to enum <a href="libvirt-libvirt.html#virCPUCompareResult">virCPUCompareResult</a></td></tr></tbody></table></div><h3><a name="virConnectDomainEventBlockJobCallback" id="virConnectDomainEventBlockJobCallback"><code>virConnectDomainEventBlockJobCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventBlockJobCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> int type, <br /> int status, <br /> void * opaque)
832
916
</pre><p>The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_BLOCK_JOB">VIR_DOMAIN_EVENT_ID_BLOCK_JOB</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>type of block job (<a href="libvirt-libvirt.html#virDomainBlockJobType">virDomainBlockJobType</a>)</td></tr><tr><td><span class="term"><i><tt>status</tt></i>:</span></td><td>final status of the operation (<a href="libvirt-libvirt.html#virConnectDomainEventBlockJobStatus">virConnectDomainEventBlockJobStatus</a>)</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td></td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventCallback" id="virConnectDomainEventCallback"><code>virConnectDomainEventCallback</code></a></h3><pre class="programlisting">typedef int (*virConnectDomainEventCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int event, <br /> int detail, <br /> void * opaque)
833
917
</pre><p>A callback function to be registered, and called when a domain event occurs</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>The domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>event</tt></i>:</span></td><td>The specfic <a href="libvirt-libvirt.html#virDomainEventType">virDomainEventType</a> which occurred</td></tr><tr><td><span class="term"><i><tt>detail</tt></i>:</span></td><td>event specific detail information</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque user data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventDeregister" id="virConnectDomainEventDeregister"><code>virConnectDomainEventDeregister</code></a></h3><pre class="programlisting">int virConnectDomainEventDeregister (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb)<br />
834
918
</pre><p>Removes a callback previously registered with the <a href="libvirt-libvirt.html#virConnectDomainEventRegister">virConnectDomainEventRegister</a> funtion. Use of this method is no longer recommended. Instead applications should try virConnectDomainEventUnregisterAny which has a more flexible API contract</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virConnectDomainEventDeregisterAny" id="virConnectDomainEventDeregisterAny"><code>virConnectDomainEventDeregisterAny</code></a></h3><pre class="programlisting">int virConnectDomainEventDeregisterAny (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> int callbackID)<br />
835
919
</pre><p>Removes an event callback. The callbackID parameter should be the vaule obtained from a previous virDomainEventRegisterAny method.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><span class="term"><i><tt>callbackID</tt></i>:</span></td><td>the callback identifier</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virConnectDomainEventDiskChangeCallback" id="virConnectDomainEventDiskChangeCallback"><code>virConnectDomainEventDiskChangeCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventDiskChangeCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * oldSrcPath, <br /> const char * newSrcPath, <br /> const char * devAlias, <br /> int reason, <br /> void * opaque)
836
</pre><p>This callback occurs when disk gets changed. However, not all @reason will cause both @oldSrcPath and @newSrcPath to be non-NULL. Please see <a href="libvirt-libvirt.html#virConnectDomainEventDiskChangeReason">virConnectDomainEventDiskChangeReason</a> for more details. The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_IO_ERROR">VIR_DOMAIN_EVENT_ID_IO_ERROR</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>oldSrcPath</tt></i>:</span></td><td>old source path</td></tr><tr><td><span class="term"><i><tt>newSrcPath</tt></i>:</span></td><td>new source path</td></tr><tr><td><span class="term"><i><tt>devAlias</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>reason why this callback was called; any of <a href="libvirt-libvirt.html#virConnectDomainEventDiskChangeReason">virConnectDomainEventDiskChangeReason</a></td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventGenericCallback" id="virConnectDomainEventGenericCallback"><code>virConnectDomainEventGenericCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventGenericCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> void * opaque)
920
</pre><p>This callback occurs when disk gets changed. However, not all @reason will cause both @oldSrcPath and @newSrcPath to be non-NULL. Please see <a href="libvirt-libvirt.html#virConnectDomainEventDiskChangeReason">virConnectDomainEventDiskChangeReason</a> for more details. The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_DISK_CHANGE">VIR_DOMAIN_EVENT_ID_DISK_CHANGE</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>oldSrcPath</tt></i>:</span></td><td>old source path</td></tr><tr><td><span class="term"><i><tt>newSrcPath</tt></i>:</span></td><td>new source path</td></tr><tr><td><span class="term"><i><tt>devAlias</tt></i>:</span></td><td>device alias name</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>reason why this callback was called; any of <a href="libvirt-libvirt.html#virConnectDomainEventDiskChangeReason">virConnectDomainEventDiskChangeReason</a></td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventGenericCallback" id="virConnectDomainEventGenericCallback"><code>virConnectDomainEventGenericCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventGenericCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> void * opaque)
837
921
</pre><p>A generic domain event callback handler. Specific events usually have a customization with extra parameters</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>the connection pointer</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>the domain pointer</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventGraphicsCallback" id="virConnectDomainEventGraphicsCallback"><code>virConnectDomainEventGraphicsCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventGraphicsCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int phase, <br /> <a href="libvirt-libvirt.html#virDomainEventGraphicsAddressPtr">virDomainEventGraphicsAddressPtr</a> local, <br /> <a href="libvirt-libvirt.html#virDomainEventGraphicsAddressPtr">virDomainEventGraphicsAddressPtr</a> remote, <br /> const char * authScheme, <br /> <a href="libvirt-libvirt.html#virDomainEventGraphicsSubjectPtr">virDomainEventGraphicsSubjectPtr</a> subject, <br /> void * opaque)
838
922
</pre><p>The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_GRAPHICS">VIR_DOMAIN_EVENT_ID_GRAPHICS</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>phase</tt></i>:</span></td><td>the phase of the connection</td></tr><tr><td><span class="term"><i><tt>local</tt></i>:</span></td><td>the local server address</td></tr><tr><td><span class="term"><i><tt>remote</tt></i>:</span></td><td>the remote client address</td></tr><tr><td><span class="term"><i><tt>authScheme</tt></i>:</span></td><td>the authentication scheme activated</td></tr><tr><td><span class="term"><i><tt>subject</tt></i>:</span></td><td>the authenticated subject (user)</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventIOErrorCallback" id="virConnectDomainEventIOErrorCallback"><code>virConnectDomainEventIOErrorCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventIOErrorCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * srcPath, <br /> const char * devAlias, <br /> int action, <br /> void * opaque)
839
923
</pre><p>The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_IO_ERROR">VIR_DOMAIN_EVENT_ID_IO_ERROR</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>srcPath</tt></i>:</span></td><td>The host file on which the IO error occurred</td></tr><tr><td><span class="term"><i><tt>devAlias</tt></i>:</span></td><td>The guest device alias associated with the path</td></tr><tr><td><span class="term"><i><tt>action</tt></i>:</span></td><td>action that is to be taken due to the IO error</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventIOErrorReasonCallback" id="virConnectDomainEventIOErrorReasonCallback"><code>virConnectDomainEventIOErrorReasonCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventIOErrorReasonCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * srcPath, <br /> const char * devAlias, <br /> int action, <br /> const char * reason, <br /> void * opaque)
840
</pre><p>The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_IO_ERROR">VIR_DOMAIN_EVENT_ID_IO_ERROR</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>srcPath</tt></i>:</span></td><td>The host file on which the IO error occurred</td></tr><tr><td><span class="term"><i><tt>devAlias</tt></i>:</span></td><td>The guest device alias associated with the path</td></tr><tr><td><span class="term"><i><tt>action</tt></i>:</span></td><td>action that is to be taken due to the IO error</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>the cause of the IO error</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventRTCChangeCallback" id="virConnectDomainEventRTCChangeCallback"><code>virConnectDomainEventRTCChangeCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventRTCChangeCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> long long utcoffset, <br /> void * opaque)
924
</pre><p>The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_IO_ERROR">VIR_DOMAIN_EVENT_ID_IO_ERROR</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>srcPath</tt></i>:</span></td><td>The host file on which the IO error occurred</td></tr><tr><td><span class="term"><i><tt>devAlias</tt></i>:</span></td><td>The guest device alias associated with the path</td></tr><tr><td><span class="term"><i><tt>action</tt></i>:</span></td><td>action that is to be taken due to the IO error</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>the cause of the IO error</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventPMSuspendCallback" id="virConnectDomainEventPMSuspendCallback"><code>virConnectDomainEventPMSuspendCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventPMSuspendCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int reason, <br /> void * opaque)
925
</pre><p>This callback occurs when the guest is waken up. The callback signature to use when registering for an event of type VIR_DOMAIN_EVENT_ID_PMSuspend with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>reason why the callback was called, unused currently, always passes 0</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventPMWakeupCallback" id="virConnectDomainEventPMWakeupCallback"><code>virConnectDomainEventPMWakeupCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventPMWakeupCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int reason, <br /> void * opaque)
926
</pre><p>This callback occurs when the guest is waken up. The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_PMWAKEUP">VIR_DOMAIN_EVENT_ID_PMWAKEUP</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>reason why the callback was called, unused currently, always passes 0</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventRTCChangeCallback" id="virConnectDomainEventRTCChangeCallback"><code>virConnectDomainEventRTCChangeCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventRTCChangeCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> long long utcoffset, <br /> void * opaque)
841
927
</pre><p>The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_RTC_CHANGE">VIR_DOMAIN_EVENT_ID_RTC_CHANGE</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>utcoffset</tt></i>:</span></td><td>the new RTC offset from UTC, measured in seconds</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventRegister" id="virConnectDomainEventRegister"><code>virConnectDomainEventRegister</code></a></h3><pre class="programlisting">int virConnectDomainEventRegister (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventCallback">virConnectDomainEventCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> freecb)<br />
842
928
</pre><p>Adds a callback to receive notifications of domain lifecycle events occurring on a connection Use of this method is no longer recommended. Instead applications should try <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a> which has a more flexible API contract The <a href="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 returns, it shall take a reference to it, by calling <a href="libvirt-libvirt.html#virDomainRef">virDomainRef</a>. The reference can be released once the object is no longer required by calling <a href="libvirt-libvirt.html#virDomainFree">virDomainFree</a>.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque data to pass on to the callback</td></tr><tr><td><span class="term"><i><tt>freecb</tt></i>:</span></td><td>optional function to deallocate opaque when not used anymore</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virConnectDomainEventRegisterAny" id="virConnectDomainEventRegisterAny"><code>virConnectDomainEventRegisterAny</code></a></h3><pre class="programlisting">int virConnectDomainEventRegisterAny (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int eventID, <br /> <a href="libvirt-libvirt.html#virConnectDomainEventGenericCallback">virConnectDomainEventGenericCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> freecb)<br />
843
</pre><p>Adds a callback to receive notifications of arbitrary domain events occurring on a domain. If dom is NULL, then events will be monitored for any domain. If dom is non-NULL, then only the specific domain will be monitored Most types of event have a callback providing a custom set of parameters for the event. When registering an event, it is thus neccessary to use the <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_CALLBACK">VIR_DOMAIN_EVENT_CALLBACK</a>() macro to cast the supplied function pointer to match the signature of this method. The <a href="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 returns, it shall take a reference to it, by calling <a href="libvirt-libvirt.html#virDomainRef">virDomainRef</a>. The reference can be released once the object is no longer required by calling <a href="libvirt-libvirt.html#virDomainFree">virDomainFree</a>. The return value from this method is a positive integer identifier for the callback. To unregister a callback, this callback ID should be passed to the virDomainEventUnregisterAny method</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain</td></tr><tr><td><span class="term"><i><tt>eventID</tt></i>:</span></td><td>the event type to receive</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque data to pass on to the callback</td></tr><tr><td><span class="term"><i><tt>freecb</tt></i>:</span></td><td>optional function to deallocate opaque when not used anymore</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a callback identifier on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virConnectDomainEventWatchdogCallback" id="virConnectDomainEventWatchdogCallback"><code>virConnectDomainEventWatchdogCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventWatchdogCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int action, <br /> void * opaque)
929
</pre><p>Adds a callback to receive notifications of arbitrary domain events occurring on a domain. If dom is NULL, then events will be monitored for any domain. If dom is non-NULL, then only the specific domain will be monitored Most types of event have a callback providing a custom set of parameters for the event. When registering an event, it is thus necessary to use the <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_CALLBACK">VIR_DOMAIN_EVENT_CALLBACK</a>() macro to cast the supplied function pointer to match the signature of this method. The <a href="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 returns, it shall take a reference to it, by calling <a href="libvirt-libvirt.html#virDomainRef">virDomainRef</a>. The reference can be released once the object is no longer required by calling <a href="libvirt-libvirt.html#virDomainFree">virDomainFree</a>. The return value from this method is a positive integer identifier for the callback. To unregister a callback, this callback ID should be passed to the virDomainEventUnregisterAny method</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the connection</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain</td></tr><tr><td><span class="term"><i><tt>eventID</tt></i>:</span></td><td>the event type to receive</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>callback to the function handling domain events</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>opaque data to pass on to the callback</td></tr><tr><td><span class="term"><i><tt>freecb</tt></i>:</span></td><td>optional function to deallocate opaque when not used anymore</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a callback identifier on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virConnectDomainEventTrayChangeCallback" id="virConnectDomainEventTrayChangeCallback"><code>virConnectDomainEventTrayChangeCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventTrayChangeCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * devAlias, <br /> int reason, <br /> void * opaque)
930
</pre><p>This callback occurs when the tray of a removable device is moved. The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_TRAY_CHANGE">VIR_DOMAIN_EVENT_ID_TRAY_CHANGE</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>devAlias</tt></i>:</span></td><td>device alias</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>why the tray status was changed?</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainEventWatchdogCallback" id="virConnectDomainEventWatchdogCallback"><code>virConnectDomainEventWatchdogCallback</code></a></h3><pre class="programlisting">typedef void (*virConnectDomainEventWatchdogCallback) (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> int action, <br /> void * opaque)
844
931
</pre><p>The callback signature to use when registering for an event of type <a href="libvirt-libvirt.html#VIR_DOMAIN_EVENT_ID_WATCHDOG">VIR_DOMAIN_EVENT_ID_WATCHDOG</a> with <a href="libvirt-libvirt.html#virConnectDomainEventRegisterAny">virConnectDomainEventRegisterAny</a>()</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>connection object</td></tr><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>domain on which the event occurred</td></tr><tr><td><span class="term"><i><tt>action</tt></i>:</span></td><td>action that is to be taken due to watchdog firing</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application specified data</td></tr></tbody></table></div><br /><h3><a name="virConnectDomainXMLFromNative" id="virConnectDomainXMLFromNative"><code>virConnectDomainXMLFromNative</code></a></h3><pre class="programlisting">char * virConnectDomainXMLFromNative (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * nativeFormat, <br /> const char * nativeConfig, <br /> unsigned int flags)<br />
845
</pre><p>Reads native configuration data describing a domain, and generates libvirt domain XML. The format of the native data is hypervisor dependant.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><span class="term"><i><tt>nativeFormat</tt></i>:</span></td><td>configuration format importing from</td></tr><tr><td><span class="term"><i><tt>nativeConfig</tt></i>:</span></td><td>the configuration data to import</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, pass 0</td></tr><tr><td><span class="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><a name="virConnectDomainXMLToNative" id="virConnectDomainXMLToNative"><code>virConnectDomainXMLToNative</code></a></h3><pre class="programlisting">char * virConnectDomainXMLToNative (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * nativeFormat, <br /> const char * domainXml, <br /> unsigned int flags)<br />
846
</pre><p>Reads a domain XML configuration document, and generates a native configuration file describing the domain. The format of the native data is hypervisor dependant.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><span class="term"><i><tt>nativeFormat</tt></i>:</span></td><td>configuration format exporting to</td></tr><tr><td><span class="term"><i><tt>domainXml</tt></i>:</span></td><td>the domain configuration to export</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, pass 0</td></tr><tr><td><span class="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><a name="virConnectFindStoragePoolSources" id="virConnectFindStoragePoolSources"><code>virConnectFindStoragePoolSources</code></a></h3><pre class="programlisting">char * virConnectFindStoragePoolSources (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * type, <br /> const char * srcSpec, <br /> unsigned int flags)<br />
847
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>type of storage pool sources to discover</td></tr><tr><td><span class="term"><i><tt>srcSpec</tt></i>:</span></td><td>XML document specifying discovery source</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for discovery (unused, pass 0)</td></tr><tr><td><span class="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><a name="virConnectGetCapabilities" id="virConnectGetCapabilities"><code>virConnectGetCapabilities</code></a></h3><pre class="programlisting">char * virConnectGetCapabilities (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
932
</pre><p>Reads native configuration data describing a domain, and generates libvirt domain XML. The format of the native data is hypervisor dependant.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><span class="term"><i><tt>nativeFormat</tt></i>:</span></td><td>configuration format importing from</td></tr><tr><td><span class="term"><i><tt>nativeConfig</tt></i>:</span></td><td>the configuration data to import</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virConnectDomainXMLToNative" id="virConnectDomainXMLToNative"><code>virConnectDomainXMLToNative</code></a></h3><pre class="programlisting">char * virConnectDomainXMLToNative (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * nativeFormat, <br /> const char * domainXml, <br /> unsigned int flags)<br />
933
</pre><p>Reads a domain XML configuration document, and generates a native configuration file describing the domain. The format of the native data is hypervisor dependant.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><span class="term"><i><tt>nativeFormat</tt></i>:</span></td><td>configuration format exporting to</td></tr><tr><td><span class="term"><i><tt>domainXml</tt></i>:</span></td><td>the domain configuration to export</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virConnectFindStoragePoolSources" id="virConnectFindStoragePoolSources"><code>virConnectFindStoragePoolSources</code></a></h3><pre class="programlisting">char * virConnectFindStoragePoolSources (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * type, <br /> const char * srcSpec, <br /> unsigned int flags)<br />
934
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>type of storage pool sources to discover</td></tr><tr><td><span class="term"><i><tt>srcSpec</tt></i>:</span></td><td>XML document specifying discovery source</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virConnectGetCapabilities" id="virConnectGetCapabilities"><code>virConnectGetCapabilities</code></a></h3><pre class="programlisting">char * virConnectGetCapabilities (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
848
935
</pre><p>Provides capabilities of the hypervisor / driver.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="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><a name="virConnectGetHostname" id="virConnectGetHostname"><code>virConnectGetHostname</code></a></h3><pre class="programlisting">char * virConnectGetHostname (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
849
936
</pre><p>This returns the system hostname on which the hypervisor is running (the result of the gethostname system call). If we are connected to a remote system, then this returns the hostname of the remote system.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><span class="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><a name="virConnectGetLibVersion" id="virConnectGetLibVersion"><code>virConnectGetLibVersion</code></a></h3><pre class="programlisting">int virConnectGetLibVersion (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> unsigned long * libVer)<br />
850
937
</pre><p>Provides @libVer, which is the version of libvirt used by the daemon running on the @conn host</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>libVer</tt></i>:</span></td><td>returns the libvirt library version used on the connection (OUT)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 otherwise, and values for @libVer have the format major * 1,000,000 + minor * 1,000 + release.</td></tr></tbody></table></div><h3><a name="virConnectGetMaxVcpus" id="virConnectGetMaxVcpus"><code>virConnectGetMaxVcpus</code></a></h3><pre class="programlisting">int virConnectGetMaxVcpus (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * type)<br />
851
938
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>value of the 'type' attribute in the <domain> element</td></tr><tr><td><span class="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><a name="virConnectGetSysinfo" id="virConnectGetSysinfo"><code>virConnectGetSysinfo</code></a></h3><pre class="programlisting">char * virConnectGetSysinfo (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> unsigned int flags)<br />
852
</pre><p>This returns the XML description of the sysinfo details for the host on which the hypervisor is running, in the same format as the <sysinfo> element of a domain XML. This information is generally available only for hypervisors running with root privileges.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML string which must be freed by the caller, or NULL if there was an error.</td></tr></tbody></table></div><h3><a name="virConnectGetType" id="virConnectGetType"><code>virConnectGetType</code></a></h3><pre class="programlisting">const char * virConnectGetType (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
939
</pre><p>This returns the XML description of the sysinfo details for the host on which the hypervisor is running, in the same format as the <sysinfo> element of a domain XML. This information is generally available only for hypervisors running with root privileges.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML string which must be freed by the caller, or NULL if there was an error.</td></tr></tbody></table></div><h3><a name="virConnectGetType" id="virConnectGetType"><code>virConnectGetType</code></a></h3><pre class="programlisting">const char * virConnectGetType (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
853
940
</pre><p>Get the name of the Hypervisor software used.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="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><a name="virConnectGetURI" id="virConnectGetURI"><code>virConnectGetURI</code></a></h3><pre class="programlisting">char * virConnectGetURI (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
854
941
</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 <a href="libvirt-libvirt.html#virConnectOpen">virConnectOpen</a>, then the driver will return a non-NULL URI which can be used to connect to the same hypervisor later.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><span class="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><a name="virConnectGetVersion" id="virConnectGetVersion"><code>virConnectGetVersion</code></a></h3><pre class="programlisting">int virConnectGetVersion (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> unsigned long * hvVer)<br />
855
942
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>hvVer</tt></i>:</span></td><td>return value for the version of the running hypervisor (OUT)</td></tr><tr><td><span class="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><a name="virConnectIsAlive" id="virConnectIsAlive"><code>virConnectIsAlive</code></a></h3><pre class="programlisting">int virConnectIsAlive (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
876
963
</pre><p>Provides the number of active networks.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="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><a name="virConnectNumOfSecrets" id="virConnectNumOfSecrets"><code>virConnectNumOfSecrets</code></a></h3><pre class="programlisting">int virConnectNumOfSecrets (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
877
964
</pre><p>Fetch number of currently defined secrets.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number currently defined secrets.</td></tr></tbody></table></div><h3><a name="virConnectNumOfStoragePools" id="virConnectNumOfStoragePools"><code>virConnectNumOfStoragePools</code></a></h3><pre class="programlisting">int virConnectNumOfStoragePools (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
878
965
</pre><p>Provides the number of active storage pools</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of pools found, or -1 on error</td></tr></tbody></table></div><h3><a name="virConnectOpen" id="virConnectOpen"><code>virConnectOpen</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpen (const char * name)<br />
879
</pre><p>This function should be called first to get a connection to the Hypervisor and xen store</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><span class="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><a name="virConnectOpenAuth" id="virConnectOpenAuth"><code>virConnectOpenAuth</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpenAuth (const char * name, <br /> <a href="libvirt-libvirt.html#virConnectAuthPtr">virConnectAuthPtr</a> auth, <br /> unsigned int flags)<br />
880
</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 <a href="libvirt-libvirt.html#virConnectOpen">virConnectOpen</a> for notes about environment variables which can have an effect on opening drivers</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><span class="term"><i><tt>auth</tt></i>:</span></td><td>Authenticate callback parameters</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>Open flags</td></tr><tr><td><span class="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><a name="virConnectOpenReadOnly" id="virConnectOpenReadOnly"><code>virConnectOpenReadOnly</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpenReadOnly (const char * name)<br />
966
</pre><p>This function should be called first to get a connection to the Hypervisor and xen store</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><span class="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, if the LIBVIRT_DEFAULT_URI environment variable is set, then it will be used. Otherwise if the client configuration file has the "uri_default" parameter set, then it will be used. Finally probing will be done to determine a suitable default driver to activate. This involves trying each hypervisor in turn until one successfully opens. If connecting to an unprivileged hypervisor driver which requires the libvirtd daemon to be active, it will automatically be launched if not already running. This can be prevented by setting the environment variable LIBVIRT_AUTOSTART=0 URIs are documented at http://libvirt.org/uri.html</td></tr></tbody></table></div><h3><a name="virConnectOpenAuth" id="virConnectOpenAuth"><code>virConnectOpenAuth</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpenAuth (const char * name, <br /> <a href="libvirt-libvirt.html#virConnectAuthPtr">virConnectAuthPtr</a> auth, <br /> unsigned int flags)<br />
967
</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 <a href="libvirt-libvirt.html#virConnectOpen">virConnectOpen</a> for notes about environment variables which can have an effect on opening drivers</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><span class="term"><i><tt>auth</tt></i>:</span></td><td>Authenticate callback parameters</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virConnectFlags">virConnectFlags</a></td></tr><tr><td><span class="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><a name="virConnectOpenReadOnly" id="virConnectOpenReadOnly"><code>virConnectOpenReadOnly</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpenReadOnly (const char * name)<br />
881
968
</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 <a href="libvirt-libvirt.html#virConnectOpen">virConnectOpen</a> for notes about environment variables which can have an effect on opening drivers</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>URI of the hypervisor</td></tr><tr><td><span class="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><a name="virConnectRef" id="virConnectRef"><code>virConnectRef</code></a></h3><pre class="programlisting">int virConnectRef (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
882
969
</pre><p>Increment the reference count on the connection. For each additional call to this method, there shall be a corresponding call to <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>the connection to hold a reference on</td></tr><tr><td><span class="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><a name="virConnectSetKeepAlive" id="virConnectSetKeepAlive"><code>virConnectSetKeepAlive</code></a></h3><pre class="programlisting">int virConnectSetKeepAlive (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> int interval, <br /> unsigned int count)<br />
883
</pre><p>Start sending keepalive messages after interval second of inactivity and consider the connection to be broken when no response is received after count keepalive messages sent in a row. In other words, sending count + 1 keepalive message results in closing the connection. When interval is <= 0, no keepalive messages will be sent. When count is 0, the connection will be automatically closed after interval seconds of inactivity without sending any keepalive messages. Note: client has to implement and run event loop to be able to use keepalive messages. Failure to do so may result in connections being closed unexpectedly.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><span class="term"><i><tt>interval</tt></i>:</span></td><td>number of seconds of inactivity before a keepalive message is sent</td></tr><tr><td><span class="term"><i><tt>count</tt></i>:</span></td><td>number of messages that can be sent in a row</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 on error, 0 on success, 1 when remote party doesn't support keepalive messages.</td></tr></tbody></table></div><h3><a name="virDomainAbortJob" id="virDomainAbortJob"><code>virDomainAbortJob</code></a></h3><pre class="programlisting">int virDomainAbortJob (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
970
</pre><p>Start sending keepalive messages after interval second of inactivity and consider the connection to be broken when no response is received after count keepalive messages sent in a row. In other words, sending count + 1 keepalive message results in closing the connection. When interval is <= 0, no keepalive messages will be sent. When count is 0, the connection will be automatically closed after interval seconds of inactivity without sending any keepalive messages. Note: client has to implement and run event loop to be able to use keepalive messages. Failure to do so may result in connections being closed unexpectedly. Note: This API function controls only keepalive messages sent by the client. If the server is configured to use keepalive you still need to run the event loop to respond to them, even if you disable keepalives by this function.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to a hypervisor connection</td></tr><tr><td><span class="term"><i><tt>interval</tt></i>:</span></td><td>number of seconds of inactivity before a keepalive message is sent</td></tr><tr><td><span class="term"><i><tt>count</tt></i>:</span></td><td>number of messages that can be sent in a row</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 on error, 0 on success, 1 when remote party doesn't support keepalive messages.</td></tr></tbody></table></div><h3><a name="virDomainAbortJob" id="virDomainAbortJob"><code>virDomainAbortJob</code></a></h3><pre class="programlisting">int virDomainAbortJob (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
884
971
</pre><p>Requests that the current background job be aborted at the soonest opportunity. This will block until the job has either completed, or aborted.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainAttachDevice" id="virDomainAttachDevice"><code>virDomainAttachDevice</code></a></h3><pre class="programlisting">int virDomainAttachDevice (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xml)<br />
885
972
</pre><p>Create a virtual device attachment to backend. This function, having hotplug semantics, is only allowed on an active domain. For compatibility, this method can also be used to change the media in an existing CDROM/Floppy device, however, applications are recommended to use the virDomainUpdateDeviceFlag method instead.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="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><a name="virDomainAttachDeviceFlags" id="virDomainAttachDeviceFlags"><code>virDomainAttachDeviceFlags</code></a></h3><pre class="programlisting">int virDomainAttachDeviceFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xml, <br /> unsigned int flags)<br />
886
</pre><p>Attach a virtual device to a domain, using the flags parameter to control how the device is attached. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a> specifies that the device allocation is made based on current domain state. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> specifies that the device shall be allocated to the active domain instance only and is not added to the persisted domain configuration. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> specifies that the device shall be allocated to the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation. For compatibility, this method can also be used to change the media in an existing CDROM/Floppy device, however, applications are recommended to use the virDomainUpdateDeviceFlag method instead.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainDeviceModifyFlags">virDomainDeviceModifyFlags</a></td></tr><tr><td><span class="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><a name="virDomainBlockJobAbort" id="virDomainBlockJobAbort"><code>virDomainBlockJobAbort</code></a></h3><pre class="programlisting">int virDomainBlockJobAbort (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned int flags)<br />
887
</pre><p>Cancel the active block job on the given disk. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, for future extension</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 when successful.</td></tr></tbody></table></div><h3><a name="virDomainBlockJobSetSpeed" id="virDomainBlockJobSetSpeed"><code>virDomainBlockJobSetSpeed</code></a></h3><pre class="programlisting">int virDomainBlockJobSetSpeed (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long bandwidth, <br /> unsigned int flags)<br />
888
</pre><p>Set the maximimum allowable bandwidth that a block job may consume. If bandwidth is 0, the limit will revert to the hypervisor default. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>specify bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, for future extension</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 when successful.</td></tr></tbody></table></div><h3><a name="virDomainBlockPeek" id="virDomainBlockPeek"><code>virDomainBlockPeek</code></a></h3><pre class="programlisting">int virDomainBlockPeek (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long long offset, <br /> size_t size, <br /> void * buffer, <br /> unsigned int flags)<br />
889
</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). The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. 'offset' and 'size' represent an area which must lie entirely within the device or file. 'size' may be 0 to test if the call would succeed. 'buffer' is the return buffer and must be at least 'size' bytes. NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>offset</tt></i>:</span></td><td>offset within block device</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>size to read</td></tr><tr><td><span class="term"><i><tt>buffer</tt></i>:</span></td><td>return buffer (must be at least size bytes)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused, always pass 0</td></tr><tr><td><span class="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><a name="virDomainBlockPull" id="virDomainBlockPull"><code>virDomainBlockPull</code></a></h3><pre class="programlisting">int virDomainBlockPull (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long bandwidth, <br /> unsigned int flags)<br />
890
</pre><p>Populate a disk image with data from its backing image. Once all data from its backing image has been pulled, the disk no longer depends on a backing image. This function pulls data for the entire device in the background. Progress of the operation can be checked with <a href="libvirt-libvirt.html#virDomainGetBlockJobInfo">virDomainGetBlockJobInfo</a>() and the operation can be aborted with <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>(). When finished, an asynchronous event is raised to indicate the final status. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. The maximum bandwidth (in Mbps) that will be used to do the copy can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify copy bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, for future extension</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the operation has started, -1 on failure.</td></tr></tbody></table></div><h3><a name="virDomainBlockResize" id="virDomainBlockResize"><code>virDomainBlockResize</code></a></h3><pre class="programlisting">int virDomainBlockResize (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long long size, <br /> unsigned int flags)<br />
891
</pre><p>Note that this call may fail if the underlying virtualization hypervisor does not support it. And this call requires privileged access to the hypervisor. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. Resize a block device of domain while the domain is running.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block image, or shorthand</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>new size of the block image in kilobytes</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused, always pass 0</td></tr><tr><td><span class="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><a name="virDomainBlockStats" id="virDomainBlockStats"><code>virDomainBlockStats</code></a></h3><pre class="programlisting">int virDomainBlockStats (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virDomainBlockStatsPtr">virDomainBlockStatsPtr</a> stats, <br /> size_t size)<br />
973
</pre><p>Attach a virtual device to a domain, using the flags parameter to control how the device is attached. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a> specifies that the device allocation is made based on current domain state. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> specifies that the device shall be allocated to the active domain instance only and is not added to the persisted domain configuration. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> specifies that the device shall be allocated to the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation. For compatibility, this method can also be used to change the media in an existing CDROM/Floppy device, however, applications are recommended to use the virDomainUpdateDeviceFlag method instead.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainDeviceModifyFlags">virDomainDeviceModifyFlags</a></td></tr><tr><td><span class="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><a name="virDomainBlockJobAbort" id="virDomainBlockJobAbort"><code>virDomainBlockJobAbort</code></a></h3><pre class="programlisting">int virDomainBlockJobAbort (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned int flags)<br />
974
</pre><p>Cancel the active block job on the given disk. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. If the current block job for @disk is <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_TYPE_PULL">VIR_DOMAIN_BLOCK_JOB_TYPE_PULL</a>, then by default, this function performs a synchronous operation and the caller may assume that the operation has completed when 0 is returned. However, BlockJob operations may take a long time to cancel, and during this time further domain interactions may be unresponsive. To avoid this problem, pass <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC">VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC</a> in the @flags argument to enable asynchronous behavior, returning as soon as possible. When the job has been canceled, a BlockJob event will be emitted, with status <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_CANCELED">VIR_DOMAIN_BLOCK_JOB_CANCELED</a> (even if the ABORT_ASYNC flag was not used); it is also possible to poll <a href="libvirt-libvirt.html#virDomainBlockJobInfo">virDomainBlockJobInfo</a>() to see if the job cancellation is still pending. This type of job can be restarted to pick up from where it left off. If the current block job for @disk is <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_TYPE_COPY">VIR_DOMAIN_BLOCK_JOB_TYPE_COPY</a>, then the default is to abort the mirroring and revert to the source disk; adding @flags of <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT">VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT</a> causes this call to fail with <a href="libvirt-virterror.html#VIR_ERR_BLOCK_COPY_ACTIVE">VIR_ERR_BLOCK_COPY_ACTIVE</a> if the copy is not fully populated, otherwise it will swap the disk over to the copy to end the mirroring. An event will be issued when the job is ended, and it is possible to use <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC">VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC</a> to control whether this command waits for the completion of the job. Restarting this job requires starting over from the beginning of the first phase.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainBlockJobAbortFlags">virDomainBlockJobAbortFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 when successful.</td></tr></tbody></table></div><h3><a name="virDomainBlockJobSetSpeed" id="virDomainBlockJobSetSpeed"><code>virDomainBlockJobSetSpeed</code></a></h3><pre class="programlisting">int virDomainBlockJobSetSpeed (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long bandwidth, <br /> unsigned int flags)<br />
975
</pre><p>Set the maximimum allowable bandwidth that a block job may consume. If bandwidth is 0, the limit will revert to the hypervisor default. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>specify bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 when successful.</td></tr></tbody></table></div><h3><a name="virDomainBlockPeek" id="virDomainBlockPeek"><code>virDomainBlockPeek</code></a></h3><pre class="programlisting">int virDomainBlockPeek (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long long offset, <br /> size_t size, <br /> void * buffer, <br /> unsigned int flags)<br />
976
</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). The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. 'offset' and 'size' represent an area which must lie entirely within the device or file. 'size' may be 0 to test if the call would succeed. 'buffer' is the return buffer and must be at least 'size' bytes. NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>offset</tt></i>:</span></td><td>offset within block device</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>size to read</td></tr><tr><td><span class="term"><i><tt>buffer</tt></i>:</span></td><td>return buffer (must be at least size bytes)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainBlockPull" id="virDomainBlockPull"><code>virDomainBlockPull</code></a></h3><pre class="programlisting">int virDomainBlockPull (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long bandwidth, <br /> unsigned int flags)<br />
977
</pre><p>Populate a disk image with data from its backing image. Once all data from its backing image has been pulled, the disk no longer depends on a backing image. This function pulls data for the entire device in the background. Progress of the operation can be checked with <a href="libvirt-libvirt.html#virDomainGetBlockJobInfo">virDomainGetBlockJobInfo</a>() and the operation can be aborted with <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>(). When finished, an asynchronous event is raised to indicate the final status. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. The maximum bandwidth (in Mbps) that will be used to do the copy can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0; in this case, it might still be possible for a later call to <a href="libvirt-libvirt.html#virDomainBlockJobSetSpeed">virDomainBlockJobSetSpeed</a>() to succeed. The actual speed can be determined with <a href="libvirt-libvirt.html#virDomainGetBlockJobInfo">virDomainGetBlockJobInfo</a>(). This is shorthand for <a href="libvirt-libvirt.html#virDomainBlockRebase">virDomainBlockRebase</a>() with a NULL base.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify copy bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the operation has started, -1 on failure.</td></tr></tbody></table></div><h3><a name="virDomainBlockRebase" id="virDomainBlockRebase"><code>virDomainBlockRebase</code></a></h3><pre class="programlisting">int virDomainBlockRebase (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> const char * base, <br /> unsigned long bandwidth, <br /> unsigned int flags)<br />
978
</pre><p>Populate a disk image with data from its backing image chain, and setting the backing image to @base, or alternatively copy an entire backing chain to a new file @base. When @flags is 0, this starts a pull, where @base must be the absolute path of one of the backing images further up the chain, or NULL to convert the disk image so that it has no backing image. Once all data from its backing image chain has been pulled, the disk no longer depends on those intermediate backing images. This function pulls data for the entire device in the background. Progress of the operation can be checked with <a href="libvirt-libvirt.html#virDomainGetBlockJobInfo">virDomainGetBlockJobInfo</a>() with a job type of <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_TYPE_PULL">VIR_DOMAIN_BLOCK_JOB_TYPE_PULL</a>, and the operation can be aborted with <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>(). When finished, an asynchronous event is raised to indicate the final status, and the job no longer exists. If the job is aborted, a new one can be started later to resume from the same point. When @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_REBASE_COPY">VIR_DOMAIN_BLOCK_REBASE_COPY</a>, this starts a copy, where @base must be the name of a new file to copy the chain to. By default, the copy will pull the entire source chain into the destination file, but if @flags also contains <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_REBASE_SHALLOW">VIR_DOMAIN_BLOCK_REBASE_SHALLOW</a>, then only the top of the source chain will be copied (the source and destination have a common backing file). By default, @base will be created with the same file format as the source, but this can be altered by adding <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_REBASE_COPY_RAW">VIR_DOMAIN_BLOCK_REBASE_COPY_RAW</a> to force the copy to be raw (does not make sense with the shallow flag unless the source is also raw), or by using <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT">VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT</a> to reuse an existing file with initial contents identical to the backing file of the source (this allows a management app to pre-create files with relative backing file names, rather than the default of absolute backing file names; as a security precaution, you should generally only use reuse_ext with the shallow flag and a non-raw destination file). A copy job has two parts; in the first phase, the @bandwidth parameter affects how fast the source is pulled into the destination, and the job can only be canceled by reverting to the source file; progress in this phase can be tracked via the <a href="libvirt-libvirt.html#virDomainBlockJobInfo">virDomainBlockJobInfo</a>() command, with a job type of <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_JOB_TYPE_COPY">VIR_DOMAIN_BLOCK_JOB_TYPE_COPY</a>. The job transitions to the second phase when the job info states cur == end, and remains alive to mirror all further changes to both source and destination. The user must call <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>() to end the mirroring while choosing whether to revert to source or pivot to the destination. An event is issued when the job ends, and in the future, an event may be added when the job transitions from pulling to mirroring. If the job is aborted, a new job will have to start over from the beginning of the first phase. Some hypervisors will restrict certain actions, such as <a href="libvirt-libvirt.html#virDomainSave">virDomainSave</a>() or <a href="libvirt-libvirt.html#virDomainDetachDevice">virDomainDetachDevice</a>(), while a copy job is active; they may also restrict a copy job to transient domains. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. The maximum bandwidth (in Mbps) that will be used to do the copy can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0; in this case, it might still be possible for a later call to <a href="libvirt-libvirt.html#virDomainBlockJobSetSpeed">virDomainBlockJobSetSpeed</a>() to succeed. The actual speed can be determined with <a href="libvirt-libvirt.html#virDomainGetBlockJobInfo">virDomainGetBlockJobInfo</a>(). When @base is NULL and @flags is 0, this is identical to <a href="libvirt-libvirt.html#virDomainBlockPull">virDomainBlockPull</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>base</tt></i>:</span></td><td>path to backing file to keep, or NULL for no backing file</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify copy bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainBlockRebaseFlags">virDomainBlockRebaseFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the operation has started, -1 on failure.</td></tr></tbody></table></div><h3><a name="virDomainBlockResize" id="virDomainBlockResize"><code>virDomainBlockResize</code></a></h3><pre class="programlisting">int virDomainBlockResize (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> unsigned long long size, <br /> unsigned int flags)<br />
979
</pre><p>Resize a block device of domain while the domain is running. If @flags is 0, then @size is in kibibytes (blocks of 1024 bytes); since 0.9.11, if @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_BLOCK_RESIZE_BYTES">VIR_DOMAIN_BLOCK_RESIZE_BYTES</a>, @size is in bytes instead. @size is taken directly as the new size. Depending on the file format, the hypervisor may round up to the next alignment boundary. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. Note that this call may fail if the underlying virtualization hypervisor does not support it; this call requires privileged access to the hypervisor.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block image, or shorthand</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>new size of the block image, see below for unit</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainBlockResizeFlags">virDomainBlockResizeFlags</a></td></tr><tr><td><span class="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><a name="virDomainBlockStats" id="virDomainBlockStats"><code>virDomainBlockStats</code></a></h3><pre class="programlisting">int virDomainBlockStats (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virDomainBlockStatsPtr">virDomainBlockStatsPtr</a> stats, <br /> size_t size)<br />
892
980
</pre><p>This function returns block device (disk) stats for block devices attached to the domain. The @disk parameter is either the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"), or (since 0.9.8) an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. Domains may have more than one block device. To get stats for each you should make multiple calls to this function. Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>stats</tt></i>:</span></td><td>block device stats (returned)</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>size of stats structure</td></tr><tr><td><span class="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><a name="virDomainBlockStatsFlags" id="virDomainBlockStatsFlags"><code>virDomainBlockStatsFlags</code></a></h3><pre class="programlisting">int virDomainBlockStatsFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
893
981
</pre><p>This function is to get block stats parameters for block devices attached to the domain. The @disk parameter is either the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"), or (since 0.9.8) an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. Domains may have more than one block device. To get stats for each you should make multiple calls to this function. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. (Note that block devices of different types might support different parameters, so it might be necessary to compute @nparams for each block device). The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See <a href="libvirt-libvirt.html#virDomainGetMemoryParameters">virDomainGetMemoryParameters</a>() for more details.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to block stats parameter object (return value)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of block stats; input and output</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainCoreDump" id="virDomainCoreDump"><code>virDomainCoreDump</code></a></h3><pre class="programlisting">int virDomainCoreDump (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * to, <br /> unsigned int flags)<br />
894
</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. Hypervisors may require the user to manually ensure proper permissions on the file named by @to. If @flags includes <a href="libvirt-libvirt.html#VIR_DUMP_CRASH">VIR_DUMP_CRASH</a>, then leave the guest shut off with a crashed state after the dump completes. If @flags includes <a href="libvirt-libvirt.html#VIR_DUMP_LIVE">VIR_DUMP_LIVE</a>, then make the core dump while continuing to allow the guest to run; otherwise, the guest is suspended during the dump. <a href="libvirt-libvirt.html#VIR_DUMP_RESET">VIR_DUMP_RESET</a> flag forces reset of the quest after dump. The above three flags are mutually exclusive. Additionally, if @flags includes <a href="libvirt-libvirt.html#VIR_DUMP_BYPASS_CACHE">VIR_DUMP_BYPASS_CACHE</a>, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>to</tt></i>:</span></td><td>path for the core file</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainCoreDumpFlags">virDomainCoreDumpFlags</a></td></tr><tr><td><span class="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><a name="virDomainCreate" id="virDomainCreate"><code>virDomainCreate</code></a></h3><pre class="programlisting">int virDomainCreate (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
982
</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. Hypervisors may require the user to manually ensure proper permissions on the file named by @to. If @flags includes <a href="libvirt-libvirt.html#VIR_DUMP_CRASH">VIR_DUMP_CRASH</a>, then leave the guest shut off with a crashed state after the dump completes. If @flags includes <a href="libvirt-libvirt.html#VIR_DUMP_LIVE">VIR_DUMP_LIVE</a>, then make the core dump while continuing to allow the guest to run; otherwise, the guest is suspended during the dump. <a href="libvirt-libvirt.html#VIR_DUMP_RESET">VIR_DUMP_RESET</a> flag forces reset of the quest after dump. The above three flags are mutually exclusive. Additionally, if @flags includes <a href="libvirt-libvirt.html#VIR_DUMP_BYPASS_CACHE">VIR_DUMP_BYPASS_CACHE</a>, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>to</tt></i>:</span></td><td>path for the core file</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainCoreDumpFlags">virDomainCoreDumpFlags</a></td></tr><tr><td><span class="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><a name="virDomainCreate" id="virDomainCreate"><code>virDomainCreate</code></a></h3><pre class="programlisting">int virDomainCreate (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
895
983
</pre><p>Launch a defined domain. If the call succeeds the domain moves from the defined to the running domains pools. The domain will be paused only if restoring from managed state created from a paused domain. For more control, see <a href="libvirt-libvirt.html#virDomainCreateWithFlags">virDomainCreateWithFlags</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><span class="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><a name="virDomainCreateLinux" id="virDomainCreateLinux"><code>virDomainCreateLinux</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainCreateLinux (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
896
</pre><p>Deprecated after 0.4.6. Renamed to <a href="libvirt-libvirt.html#virDomainCreateXML">virDomainCreateXML</a>() providing identical functionality. This existing name will left indefinitely for API compatibility.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainCreateWithFlags" id="virDomainCreateWithFlags"><code>virDomainCreateWithFlags</code></a></h3><pre class="programlisting">int virDomainCreateWithFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
897
</pre><p>Launch a defined domain. If the call succeeds the domain moves from the defined to the running domains pools. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_PAUSED">VIR_DOMAIN_START_PAUSED</a> flag is set, or if the guest domain has a managed save image that requested paused state (see <a href="libvirt-libvirt.html#virDomainManagedSave">virDomainManagedSave</a>()) the guest domain will be started, but its CPUs will remain paused. The CPUs can later be manually started using <a href="libvirt-libvirt.html#virDomainResume">virDomainResume</a>(). In all other cases, the guest domain will be running. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_AUTODESTROY">VIR_DOMAIN_START_AUTODESTROY</a> flag is set, the guest domain will be automatically destroyed when the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> object is finally released. This will also happen if the client application crashes / loses its connection to the libvirtd daemon. Any domains marked for auto destroy will block attempts at migration, save-to-file, or snapshots. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_BYPASS_CACHE">VIR_DOMAIN_START_BYPASS_CACHE</a> flag is set, and there is a managed save file for this domain (created by <a href="libvirt-libvirt.html#virDomainManagedSave">virDomainManagedSave</a>()), then libvirt will attempt to bypass the file system cache while restoring the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing loads from NFS. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_FORCE_BOOT">VIR_DOMAIN_START_FORCE_BOOT</a> flag is set, then any managed save file for this domain is discarded, and the domain boots from scratch.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainCreateFlags">virDomainCreateFlags</a></td></tr><tr><td><span class="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><a name="virDomainCreateXML" id="virDomainCreateXML"><code>virDomainCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainCreateXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
898
</pre><p>Launch a new guest domain, based on an XML description similar to the one returned by <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() This function may require privileged access to the hypervisor. The domain is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted (see <a href="libvirt-libvirt.html#virDomainDefineXML">virDomainDefineXML</a>() to define persistent domains). If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_PAUSED">VIR_DOMAIN_START_PAUSED</a> flag is set, the guest domain will be started, but its CPUs will remain paused. The CPUs can later be manually started using <a href="libvirt-libvirt.html#virDomainResume">virDomainResume</a>. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_AUTODESTROY">VIR_DOMAIN_START_AUTODESTROY</a> flag is set, the guest domain will be automatically destroyed when the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> object is finally released. This will also happen if the client application crashes / loses its connection to the libvirtd daemon. Any domains marked for auto destroy will block attempts at migration, save-to-file, or snapshots.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainCreateFlags">virDomainCreateFlags</a></td></tr><tr><td><span class="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><a name="virDomainDefineXML" id="virDomainDefineXML"><code>virDomainDefineXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xml)<br />
899
</pre><p>Define a domain, but does not start it. This definition is persistent, until explicitly undefined with <a href="libvirt-libvirt.html#virDomainUndefine">virDomainUndefine</a>(). A previous definition for this domain would be overriden if it already exists.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>the XML description for the domain, preferably in UTF-8</td></tr><tr><td><span class="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><a name="virDomainDestroy" id="virDomainDestroy"><code>virDomainDestroy</code></a></h3><pre class="programlisting">int virDomainDestroy (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
900
</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 <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> object. This function may require privileged access If the domain is transient and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then that metadata will automatically be deleted when the domain quits.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainDestroyFlags" id="virDomainDestroyFlags"><code>virDomainDestroyFlags</code></a></h3><pre class="programlisting">int virDomainDestroyFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
901
</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 <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> object. This function may require privileged access. Calling this function with no @flags set (equal to zero) is equivalent to calling <a href="libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a>. Using <a href="libvirt-libvirt.html#virDomainShutdown">virDomainShutdown</a>() may produce cleaner results for the guest's disks, but depends on guest support.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of virDomainDestroyFlagsValues</td></tr><tr><td><span class="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><a name="virDomainDetachDevice" id="virDomainDetachDevice"><code>virDomainDetachDevice</code></a></h3><pre class="programlisting">int virDomainDetachDevice (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xml)<br />
984
</pre><p>Deprecated after 0.4.6. Renamed to <a href="libvirt-libvirt.html#virDomainCreateXML">virDomainCreateXML</a>() providing identical functionality. This existing name will left indefinitely for API compatibility.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainCreateWithFlags" id="virDomainCreateWithFlags"><code>virDomainCreateWithFlags</code></a></h3><pre class="programlisting">int virDomainCreateWithFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
985
</pre><p>Launch a defined domain. If the call succeeds the domain moves from the defined to the running domains pools. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_PAUSED">VIR_DOMAIN_START_PAUSED</a> flag is set, or if the guest domain has a managed save image that requested paused state (see <a href="libvirt-libvirt.html#virDomainManagedSave">virDomainManagedSave</a>()) the guest domain will be started, but its CPUs will remain paused. The CPUs can later be manually started using <a href="libvirt-libvirt.html#virDomainResume">virDomainResume</a>(). In all other cases, the guest domain will be running. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_AUTODESTROY">VIR_DOMAIN_START_AUTODESTROY</a> flag is set, the guest domain will be automatically destroyed when the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> object is finally released. This will also happen if the client application crashes / loses its connection to the libvirtd daemon. Any domains marked for auto destroy will block attempts at migration, save-to-file, or snapshots. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_BYPASS_CACHE">VIR_DOMAIN_START_BYPASS_CACHE</a> flag is set, and there is a managed save file for this domain (created by <a href="libvirt-libvirt.html#virDomainManagedSave">virDomainManagedSave</a>()), then libvirt will attempt to bypass the file system cache while restoring the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing loads from NFS. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_FORCE_BOOT">VIR_DOMAIN_START_FORCE_BOOT</a> flag is set, then any managed save file for this domain is discarded, and the domain boots from scratch.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainCreateFlags">virDomainCreateFlags</a></td></tr><tr><td><span class="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><a name="virDomainCreateXML" id="virDomainCreateXML"><code>virDomainCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainCreateXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
986
</pre><p>Launch a new guest domain, based on an XML description similar to the one returned by <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() This function may require privileged access to the hypervisor. The domain is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted (see <a href="libvirt-libvirt.html#virDomainDefineXML">virDomainDefineXML</a>() to define persistent domains). If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_PAUSED">VIR_DOMAIN_START_PAUSED</a> flag is set, the guest domain will be started, but its CPUs will remain paused. The CPUs can later be manually started using <a href="libvirt-libvirt.html#virDomainResume">virDomainResume</a>. If the <a href="libvirt-libvirt.html#VIR_DOMAIN_START_AUTODESTROY">VIR_DOMAIN_START_AUTODESTROY</a> flag is set, the guest domain will be automatically destroyed when the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> object is finally released. This will also happen if the client application crashes / loses its connection to the libvirtd daemon. Any domains marked for auto destroy will block attempts at migration, save-to-file, or snapshots.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainCreateFlags">virDomainCreateFlags</a></td></tr><tr><td><span class="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><a name="virDomainDefineXML" id="virDomainDefineXML"><code>virDomainDefineXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xml)<br />
987
</pre><p>Define a domain, but does not start it. This definition is persistent, until explicitly undefined with <a href="libvirt-libvirt.html#virDomainUndefine">virDomainUndefine</a>(). A previous definition for this domain would be overriden if it already exists. Some hypervisors may prevent this operation if there is a current block copy operation on a transient domain with the same id as the domain being defined; in that case, use <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>() to stop the block copy first.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>the XML description for the domain, preferably in UTF-8</td></tr><tr><td><span class="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><a name="virDomainDestroy" id="virDomainDestroy"><code>virDomainDestroy</code></a></h3><pre class="programlisting">int virDomainDestroy (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
988
</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 <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> object. This function may require privileged access <a href="libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a> first requests that a guest terminate (e.g. SIGTERM), then waits for it to comply. After a reasonable timeout, if the guest still exists, virDomainDestory will forcefully terminate the guest (e.g. SIGKILL) if necessary (which may produce undesirable results, for example unflushed disk cache in the guest). To avoid this possibility, it's recommended to instead call <a href="libvirt-libvirt.html#virDomainDestroyFlags">virDomainDestroyFlags</a>, sending the <a href="libvirt-libvirt.html#VIR_DOMAIN_DESTROY_GRACEFUL">VIR_DOMAIN_DESTROY_GRACEFUL</a> flag. If the domain is transient and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then that metadata will automatically be deleted when the domain quits.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainDestroyFlags" id="virDomainDestroyFlags"><code>virDomainDestroyFlags</code></a></h3><pre class="programlisting">int virDomainDestroyFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
989
</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 <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> object. This function may require privileged access. Calling this function with no @flags set (equal to zero) is equivalent to calling <a href="libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a>, and after a reasonable timeout will forcefully terminate the guest (e.g. SIGKILL) if necessary (which may produce undesirable results, for example unflushed disk cache in the guest). Including <a href="libvirt-libvirt.html#VIR_DOMAIN_DESTROY_GRACEFUL">VIR_DOMAIN_DESTROY_GRACEFUL</a> in the flags will prevent the forceful termination of the guest, and <a href="libvirt-libvirt.html#virDomainDestroyFlags">virDomainDestroyFlags</a> will instead return an error if the guest doesn't terminate by the end of the timeout; at that time, the management application can decide if calling again without <a href="libvirt-libvirt.html#VIR_DOMAIN_DESTROY_GRACEFUL">VIR_DOMAIN_DESTROY_GRACEFUL</a> is appropriate. Another alternative which may produce cleaner results for the guest's disks is to use <a href="libvirt-libvirt.html#virDomainShutdown">virDomainShutdown</a>() instead, but that depends on guest support (some hypervisor/guest combinations may ignore the shutdown request).</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainDestroyFlagsValues">virDomainDestroyFlagsValues</a></td></tr><tr><td><span class="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><a name="virDomainDetachDevice" id="virDomainDetachDevice"><code>virDomainDetachDevice</code></a></h3><pre class="programlisting">int virDomainDetachDevice (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xml)<br />
902
990
</pre><p>Destroy a virtual device attachment to backend. This function, having hot-unplug semantics, is only allowed on an active domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="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><a name="virDomainDetachDeviceFlags" id="virDomainDetachDeviceFlags"><code>virDomainDetachDeviceFlags</code></a></h3><pre class="programlisting">int virDomainDetachDeviceFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xml, <br /> unsigned int flags)<br />
903
</pre><p>Detach a virtual device from a domain, using the flags parameter to control how the device is detached. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a> specifies that the device allocation is removed based on current domain state. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> specifies that the device shall be deallocated from the active domain instance only and is not from the persisted domain configuration. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> specifies that the device shall be deallocated from the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports removing the persisted device allocation.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainDeviceModifyFlags">virDomainDeviceModifyFlags</a></td></tr><tr><td><span class="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><a name="virDomainFree" id="virDomainFree"><code>virDomainFree</code></a></h3><pre class="programlisting">int virDomainFree (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
991
</pre><p>Detach a virtual device from a domain, using the flags parameter to control how the device is detached. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a> specifies that the device allocation is removed based on current domain state. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> specifies that the device shall be deallocated from the active domain instance only and is not from the persisted domain configuration. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> specifies that the device shall be deallocated from the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports removing the persisted device allocation. Some hypervisors may prevent this operation if there is a current block copy operation on the device being detached; in that case, use <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>() to stop the block copy first.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainDeviceModifyFlags">virDomainDeviceModifyFlags</a></td></tr><tr><td><span class="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><a name="virDomainFree" id="virDomainFree"><code>virDomainFree</code></a></h3><pre class="programlisting">int virDomainFree (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
904
992
</pre><p>Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainGetAutostart" id="virDomainGetAutostart"><code>virDomainGetAutostart</code></a></h3><pre class="programlisting">int virDomainGetAutostart (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int * autostart)<br />
905
993
</pre><p>Provides a boolean value indicating whether the domain configured to be automatically started when the host machine boots.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>the value returned</td></tr><tr><td><span class="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><a name="virDomainGetBlkioParameters" id="virDomainGetBlkioParameters"><code>virDomainGetBlkioParameters</code></a></h3><pre class="programlisting">int virDomainGetBlkioParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
906
994
</pre><p>Get all blkio parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See <a href="libvirt-libvirt.html#virDomainGetMemoryParameters">virDomainGetMemoryParameters</a>() for an equivalent usage example. This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to blkio parameter object (return value, allocated by the caller)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of blkio parameters; input and output</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> and <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetBlockInfo" id="virDomainGetBlockInfo"><code>virDomainGetBlockInfo</code></a></h3><pre class="programlisting">int virDomainGetBlockInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virDomainBlockInfoPtr">virDomainBlockInfoPtr</a> info, <br /> unsigned int flags)<br />
907
</pre><p>Extract information about a domain's block device. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainBlockInfo">virDomainBlockInfo</a> structure allocated by the user</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, pass zero</td></tr><tr><td><span class="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><a name="virDomainGetBlockIoTune" id="virDomainGetBlockIoTune"><code>virDomainGetBlockIoTune</code></a></h3><pre class="programlisting">int virDomainGetBlockIoTune (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
908
</pre><p>Get all block IO tunable parameters for a given device. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor, either for the given @disk (note that block devices of different types might support different parameters), or if @disk is NULL, for all possible disks. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See <a href="libvirt-libvirt.html#virDomainGetMemoryParameters">virDomainGetMemoryParameters</a>() for more details. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. This parameter cannot be NULL unless @nparams is 0 on input.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>Pointer to blkio parameter object (return value, allocated by the caller)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>Pointer to number of blkio parameters</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>An OR'ed set of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainGetBlockJobInfo" id="virDomainGetBlockJobInfo"><code>virDomainGetBlockJobInfo</code></a></h3><pre class="programlisting">int virDomainGetBlockJobInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virDomainBlockJobInfoPtr">virDomainBlockJobInfoPtr</a> info, <br /> unsigned int flags)<br />
909
</pre><p>Request block job information for the given disk. If an operation is active @info will be updated with the current progress. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainBlockJobInfo">virDomainBlockJobInfo</a> structure</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, for future extension</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 when nothing found, 1 when info was found.</td></tr></tbody></table></div><h3><a name="virDomainGetConnect" id="virDomainGetConnect"><code>virDomainGetConnect</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virDomainGetConnect (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br />
995
</pre><p>Extract information about a domain's block device. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainBlockInfo">virDomainBlockInfo</a> structure allocated by the user</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainGetBlockIoTune" id="virDomainGetBlockIoTune"><code>virDomainGetBlockIoTune</code></a></h3><pre class="programlisting">int virDomainGetBlockIoTune (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
996
</pre><p>Get all block IO tunable parameters for a given device. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor, either for the given @disk (note that block devices of different types might support different parameters), or if @disk is NULL, for all possible disks. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See <a href="libvirt-libvirt.html#virDomainGetMemoryParameters">virDomainGetMemoryParameters</a>() for more details. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk. This parameter cannot be NULL unless @nparams is 0 on input.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>Pointer to blkio parameter object (return value, allocated by the caller)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>Pointer to number of blkio parameters</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> and <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetBlockJobInfo" id="virDomainGetBlockJobInfo"><code>virDomainGetBlockJobInfo</code></a></h3><pre class="programlisting">int virDomainGetBlockJobInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virDomainBlockJobInfoPtr">virDomainBlockJobInfoPtr</a> info, <br /> unsigned int flags)<br />
997
</pre><p>Request block job information for the given disk. If an operation is active @info will be updated with the current progress. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or (since 0.9.5) the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainBlockJobInfo">virDomainBlockJobInfo</a> structure</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 when nothing found, 1 when info was found.</td></tr></tbody></table></div><h3><a name="virDomainGetCPUStats" id="virDomainGetCPUStats"><code>virDomainGetCPUStats</code></a></h3><pre class="programlisting">int virDomainGetCPUStats (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> unsigned int nparams, <br /> int start_cpu, <br /> unsigned int ncpus, <br /> unsigned int flags)<br />
998
</pre><p>Get statistics relating to CPU usage attributable to a single domain (in contrast to the statistics returned by <a href="libvirt-libvirt.html#virNodeGetCPUStats">virNodeGetCPUStats</a>() for all processes on the host). @dom must be running (an inactive domain has no attributable cpu usage). On input, @params must contain at least @nparams * @ncpus entries, allocated by the caller. If @start_cpu is -1, then @ncpus must be 1, and the returned results reflect the statistics attributable to the entire domain (such as user and system time for the process as a whole). Otherwise, @start_cpu represents which cpu to start with, and @ncpus represents how many consecutive processors to query, with statistics attributable per processor (such as per-cpu usage). If @ncpus is larger than the number of cpus available to query, then the trailing part of the array will be unpopulated. The remote driver imposes a limit of 128 @ncpus and 16 @nparams; the number of parameters per cpu should not exceed 16, but if you have a host with more than 128 CPUs, your program should split the request into multiple calls. As special cases, if @params is NULL and @nparams is 0 and @ncpus is 1, and the return value will be how many statistics are available for the given @start_cpu. This number may be different for @start_cpu of -1 than for any non-negative value, but will be the same for all non-negative @start_cpu. Likewise, if @params is NULL and @nparams is 0 and @ncpus is 0, the number of cpus available to query is returned. From the host perspective, this would typically match the cpus member of <a href="libvirt-libvirt.html#virNodeGetInfo">virNodeGetInfo</a>(), but might be less due to host cpu hotplug. For now, @flags is unused, and the statistics all relate to the usage from the host perspective. It is possible that a future version will support a flag that queries the cpu usage from the guest's perspective, where the maximum cpu to query would be related to <a href="libvirt-libvirt.html#virDomainGetVcpusFlags">virDomainGetVcpusFlags</a>() rather than <a href="libvirt-libvirt.html#virNodeGetInfo">virNodeGetInfo</a>(). An individual guest vcpu cannot be reliably mapped back to a specific host cpu unless a single-processor vcpu pinning was used, but when @start_cpu is -1, any difference in usage between a host and guest perspective would serve as a measure of hypervisor overhead. Typical use sequence is below. getting total stats: set start_cpu as -1, ncpus 1 virDomainGetCPUStats(dom, NULL, 0, -1, 1, 0) => nparams params = calloc(nparams, sizeof(virTypedParameter)) virDomainGetCPUStats(dom, params, nparams, -1, 1, 0) => total stats. getting per-cpu stats: virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0) => ncpus virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0) => nparams params = calloc(ncpus * nparams, sizeof(virTypedParameter)) virDomainGetCPUStats(dom, params, nparams, 0, ncpus, 0) => per-cpu stats</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>domain to query</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>array to populate on output</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of parameters per cpu</td></tr><tr><td><span class="term"><i><tt>start_cpu</tt></i>:</span></td><td>which cpu to start with, or -1 for summary</td></tr><tr><td><span class="term"><i><tt>ncpus</tt></i>:</span></td><td>how many cpus to query</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 on failure, or the number of statistics that were populated per cpu on success (this will be less than the total number of populated @params, unless @ncpus was 1; and may be less than @nparams). The populated parameters start at each stride of @nparams, which means the results may be discontiguous; any unpopulated parameters will be zeroed on success (this includes skipped elements if @nparams is too large, and tail elements if @ncpus is too large). The caller is responsible for freeing any returned string parameters.</td></tr></tbody></table></div><h3><a name="virDomainGetConnect" id="virDomainGetConnect"><code>virDomainGetConnect</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virDomainGetConnect (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br />
910
999
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to a domain</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainGetControlInfo" id="virDomainGetControlInfo"><code>virDomainGetControlInfo</code></a></h3><pre class="programlisting">int virDomainGetControlInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virDomainControlInfoPtr">virDomainControlInfoPtr</a> info, <br /> unsigned int flags)<br />
911
</pre><p>Extract details about current state of control interface to a domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainControlInfo">virDomainControlInfo</a> structure allocated by the user</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>additional flags, 0 for now</td></tr><tr><td><span class="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><a name="virDomainGetID" id="virDomainGetID"><code>virDomainGetID</code></a></h3><pre class="programlisting">unsigned int virDomainGetID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
1000
</pre><p>Extract details about current state of control interface to a domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainControlInfo">virDomainControlInfo</a> structure allocated by the user</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainGetDiskErrors" id="virDomainGetDiskErrors"><code>virDomainGetDiskErrors</code></a></h3><pre class="programlisting">int virDomainGetDiskErrors (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> <a href="libvirt-libvirt.html#virDomainDiskErrorPtr">virDomainDiskErrorPtr</a> errors, <br /> unsigned int maxerrors, <br /> unsigned int flags)<br />
1001
</pre><p>The function populates @errors array with all disks that encountered an I/O error. Disks with no error will not be returned in the @errors array. Each disk is identified by its target (the dev attribute of target subelement in domain XML), such as "vda", and accompanied with the error that was seen on it. The caller is also responsible for calling free() on each disk name returned. In a special case when @errors is NULL and @maxerrors is 0, the function</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>errors</tt></i>:</span></td><td>array to populate on output</td></tr><tr><td><span class="term"><i><tt>maxerrors</tt></i>:</span></td><td>size of @errors array</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>preferred size of @errors that the caller should use to get all disk errors. Since calling virDomainGetDiskErrors(dom, NULL, 0, 0) to get preferred size of @errors array and getting the errors are two separate operations, new disks may be hotplugged to the domain and new errors may be encountered between the two calls. Thus, this function may not return all disk errors because the supplied array is not large enough. Such errors may, however, be detected by listening to domain events. Returns number of disks with errors filled in the @errors array or -1 on error.</td></tr></tbody></table></div><h3><a name="virDomainGetID" id="virDomainGetID"><code>virDomainGetID</code></a></h3><pre class="programlisting">unsigned int virDomainGetID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
912
1002
</pre><p>Get the hypervisor ID number for the domain</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainGetInfo" id="virDomainGetInfo"><code>virDomainGetInfo</code></a></h3><pre class="programlisting">int virDomainGetInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virDomainInfoPtr">virDomainInfoPtr</a> info)<br />
913
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainInfo">virDomainInfo</a> structure allocated by the user</td></tr><tr><td><span class="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><a name="virDomainGetJobInfo" id="virDomainGetJobInfo"><code>virDomainGetJobInfo</code></a></h3><pre class="programlisting">int virDomainGetJobInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virDomainJobInfoPtr">virDomainJobInfoPtr</a> info)<br />
1003
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainInfo">virDomainInfo</a> structure allocated by the user</td></tr><tr><td><span class="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><a name="virDomainGetInterfaceParameters" id="virDomainGetInterfaceParameters"><code>virDomainGetInterfaceParameters</code></a></h3><pre class="programlisting">int virDomainGetInterfaceParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * device, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
1004
</pre><p>Get all interface parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See <a href="libvirt-libvirt.html#virDomainGetMemoryParameters">virDomainGetMemoryParameters</a>() for an equivalent usage example. This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>device</tt></i>:</span></td><td>the interface name or mac address</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to interface parameter objects (return value, allocated by the caller)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of interface parameter; input and output</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> and <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetJobInfo" id="virDomainGetJobInfo"><code>virDomainGetJobInfo</code></a></h3><pre class="programlisting">int virDomainGetJobInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virDomainJobInfoPtr">virDomainJobInfoPtr</a> info)<br />
914
1005
</pre><p>Extract information about progress of a background job on a domain. Will return an error if the domain is not active.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virDomainJobInfo">virDomainJobInfo</a> structure allocated by the user</td></tr><tr><td><span class="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><a name="virDomainGetMaxMemory" id="virDomainGetMaxMemory"><code>virDomainGetMaxMemory</code></a></h3><pre class="programlisting">unsigned long virDomainGetMaxMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
915
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="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><a name="virDomainGetMaxVcpus" id="virDomainGetMaxVcpus"><code>virDomainGetMaxVcpus</code></a></h3><pre class="programlisting">int virDomainGetMaxVcpus (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
1006
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the memory size in kibibytes (blocks of 1024 bytes), or 0 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainGetMaxVcpus" id="virDomainGetMaxVcpus"><code>virDomainGetMaxVcpus</code></a></h3><pre class="programlisting">int virDomainGetMaxVcpus (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
916
1007
</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 <a href="libvirt-libvirt.html#virConnectGetMaxVcpus">virConnectGetMaxVcpus</a>(). If the guest is running this will reflect the maximum number of virtual CPUs the guest was booted with. For more details, see <a href="libvirt-libvirt.html#virDomainGetVcpusFlags">virDomainGetVcpusFlags</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="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><a name="virDomainGetMemoryParameters" id="virDomainGetMemoryParameters"><code>virDomainGetMemoryParameters</code></a></h3><pre class="programlisting">int virDomainGetMemoryParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
917
</pre><p>Get all memory parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. Here is a sample code snippet: if ((virDomainGetMemoryParameters(dom, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(*params) * nparams)) == NULL) goto error; memset(params, 0, sizeof(*params) * nparams); if (virDomainGetMemoryParameters(dom, params, &nparams, 0)) goto error; } This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to memory parameter object (return value, allocated by the caller)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of memory parameters; input and output</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> and <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetName" id="virDomainGetName"><code>virDomainGetName</code></a></h3><pre class="programlisting">const char * virDomainGetName (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
918
</pre><p>Get the public name for that domain</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainGetOSType" id="virDomainGetOSType"><code>virDomainGetOSType</code></a></h3><pre class="programlisting">char * virDomainGetOSType (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
1008
</pre><p>Get all memory parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. Here is a sample code snippet: if ((virDomainGetMemoryParameters(dom, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(*params) * nparams)) == NULL) goto error; memset(params, 0, sizeof(*params) * nparams); if (virDomainGetMemoryParameters(dom, params, &nparams, 0)) goto error; } This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to memory parameter object (return value, allocated by the caller)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of memory parameters; input and output</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> and <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetMetadata" id="virDomainGetMetadata"><code>virDomainGetMetadata</code></a></h3><pre class="programlisting">char * virDomainGetMetadata (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int type, <br /> const char * uri, <br /> unsigned int flags)<br />
1009
</pre><p>Retrieves the appropriate domain element given by @type. If <a href="libvirt-libvirt.html#VIR_DOMAIN_METADATA_ELEMENT">VIR_DOMAIN_METADATA_ELEMENT</a> is requested parameter @uri must be set to the name of the namespace the requested elements belong to, otherwise must be NULL. If an element of the domain XML is not present, the resulting error will be <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN_METADATA">VIR_ERR_NO_DOMAIN_METADATA</a>. This method forms a shortcut for seeing information from <a href="libvirt-libvirt.html#virDomainSetMetadata">virDomainSetMetadata</a>() without having to go through <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>(). @flags controls whether the live domain or persistent configuration will be queried.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>type of description, from <a href="libvirt-libvirt.html#virDomainMetadataType">virDomainMetadataType</a></td></tr><tr><td><span class="term"><i><tt>uri</tt></i>:</span></td><td>XML namespace identifier</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the metadata string on success (caller must free), or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainGetName" id="virDomainGetName"><code>virDomainGetName</code></a></h3><pre class="programlisting">const char * virDomainGetName (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
1010
</pre><p>Get the public name for that domain</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainGetNumaParameters" id="virDomainGetNumaParameters"><code>virDomainGetNumaParameters</code></a></h3><pre class="programlisting">int virDomainGetNumaParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
1011
</pre><p>Get all numa parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. As a special case, calling with @params as NULL and @nparams as 0 on input will cause @nparams on output to contain the number of parameters supported by the hypervisor. The caller should then allocate @params array, i.e. (sizeof(@virTypedParameter) * @nparams) bytes and call the API again. See <a href="libvirt-libvirt.html#virDomainGetMemoryParameters">virDomainGetMemoryParameters</a>() for an equivalent usage example. This function may require privileged access to the hypervisor. This function expects the caller to allocate the @params.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to numa parameter object (return value, allocated by the caller)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of numa parameters</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> and <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetOSType" id="virDomainGetOSType"><code>virDomainGetOSType</code></a></h3><pre class="programlisting">char * virDomainGetOSType (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
919
1012
</pre><p>Get the type of domain operation system.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainGetSchedulerParameters" id="virDomainGetSchedulerParameters"><code>virDomainGetSchedulerParameters</code></a></h3><pre class="programlisting">int virDomainGetSchedulerParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams)<br />
920
1013
</pre><p>Get all scheduler parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. @nparams cannot be 0. It is hypervisor specific whether this returns the live or persistent state; for more control, use <a href="libvirt-libvirt.html#virDomainGetSchedulerParametersFlags">virDomainGetSchedulerParametersFlags</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to scheduler parameter objects (return value)</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of scheduler parameter objects (this value should generally be as large as the returned value nparams of <a href="libvirt-libvirt.html#virDomainGetSchedulerType">virDomainGetSchedulerType</a>()); input and output</td></tr><tr><td><span class="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><a name="virDomainGetSchedulerParametersFlags" id="virDomainGetSchedulerParametersFlags"><code>virDomainGetSchedulerParametersFlags</code></a></h3><pre class="programlisting">int virDomainGetSchedulerParametersFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
921
1014
</pre><p>Get all scheduler parameters. On input, @nparams gives the size of the @params array; on output, @nparams gives how many slots were filled with parameter information, which might be less but will not exceed the input value. @nparams cannot be 0. The value of @flags can be exactly <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>, <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a>, or <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a>. Here is a sample code snippet: char *ret = virDomainGetSchedulerType(dom, &nparams); if (ret && nparams != 0) { if ((params = malloc(sizeof(*params) * nparams)) == NULL) goto error; memset(params, 0, sizeof(*params) * nparams); if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, 0)) goto error; }</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to scheduler parameter object (return value)</td></tr><tr><td><span class="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 <a href="libvirt-libvirt.html#virDomainGetSchedulerType">virDomainGetSchedulerType</a>()); input and output</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> and <a href="libvirt-libvirt.html#virTypedParameterFlags">virTypedParameterFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetSchedulerType" id="virDomainGetSchedulerType"><code>virDomainGetSchedulerType</code></a></h3><pre class="programlisting">char * virDomainGetSchedulerType (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int * nparams)<br />
922
1015
</pre><p>Get the scheduler type and the number of scheduler parameters.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>pointer to number of scheduler parameters, can be NULL (return value)</td></tr><tr><td><span class="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><a name="virDomainGetSecurityLabel" id="virDomainGetSecurityLabel"><code>virDomainGetSecurityLabel</code></a></h3><pre class="programlisting">int virDomainGetSecurityLabel (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virSecurityLabelPtr">virSecurityLabelPtr</a> seclabel)<br />
923
1016
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>seclabel</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virSecurityLabel">virSecurityLabel</a> structure</td></tr><tr><td><span class="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><a name="virDomainGetState" id="virDomainGetState"><code>virDomainGetState</code></a></h3><pre class="programlisting">int virDomainGetState (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int * state, <br /> int * reason, <br /> unsigned int flags)<br />
924
</pre><p>Extract domain state. Each state can be accompanied with a reason (if known) which led to the state.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>state</tt></i>:</span></td><td>returned state of the domain (one of <a href="libvirt-libvirt.html#virDomainState">virDomainState</a>)</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>returned reason which led to @state (one of virDomain*Reason corresponding to the current state); it is allowed to be NULL</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>additional flags, 0 for now.</td></tr><tr><td><span class="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><a name="virDomainGetUUID" id="virDomainGetUUID"><code>virDomainGetUUID</code></a></h3><pre class="programlisting">int virDomainGetUUID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned char * uuid)<br />
1017
</pre><p>Extract domain state. Each state can be accompanied with a reason (if known) which led to the state.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>state</tt></i>:</span></td><td>returned state of the domain (one of <a href="libvirt-libvirt.html#virDomainState">virDomainState</a>)</td></tr><tr><td><span class="term"><i><tt>reason</tt></i>:</span></td><td>returned reason which led to @state (one of virDomain*Reason corresponding to the current state); it is allowed to be NULL</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainGetUUID" id="virDomainGetUUID"><code>virDomainGetUUID</code></a></h3><pre class="programlisting">int virDomainGetUUID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned char * uuid)<br />
925
1018
</pre><p>Get the UUID for a domain</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>uuid</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#VIR_UUID_BUFLEN">VIR_UUID_BUFLEN</a> bytes array</td></tr><tr><td><span class="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><a name="virDomainGetUUIDString" id="virDomainGetUUIDString"><code>virDomainGetUUIDString</code></a></h3><pre class="programlisting">int virDomainGetUUIDString (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> char * buf)<br />
926
1019
</pre><p>Get the UUID for a domain as string. For more information about UUID see RFC4122.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>buf</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#VIR_UUID_STRING_BUFLEN">VIR_UUID_STRING_BUFLEN</a> bytes array</td></tr><tr><td><span class="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><a name="virDomainGetVcpuPinInfo" id="virDomainGetVcpuPinInfo"><code>virDomainGetVcpuPinInfo</code></a></h3><pre class="programlisting">int virDomainGetVcpuPinInfo (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int ncpumaps, <br /> unsigned char * cpumaps, <br /> int maplen, <br /> unsigned int flags)<br />
927
</pre><p>Query the CPU affinity setting of all virtual CPUs of domain, store it in cpumaps.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>ncpumaps</tt></i>:</span></td><td>the number of cpumap (listed first to match <a href="libvirt-libvirt.html#virDomainGetVcpus">virDomainGetVcpus</a>)</td></tr><tr><td><span class="term"><i><tt>cpumaps</tt></i>:</span></td><td>pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT) It's assumed there is <ncpumaps> cpumap in cpumaps array. The memory allocated to cpumaps must be (ncpumaps * maplen) bytes (ie: calloc(ncpumaps, maplen)). One cpumap inside cpumaps has the format described in <a href="libvirt-libvirt.html#virDomainPinVcpu">virDomainPinVcpu</a>() API. Must not be NULL.</td></tr><tr><td><span class="term"><i><tt>maplen</tt></i>:</span></td><td>the number of bytes in one cpumap, from 1 up to size of CPU map. Must be positive.</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> Must not be <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> and <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> concurrently.</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of virtual CPUs in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainGetVcpus" id="virDomainGetVcpus"><code>virDomainGetVcpus</code></a></h3><pre class="programlisting">int virDomainGetVcpus (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virVcpuInfoPtr">virVcpuInfoPtr</a> info, <br /> int maxinfo, <br /> unsigned char * cpumaps, <br /> int maplen)<br />
1020
</pre><p>Query the CPU affinity setting of all virtual CPUs of domain, store it in cpumaps.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>ncpumaps</tt></i>:</span></td><td>the number of cpumap (listed first to match <a href="libvirt-libvirt.html#virDomainGetVcpus">virDomainGetVcpus</a>)</td></tr><tr><td><span class="term"><i><tt>cpumaps</tt></i>:</span></td><td>pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT) It's assumed there is <ncpumaps> cpumap in cpumaps array. The memory allocated to cpumaps must be (ncpumaps * maplen) bytes (ie: calloc(ncpumaps, maplen)). One cpumap inside cpumaps has the format described in <a href="libvirt-libvirt.html#virDomainPinVcpu">virDomainPinVcpu</a>() API. Must not be NULL.</td></tr><tr><td><span class="term"><i><tt>maplen</tt></i>:</span></td><td>the number of bytes in one cpumap, from 1 up to size of CPU map. Must be positive.</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a> Must not be <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> and <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> concurrently.</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of virtual CPUs in case of success, -1 in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainGetVcpus" id="virDomainGetVcpus"><code>virDomainGetVcpus</code></a></h3><pre class="programlisting">int virDomainGetVcpus (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virVcpuInfoPtr">virVcpuInfoPtr</a> info, <br /> int maxinfo, <br /> unsigned char * cpumaps, <br /> int maplen)<br />
928
1021
</pre><p>Extract information about virtual CPUs of domain, store it in info array and also in cpumaps if this pointer isn't NULL. This call may fail on an inactive domain. See also <a href="libvirt-libvirt.html#virDomainGetVcpuPinInfo">virDomainGetVcpuPinInfo</a> for querying just cpumaps, including on an inactive domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to an array of <a href="libvirt-libvirt.html#virVcpuInfo">virVcpuInfo</a> structures (OUT)</td></tr><tr><td><span class="term"><i><tt>maxinfo</tt></i>:</span></td><td>number of structures in info array</td></tr><tr><td><span class="term"><i><tt>cpumaps</tt></i>:</span></td><td>pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT) If cpumaps is NULL, then no cpumap information is returned by the API. It's assumed there is <maxinfo> cpumap in cpumaps array. The memory allocated to cpumaps must be (maxinfo * maplen) bytes (ie: calloc(maxinfo, maplen)). One cpumap inside cpumaps has the format described in <a href="libvirt-libvirt.html#virDomainPinVcpu">virDomainPinVcpu</a>() API.</td></tr><tr><td><span class="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...). Must be zero when cpumaps is NULL and positive when it is non-NULL.</td></tr><tr><td><span class="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><a name="virDomainGetVcpusFlags" id="virDomainGetVcpusFlags"><code>virDomainGetVcpusFlags</code></a></h3><pre class="programlisting">int virDomainGetVcpusFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
929
</pre><p>Query the number of virtual CPUs used by the domain. Note that this call may fail if the underlying virtualization hypervisor does not support it. This function may require privileged access to the hypervisor. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a>, this will query a running domain (which will fail if domain is not active); if it includes <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a>, this will query the XML description of the domain. It is an error to set both flags. If neither flag is set (that is, <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>), then the configuration queried depends on whether the domain is currently running. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_VCPU_MAXIMUM">VIR_DOMAIN_VCPU_MAXIMUM</a>, then the maximum virtual CPU limit is queried. Otherwise, this call queries the current virtual CPU limit.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainVcpuFlags">virDomainVcpuFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetXMLDesc" id="virDomainGetXMLDesc"><code>virDomainGetXMLDesc</code></a></h3><pre class="programlisting">char * virDomainGetXMLDesc (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
930
</pre><p>Provide an XML description of the domain. The description may be reused later to relaunch the domain with <a href="libvirt-libvirt.html#virDomainCreateXML">virDomainCreateXML</a>(). No security-sensitive data will be included unless @flags contains <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_SECURE">VIR_DOMAIN_XML_SECURE</a>; this flag is rejected on read-only connections. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_INACTIVE">VIR_DOMAIN_XML_INACTIVE</a>, then the XML represents the configuration that will be used on the next boot of a persistent domain; otherwise, the configuration represents the currently running domain. If @flags contains <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_UPDATE_CPU">VIR_DOMAIN_XML_UPDATE_CPU</a>, then the portion of the domain XML describing CPU capabilities is modified to match actual capabilities of the host.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainXMLFlags">virDomainXMLFlags</a></td></tr><tr><td><span class="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><a name="virDomainHasCurrentSnapshot" id="virDomainHasCurrentSnapshot"><code>virDomainHasCurrentSnapshot</code></a></h3><pre class="programlisting">int virDomainHasCurrentSnapshot (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
931
</pre><p>Determine if the domain has a current snapshot.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused flag parameters; callers should pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if such snapshot exists, 0 if it doesn't, -1 on error.</td></tr></tbody></table></div><h3><a name="virDomainHasManagedSaveImage" id="virDomainHasManagedSaveImage"><code>virDomainHasManagedSaveImage</code></a></h3><pre class="programlisting">int virDomainHasManagedSaveImage (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int flags)<br />
932
</pre><p>Check if a domain has a managed save image as created by <a href="libvirt-libvirt.html#virDomainManagedSave">virDomainManagedSave</a>(). Note that any running domain should not have such an image, as it should have been removed on restart.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>optional flags currently unused</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if no image is present, 1 if an image is present, and -1 in case of error</td></tr></tbody></table></div><h3><a name="virDomainInjectNMI" id="virDomainInjectNMI"><code>virDomainInjectNMI</code></a></h3><pre class="programlisting">int virDomainInjectNMI (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
933
</pre><p>Send NMI to the guest</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>the flags for controlling behavior, pass 0 for now</td></tr><tr><td><span class="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><a name="virDomainInterfaceStats" id="virDomainInterfaceStats"><code>virDomainInterfaceStats</code></a></h3><pre class="programlisting">int virDomainInterfaceStats (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * path, <br /> <a href="libvirt-libvirt.html#virDomainInterfaceStatsPtr">virDomainInterfaceStatsPtr</a> stats, <br /> size_t size)<br />
1022
</pre><p>Query the number of virtual CPUs used by the domain. Note that this call may fail if the underlying virtualization hypervisor does not support it. This function may require privileged access to the hypervisor. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a>, this will query a running domain (which will fail if domain is not active); if it includes <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a>, this will query the XML description of the domain. It is an error to set both flags. If neither flag is set (that is, <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>), then the configuration queried depends on whether the domain is currently running. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_VCPU_MAXIMUM">VIR_DOMAIN_VCPU_MAXIMUM</a>, then the maximum virtual CPU limit is queried. Otherwise, this call queries the current virtual CPU limit.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainVcpuFlags">virDomainVcpuFlags</a></td></tr><tr><td><span class="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><a name="virDomainGetXMLDesc" id="virDomainGetXMLDesc"><code>virDomainGetXMLDesc</code></a></h3><pre class="programlisting">char * virDomainGetXMLDesc (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
1023
</pre><p>Provide an XML description of the domain. The description may be reused later to relaunch the domain with <a href="libvirt-libvirt.html#virDomainCreateXML">virDomainCreateXML</a>(). No security-sensitive data will be included unless @flags contains <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_SECURE">VIR_DOMAIN_XML_SECURE</a>; this flag is rejected on read-only connections. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_INACTIVE">VIR_DOMAIN_XML_INACTIVE</a>, then the XML represents the configuration that will be used on the next boot of a persistent domain; otherwise, the configuration represents the currently running domain. If @flags contains <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_UPDATE_CPU">VIR_DOMAIN_XML_UPDATE_CPU</a>, then the portion of the domain XML describing CPU capabilities is modified to match actual capabilities of the host.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainXMLFlags">virDomainXMLFlags</a></td></tr><tr><td><span class="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><a name="virDomainHasCurrentSnapshot" id="virDomainHasCurrentSnapshot"><code>virDomainHasCurrentSnapshot</code></a></h3><pre class="programlisting">int virDomainHasCurrentSnapshot (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
1024
</pre><p>Determine if the domain has a current snapshot.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if such snapshot exists, 0 if it doesn't, -1 on error.</td></tr></tbody></table></div><h3><a name="virDomainHasManagedSaveImage" id="virDomainHasManagedSaveImage"><code>virDomainHasManagedSaveImage</code></a></h3><pre class="programlisting">int virDomainHasManagedSaveImage (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int flags)<br />
1025
</pre><p>Check if a domain has a managed save image as created by <a href="libvirt-libvirt.html#virDomainManagedSave">virDomainManagedSave</a>(). Note that any running domain should not have such an image, as it should have been removed on restart.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if no image is present, 1 if an image is present, and -1 in case of error</td></tr></tbody></table></div><h3><a name="virDomainInjectNMI" id="virDomainInjectNMI"><code>virDomainInjectNMI</code></a></h3><pre class="programlisting">int virDomainInjectNMI (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
1026
</pre><p>Send NMI to the guest</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainInterfaceStats" id="virDomainInterfaceStats"><code>virDomainInterfaceStats</code></a></h3><pre class="programlisting">int virDomainInterfaceStats (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * path, <br /> <a href="libvirt-libvirt.html#virDomainInterfaceStatsPtr">virDomainInterfaceStatsPtr</a> stats, <br /> size_t size)<br />
934
1027
</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 one network interface. To get stats for each you should make multiple calls to this function. Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>path</tt></i>:</span></td><td>path to the interface</td></tr><tr><td><span class="term"><i><tt>stats</tt></i>:</span></td><td>network interface stats (returned)</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>size of stats structure</td></tr><tr><td><span class="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><a name="virDomainIsActive" id="virDomainIsActive"><code>virDomainIsActive</code></a></h3><pre class="programlisting">int virDomainIsActive (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br />
935
1028
</pre><p>Determine if the domain is currently running</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if running, 0 if inactive, -1 on error</td></tr></tbody></table></div><h3><a name="virDomainIsPersistent" id="virDomainIsPersistent"><code>virDomainIsPersistent</code></a></h3><pre class="programlisting">int virDomainIsPersistent (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br />
936
1029
</pre><p>Determine if the domain has a persistent configuration which means it will still exist after shutting down</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if persistent, 0 if transient, -1 on error</td></tr></tbody></table></div><h3><a name="virDomainIsUpdated" id="virDomainIsUpdated"><code>virDomainIsUpdated</code></a></h3><pre class="programlisting">int virDomainIsUpdated (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom)<br />
940
1033
</pre><p>Try to lookup a domain on the given hypervisor based on its UUID.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>uuid</tt></i>:</span></td><td>the raw UUID for the domain</td></tr><tr><td><span class="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 <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN">VIR_ERR_NO_DOMAIN</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainLookupByUUIDString" id="virDomainLookupByUUIDString"><code>virDomainLookupByUUIDString</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByUUIDString (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * uuidstr)<br />
941
1034
</pre><p>Try to lookup a domain on the given hypervisor based on its UUID.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>uuidstr</tt></i>:</span></td><td>the string UUID for the domain</td></tr><tr><td><span class="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 <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN">VIR_ERR_NO_DOMAIN</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainManagedSave" id="virDomainManagedSave"><code>virDomainManagedSave</code></a></h3><pre class="programlisting">int virDomainManagedSave (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int flags)<br />
942
1035
</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. The difference from <a href="libvirt-libvirt.html#virDomainSave">virDomainSave</a>() is that libvirt is keeping track of the saved state itself, and will reuse it once the domain is being restarted (automatically or via an explicit libvirt call). As a result any running domain is sure to not have a managed saved image. This also implies that managed save only works on persistent domains, since the domain must still exist in order to use <a href="libvirt-libvirt.html#virDomainCreate">virDomainCreate</a>() to restart it. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_BYPASS_CACHE">VIR_DOMAIN_SAVE_BYPASS_CACHE</a>, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS. Normally, the managed saved state will remember whether the domain was running or paused, and start will resume to the same state. Specifying <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_RUNNING">VIR_DOMAIN_SAVE_RUNNING</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_PAUSED">VIR_DOMAIN_SAVE_PAUSED</a> in @flags will override the default saved into the file. These two flags are mutually exclusive.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSaveRestoreFlags">virDomainSaveRestoreFlags</a></td></tr><tr><td><span class="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><a name="virDomainManagedSaveRemove" id="virDomainManagedSaveRemove"><code>virDomainManagedSaveRemove</code></a></h3><pre class="programlisting">int virDomainManagedSaveRemove (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int flags)<br />
943
</pre><p>Remove any managed save image for this domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>optional flags currently unused</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, and -1 in case of error</td></tr></tbody></table></div><h3><a name="virDomainMemoryPeek" id="virDomainMemoryPeek"><code>virDomainMemoryPeek</code></a></h3><pre class="programlisting">int virDomainMemoryPeek (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned long long start, <br /> size_t size, <br /> void * buffer, <br /> unsigned int flags)<br />
944
</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 <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>start</tt></i>:</span></td><td>start of memory to peek</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>size of memory to peek</td></tr><tr><td><span class="term"><i><tt>buffer</tt></i>:</span></td><td>return buffer (must be at least size bytes)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags, see below</td></tr><tr><td><span class="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><a name="virDomainMemoryStats" id="virDomainMemoryStats"><code>virDomainMemoryStats</code></a></h3><pre class="programlisting">int virDomainMemoryStats (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> <a href="libvirt-libvirt.html#virDomainMemoryStatPtr">virDomainMemoryStatPtr</a> stats, <br /> unsigned int nr_stats, <br /> unsigned int flags)<br />
945
</pre><p>This function provides memory statistics for the domain. Up to 'nr_stats' elements of 'stats' will be populated with memory statistics from the domain. Only statistics supported by the domain, the driver, and this version of libvirt will be returned. Memory Statistics: <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_SWAP_IN">VIR_DOMAIN_MEMORY_STAT_SWAP_IN</a>: The total amount of data read from swap space (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_SWAP_OUT">VIR_DOMAIN_MEMORY_STAT_SWAP_OUT</a>: The total amount of memory written out to swap space (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT">VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT</a>: The number of page faults that required disk IO to service. <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT">VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT</a>: The number of page faults serviced without disk IO. <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_UNUSED">VIR_DOMAIN_MEMORY_STAT_UNUSED</a>: The amount of memory which is not being used for any purpose (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_AVAILABLE">VIR_DOMAIN_MEMORY_STAT_AVAILABLE</a>: The total amount of memory available to the domain's OS (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON">VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON</a>: Current balloon value (in kb).</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>stats</tt></i>:</span></td><td>nr_stats-sized array of stat structures (returned)</td></tr><tr><td><span class="term"><i><tt>nr_stats</tt></i>:</span></td><td>number of memory statistics requested</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused, always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>The number of stats provided or -1 in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainMigrate" id="virDomainMigrate"><code>virDomainMigrate</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainMigrate (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> dconn, <br /> unsigned long flags, <br /> const char * dname, <br /> const char * uri, <br /> unsigned long bandwidth)<br />
946
</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: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_PAUSED">VIR_MIGRATE_PAUSED</a> Leave the domain suspended on the remote side. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. Applications using the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag will probably prefer to invoke <a href="libvirt-libvirt.html#virDomainMigrateToURI">virDomainMigrateToURI</a>, avoiding the need to open connection to the destination host themselves. If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is set, the uri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If omitted, the dconn connection object will be queried for its current URI. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, the URI parameter takes a hypervisor specific format. The hypervisor capabilities XML includes details of the support URI schemes. If omitted the dconn will be asked for a default URI. In either case it is typically only necessary to specify a URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dconn</tt></i>:</span></td><td>destination host (a connection object)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags</td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>uri</tt></i>:</span></td><td>(optional) dest hostname/URI as seen from the source host</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="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><a name="virDomainMigrate2" id="virDomainMigrate2"><code>virDomainMigrate2</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainMigrate2 (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> dconn, <br /> const char * dxml, <br /> unsigned long flags, <br /> const char * dname, <br /> const char * uri, <br /> unsigned long bandwidth)<br />
947
</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: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_PAUSED">VIR_MIGRATE_PAUSED</a> Leave the domain suspended on the remote side. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. Applications using the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag will probably prefer to invoke <a href="libvirt-libvirt.html#virDomainMigrateToURI">virDomainMigrateToURI</a>, avoiding the need to open connection to the destination host themselves. If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is set, the uri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If omitted, the dconn connection object will be queried for its current URI. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, the URI parameter takes a hypervisor specific format. The hypervisor capabilities XML includes details of the support URI schemes. If omitted the dconn will be asked for a default URI. In either case it is typically only necessary to specify a URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /capabilities/host/migration_features. There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor. If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used on the destination. For example, it is possible to alter the backing filename that is associated with a disk device, in order to account for naming differences between source and destination in accessing the underlying storage. The migration will fail if @dxml would cause any guest-visible changes. Pass NULL if no changes are needed to the XML between source and destination. @dxml cannot be used to rename the domain during migration (use @dname for that purpose). Domain name in @dxml must either match the original domain name or @dname if it was specified.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dconn</tt></i>:</span></td><td>destination host (a connection object)</td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>(optional) XML config for launching guest on target</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags</td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>uri</tt></i>:</span></td><td>(optional) dest hostname/URI as seen from the source host</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="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><a name="virDomainMigrateGetMaxSpeed" id="virDomainMigrateGetMaxSpeed"><code>virDomainMigrateGetMaxSpeed</code></a></h3><pre class="programlisting">int virDomainMigrateGetMaxSpeed (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long * bandwidth, <br /> unsigned int flags)<br />
948
</pre><p>Get the current maximum bandwidth (in Mbps) that will be used if the domain is migrated. Not all hypervisors will support a bandwidth limit.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>return value of current migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>fine-tuning flags, currently unused, use 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 otherwise.</td></tr></tbody></table></div><h3><a name="virDomainMigrateSetMaxDowntime" id="virDomainMigrateSetMaxDowntime"><code>virDomainMigrateSetMaxDowntime</code></a></h3><pre class="programlisting">int virDomainMigrateSetMaxDowntime (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long long downtime, <br /> unsigned int flags)<br />
949
</pre><p>Sets maximum tolerable time for which the domain is allowed to be paused at the end of live migration. It's supposed to be called while the domain is being live-migrated as a reaction to migration progress.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>downtime</tt></i>:</span></td><td>maximum tolerable downtime for live migration, in milliseconds</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>fine-tuning flags, currently unused, use 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 otherwise.</td></tr></tbody></table></div><h3><a name="virDomainMigrateSetMaxSpeed" id="virDomainMigrateSetMaxSpeed"><code>virDomainMigrateSetMaxSpeed</code></a></h3><pre class="programlisting">int virDomainMigrateSetMaxSpeed (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long bandwidth, <br /> unsigned int flags)<br />
950
</pre><p>The maximum bandwidth (in Mbps) that will be used to do migration can be specified with the bandwidth parameter. Not all hypervisors will support a bandwidth cap</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>fine-tuning flags, currently unused, use 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 otherwise.</td></tr></tbody></table></div><h3><a name="virDomainMigrateToURI" id="virDomainMigrateToURI"><code>virDomainMigrateToURI</code></a></h3><pre class="programlisting">int virDomainMigrateToURI (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * duri, <br /> unsigned long flags, <br /> const char * dname, <br /> unsigned long bandwidth)<br />
951
</pre><p>Migrate the domain object from its current host to the destination host given by duri. Flags may be one of more of the following: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). The operation of this API hinges on the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, the duri parameter takes a hypervisor specific format. The uri_transports element of the hypervisor capabilities XML includes details of the supported URI schemes. Not all hypervisors will support this mode of migration, so if the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is not set, then it may be necessary to use the alternative <a href="libvirt-libvirt.html#virDomainMigrate">virDomainMigrate</a> API providing and explicit <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> for the destination host. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag IS set, the duri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. If a hypervisor supports renaming domains during migration, the dname parameter specifies the new name for the domain. Setting dname to NULL keeps the domain name the same. If domain renaming is not supported by the hypervisor, dname must be NULL or else an error will be returned. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>duri</tt></i>:</span></td><td>mandatory URI for the destination host</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags</td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the migration succeeded, -1 upon error.</td></tr></tbody></table></div><h3><a name="virDomainMigrateToURI2" id="virDomainMigrateToURI2"><code>virDomainMigrateToURI2</code></a></h3><pre class="programlisting">int virDomainMigrateToURI2 (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * dconnuri, <br /> const char * miguri, <br /> const char * dxml, <br /> unsigned long flags, <br /> const char * dname, <br /> unsigned long bandwidth)<br />
952
</pre><p>Migrate the domain object from its current host to the destination host given by duri. Flags may be one of more of the following: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). The operation of this API hinges on the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is set, the @dconnuri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, then @dconnuri must be NULL. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> flag is NOT set, then the @miguri parameter allows specification of a URI to use to initiate the VM migration. It takes a hypervisor specific format. The uri_transports element of the hypervisor capabilities XML includes details of the supported URI schemes. <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. If a hypervisor supports changing the configuration of the guest during migration, the @dxml parameter specifies the new config for the guest. The configuration must include an identical set of virtual devices, to ensure a stable guest ABI across migration. Only parameters related to host side configuration can be changed in the XML. Hypervisors will validate this and refuse to allow migration if the provided XML would cause a change in the guest ABI, If a hypervisor supports renaming domains during migration, the dname parameter specifies the new name for the domain. Setting dname to NULL keeps the domain name the same. If domain renaming is not supported by the hypervisor, dname must be NULL or else an error will be returned. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dconnuri</tt></i>:</span></td><td>(optional) URI for target libvirtd if @flags includes <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a></td></tr><tr><td><span class="term"><i><tt>miguri</tt></i>:</span></td><td>(optional) URI for invoking the migration, not if @flags includs <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a></td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>(optional) XML config for launching guest on target</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags</td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the migration succeeded, -1 upon error.</td></tr></tbody></table></div><h3><a name="virDomainOpenConsole" id="virDomainOpenConsole"><code>virDomainOpenConsole</code></a></h3><pre class="programlisting">int virDomainOpenConsole (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * dev_name, <br /> <a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> st, <br /> unsigned int flags)<br />
953
</pre><p>This opens the backend associated with a console, serial or parallel port device on a guest, if the backend is supported. If the @dev_name is omitted, then the first console or serial device is opened. The console is associated with the passed in @st stream, which should have been opened in non-blocking mode for bi-directional I/O.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dev_name</tt></i>:</span></td><td>the console, serial or parallel port device alias, or NULL</td></tr><tr><td><span class="term"><i><tt>st</tt></i>:</span></td><td>a stream to associate with the console</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused, pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the console was opened, -1 on error</td></tr></tbody></table></div><h3><a name="virDomainOpenGraphics" id="virDomainOpenGraphics"><code>virDomainOpenGraphics</code></a></h3><pre class="programlisting">int virDomainOpenGraphics (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int idx, <br /> int fd, <br /> unsigned int flags)<br />
954
</pre><p>This will attempt to connect the file descriptor @fd, to the graphics backend of @dom. If @dom has multiple graphics backends configured, then @idx will determine which one is opened, starting from @idx 0. To disable any authentication, pass the <a href="libvirt-libvirt.html#VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH">VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH</a> constant for @flags. The caller should use an anonymous socketpair to open @fd before invocation. This method can only be used when connected to a local libvirt hypervisor, over a UNIX domain socket. Attempts to use this method over a TCP connection will always fail</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>idx</tt></i>:</span></td><td>index of graphics config to open</td></tr><tr><td><span class="term"><i><tt>fd</tt></i>:</span></td><td>file descriptor to attach graphics to</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags to control open operation</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virDomainPinVcpu" id="virDomainPinVcpu"><code>virDomainPinVcpu</code></a></h3><pre class="programlisting">int virDomainPinVcpu (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int vcpu, <br /> unsigned char * cpumap, <br /> int maplen)<br />
1036
</pre><p>Remove any managed save image for this domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, and -1 in case of error</td></tr></tbody></table></div><h3><a name="virDomainMemoryPeek" id="virDomainMemoryPeek"><code>virDomainMemoryPeek</code></a></h3><pre class="programlisting">int virDomainMemoryPeek (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned long long start, <br /> size_t size, <br /> void * buffer, <br /> unsigned int flags)<br />
1037
</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 <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>start</tt></i>:</span></td><td>start of memory to peek</td></tr><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>size of memory to peek</td></tr><tr><td><span class="term"><i><tt>buffer</tt></i>:</span></td><td>return buffer (must be at least size bytes)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainMemoryFlags">virDomainMemoryFlags</a></td></tr><tr><td><span class="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><a name="virDomainMemoryStats" id="virDomainMemoryStats"><code>virDomainMemoryStats</code></a></h3><pre class="programlisting">int virDomainMemoryStats (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> <a href="libvirt-libvirt.html#virDomainMemoryStatPtr">virDomainMemoryStatPtr</a> stats, <br /> unsigned int nr_stats, <br /> unsigned int flags)<br />
1038
</pre><p>This function provides memory statistics for the domain. Up to 'nr_stats' elements of 'stats' will be populated with memory statistics from the domain. Only statistics supported by the domain, the driver, and this version of libvirt will be returned. Memory Statistics: <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_SWAP_IN">VIR_DOMAIN_MEMORY_STAT_SWAP_IN</a>: The total amount of data read from swap space (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_SWAP_OUT">VIR_DOMAIN_MEMORY_STAT_SWAP_OUT</a>: The total amount of memory written out to swap space (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT">VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT</a>: The number of page faults that required disk IO to service. <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT">VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT</a>: The number of page faults serviced without disk IO. <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_UNUSED">VIR_DOMAIN_MEMORY_STAT_UNUSED</a>: The amount of memory which is not being used for any purpose (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_AVAILABLE">VIR_DOMAIN_MEMORY_STAT_AVAILABLE</a>: The total amount of memory available to the domain's OS (in kb). <a href="libvirt-libvirt.html#VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON">VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON</a>: Current balloon value (in kb).</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to the domain object</td></tr><tr><td><span class="term"><i><tt>stats</tt></i>:</span></td><td>nr_stats-sized array of stat structures (returned)</td></tr><tr><td><span class="term"><i><tt>nr_stats</tt></i>:</span></td><td>number of memory statistics requested</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>The number of stats provided or -1 in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainMigrate" id="virDomainMigrate"><code>virDomainMigrate</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainMigrate (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> dconn, <br /> unsigned long flags, <br /> const char * dname, <br /> const char * uri, <br /> unsigned long bandwidth)<br />
1039
</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: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_PAUSED">VIR_MIGRATE_PAUSED</a> Leave the domain suspended on the remote side. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). <a href="libvirt-libvirt.html#VIR_MIGRATE_UNSAFE">VIR_MIGRATE_UNSAFE</a> Force migration even if it is considered unsafe. <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. Applications using the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag will probably prefer to invoke <a href="libvirt-libvirt.html#virDomainMigrateToURI">virDomainMigrateToURI</a>, avoiding the need to open connection to the destination host themselves. If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is set, the uri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If omitted, the dconn connection object will be queried for its current URI. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, the URI parameter takes a hypervisor specific format. The hypervisor capabilities XML includes details of the support URI schemes. If omitted the dconn will be asked for a default URI. In either case it is typically only necessary to specify a URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dconn</tt></i>:</span></td><td>destination host (a connection object)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainMigrateFlags">virDomainMigrateFlags</a></td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>uri</tt></i>:</span></td><td>(optional) dest hostname/URI as seen from the source host</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="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><a name="virDomainMigrate2" id="virDomainMigrate2"><code>virDomainMigrate2</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainMigrate2 (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> dconn, <br /> const char * dxml, <br /> unsigned long flags, <br /> const char * dname, <br /> const char * uri, <br /> unsigned long bandwidth)<br />
1040
</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: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_PAUSED">VIR_MIGRATE_PAUSED</a> Leave the domain suspended on the remote side. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). <a href="libvirt-libvirt.html#VIR_MIGRATE_UNSAFE">VIR_MIGRATE_UNSAFE</a> Force migration even if it is considered unsafe. <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. Applications using the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag will probably prefer to invoke <a href="libvirt-libvirt.html#virDomainMigrateToURI">virDomainMigrateToURI</a>, avoiding the need to open connection to the destination host themselves. If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is set, the uri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If omitted, the dconn connection object will be queried for its current URI. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, the URI parameter takes a hypervisor specific format. The hypervisor capabilities XML includes details of the support URI schemes. If omitted the dconn will be asked for a default URI. In either case it is typically only necessary to specify a URI if the destination host has multiple interfaces and a specific interface is required to transmit migration data. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /capabilities/host/migration_features. There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor. If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used on the destination. For example, it is possible to alter the backing filename that is associated with a disk device, in order to account for naming differences between source and destination in accessing the underlying storage. The migration will fail if @dxml would cause any guest-visible changes. Pass NULL if no changes are needed to the XML between source and destination. @dxml cannot be used to rename the domain during migration (use @dname for that purpose). Domain name in @dxml must match the original domain name.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dconn</tt></i>:</span></td><td>destination host (a connection object)</td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>(optional) XML config for launching guest on target</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainMigrateFlags">virDomainMigrateFlags</a></td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>uri</tt></i>:</span></td><td>(optional) dest hostname/URI as seen from the source host</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="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><a name="virDomainMigrateGetMaxSpeed" id="virDomainMigrateGetMaxSpeed"><code>virDomainMigrateGetMaxSpeed</code></a></h3><pre class="programlisting">int virDomainMigrateGetMaxSpeed (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long * bandwidth, <br /> unsigned int flags)<br />
1041
</pre><p>Get the current maximum bandwidth (in Mbps) that will be used if the domain is migrated. Not all hypervisors will support a bandwidth limit.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>return value of current migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 otherwise.</td></tr></tbody></table></div><h3><a name="virDomainMigrateSetMaxDowntime" id="virDomainMigrateSetMaxDowntime"><code>virDomainMigrateSetMaxDowntime</code></a></h3><pre class="programlisting">int virDomainMigrateSetMaxDowntime (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long long downtime, <br /> unsigned int flags)<br />
1042
</pre><p>Sets maximum tolerable time for which the domain is allowed to be paused at the end of live migration. It's supposed to be called while the domain is being live-migrated as a reaction to migration progress.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>downtime</tt></i>:</span></td><td>maximum tolerable downtime for live migration, in milliseconds</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 otherwise.</td></tr></tbody></table></div><h3><a name="virDomainMigrateSetMaxSpeed" id="virDomainMigrateSetMaxSpeed"><code>virDomainMigrateSetMaxSpeed</code></a></h3><pre class="programlisting">int virDomainMigrateSetMaxSpeed (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long bandwidth, <br /> unsigned int flags)<br />
1043
</pre><p>The maximum bandwidth (in Mbps) that will be used to do migration can be specified with the bandwidth parameter. Not all hypervisors will support a bandwidth cap</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 otherwise.</td></tr></tbody></table></div><h3><a name="virDomainMigrateToURI" id="virDomainMigrateToURI"><code>virDomainMigrateToURI</code></a></h3><pre class="programlisting">int virDomainMigrateToURI (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * duri, <br /> unsigned long flags, <br /> const char * dname, <br /> unsigned long bandwidth)<br />
1044
</pre><p>Migrate the domain object from its current host to the destination host given by duri. Flags may be one of more of the following: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). <a href="libvirt-libvirt.html#VIR_MIGRATE_UNSAFE">VIR_MIGRATE_UNSAFE</a> Force migration even if it is considered unsafe. The operation of this API hinges on the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, the duri parameter takes a hypervisor specific format. The uri_transports element of the hypervisor capabilities XML includes details of the supported URI schemes. Not all hypervisors will support this mode of migration, so if the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is not set, then it may be necessary to use the alternative <a href="libvirt-libvirt.html#virDomainMigrate">virDomainMigrate</a> API providing and explicit <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> for the destination host. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag IS set, the duri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. If a hypervisor supports renaming domains during migration, the dname parameter specifies the new name for the domain. Setting dname to NULL keeps the domain name the same. If domain renaming is not supported by the hypervisor, dname must be NULL or else an error will be returned. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>duri</tt></i>:</span></td><td>mandatory URI for the destination host</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainMigrateFlags">virDomainMigrateFlags</a></td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the migration succeeded, -1 upon error.</td></tr></tbody></table></div><h3><a name="virDomainMigrateToURI2" id="virDomainMigrateToURI2"><code>virDomainMigrateToURI2</code></a></h3><pre class="programlisting">int virDomainMigrateToURI2 (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * dconnuri, <br /> const char * miguri, <br /> const char * dxml, <br /> unsigned long flags, <br /> const char * dname, <br /> unsigned long bandwidth)<br />
1045
</pre><p>Migrate the domain object from its current host to the destination host given by duri. Flags may be one of more of the following: <a href="libvirt-libvirt.html#VIR_MIGRATE_LIVE">VIR_MIGRATE_LIVE</a> Do not pause the VM during migration <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> Direct connection between source & destination hosts <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> Tunnel migration data over the libvirt RPC channel <a href="libvirt-libvirt.html#VIR_MIGRATE_PERSIST_DEST">VIR_MIGRATE_PERSIST_DEST</a> If the migration is successful, persist the domain on the destination host. <a href="libvirt-libvirt.html#VIR_MIGRATE_UNDEFINE_SOURCE">VIR_MIGRATE_UNDEFINE_SOURCE</a> If the migration is successful, undefine the domain on the source host. <a href="libvirt-libvirt.html#VIR_MIGRATE_CHANGE_PROTECTION">VIR_MIGRATE_CHANGE_PROTECTION</a> Protect against domain configuration changes during the migration process (set automatically when supported). <a href="libvirt-libvirt.html#VIR_MIGRATE_UNSAFE">VIR_MIGRATE_UNSAFE</a> Force migration even if it is considered unsafe. The operation of this API hinges on the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is set, the @dconnuri parameter must be a valid libvirt connection URI, by which the source libvirt driver can connect to the destination libvirt. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> flag is NOT set, then @dconnuri must be NULL. If the <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> flag is NOT set, then the @miguri parameter allows specification of a URI to use to initiate the VM migration. It takes a hypervisor specific format. The uri_transports element of the hypervisor capabilities XML includes details of the supported URI schemes. <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a> requires that <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a> be set. If a hypervisor supports changing the configuration of the guest during migration, the @dxml parameter specifies the new config for the guest. The configuration must include an identical set of virtual devices, to ensure a stable guest ABI across migration. Only parameters related to host side configuration can be changed in the XML. Hypervisors will validate this and refuse to allow migration if the provided XML would cause a change in the guest ABI, If a hypervisor supports renaming domains during migration, the dname parameter specifies the new name for the domain. Setting dname to NULL keeps the domain name the same. If domain renaming is not supported by the hypervisor, dname must be NULL or else an error will be returned. The maximum bandwidth (in 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 <a href="libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>, /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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dconnuri</tt></i>:</span></td><td>(optional) URI for target libvirtd if @flags includes <a href="libvirt-libvirt.html#VIR_MIGRATE_PEER2PEER">VIR_MIGRATE_PEER2PEER</a></td></tr><tr><td><span class="term"><i><tt>miguri</tt></i>:</span></td><td>(optional) URI for invoking the migration, not if @flags includs <a href="libvirt-libvirt.html#VIR_MIGRATE_TUNNELLED">VIR_MIGRATE_TUNNELLED</a></td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>(optional) XML config for launching guest on target</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainMigrateFlags">virDomainMigrateFlags</a></td></tr><tr><td><span class="term"><i><tt>dname</tt></i>:</span></td><td>(optional) rename domain to this at destination</td></tr><tr><td><span class="term"><i><tt>bandwidth</tt></i>:</span></td><td>(optional) specify migration bandwidth limit in Mbps</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the migration succeeded, -1 upon error.</td></tr></tbody></table></div><h3><a name="virDomainOpenConsole" id="virDomainOpenConsole"><code>virDomainOpenConsole</code></a></h3><pre class="programlisting">int virDomainOpenConsole (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * dev_name, <br /> <a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> st, <br /> unsigned int flags)<br />
1046
</pre><p>This opens the backend associated with a console, serial or parallel port device on a guest, if the backend is supported. If the @dev_name is omitted, then the first console or serial device is opened. The console is associated with the passed in @st stream, which should have been opened in non-blocking mode for bi-directional I/O. By default, when @flags is 0, the open will fail if libvirt detects that the console is already in use by another client; passing <a href="libvirt-libvirt.html#VIR_DOMAIN_CONSOLE_FORCE">VIR_DOMAIN_CONSOLE_FORCE</a> will cause libvirt to forcefully remove the other client prior to opening this console. If flag <a href="libvirt-libvirt.html#VIR_DOMAIN_CONSOLE_SAFE">VIR_DOMAIN_CONSOLE_SAFE</a> the console is opened only in the case where the hypervisor driver supports safe (mutually exclusive) console handling. Older servers did not support either flag, and also did not forbid simultaneous clients on a console, with potentially confusing results. When passing @flags of 0 in order to support a wider range of server versions, it is up to the client to ensure mutual exclusion.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>dev_name</tt></i>:</span></td><td>the console, serial or parallel port device alias, or NULL</td></tr><tr><td><span class="term"><i><tt>st</tt></i>:</span></td><td>a stream to associate with the console</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainConsoleFlags">virDomainConsoleFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the console was opened, -1 on error</td></tr></tbody></table></div><h3><a name="virDomainOpenGraphics" id="virDomainOpenGraphics"><code>virDomainOpenGraphics</code></a></h3><pre class="programlisting">int virDomainOpenGraphics (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int idx, <br /> int fd, <br /> unsigned int flags)<br />
1047
</pre><p>This will attempt to connect the file descriptor @fd, to the graphics backend of @dom. If @dom has multiple graphics backends configured, then @idx will determine which one is opened, starting from @idx 0. To disable any authentication, pass the <a href="libvirt-libvirt.html#VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH">VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH</a> constant for @flags. The caller should use an anonymous socketpair to open @fd before invocation. This method can only be used when connected to a local libvirt hypervisor, over a UNIX domain socket. Attempts to use this method over a TCP connection will always fail</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>idx</tt></i>:</span></td><td>index of graphics config to open</td></tr><tr><td><span class="term"><i><tt>fd</tt></i>:</span></td><td>file descriptor to attach graphics to</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainOpenGraphicsFlags">virDomainOpenGraphicsFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virDomainPMSuspendForDuration" id="virDomainPMSuspendForDuration"><code>virDomainPMSuspendForDuration</code></a></h3><pre class="programlisting">int virDomainPMSuspendForDuration (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int target, <br /> unsigned long long duration, <br /> unsigned int flags)<br />
1048
</pre><p>Attempt to have the guest enter the given @target power management suspension level. If @duration is non-zero, also schedule the guest to resume normal operation after that many seconds, if nothing else has resumed it earlier. Some hypervisors require that @duration be 0, for an indefinite suspension. Dependent on hypervisor used, this may require a guest agent to be available, e.g. QEMU.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>target</tt></i>:</span></td><td>a value from <a href="libvirt-libvirt.html#virNodeSuspendTarget">virNodeSuspendTarget</a></td></tr><tr><td><span class="term"><i><tt>duration</tt></i>:</span></td><td>duration in seconds to suspend, or 0 for indefinite</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure.</td></tr></tbody></table></div><h3><a name="virDomainPMWakeup" id="virDomainPMWakeup"><code>virDomainPMWakeup</code></a></h3><pre class="programlisting">int virDomainPMWakeup (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> unsigned int flags)<br />
1049
</pre><p>Inject a wakeup into the guest that previously used <a href="libvirt-libvirt.html#virDomainPMSuspendForDuration">virDomainPMSuspendForDuration</a>, rather than waiting for the previously requested duration (if any) to elapse.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure.</td></tr></tbody></table></div><h3><a name="virDomainPinVcpu" id="virDomainPinVcpu"><code>virDomainPinVcpu</code></a></h3><pre class="programlisting">int virDomainPinVcpu (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int vcpu, <br /> unsigned char * cpumap, <br /> int maplen)<br />
955
1050
</pre><p>Dynamically change the real CPUs which can be allocated to a virtual CPU. This function may require privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>vcpu</tt></i>:</span></td><td>virtual CPU number</td></tr><tr><td><span class="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><span class="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><span class="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><a name="virDomainPinVcpuFlags" id="virDomainPinVcpuFlags"><code>virDomainPinVcpuFlags</code></a></h3><pre class="programlisting">int virDomainPinVcpuFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int vcpu, <br /> unsigned char * cpumap, <br /> int maplen, <br /> unsigned int flags)<br />
956
1051
</pre><p>Dynamically change the real CPUs which can be allocated to a virtual CPU. This function may require privileged access to the hypervisor. @flags may include <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a>. Both flags may be set. If <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> is set, the change affects a running domain and may fail if domain is not alive. If <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> is set, the change affects persistent state, and will fail for transient domains. If neither flag is specified (that is, @flags is <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. Not all hypervisors can support all flag combinations. See also <a href="libvirt-libvirt.html#virDomainGetVcpuPinInfo">virDomainGetVcpuPinInfo</a> for querying this information.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>vcpu</tt></i>:</span></td><td>virtual CPU number</td></tr><tr><td><span class="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><span class="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><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainReboot" id="virDomainReboot"><code>virDomainReboot</code></a></h3><pre class="programlisting">int virDomainReboot (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
957
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags for the reboot operation, not used yet</td></tr><tr><td><span class="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><a name="virDomainRef" id="virDomainRef"><code>virDomainRef</code></a></h3><pre class="programlisting">int virDomainRef (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
1052
</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. If @flags is set to zero, then the hypervisor will choose the method of shutdown it considers best. To have greater control pass exactly one of the <a href="libvirt-libvirt.html#virDomainRebootFlagValues">virDomainRebootFlagValues</a>. To use guest agent (<a href="libvirt-libvirt.html#VIR_DOMAIN_REBOOT_GUEST_AGENT">VIR_DOMAIN_REBOOT_GUEST_AGENT</a>) the domain XML must have <channel> configured.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainRebootFlagValues">virDomainRebootFlagValues</a></td></tr><tr><td><span class="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><a name="virDomainRef" id="virDomainRef"><code>virDomainRef</code></a></h3><pre class="programlisting">int virDomainRef (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
958
1053
</pre><p>Increment the reference count on the domain. For each additional call to this method, there shall be a corresponding call to <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>the domain to hold a reference on</td></tr><tr><td><span class="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><a name="virDomainReset" id="virDomainReset"><code>virDomainReset</code></a></h3><pre class="programlisting">int virDomainReset (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
959
</pre><p>Reset a domain immediately without any guest OS shutdown. Reset emulates the power reset button on a machine, where all hardware sees the RST line set and reinitializes internal state. Note that there is a risk of data loss caused by reset without any guest OS shutdown.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags for the reboot operation, not used yet</td></tr><tr><td><span class="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><a name="virDomainRestore" id="virDomainRestore"><code>virDomainRestore</code></a></h3><pre class="programlisting">int virDomainRestore (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * from)<br />
1054
</pre><p>Reset a domain immediately without any guest OS shutdown. Reset emulates the power reset button on a machine, where all hardware sees the RST line set and reinitializes internal state. Note that there is a risk of data loss caused by reset without any guest OS shutdown.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainRestore" id="virDomainRestore"><code>virDomainRestore</code></a></h3><pre class="programlisting">int virDomainRestore (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * from)<br />
960
1055
</pre><p>This method will restore a domain saved to disk by <a href="libvirt-libvirt.html#virDomainSave">virDomainSave</a>(). See <a href="libvirt-libvirt.html#virDomainRestoreFlags">virDomainRestoreFlags</a>() for more control.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>from</tt></i>:</span></td><td>path to the input file</td></tr><tr><td><span class="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><a name="virDomainRestoreFlags" id="virDomainRestoreFlags"><code>virDomainRestoreFlags</code></a></h3><pre class="programlisting">int virDomainRestoreFlags (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * from, <br /> const char * dxml, <br /> unsigned int flags)<br />
961
1056
</pre><p>This method will restore a domain saved to disk by <a href="libvirt-libvirt.html#virDomainSave">virDomainSave</a>(). If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used when restoring an image. For example, it is possible to alter the backing filename that is associated with a disk device, in order to prepare for file renaming done as part of backing up the disk device while the domain is stopped. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_BYPASS_CACHE">VIR_DOMAIN_SAVE_BYPASS_CACHE</a>, then libvirt will attempt to bypass the file system cache while restoring the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS. Normally, the saved state file will remember whether the domain was running or paused, and restore defaults to the same state. Specifying <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_RUNNING">VIR_DOMAIN_SAVE_RUNNING</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_PAUSED">VIR_DOMAIN_SAVE_PAUSED</a> in @flags will override the default read from the file. These two flags are mutually exclusive.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>from</tt></i>:</span></td><td>path to the input file</td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>(optional) XML config for adjusting guest xml used on restore</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSaveRestoreFlags">virDomainSaveRestoreFlags</a></td></tr><tr><td><span class="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><a name="virDomainResume" id="virDomainResume"><code>virDomainResume</code></a></h3><pre class="programlisting">int virDomainResume (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
962
1057
</pre><p>Resume a suspended domain, the process is restarted from the state where it was frozen by calling <a href="libvirt-libvirt.html#virDomainSuspend">virDomainSuspend</a>(). This function may require privileged access</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainRevertToSnapshot" id="virDomainRevertToSnapshot"><code>virDomainRevertToSnapshot</code></a></h3><pre class="programlisting">int virDomainRevertToSnapshot (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
963
1058
</pre><p>Revert the domain to a given snapshot. Normally, the domain will revert to the same state the domain was in while the snapshot was taken (whether inactive, running, or paused), except that disk snapshots default to reverting to inactive state. Including <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING">VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING</a> in @flags overrides the snapshot state to guarantee a running domain after the revert; or including <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED">VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED</a> in @flags guarantees a paused domain after the revert. These two flags are mutually exclusive. While a persistent domain does not need either flag, it is not possible to revert a transient domain into an inactive state, so transient domains require the use of one of these two flags. Reverting to any snapshot discards all configuration changes made since the last snapshot. Additionally, reverting to a snapshot from a running domain is a form of data loss, since it discards whatever is in the guest's RAM at the time. Since the very nature of keeping snapshots implies the intent to roll back state, no additional confirmation is normally required for these lossy effects. However, there are two particular situations where reverting will be refused by default, and where @flags must include <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_REVERT_FORCE">VIR_DOMAIN_SNAPSHOT_REVERT_FORCE</a> to acknowledge the risks. 1) Any attempt to revert to a snapshot that lacks the metadata to perform ABI compatibility checks (generally the case for snapshots that lack a full <domain> when listed by <a href="libvirt-libvirt.html#virDomainSnapshotGetXMLDesc">virDomainSnapshotGetXMLDesc</a>(), such as those created prior to libvirt 0.9.5). 2) Any attempt to revert a running domain to an active state that requires starting a new hypervisor instance rather than reusing the existing hypervisor (since this would terminate all connections to the domain, such as such as VNC or Spice graphics) - this condition arises from active snapshots that are provably ABI incomaptible, as well as from inactive snapshots with a @flags request to start the domain after the revert.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSnapshotRevertFlags">virDomainSnapshotRevertFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the creation is successful, -1 on error.</td></tr></tbody></table></div><h3><a name="virDomainSave" id="virDomainSave"><code>virDomainSave</code></a></h3><pre class="programlisting">int virDomainSave (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * to)<br />
964
1059
</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 ends the life of a transient domain). Use <a href="libvirt-libvirt.html#virDomainRestore">virDomainRestore</a>() to restore a domain after saving. See <a href="libvirt-libvirt.html#virDomainSaveFlags">virDomainSaveFlags</a>() for more control. Also, a save file can be inspected or modified slightly with <a href="libvirt-libvirt.html#virDomainSaveImageGetXMLDesc">virDomainSaveImageGetXMLDesc</a>() and <a href="libvirt-libvirt.html#virDomainSaveImageDefineXML">virDomainSaveImageDefineXML</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>to</tt></i>:</span></td><td>path for the output file</td></tr><tr><td><span class="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><a name="virDomainSaveFlags" id="virDomainSaveFlags"><code>virDomainSaveFlags</code></a></h3><pre class="programlisting">int virDomainSaveFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * to, <br /> const char * dxml, <br /> unsigned int flags)<br />
965
</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 ends the life of a transient domain). Use <a href="libvirt-libvirt.html#virDomainRestore">virDomainRestore</a>() to restore a domain after saving. If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used when restoring an image. For example, it is possible to alter the backing filename that is associated with a disk device, in order to prepare for file renaming done as part of backing up the disk device while the domain is stopped. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_BYPASS_CACHE">VIR_DOMAIN_SAVE_BYPASS_CACHE</a>, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS. Normally, the saved state file will remember whether the domain was running or paused, and restore defaults to the same state. Specifying <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_RUNNING">VIR_DOMAIN_SAVE_RUNNING</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_PAUSED">VIR_DOMAIN_SAVE_PAUSED</a> in @flags will override what state gets saved into the file. These two flags are mutually exclusive. A save file can be inspected or modified slightly with <a href="libvirt-libvirt.html#virDomainSaveImageGetXMLDesc">virDomainSaveImageGetXMLDesc</a>() and <a href="libvirt-libvirt.html#virDomainSaveImageDefineXML">virDomainSaveImageDefineXML</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>to</tt></i>:</span></td><td>path for the output file</td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>(optional) XML config for adjusting guest xml used on restore</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSaveRestoreFlags">virDomainSaveRestoreFlags</a></td></tr><tr><td><span class="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><a name="virDomainSaveImageDefineXML" id="virDomainSaveImageDefineXML"><code>virDomainSaveImageDefineXML</code></a></h3><pre class="programlisting">int virDomainSaveImageDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * file, <br /> const char * dxml, <br /> unsigned int flags)<br />
1060
</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 ends the life of a transient domain). Use <a href="libvirt-libvirt.html#virDomainRestore">virDomainRestore</a>() to restore a domain after saving. If the hypervisor supports it, @dxml can be used to alter host-specific portions of the domain XML that will be used when restoring an image. For example, it is possible to alter the backing filename that is associated with a disk device, in order to prepare for file renaming done as part of backing up the disk device while the domain is stopped. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_BYPASS_CACHE">VIR_DOMAIN_SAVE_BYPASS_CACHE</a>, then libvirt will attempt to bypass the file system cache while creating the file, or fail if it cannot do so for the given system; this can allow less pressure on file system cache, but also risks slowing saves to NFS. Normally, the saved state file will remember whether the domain was running or paused, and restore defaults to the same state. Specifying <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_RUNNING">VIR_DOMAIN_SAVE_RUNNING</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_PAUSED">VIR_DOMAIN_SAVE_PAUSED</a> in @flags will override what state gets saved into the file. These two flags are mutually exclusive. A save file can be inspected or modified slightly with <a href="libvirt-libvirt.html#virDomainSaveImageGetXMLDesc">virDomainSaveImageGetXMLDesc</a>() and <a href="libvirt-libvirt.html#virDomainSaveImageDefineXML">virDomainSaveImageDefineXML</a>(). Some hypervisors may prevent this operation if there is a current block copy operation; in that case, use <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>() to stop the block copy first.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>to</tt></i>:</span></td><td>path for the output file</td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>(optional) XML config for adjusting guest xml used on restore</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSaveRestoreFlags">virDomainSaveRestoreFlags</a></td></tr><tr><td><span class="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><a name="virDomainSaveImageDefineXML" id="virDomainSaveImageDefineXML"><code>virDomainSaveImageDefineXML</code></a></h3><pre class="programlisting">int virDomainSaveImageDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * file, <br /> const char * dxml, <br /> unsigned int flags)<br />
966
1061
</pre><p>This updates the definition of a domain stored in a saved state file. @file must be a file created previously by <a href="libvirt-libvirt.html#virDomainSave">virDomainSave</a>() or <a href="libvirt-libvirt.html#virDomainSaveFlags">virDomainSaveFlags</a>(). @dxml can be used to alter host-specific portions of the domain XML that will be used when restoring an image. For example, it is possible to alter the backing filename that is associated with a disk device, to match renaming done as part of backing up the disk device while the domain is stopped. Normally, the saved state file will remember whether the domain was running or paused, and restore defaults to the same state. Specifying <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_RUNNING">VIR_DOMAIN_SAVE_RUNNING</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_SAVE_PAUSED">VIR_DOMAIN_SAVE_PAUSED</a> in @flags will override the default saved into the file; omitting both leaves the file's default unchanged. These two flags are mutually exclusive.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>path to saved state file</td></tr><tr><td><span class="term"><i><tt>dxml</tt></i>:</span></td><td>XML config for adjusting guest xml used on restore</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSaveRestoreFlags">virDomainSaveRestoreFlags</a></td></tr><tr><td><span class="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><a name="virDomainSaveImageGetXMLDesc" id="virDomainSaveImageGetXMLDesc"><code>virDomainSaveImageGetXMLDesc</code></a></h3><pre class="programlisting">char * virDomainSaveImageGetXMLDesc (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * file, <br /> unsigned int flags)<br />
967
1062
</pre><p>This method will extract the XML describing the domain at the time a saved state file was created. @file must be a file created previously by <a href="libvirt-libvirt.html#virDomainSave">virDomainSave</a>() or <a href="libvirt-libvirt.html#virDomainSaveFlags">virDomainSaveFlags</a>(). No security-sensitive data will be included unless @flags contains <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_SECURE">VIR_DOMAIN_XML_SECURE</a>; this flag is rejected on read-only connections. For this API, @flags should not contain either <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_INACTIVE">VIR_DOMAIN_XML_INACTIVE</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_UPDATE_CPU">VIR_DOMAIN_XML_UPDATE_CPU</a>.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>path to saved state file</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of subset of <a href="libvirt-libvirt.html#virDomainXMLFlags">virDomainXMLFlags</a></td></tr><tr><td><span class="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><a name="virDomainScreenshot" id="virDomainScreenshot"><code>virDomainScreenshot</code></a></h3><pre class="programlisting">char * virDomainScreenshot (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream, <br /> unsigned int screen, <br /> unsigned int flags)<br />
968
</pre><p>Take a screenshot of current domain console as a stream. The image format is hypervisor specific. Moreover, some hypervisors supports multiple displays per domain. These can be distinguished by @screen argument. This call sets up a stream; subsequent use of stream API is necessary to transfer actual data, determine how much data is successfully transfered, and detect any errors. The screen ID is the sequential number of screen. In case of multiple graphics cards, heads are enumerated before devices, e.g. having two graphics cards, both with four heads, screen ID 5 addresses the second head on the second card.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>stream to use as output</td></tr><tr><td><span class="term"><i><tt>screen</tt></i>:</span></td><td>monitor ID to take screenshot from</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags, currently unused</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a string representing the mime-type of the image format, or NULL upon error. The caller must free() the returned value.</td></tr></tbody></table></div><h3><a name="virDomainSendKey" id="virDomainSendKey"><code>virDomainSendKey</code></a></h3><pre class="programlisting">int virDomainSendKey (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int codeset, <br /> unsigned int holdtime, <br /> unsigned int * keycodes, <br /> int nkeycodes, <br /> unsigned int flags)<br />
969
</pre><p>Send key(s) to the guest.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>codeset</tt></i>:</span></td><td>the code set of keycodes, from <a href="libvirt-libvirt.html#virKeycodeSet">virKeycodeSet</a></td></tr><tr><td><span class="term"><i><tt>holdtime</tt></i>:</span></td><td>the duration (in milliseconds) that the keys will be held</td></tr><tr><td><span class="term"><i><tt>keycodes</tt></i>:</span></td><td>array of keycodes</td></tr><tr><td><span class="term"><i><tt>nkeycodes</tt></i>:</span></td><td>number of keycodes, up to <a href="libvirt-libvirt.html#VIR_DOMAIN_SEND_KEY_MAX_KEYS">VIR_DOMAIN_SEND_KEY_MAX_KEYS</a></td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>the flags for controlling behavior, pass 0 for now</td></tr><tr><td><span class="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><a name="virDomainSetAutostart" id="virDomainSetAutostart"><code>virDomainSetAutostart</code></a></h3><pre class="programlisting">int virDomainSetAutostart (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int autostart)<br />
1063
</pre><p>Take a screenshot of current domain console as a stream. The image format is hypervisor specific. Moreover, some hypervisors supports multiple displays per domain. These can be distinguished by @screen argument. This call sets up a stream; subsequent use of stream API is necessary to transfer actual data, determine how much data is successfully transfered, and detect any errors. The screen ID is the sequential number of screen. In case of multiple graphics cards, heads are enumerated before devices, e.g. having two graphics cards, both with four heads, screen ID 5 addresses the second head on the second card.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>stream to use as output</td></tr><tr><td><span class="term"><i><tt>screen</tt></i>:</span></td><td>monitor ID to take screenshot from</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a string representing the mime-type of the image format, or NULL upon error. The caller must free() the returned value.</td></tr></tbody></table></div><h3><a name="virDomainSendKey" id="virDomainSendKey"><code>virDomainSendKey</code></a></h3><pre class="programlisting">int virDomainSendKey (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int codeset, <br /> unsigned int holdtime, <br /> unsigned int * keycodes, <br /> int nkeycodes, <br /> unsigned int flags)<br />
1064
</pre><p>Send key(s) to the guest.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>codeset</tt></i>:</span></td><td>the code set of keycodes, from <a href="libvirt-libvirt.html#virKeycodeSet">virKeycodeSet</a></td></tr><tr><td><span class="term"><i><tt>holdtime</tt></i>:</span></td><td>the duration (in milliseconds) that the keys will be held</td></tr><tr><td><span class="term"><i><tt>keycodes</tt></i>:</span></td><td>array of keycodes</td></tr><tr><td><span class="term"><i><tt>nkeycodes</tt></i>:</span></td><td>number of keycodes, up to <a href="libvirt-libvirt.html#VIR_DOMAIN_SEND_KEY_MAX_KEYS">VIR_DOMAIN_SEND_KEY_MAX_KEYS</a></td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virDomainSetAutostart" id="virDomainSetAutostart"><code>virDomainSetAutostart</code></a></h3><pre class="programlisting">int virDomainSetAutostart (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int autostart)<br />
970
1065
</pre><p>Configure the domain to be automatically started when the host machine boots.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>whether the domain should be automatically started 0 or 1</td></tr><tr><td><span class="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><a name="virDomainSetBlkioParameters" id="virDomainSetBlkioParameters"><code>virDomainSetBlkioParameters</code></a></h3><pre class="programlisting">int virDomainSetBlkioParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams, <br /> unsigned int flags)<br />
971
1066
</pre><p>Change all or a subset of the blkio tunables. This function may require privileged access to the hypervisor.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to blkio parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of blkio parameters (this value can be the same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetBlockIoTune" id="virDomainSetBlockIoTune"><code>virDomainSetBlockIoTune</code></a></h3><pre class="programlisting">int virDomainSetBlockIoTune (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom, <br /> const char * disk, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams, <br /> unsigned int flags)<br />
972
</pre><p>Change all or a subset of the per-device block IO tunables. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>Pointer to blkio parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>Number of blkio parameters (this value can be the same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>An OR'ed set of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetMaxMemory" id="virDomainSetMaxMemory"><code>virDomainSetMaxMemory</code></a></h3><pre class="programlisting">int virDomainSetMaxMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long memory)<br />
973
</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 may require privileged access to the hypervisor. This command is hypervisor-specific for whether active, persistent, or both configurations are changed; for more control, use <a href="libvirt-libvirt.html#virDomainSetMemoryFlags">virDomainSetMemoryFlags</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kilobytes</td></tr><tr><td><span class="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><a name="virDomainSetMemory" id="virDomainSetMemory"><code>virDomainSetMemory</code></a></h3><pre class="programlisting">int virDomainSetMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long memory)<br />
974
</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 require privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kilobytes</td></tr><tr><td><span class="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><a name="virDomainSetMemoryFlags" id="virDomainSetMemoryFlags"><code>virDomainSetMemoryFlags</code></a></h3><pre class="programlisting">int virDomainSetMemoryFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long memory, <br /> unsigned int flags)<br />
975
</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 require privileged access to the hypervisor. @flags may include <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a>. Both flags may be set. If <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> is set, the change affects a running domain and will fail if domain is not active. If <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> is set, the change affects persistent state, and will fail for transient domains. If neither flag is specified (that is, @flags is <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. If <a href="libvirt-libvirt.html#VIR_DOMAIN_MEM_MAXIMUM">VIR_DOMAIN_MEM_MAXIMUM</a> is set, the change affects domain's maximum memory size rather than current memory size. Not all hypervisors can support all flag combinations.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kilobytes</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainMemoryModFlags">virDomainMemoryModFlags</a></td></tr><tr><td><span class="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><a name="virDomainSetMemoryParameters" id="virDomainSetMemoryParameters"><code>virDomainSetMemoryParameters</code></a></h3><pre class="programlisting">int virDomainSetMemoryParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams, <br /> unsigned int flags)<br />
976
</pre><p>Change all or a subset of the memory tunables. This function may require privileged access to the hypervisor.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to memory parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of memory parameter (this value can be the same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetSchedulerParameters" id="virDomainSetSchedulerParameters"><code>virDomainSetSchedulerParameters</code></a></h3><pre class="programlisting">int virDomainSetSchedulerParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams)<br />
1067
</pre><p>Change all or a subset of the per-device block IO tunables. The @disk parameter is either an unambiguous source name of the block device (the <source file='...'/> sub-element, such as "/path/to/image"), or the device target shorthand (the <target dev='...'/> sub-element, such as "xvda"). Valid names can be found by calling <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and inspecting elements within //domain/devices/disk.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dom</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>disk</tt></i>:</span></td><td>path to the block device, or device shorthand</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>Pointer to blkio parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>Number of blkio parameters (this value can be the same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetInterfaceParameters" id="virDomainSetInterfaceParameters"><code>virDomainSetInterfaceParameters</code></a></h3><pre class="programlisting">int virDomainSetInterfaceParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * device, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams, <br /> unsigned int flags)<br />
1068
</pre><p>Change a subset or all parameters of interface; currently this includes bandwidth parameters. The value of @flags should be either <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>, or a bitwise-or of values <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> and <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a>, although hypervisors vary in which flags are supported. This function may require privileged access to the hypervisor.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>device</tt></i>:</span></td><td>the interface name or mac address</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to interface parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of interface parameter (this value can be the same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetMaxMemory" id="virDomainSetMaxMemory"><code>virDomainSetMaxMemory</code></a></h3><pre class="programlisting">int virDomainSetMaxMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long memory)<br />
1069
</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 may require privileged access to the hypervisor. This command is hypervisor-specific for whether active, persistent, or both configurations are changed; for more control, use <a href="libvirt-libvirt.html#virDomainSetMemoryFlags">virDomainSetMemoryFlags</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kibibytes (blocks of 1024 bytes)</td></tr><tr><td><span class="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><a name="virDomainSetMemory" id="virDomainSetMemory"><code>virDomainSetMemory</code></a></h3><pre class="programlisting">int virDomainSetMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long memory)<br />
1070
</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 require privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kibibytes (blocks of 1024 bytes)</td></tr><tr><td><span class="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><a name="virDomainSetMemoryFlags" id="virDomainSetMemoryFlags"><code>virDomainSetMemoryFlags</code></a></h3><pre class="programlisting">int virDomainSetMemoryFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned long memory, <br /> unsigned int flags)<br />
1071
</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 require privileged access to the hypervisor. @flags may include <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a>. Both flags may be set. If <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> is set, the change affects a running domain and will fail if domain is not active. If <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> is set, the change affects persistent state, and will fail for transient domains. If neither flag is specified (that is, @flags is <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. If <a href="libvirt-libvirt.html#VIR_DOMAIN_MEM_MAXIMUM">VIR_DOMAIN_MEM_MAXIMUM</a> is set, the change affects domain's maximum memory size rather than current memory size. Not all hypervisors can support all flag combinations.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object or NULL</td></tr><tr><td><span class="term"><i><tt>memory</tt></i>:</span></td><td>the memory size in kibibytes (blocks of 1024 bytes)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainMemoryModFlags">virDomainMemoryModFlags</a></td></tr><tr><td><span class="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><a name="virDomainSetMemoryParameters" id="virDomainSetMemoryParameters"><code>virDomainSetMemoryParameters</code></a></h3><pre class="programlisting">int virDomainSetMemoryParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams, <br /> unsigned int flags)<br />
1072
</pre><p>Change all or a subset of the memory tunables. This function may require privileged access to the hypervisor.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to memory parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of memory parameter (this value can be the same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetMetadata" id="virDomainSetMetadata"><code>virDomainSetMetadata</code></a></h3><pre class="programlisting">int virDomainSetMetadata (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> int type, <br /> const char * metadata, <br /> const char * key, <br /> const char * uri, <br /> unsigned int flags)<br />
1073
</pre><p>Sets the appropriate domain element given by @type to the value of @description. A @type of <a href="libvirt-libvirt.html#VIR_DOMAIN_METADATA_DESCRIPTION">VIR_DOMAIN_METADATA_DESCRIPTION</a> is free-form text; <a href="libvirt-libvirt.html#VIR_DOMAIN_METADATA_TITLE">VIR_DOMAIN_METADATA_TITLE</a> is free-form, but no newlines are permitted, and should be short (although the length is not enforced). For these two options @key and @uri are irrelevant and must be set to NULL. For type <a href="libvirt-libvirt.html#VIR_DOMAIN_METADATA_ELEMENT">VIR_DOMAIN_METADATA_ELEMENT</a> @metadata must be well-formed XML belonging to namespace defined by @uri with local name @key. Passing NULL for @metadata says to remove that element from the domain XML (passing the empty string leaves the element present). The resulting metadata will be present in <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>(), as well as quick access through <a href="libvirt-libvirt.html#virDomainGetMetadata">virDomainGetMetadata</a>(). @flags controls whether the live domain, persistent configuration, or both will be modified.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>type of description, from <a href="libvirt-libvirt.html#virDomainMetadataType">virDomainMetadataType</a></td></tr><tr><td><span class="term"><i><tt>metadata</tt></i>:</span></td><td>new metadata text</td></tr><tr><td><span class="term"><i><tt>key</tt></i>:</span></td><td>XML namespace key, or NULL</td></tr><tr><td><span class="term"><i><tt>uri</tt></i>:</span></td><td>XML namespace URI, or NULL</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 in case of failure.</td></tr></tbody></table></div><h3><a name="virDomainSetNumaParameters" id="virDomainSetNumaParameters"><code>virDomainSetNumaParameters</code></a></h3><pre class="programlisting">int virDomainSetNumaParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams, <br /> unsigned int flags)<br />
1074
</pre><p>Change all or a subset of the numa tunables. This function may require privileged access to the hypervisor.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to numa parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of numa parameters (this value can be the same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetSchedulerParameters" id="virDomainSetSchedulerParameters"><code>virDomainSetSchedulerParameters</code></a></h3><pre class="programlisting">int virDomainSetSchedulerParameters (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams)<br />
977
1075
</pre><p>Change all or a subset or the scheduler parameters. It is hypervisor-specific whether this sets live, persistent, or both settings; for more control, use <a href="libvirt-libvirt.html#virDomainSetSchedulerParametersFlags">virDomainSetSchedulerParametersFlags</a>.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to scheduler parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of scheduler parameter objects (this value can be the same or less than the returned value nparams of <a href="libvirt-libvirt.html#virDomainGetSchedulerType">virDomainGetSchedulerType</a>)</td></tr><tr><td><span class="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><a name="virDomainSetSchedulerParametersFlags" id="virDomainSetSchedulerParametersFlags"><code>virDomainSetSchedulerParametersFlags</code></a></h3><pre class="programlisting">int virDomainSetSchedulerParametersFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> <a href="libvirt-libvirt.html#virTypedParameterPtr">virTypedParameterPtr</a> params, <br /> int nparams, <br /> unsigned int flags)<br />
978
1076
</pre><p>Change a subset or all scheduler parameters. The value of @flags should be either <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>, or a bitwise-or of values from <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> and <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>, although hypervisors vary in which flags are supported.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to scheduler parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of scheduler parameter objects (this value can be the same or less than the returned value nparams of <a href="libvirt-libvirt.html#virDomainGetSchedulerType">virDomainGetSchedulerType</a>)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainModificationImpact">virDomainModificationImpact</a></td></tr><tr><td><span class="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><a name="virDomainSetVcpus" id="virDomainSetVcpus"><code>virDomainSetVcpus</code></a></h3><pre class="programlisting">int virDomainSetVcpus (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int nvcpus)<br />
979
1077
</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 may require privileged access to the hypervisor. This command only changes the runtime configuration of the domain, so can only be called on an active domain. It is hypervisor-dependent whether it also affects persistent configuration; for more control, use <a href="libvirt-libvirt.html#virDomainSetVcpusFlags">virDomainSetVcpusFlags</a>().</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>nvcpus</tt></i>:</span></td><td>the new number of virtual CPUs for this domain</td></tr><tr><td><span class="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><a name="virDomainSetVcpusFlags" id="virDomainSetVcpusFlags"><code>virDomainSetVcpusFlags</code></a></h3><pre class="programlisting">int virDomainSetVcpusFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int nvcpus, <br /> unsigned int flags)<br />
980
</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 may require privileged access to the hypervisor. @flags may include <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> to affect a running domain (which may fail if domain is not active), or <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> to affect the next boot via the XML description of the domain. Both flags may be set. If neither flag is specified (that is, @flags is <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_VCPU_MAXIMUM">VIR_DOMAIN_VCPU_MAXIMUM</a>, then <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> must be clear, and only the maximum virtual CPU limit is altered; generally, this value must be less than or equal to <a href="libvirt-libvirt.html#virConnectGetMaxVcpus">virConnectGetMaxVcpus</a>(). Otherwise, this call affects the current virtual CPU limit, which must be less than or equal to the maximum limit. Not all hypervisors can support all flag combinations.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>nvcpus</tt></i>:</span></td><td>the new number of virtual CPUs for this domain, must be at least 1</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainVcpuFlags">virDomainVcpuFlags</a></td></tr><tr><td><span class="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><a name="virDomainShutdown" id="virDomainShutdown"><code>virDomainShutdown</code></a></h3><pre class="programlisting">int virDomainShutdown (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
981
</pre><p>Shutdown a domain, the domain object is still usable thereafter but the domain OS is being stopped. Note that the guest OS may ignore the request. For guests that react to a shutdown request, the differences from <a href="libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a>() are that the guests disk storage will be in a stable state rather than having the (virtual) power cord pulled, and this command returns as soon as the shutdown request is issued rather than blocking until the guest is no longer running. If the domain is transient and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then that metadata will automatically be deleted when the domain quits.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainSnapshotCreateXML" id="virDomainSnapshotCreateXML"><code>virDomainSnapshotCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> virDomainSnapshotCreateXML (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
982
</pre><p>Creates a new snapshot of a domain based on the snapshot xml contained in xmlDesc. If @flags is 0, the domain can be active, in which case the snapshot will be a system checkpoint (both disk state and runtime VM state such as RAM contents), where reverting to the snapshot is the same as resuming from hibernation (TCP connections may have timed out, but everything else picks up where it left off); or the domain can be inactive, in which case the snapshot includes just the disk state prior to booting. The newly created snapshot becomes current (see <a href="libvirt-libvirt.html#virDomainSnapshotCurrent">virDomainSnapshotCurrent</a>()), and is a child of any previous current snapshot. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>, then this is a request to reinstate snapshot metadata that was previously discarded, rather than creating a new snapshot. This can be used to recreate a snapshot hierarchy on a destination, then remove it on the source, in order to allow migration (since migration normally fails if snapshot metadata still remains on the source machine). When redefining snapshot metadata, the current snapshot will not be altered unless the <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT">VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT</a> flag is also present. It is an error to request the <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT">VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT</a> flag without <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>. On some hypervisors, redefining an existing snapshot can be used to alter host-specific portions of the domain XML to be used during revert (such as backing filenames associated with disk devices), but must not alter guest-visible layout. When redefining a snapshot name that does not exist, the hypervisor may validate that reverting to the snapshot appears to be possible (for example, disk images have snapshot contents by the requested name). Not all hypervisors support these flags. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA">VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA</a>, then the domain's disk images are modified according to @xmlDesc, but then the just-created snapshot has its metadata deleted. This flag is incompatible with <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_HALT">VIR_DOMAIN_SNAPSHOT_CREATE_HALT</a>, then the domain will be inactive after the snapshot completes, regardless of whether it was active before; otherwise, a running domain will still be running after the snapshot. This flag is invalid on transient domains, and is incompatible with <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY">VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY</a>, then the snapshot will be limited to the disks described in @xmlDesc, and no VM state will be saved. For an active guest, the disk image may be inconsistent (as if power had been pulled), and specifying this with the <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_HALT">VIR_DOMAIN_SNAPSHOT_CREATE_HALT</a> flag risks data loss.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSnapshotCreateFlags">virDomainSnapshotCreateFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an (opaque) <a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> on success, NULL on failure.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotCurrent" id="virDomainSnapshotCurrent"><code>virDomainSnapshotCurrent</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> virDomainSnapshotCurrent (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
983
</pre><p>Get the current snapshot for a domain, if any.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused flag parameters; callers should pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a domain snapshot object or NULL in case of failure. If the current domain snapshot cannot be found, then the <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN_SNAPSHOT">VIR_ERR_NO_DOMAIN_SNAPSHOT</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotDelete" id="virDomainSnapshotDelete"><code>virDomainSnapshotDelete</code></a></h3><pre class="programlisting">int virDomainSnapshotDelete (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
984
</pre><p>Delete the snapshot. If @flags is 0, then just this snapshot is deleted, and changes from this snapshot are automatically merged into children snapshots. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN">VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN</a>, then this snapshot and any descendant snapshots are deleted. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY">VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY</a>, then any descendant snapshots are deleted, but this snapshot remains. These two flags are mutually exclusive. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY">VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY</a>, then any snapshot metadata tracked by libvirt is removed while keeping the snapshot contents intact; if a hypervisor does not require any libvirt metadata to track snapshots, then this flag is silently ignored.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainSnapshotDeleteFlags">virDomainSnapshotDeleteFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the selected snapshot(s) were successfully deleted, -1 on error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotFree" id="virDomainSnapshotFree"><code>virDomainSnapshotFree</code></a></h3><pre class="programlisting">int virDomainSnapshotFree (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot)<br />
1078
</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 may require privileged access to the hypervisor. @flags may include <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> to affect a running domain (which may fail if domain is not active), or <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> to affect the next boot via the XML description of the domain. Both flags may be set. If neither flag is specified (that is, @flags is <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a>), then an inactive domain modifies persistent setup, while an active domain is hypervisor-dependent on whether just live or both live and persistent state is changed. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_VCPU_MAXIMUM">VIR_DOMAIN_VCPU_MAXIMUM</a>, then <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> must be clear, and only the maximum virtual CPU limit is altered; generally, this value must be less than or equal to <a href="libvirt-libvirt.html#virConnectGetMaxVcpus">virConnectGetMaxVcpus</a>(). Otherwise, this call affects the current virtual CPU limit, which must be less than or equal to the maximum limit. Not all hypervisors can support all flag combinations.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object, or NULL for Domain0</td></tr><tr><td><span class="term"><i><tt>nvcpus</tt></i>:</span></td><td>the new number of virtual CPUs for this domain, must be at least 1</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainVcpuFlags">virDomainVcpuFlags</a></td></tr><tr><td><span class="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><a name="virDomainShutdown" id="virDomainShutdown"><code>virDomainShutdown</code></a></h3><pre class="programlisting">int virDomainShutdown (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
1079
</pre><p>Shutdown a domain, the domain object is still usable thereafter but the domain OS is being stopped. Note that the guest OS may ignore the request. For guests that react to a shutdown request, the differences from <a href="libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a>() are that the guests disk storage will be in a stable state rather than having the (virtual) power cord pulled, and this command returns as soon as the shutdown request is issued rather than blocking until the guest is no longer running. If the domain is transient and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then that metadata will automatically be deleted when the domain quits.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainShutdownFlags" id="virDomainShutdownFlags"><code>virDomainShutdownFlags</code></a></h3><pre class="programlisting">int virDomainShutdownFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
1080
</pre><p>Shutdown a domain, the domain object is still usable thereafter but the domain OS is being stopped. Note that the guest OS may ignore the request. For guests that react to a shutdown request, the differences from <a href="libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a>() are that the guest's disk storage will be in a stable state rather than having the (virtual) power cord pulled, and this command returns as soon as the shutdown request is issued rather than blocking until the guest is no longer running. If the domain is transient and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then that metadata will automatically be deleted when the domain quits. If @flags is set to zero, then the hypervisor will choose the method of shutdown it considers best. To have greater control pass exactly one of the <a href="libvirt-libvirt.html#virDomainShutdownFlagValues">virDomainShutdownFlagValues</a>.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainShutdownFlagValues">virDomainShutdownFlagValues</a></td></tr><tr><td><span class="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><a name="virDomainSnapshotCreateXML" id="virDomainSnapshotCreateXML"><code>virDomainSnapshotCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> virDomainSnapshotCreateXML (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
1081
</pre><p>Creates a new snapshot of a domain based on the snapshot xml contained in xmlDesc. If @flags is 0, the domain can be active, in which case the snapshot will be a system checkpoint (both disk state and runtime VM state such as RAM contents), where reverting to the snapshot is the same as resuming from hibernation (TCP connections may have timed out, but everything else picks up where it left off); or the domain can be inactive, in which case the snapshot includes just the disk state prior to booting. The newly created snapshot becomes current (see <a href="libvirt-libvirt.html#virDomainSnapshotCurrent">virDomainSnapshotCurrent</a>()), and is a child of any previous current snapshot. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>, then this is a request to reinstate snapshot metadata that was previously discarded, rather than creating a new snapshot. This can be used to recreate a snapshot hierarchy on a destination, then remove it on the source, in order to allow migration (since migration normally fails if snapshot metadata still remains on the source machine). When redefining snapshot metadata, the current snapshot will not be altered unless the <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT">VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT</a> flag is also present. It is an error to request the <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT">VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT</a> flag without <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>. On some hypervisors, redefining an existing snapshot can be used to alter host-specific portions of the domain XML to be used during revert (such as backing filenames associated with disk devices), but must not alter guest-visible layout. When redefining a snapshot name that does not exist, the hypervisor may validate that reverting to the snapshot appears to be possible (for example, disk images have snapshot contents by the requested name). Not all hypervisors support these flags. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA">VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA</a>, then the domain's disk images are modified according to @xmlDesc, but then the just-created snapshot has its metadata deleted. This flag is incompatible with <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_HALT">VIR_DOMAIN_SNAPSHOT_CREATE_HALT</a>, then the domain will be inactive after the snapshot completes, regardless of whether it was active before; otherwise, a running domain will still be running after the snapshot. This flag is invalid on transient domains, and is incompatible with <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE">VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</a>. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY">VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY</a>, then the snapshot will be limited to the disks described in @xmlDesc, and no VM state will be saved. For an active guest, the disk image may be inconsistent (as if power had been pulled), and specifying this with the <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_HALT">VIR_DOMAIN_SNAPSHOT_CREATE_HALT</a> flag risks data loss. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE">VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE</a>, then the libvirt will attempt to use guest agent to freeze and thaw all file systems in use within domain OS. However, if the guest agent is not present, an error is thrown. Moreover, this flag requires <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY">VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY</a> to be passed as well. By default, if the snapshot involves external files, and any of the destination files already exist as a non-empty regular file, the snapshot is rejected to avoid losing contents of those files. However, if @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT">VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT</a>, then the destination files must already exist and contain content identical to the source files (this allows a management app to pre-create files with relative backing file names, rather than the default of creating with absolute backing file names). Be aware that although libvirt prefers to report errors up front with no other effect, some hypervisors have certain types of failures where the overall command can easily fail even though the guest configuration was partially altered (for example, if a disk snapshot request for two disks fails on the second disk, but the first disk alteration cannot be rolled back). If this API call fails, it is therefore normally necessary to follow up with <a href="libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a>() and check each disk to determine if any partial changes occurred. However, if @flags contains <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC">VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC</a>, then libvirt guarantees that this command will not alter any disks unless the entire set of changes can be done atomically, making failure recovery simpler (note that it is still possible to fail after disks have changed, but only in the much rarer cases of running out of memory or disk space). Some hypervisors may prevent this operation if there is a current block copy operation; in that case, use <a href="libvirt-libvirt.html#virDomainBlockJobAbort">virDomainBlockJobAbort</a>() to stop the block copy first.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainSnapshotCreateFlags">virDomainSnapshotCreateFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an (opaque) <a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> on success, NULL on failure.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotCurrent" id="virDomainSnapshotCurrent"><code>virDomainSnapshotCurrent</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> virDomainSnapshotCurrent (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
1082
</pre><p>Get the current snapshot for a domain, if any.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a domain snapshot object or NULL in case of failure. If the current domain snapshot cannot be found, then the <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN_SNAPSHOT">VIR_ERR_NO_DOMAIN_SNAPSHOT</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotDelete" id="virDomainSnapshotDelete"><code>virDomainSnapshotDelete</code></a></h3><pre class="programlisting">int virDomainSnapshotDelete (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
1083
</pre><p>Delete the snapshot. If @flags is 0, then just this snapshot is deleted, and changes from this snapshot are automatically merged into children snapshots. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN">VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN</a>, then this snapshot and any descendant snapshots are deleted. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY">VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY</a>, then any descendant snapshots are deleted, but this snapshot remains. These two flags are mutually exclusive. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY">VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY</a>, then any snapshot metadata tracked by libvirt is removed while keeping the snapshot contents intact; if a hypervisor does not require any libvirt metadata to track snapshots, then this flag is silently ignored.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainSnapshotDeleteFlags">virDomainSnapshotDeleteFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if the selected snapshot(s) were successfully deleted, -1 on error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotFree" id="virDomainSnapshotFree"><code>virDomainSnapshotFree</code></a></h3><pre class="programlisting">int virDomainSnapshotFree (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot)<br />
985
1084
</pre><p>Free the domain snapshot object. The snapshot itself is not modified. The data structure is freed and should not be used thereafter.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="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><a name="virDomainSnapshotGetConnect" id="virDomainSnapshotGetConnect"><code>virDomainSnapshotGetConnect</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virDomainSnapshotGetConnect (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot)<br />
986
1085
</pre><p>Get the connection that owns the domain that a snapshot was created for</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a snapshot object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the connection or NULL.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotGetDomain" id="virDomainSnapshotGetDomain"><code>virDomainSnapshotGetDomain</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainSnapshotGetDomain (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot)<br />
987
1086
</pre><p>Get the domain that a snapshot was created for</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a snapshot object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the domain or NULL.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotGetName" id="virDomainSnapshotGetName"><code>virDomainSnapshotGetName</code></a></h3><pre class="programlisting">const char * virDomainSnapshotGetName (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot)<br />
988
1087
</pre><p>Get the public name for that snapshot</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a snapshot object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the name or NULL, the string need not be deallocated as its lifetime will be the same as the snapshot object.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotGetParent" id="virDomainSnapshotGetParent"><code>virDomainSnapshotGetParent</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> virDomainSnapshotGetParent (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
989
</pre><p>Get the parent snapshot for @snapshot, if any.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused flag parameters; callers should pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a domain snapshot object or NULL in case of failure. If the given snapshot is a root (no parent), then the <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN_SNAPSHOT">VIR_ERR_NO_DOMAIN_SNAPSHOT</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotGetXMLDesc" id="virDomainSnapshotGetXMLDesc"><code>virDomainSnapshotGetXMLDesc</code></a></h3><pre class="programlisting">char * virDomainSnapshotGetXMLDesc (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
1088
</pre><p>Get the parent snapshot for @snapshot, if any.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a domain snapshot object or NULL in case of failure. If the given snapshot is a root (no parent), then the <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN_SNAPSHOT">VIR_ERR_NO_DOMAIN_SNAPSHOT</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotGetXMLDesc" id="virDomainSnapshotGetXMLDesc"><code>virDomainSnapshotGetXMLDesc</code></a></h3><pre class="programlisting">char * virDomainSnapshotGetXMLDesc (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
990
1089
</pre><p>Provide an XML description of the domain snapshot. No security-sensitive data will be included unless @flags contains <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_SECURE">VIR_DOMAIN_XML_SECURE</a>; this flag is rejected on read-only connections. For this API, @flags should not contain either <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_INACTIVE">VIR_DOMAIN_XML_INACTIVE</a> or <a href="libvirt-libvirt.html#VIR_DOMAIN_XML_UPDATE_CPU">VIR_DOMAIN_XML_UPDATE_CPU</a>.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of subset of <a href="libvirt-libvirt.html#virDomainXMLFlags">virDomainXMLFlags</a></td></tr><tr><td><span class="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><a name="virDomainSnapshotListChildrenNames" id="virDomainSnapshotListChildrenNames"><code>virDomainSnapshotListChildrenNames</code></a></h3><pre class="programlisting">int virDomainSnapshotListChildrenNames (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> char ** names, <br /> int nameslen, <br /> unsigned int flags)<br />
991
</pre><p>Collect the list of domain snapshots that are children of the given snapshot, and store their names in @names. Caller is responsible for freeing each member of the array. The value to use for @nameslen can be determined by <a href="libvirt-libvirt.html#virDomainSnapshotNumChildren">virDomainSnapshotNumChildren</a>() with the same @flags. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS">VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS</a>, then the result includes all descendants, otherwise it is limited to direct children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of names of snapshots</td></tr><tr><td><span class="term"><i><tt>nameslen</tt></i>:</span></td><td>size of @names</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotListNames" id="virDomainSnapshotListNames"><code>virDomainSnapshotListNames</code></a></h3><pre class="programlisting">int virDomainSnapshotListNames (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> char ** names, <br /> int nameslen, <br /> unsigned int flags)<br />
992
</pre><p>Collect the list of domain snapshots for the given domain, and store their names in @names. Caller is responsible for freeing each member of the array. The value to use for @nameslen can be determined by <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>() with the same @flags. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_ROOTS">VIR_DOMAIN_SNAPSHOT_LIST_ROOTS</a>, then the result is filtered to the number of snapshots that have no parents. Likewise, if @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. Both flags can be used together to find unrelated snapshots. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of names of snapshots</td></tr><tr><td><span class="term"><i><tt>nameslen</tt></i>:</span></td><td>size of @names</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotLookupByName" id="virDomainSnapshotLookupByName"><code>virDomainSnapshotLookupByName</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> virDomainSnapshotLookupByName (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * name, <br /> unsigned int flags)<br />
993
</pre><p>Try to lookup a domain snapshot based on its name.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>name for the domain snapshot</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>unused flag parameters; callers should pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a domain snapshot object or NULL in case of failure. If the domain snapshot cannot be found, then the <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN_SNAPSHOT">VIR_ERR_NO_DOMAIN_SNAPSHOT</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotNum" id="virDomainSnapshotNum"><code>virDomainSnapshotNum</code></a></h3><pre class="programlisting">int virDomainSnapshotNum (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
994
</pre><p>Provides the number of domain snapshots for this domain. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_ROOTS">VIR_DOMAIN_SNAPSHOT_LIST_ROOTS</a>, then the result is filtered to the number of snapshots that have no parents. Likewise, if @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. Both flags can be used together to find unrelated snapshots. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotNumChildren" id="virDomainSnapshotNumChildren"><code>virDomainSnapshotNumChildren</code></a></h3><pre class="programlisting">int virDomainSnapshotNumChildren (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
995
</pre><p>Provides the number of child snapshots for this domain snapshot. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS">VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS</a>, then the result includes all descendants, otherwise it is limited to direct children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSuspend" id="virDomainSuspend"><code>virDomainSuspend</code></a></h3><pre class="programlisting">int virDomainSuspend (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
1090
</pre><p>Collect the list of domain snapshots that are children of the given snapshot, and store their names in @names. Caller is responsible for freeing each member of the array. The value to use for @nameslen can be determined by <a href="libvirt-libvirt.html#virDomainSnapshotNumChildren">virDomainSnapshotNumChildren</a>() with the same @flags. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS">VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS</a>, then the result includes all descendants, otherwise it is limited to direct children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of names of snapshots</td></tr><tr><td><span class="term"><i><tt>nameslen</tt></i>:</span></td><td>size of @names</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotListNames" id="virDomainSnapshotListNames"><code>virDomainSnapshotListNames</code></a></h3><pre class="programlisting">int virDomainSnapshotListNames (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> char ** names, <br /> int nameslen, <br /> unsigned int flags)<br />
1091
</pre><p>Collect the list of domain snapshots for the given domain, and store their names in @names. Caller is responsible for freeing each member of the array. The value to use for @nameslen can be determined by <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>() with the same @flags. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_ROOTS">VIR_DOMAIN_SNAPSHOT_LIST_ROOTS</a>, then the result is filtered to the number of snapshots that have no parents. Likewise, if @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. Both flags can be used together to find unrelated snapshots. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of names of snapshots</td></tr><tr><td><span class="term"><i><tt>nameslen</tt></i>:</span></td><td>size of @names</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotLookupByName" id="virDomainSnapshotLookupByName"><code>virDomainSnapshotLookupByName</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> virDomainSnapshotLookupByName (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * name, <br /> unsigned int flags)<br />
1092
</pre><p>Try to lookup a domain snapshot based on its name.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>name for the domain snapshot</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a domain snapshot object or NULL in case of failure. If the domain snapshot cannot be found, then the <a href="libvirt-virterror.html#VIR_ERR_NO_DOMAIN_SNAPSHOT">VIR_ERR_NO_DOMAIN_SNAPSHOT</a> error is raised.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotNum" id="virDomainSnapshotNum"><code>virDomainSnapshotNum</code></a></h3><pre class="programlisting">int virDomainSnapshotNum (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
1093
</pre><p>Provides the number of domain snapshots for this domain. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_ROOTS">VIR_DOMAIN_SNAPSHOT_LIST_ROOTS</a>, then the result is filtered to the number of snapshots that have no parents. Likewise, if @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. Both flags can be used together to find unrelated snapshots. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSnapshotNumChildren" id="virDomainSnapshotNumChildren"><code>virDomainSnapshotNumChildren</code></a></h3><pre class="programlisting">int virDomainSnapshotNumChildren (<a href="libvirt-libvirt.html#virDomainSnapshotPtr">virDomainSnapshotPtr</a> snapshot, <br /> unsigned int flags)<br />
1094
</pre><p>Provides the number of child snapshots for this domain snapshot. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS">VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS</a>, then the result includes all descendants, otherwise it is limited to direct children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_LEAVES">VIR_DOMAIN_SNAPSHOT_LIST_LEAVES</a>, then the result is filtered to the number of snapshots that have no children. If @flags includes <a href="libvirt-libvirt.html#VIR_DOMAIN_SNAPSHOT_LIST_METADATA">VIR_DOMAIN_SNAPSHOT_LIST_METADATA</a>, then the result is the number of snapshots that also include metadata that would prevent the removal of the last reference to a domain; this value will either be 0 or the same value as if the flag were not given.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>snapshot</tt></i>:</span></td><td>a domain snapshot object</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainSnapshotListFlags">virDomainSnapshotListFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain snapshots found or -1 in case of error.</td></tr></tbody></table></div><h3><a name="virDomainSuspend" id="virDomainSuspend"><code>virDomainSuspend</code></a></h3><pre class="programlisting">int virDomainSuspend (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
996
1095
</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 <a href="libvirt-libvirt.html#virDomainResume">virDomainResume</a>() to reactivate the domain. This function may require privileged access.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>a domain object</td></tr><tr><td><span class="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><a name="virDomainUndefine" id="virDomainUndefine"><code>virDomainUndefine</code></a></h3><pre class="programlisting">int virDomainUndefine (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br />
997
1096
</pre><p>Undefine a domain. If the domain is running, it's converted to transient domain, without stopping it. If the domain is inactive, the domain configuration is removed. If the domain has a managed save image (see <a href="libvirt-libvirt.html#virDomainHasManagedSaveImage">virDomainHasManagedSaveImage</a>()), or if it is inactive and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then the undefine will fail. See <a href="libvirt-libvirt.html#virDomainUndefineFlags">virDomainUndefineFlags</a>() for more control.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><span class="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><a name="virDomainUndefineFlags" id="virDomainUndefineFlags"><code>virDomainUndefineFlags</code></a></h3><pre class="programlisting">int virDomainUndefineFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> unsigned int flags)<br />
998
</pre><p>Undefine a domain. If the domain is running, it's converted to transient domain, without stopping it. If the domain is inactive, the domain configuration is removed. If the domain has a managed save image (see <a href="libvirt-libvirt.html#virDomainHasManagedSaveImage">virDomainHasManagedSaveImage</a>()), then including <a href="libvirt-libvirt.html#VIR_DOMAIN_UNDEFINE_MANAGED_SAVE">VIR_DOMAIN_UNDEFINE_MANAGED_SAVE</a> in @flags will also remove that file, and omitting the flag will cause the undefine process to fail. If the domain is inactive and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then including <a href="libvirt-libvirt.html#VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA">VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA</a> in @flags will also remove that metadata. Omitting the flag will cause the undefine of an inactive domain to fail. Active snapshots will retain snapshot metadata until the (now-transient) domain halts, regardless of whether this flag is present. On hypervisors where snapshots do not use libvirt metadata, this flag has no effect.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-or of supported <a href="libvirt-libvirt.html#virDomainUndefineFlagsValues">virDomainUndefineFlagsValues</a></td></tr><tr><td><span class="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><a name="virDomainUpdateDeviceFlags" id="virDomainUpdateDeviceFlags"><code>virDomainUpdateDeviceFlags</code></a></h3><pre class="programlisting">int virDomainUpdateDeviceFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xml, <br /> unsigned int flags)<br />
999
</pre><p>Change a virtual device on a domain, using the flags parameter to control how the device is changed. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a> specifies that the device change is made based on current domain state. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> specifies that the device shall be changed on the active domain instance only and is not added to the persisted domain configuration. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> specifies that the device shall be changed on the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation. This method is used for actions such changing CDROM/Floppy device media, altering the graphics configuration such as password, reconfiguring the NIC device backend connectivity, etc.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an OR'ed set of <a href="libvirt-libvirt.html#virDomainDeviceModifyFlags">virDomainDeviceModifyFlags</a></td></tr><tr><td><span class="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><a name="virEventAddHandle" id="virEventAddHandle"><code>virEventAddHandle</code></a></h3><pre class="programlisting">int virEventAddHandle (int fd, <br /> int events, <br /> <a href="libvirt-libvirt.html#virEventHandleCallback">virEventHandleCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)<br />
1097
</pre><p>Undefine a domain. If the domain is running, it's converted to transient domain, without stopping it. If the domain is inactive, the domain configuration is removed. If the domain has a managed save image (see <a href="libvirt-libvirt.html#virDomainHasManagedSaveImage">virDomainHasManagedSaveImage</a>()), then including <a href="libvirt-libvirt.html#VIR_DOMAIN_UNDEFINE_MANAGED_SAVE">VIR_DOMAIN_UNDEFINE_MANAGED_SAVE</a> in @flags will also remove that file, and omitting the flag will cause the undefine process to fail. If the domain is inactive and has any snapshot metadata (see <a href="libvirt-libvirt.html#virDomainSnapshotNum">virDomainSnapshotNum</a>()), then including <a href="libvirt-libvirt.html#VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA">VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA</a> in @flags will also remove that metadata. Omitting the flag will cause the undefine of an inactive domain to fail. Active snapshots will retain snapshot metadata until the (now-transient) domain halts, regardless of whether this flag is present. On hypervisors where snapshots do not use libvirt metadata, this flag has no effect.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to a defined domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of supported <a href="libvirt-libvirt.html#virDomainUndefineFlagsValues">virDomainUndefineFlagsValues</a></td></tr><tr><td><span class="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><a name="virDomainUpdateDeviceFlags" id="virDomainUpdateDeviceFlags"><code>virDomainUpdateDeviceFlags</code></a></h3><pre class="programlisting">int virDomainUpdateDeviceFlags (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br /> const char * xml, <br /> unsigned int flags)<br />
1098
</pre><p>Change a virtual device on a domain, using the flags parameter to control how the device is changed. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CURRENT">VIR_DOMAIN_AFFECT_CURRENT</a> specifies that the device change is made based on current domain state. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_LIVE">VIR_DOMAIN_AFFECT_LIVE</a> specifies that the device shall be changed on the active domain instance only and is not added to the persisted domain configuration. <a href="libvirt-libvirt.html#VIR_DOMAIN_AFFECT_CONFIG">VIR_DOMAIN_AFFECT_CONFIG</a> specifies that the device shall be changed on the persisted domain configuration only. Note that the target hypervisor must return an error if unable to satisfy flags. E.g. the hypervisor driver will return failure if LIVE is specified but it only supports modifying the persisted device allocation. This method is used for actions such changing CDROM/Floppy device media, altering the graphics configuration such as password, reconfiguring the NIC device backend connectivity, etc.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>domain</tt></i>:</span></td><td>pointer to domain object</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>pointer to XML description of one device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virDomainDeviceModifyFlags">virDomainDeviceModifyFlags</a></td></tr><tr><td><span class="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><a name="virEventAddHandle" id="virEventAddHandle"><code>virEventAddHandle</code></a></h3><pre class="programlisting">int virEventAddHandle (int fd, <br /> int events, <br /> <a href="libvirt-libvirt.html#virEventHandleCallback">virEventHandleCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)<br />
1000
1099
</pre><p></p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>fd</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>events</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>ff</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><h3><a name="virEventAddHandleFunc" id="virEventAddHandleFunc"><code>virEventAddHandleFunc</code></a></h3><pre class="programlisting">typedef int (*virEventAddHandleFunc ) (int fd, <br /> int event, <br /> <a href="libvirt-libvirt.html#virEventHandleCallback">virEventHandleCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)
1001
1100
</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. This callback needs to be invoked from a clean stack. If 'ff' callbacks are invoked directly from the <a href="libvirt-libvirt.html#virEventRemoveHandleFunc">virEventRemoveHandleFunc</a> they will likely deadlock in libvirt.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>fd</tt></i>:</span></td><td>file descriptor to listen on</td></tr><tr><td><span class="term"><i><tt>event</tt></i>:</span></td><td>bitset of events on which to fire the callback</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>the callback to be called when an event occurrs</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>user data to pass to the callback</td></tr><tr><td><span class="term"><i><tt>ff</tt></i>:</span></td><td>the callback invoked to free opaque data blob</td></tr><tr><td><span class="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><a name="virEventAddTimeout" id="virEventAddTimeout"><code>virEventAddTimeout</code></a></h3><pre class="programlisting">int virEventAddTimeout (int timeout, <br /> <a href="libvirt-libvirt.html#virEventTimeoutCallback">virEventTimeoutCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)<br />
1002
1101
</pre><p></p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>timeout</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>ff</tt></i>:</span></td><td></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td></td></tr></tbody></table></div><h3><a name="virEventAddTimeoutFunc" id="virEventAddTimeoutFunc"><code>virEventAddTimeoutFunc</code></a></h3><pre class="programlisting">typedef int (*virEventAddTimeoutFunc ) (int timeout, <br /> <a href="libvirt-libvirt.html#virEventTimeoutCallback">virEventTimeoutCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)
1064
1163
</pre><p>Increment the reference count on the network. For each additional call to this method, there shall be a corresponding call to <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>network</tt></i>:</span></td><td>the network to hold a reference on</td></tr><tr><td><span class="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><a name="virNetworkSetAutostart" id="virNetworkSetAutostart"><code>virNetworkSetAutostart</code></a></h3><pre class="programlisting">int virNetworkSetAutostart (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network, <br /> int autostart)<br />
1065
1164
</pre><p>Configure the network to be automatically started when the host machine boots.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>network</tt></i>:</span></td><td>a network object</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>whether the network should be automatically started 0 or 1</td></tr><tr><td><span class="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><a name="virNetworkUndefine" id="virNetworkUndefine"><code>virNetworkUndefine</code></a></h3><pre class="programlisting">int virNetworkUndefine (<a href="libvirt-libvirt.html#virNetworkPtr">virNetworkPtr</a> network)<br />
1066
1165
</pre><p>Undefine a network but does not stop it if it is running</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>network</tt></i>:</span></td><td>pointer to a defined network</td></tr><tr><td><span class="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><a name="virNodeDeviceCreateXML" id="virNodeDeviceCreateXML"><code>virNodeDeviceCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> virNodeDeviceCreateXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
1067
</pre><p>Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the device to be created</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>callers should always pass 0</td></tr><tr><td><span class="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><a name="virNodeDeviceDestroy" id="virNodeDeviceDestroy"><code>virNodeDeviceDestroy</code></a></h3><pre class="programlisting">int virNodeDeviceDestroy (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1166
</pre><p>Create a new device on the VM host machine, for example, virtual HBAs created using vport_create.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>string containing an XML description of the device to be created</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virNodeDeviceDestroy" id="virNodeDeviceDestroy"><code>virNodeDeviceDestroy</code></a></h3><pre class="programlisting">int virNodeDeviceDestroy (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1068
1167
</pre><p>Destroy the device object. The virtual device is removed from the host operating system. This function may require privileged access</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>a device object</td></tr><tr><td><span class="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><a name="virNodeDeviceDettach" id="virNodeDeviceDettach"><code>virNodeDeviceDettach</code></a></h3><pre class="programlisting">int virNodeDeviceDettach (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1069
1168
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><span class="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><a name="virNodeDeviceFree" id="virNodeDeviceFree"><code>virNodeDeviceFree</code></a></h3><pre class="programlisting">int virNodeDeviceFree (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1070
1169
</pre><p>Drops a reference to the node device, freeing it if this was the last reference.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the 0 for success, -1 for error.</td></tr></tbody></table></div><h3><a name="virNodeDeviceGetName" id="virNodeDeviceGetName"><code>virNodeDeviceGetName</code></a></h3><pre class="programlisting">const char * virNodeDeviceGetName (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1071
1170
</pre><p>Just return the device name</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the device name or NULL in case of error</td></tr></tbody></table></div><h3><a name="virNodeDeviceGetParent" id="virNodeDeviceGetParent"><code>virNodeDeviceGetParent</code></a></h3><pre class="programlisting">const char * virNodeDeviceGetParent (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1072
1171
</pre><p>Accessor for the parent of the device</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><span class="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><a name="virNodeDeviceGetXMLDesc" id="virNodeDeviceGetXMLDesc"><code>virNodeDeviceGetXMLDesc</code></a></h3><pre class="programlisting">char * virNodeDeviceGetXMLDesc (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev, <br /> unsigned int flags)<br />
1073
</pre><p>Fetch an XML document describing all aspects of the device.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for XML generation (unused, pass 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document, or NULL on error</td></tr></tbody></table></div><h3><a name="virNodeDeviceListCaps" id="virNodeDeviceListCaps"><code>virNodeDeviceListCaps</code></a></h3><pre class="programlisting">int virNodeDeviceListCaps (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev, <br /> char ** const names, <br /> int maxnames)<br />
1172
</pre><p>Fetch an XML document describing all aspects of the device.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document, or NULL on error</td></tr></tbody></table></div><h3><a name="virNodeDeviceListCaps" id="virNodeDeviceListCaps"><code>virNodeDeviceListCaps</code></a></h3><pre class="programlisting">int virNodeDeviceListCaps (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev, <br /> char ** const names, <br /> int maxnames)<br />
1074
1173
</pre><p>Lists the names of the capabilities supported by the device.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><span class="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of capability names</td></tr><tr><td><span class="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of capability names listed in @names.</td></tr></tbody></table></div><h3><a name="virNodeDeviceLookupByName" id="virNodeDeviceLookupByName"><code>virNodeDeviceLookupByName</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> virNodeDeviceLookupByName (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * name)<br />
1075
1174
</pre><p>Lookup a node device by its name.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>unique device name</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> if found, NULL otherwise.</td></tr></tbody></table></div><h3><a name="virNodeDeviceNumOfCaps" id="virNodeDeviceNumOfCaps"><code>virNodeDeviceNumOfCaps</code></a></h3><pre class="programlisting">int virNodeDeviceNumOfCaps (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1076
1175
</pre><p>Accessor for the number of capabilities supported by the device.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>the device</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of capabilities supported by the device.</td></tr></tbody></table></div><h3><a name="virNodeDeviceReAttach" id="virNodeDeviceReAttach"><code>virNodeDeviceReAttach</code></a></h3><pre class="programlisting">int virNodeDeviceReAttach (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1077
1176
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><span class="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><a name="virNodeDeviceRef" id="virNodeDeviceRef"><code>virNodeDeviceRef</code></a></h3><pre class="programlisting">int virNodeDeviceRef (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1078
1177
</pre><p>Increment the reference count on the dev. For each additional call to this method, there shall be a corresponding call to <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>the dev to hold a reference on</td></tr><tr><td><span class="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><a name="virNodeDeviceReset" id="virNodeDeviceReset"><code>virNodeDeviceReset</code></a></h3><pre class="programlisting">int virNodeDeviceReset (<a href="libvirt-libvirt.html#virNodeDevicePtr">virNodeDevicePtr</a> dev)<br />
1079
1178
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>dev</tt></i>:</span></td><td>pointer to the node device</td></tr><tr><td><span class="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><a name="virNodeGetCPUStats" id="virNodeGetCPUStats"><code>virNodeGetCPUStats</code></a></h3><pre class="programlisting">int virNodeGetCPUStats (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> int cpuNum, <br /> <a href="libvirt-libvirt.html#virNodeCPUStatsPtr">virNodeCPUStatsPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
1080
</pre><p>This function provides individual cpu statistics of the node. If you want to get total cpu statistics of the node, you must specify <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_ALL_CPUS">VIR_NODE_CPU_STATS_ALL_CPUS</a> to @cpuNum. The @params array will be filled with the values equal to the number of parameters suggested by @nparams As the value of @nparams is dynamic, call the API setting @nparams to 0 and @params as NULL, the API returns the number of parameters supported by the HV by updating @nparams on SUCCESS. The caller should then allocate @params array, i.e. (sizeof(@virNodeCPUStats) * @nparams) bytes and call the API again. Here is a sample code snippet: if ((virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL) goto error; memset(params, 0, sizeof(virNodeCPUStats) * nparams); if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0)) goto error; } This function doesn't require privileged access to the hypervisor. This function expects the caller to allocate the @params. CPU time Statistics: <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_KERNEL">VIR_NODE_CPU_STATS_KERNEL</a>: The cumulative CPU time which spends by kernel, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_USER">VIR_NODE_CPU_STATS_USER</a>: The cumulative CPU time which spends by user processes, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_IDLE">VIR_NODE_CPU_STATS_IDLE</a>: The cumulative idle CPU time, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_IOWAIT">VIR_NODE_CPU_STATS_IOWAIT</a>: The cumulative I/O wait CPU time, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_UTILIZATION">VIR_NODE_CPU_STATS_UTILIZATION</a>: The CPU utilization. The usage value is in percent and 100% represents all CPUs on the server.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection.</td></tr><tr><td><span class="term"><i><tt>cpuNum</tt></i>:</span></td><td>number of node cpu. (<a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_ALL_CPUS">VIR_NODE_CPU_STATS_ALL_CPUS</a> means total cpu statistics)</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to node cpu time parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of node cpu time parameter (this value should be same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, for future extension. always pass 0.</td></tr><tr><td><span class="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><a name="virNodeGetCellsFreeMemory" id="virNodeGetCellsFreeMemory"><code>virNodeGetCellsFreeMemory</code></a></h3><pre class="programlisting">int virNodeGetCellsFreeMemory (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> unsigned long long * freeMems, <br /> int startCell, <br /> int maxCells)<br />
1179
</pre><p>This function provides individual cpu statistics of the node. If you want to get total cpu statistics of the node, you must specify <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_ALL_CPUS">VIR_NODE_CPU_STATS_ALL_CPUS</a> to @cpuNum. The @params array will be filled with the values equal to the number of parameters suggested by @nparams As the value of @nparams is dynamic, call the API setting @nparams to 0 and @params as NULL, the API returns the number of parameters supported by the HV by updating @nparams on SUCCESS. The caller should then allocate @params array, i.e. (sizeof(@virNodeCPUStats) * @nparams) bytes and call the API again. Here is a sample code snippet: if ((virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(virNodeCPUStats) * nparams)) == NULL) goto error; memset(params, 0, sizeof(virNodeCPUStats) * nparams); if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0)) goto error; } This function doesn't require privileged access to the hypervisor. This function expects the caller to allocate the @params. CPU time Statistics: <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_KERNEL">VIR_NODE_CPU_STATS_KERNEL</a>: The cumulative CPU time which spends by kernel, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_USER">VIR_NODE_CPU_STATS_USER</a>: The cumulative CPU time which spends by user processes, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_IDLE">VIR_NODE_CPU_STATS_IDLE</a>: The cumulative idle CPU time, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_IOWAIT">VIR_NODE_CPU_STATS_IOWAIT</a>: The cumulative I/O wait CPU time, when the node booting up.(nanoseconds) <a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_UTILIZATION">VIR_NODE_CPU_STATS_UTILIZATION</a>: The CPU utilization. The usage value is in percent and 100% represents all CPUs on the server.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection.</td></tr><tr><td><span class="term"><i><tt>cpuNum</tt></i>:</span></td><td>number of node cpu. (<a href="libvirt-libvirt.html#VIR_NODE_CPU_STATS_ALL_CPUS">VIR_NODE_CPU_STATS_ALL_CPUS</a> means total cpu statistics)</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to node cpu time parameter objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of node cpu time parameter (this value should be same or less than the number of parameters supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virNodeGetCellsFreeMemory" id="virNodeGetCellsFreeMemory"><code>virNodeGetCellsFreeMemory</code></a></h3><pre class="programlisting">int virNodeGetCellsFreeMemory (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> unsigned long long * freeMems, <br /> int startCell, <br /> int maxCells)<br />
1081
1180
</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 bytes for each cell requested, starting with startCell (in freeMems[0]), up to either (startCell + maxCells), or the number of additional cells in the node, whichever is smaller.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>freeMems</tt></i>:</span></td><td>pointer to the array of unsigned long long</td></tr><tr><td><span class="term"><i><tt>startCell</tt></i>:</span></td><td>index of first cell to return freeMems info on.</td></tr><tr><td><span class="term"><i><tt>maxCells</tt></i>:</span></td><td>Maximum number of cells for which freeMems information can be returned.</td></tr><tr><td><span class="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><a name="virNodeGetFreeMemory" id="virNodeGetFreeMemory"><code>virNodeGetFreeMemory</code></a></h3><pre class="programlisting">unsigned long long virNodeGetFreeMemory (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br />
1082
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="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><a name="virNodeGetInfo" id="virNodeGetInfo"><code>virNodeGetInfo</code></a></h3><pre class="programlisting">int virNodeGetInfo (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virNodeInfoPtr">virNodeInfoPtr</a> info)<br />
1181
</pre><p>provides the free memory available on the Node Note: most libvirt APIs provide memory sizes in kibibytes, but in this function the returned value is in bytes. Divide by 1024 as necessary.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="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><a name="virNodeGetInfo" id="virNodeGetInfo"><code>virNodeGetInfo</code></a></h3><pre class="programlisting">int virNodeGetInfo (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virNodeInfoPtr">virNodeInfoPtr</a> info)<br />
1083
1182
</pre><p>Extract hardware information about the node.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virNodeInfo">virNodeInfo</a> structure allocated by the user</td></tr><tr><td><span class="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><a name="virNodeGetMemoryStats" id="virNodeGetMemoryStats"><code>virNodeGetMemoryStats</code></a></h3><pre class="programlisting">int virNodeGetMemoryStats (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> int cellNum, <br /> <a href="libvirt-libvirt.html#virNodeMemoryStatsPtr">virNodeMemoryStatsPtr</a> params, <br /> int * nparams, <br /> unsigned int flags)<br />
1084
</pre><p>This function provides memory stats of the node. If you want to get total cpu statistics of the node, you must specify <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_ALL_CELLS">VIR_NODE_MEMORY_STATS_ALL_CELLS</a> to @cellNum. The @params array will be filled with the values equal to the number of stats suggested by @nparams As the value of @nparams is dynamic, call the API setting @nparams to 0 and @params as NULL, the API returns the number of parameters supported by the HV by updating @nparams on SUCCESS. The caller should then allocate @params array, i.e. (sizeof(@virNodeMemoryStats) * @nparams) bytes and call the API again. Here is the sample code snippet: if ((virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL) goto error; memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams); if (virNodeGetMemoryStats(conn, params, &nparams, 0)) goto error; } This function doesn't require privileged access to the hypervisor. This function expects the caller to allocate the @params. Memory Stats: <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_TOTAL">VIR_NODE_MEMORY_STATS_TOTAL</a>: The total memory usage.(KB) <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_FREE">VIR_NODE_MEMORY_STATS_FREE</a>: The free memory usage.(KB) On linux, this usage includes buffers and cached. <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_BUFFERS">VIR_NODE_MEMORY_STATS_BUFFERS</a>: The buffers memory usage.(KB) <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_CACHED">VIR_NODE_MEMORY_STATS_CACHED</a>: The cached memory usage.(KB)</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection.</td></tr><tr><td><span class="term"><i><tt>cellNum</tt></i>:</span></td><td>number of node cell. (<a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_ALL_CELLS">VIR_NODE_MEMORY_STATS_ALL_CELLS</a> means total cell statistics)</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to node memory stats objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of node memory stats (this value should be same or less than the number of stats supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>currently unused, for future extension. always pass 0.</td></tr><tr><td><span class="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><a name="virNodeGetSecurityModel" id="virNodeGetSecurityModel"><code>virNodeGetSecurityModel</code></a></h3><pre class="programlisting">int virNodeGetSecurityModel (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virSecurityModelPtr">virSecurityModelPtr</a> secmodel)<br />
1183
</pre><p>This function provides memory stats of the node. If you want to get total cpu statistics of the node, you must specify <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_ALL_CELLS">VIR_NODE_MEMORY_STATS_ALL_CELLS</a> to @cellNum. The @params array will be filled with the values equal to the number of stats suggested by @nparams As the value of @nparams is dynamic, call the API setting @nparams to 0 and @params as NULL, the API returns the number of parameters supported by the HV by updating @nparams on SUCCESS. The caller should then allocate @params array, i.e. (sizeof(@virNodeMemoryStats) * @nparams) bytes and call the API again. Here is the sample code snippet: if ((virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0) && (nparams != 0)) { if ((params = malloc(sizeof(virNodeMemoryStats) * nparams)) == NULL) goto error; memset(params, cellNum, 0, sizeof(virNodeMemoryStats) * nparams); if (virNodeGetMemoryStats(conn, params, &nparams, 0)) goto error; } This function doesn't require privileged access to the hypervisor. This function expects the caller to allocate the @params. Memory Stats: <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_TOTAL">VIR_NODE_MEMORY_STATS_TOTAL</a>: The total memory usage.(KB) <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_FREE">VIR_NODE_MEMORY_STATS_FREE</a>: The free memory usage.(KB) On linux, this usage includes buffers and cached. <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_BUFFERS">VIR_NODE_MEMORY_STATS_BUFFERS</a>: The buffers memory usage.(KB) <a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_CACHED">VIR_NODE_MEMORY_STATS_CACHED</a>: The cached memory usage.(KB)</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection.</td></tr><tr><td><span class="term"><i><tt>cellNum</tt></i>:</span></td><td>number of node cell. (<a href="libvirt-libvirt.html#VIR_NODE_MEMORY_STATS_ALL_CELLS">VIR_NODE_MEMORY_STATS_ALL_CELLS</a> means total cell statistics)</td></tr><tr><td><span class="term"><i><tt>params</tt></i>:</span></td><td>pointer to node memory stats objects</td></tr><tr><td><span class="term"><i><tt>nparams</tt></i>:</span></td><td>number of node memory stats (this value should be same or less than the number of stats supported)</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virNodeGetSecurityModel" id="virNodeGetSecurityModel"><code>virNodeGetSecurityModel</code></a></h3><pre class="programlisting">int virNodeGetSecurityModel (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> <a href="libvirt-libvirt.html#virSecurityModelPtr">virSecurityModelPtr</a> secmodel)<br />
1085
1184
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>a connection object</td></tr><tr><td><span class="term"><i><tt>secmodel</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#virSecurityModel">virSecurityModel</a> structure</td></tr><tr><td><span class="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><a name="virNodeListDevices" id="virNodeListDevices"><code>virNodeListDevices</code></a></h3><pre class="programlisting">int virNodeListDevices (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * cap, <br /> char ** const names, <br /> int maxnames, <br /> unsigned int flags)<br />
1086
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>cap</tt></i>:</span></td><td>capability name</td></tr><tr><td><span class="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of node device names</td></tr><tr><td><span class="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags (unused, pass 0)</td></tr><tr><td><span class="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><a name="virNodeNumOfDevices" id="virNodeNumOfDevices"><code>virNodeNumOfDevices</code></a></h3><pre class="programlisting">int virNodeNumOfDevices (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * cap, <br /> unsigned int flags)<br />
1087
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>cap</tt></i>:</span></td><td>capability name</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags (unused, pass 0)</td></tr><tr><td><span class="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><a name="virNodeSuspendForDuration" id="virNodeSuspendForDuration"><code>virNodeSuspendForDuration</code></a></h3><pre class="programlisting">int virNodeSuspendForDuration (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> unsigned int target, <br /> unsigned long long duration, <br /> unsigned int flags)<br />
1088
</pre><p>Attempt to suspend the node (host machine) for the given duration of time in the specified state (Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend). Schedule the node's Real-Time-Clock interrupt to resume the node after the duration is complete.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>target</tt></i>:</span></td><td>the state to which the host must be suspended to, such as: <a href="libvirt-libvirt.html#VIR_NODE_SUSPEND_TARGET_MEM">VIR_NODE_SUSPEND_TARGET_MEM</a> (Suspend-to-RAM) <a href="libvirt-libvirt.html#VIR_NODE_SUSPEND_TARGET_DISK">VIR_NODE_SUSPEND_TARGET_DISK</a> (Suspend-to-Disk) <a href="libvirt-libvirt.html#VIR_NODE_SUSPEND_TARGET_HYBRID">VIR_NODE_SUSPEND_TARGET_HYBRID</a> (Hybrid-Suspend, which is a combination of the former modes).</td></tr><tr><td><span class="term"><i><tt>duration</tt></i>:</span></td><td>the time duration in seconds for which the host has to be suspended</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>any flag values that might need to be passed; currently unused (0).</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success (i.e., the node will be suspended after a short delay), -1 on failure (the operation is not supported, or an attempted suspend is already underway).</td></tr></tbody></table></div><h3><a name="virSecretDefineXML" id="virSecretDefineXML"><code>virSecretDefineXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> virSecretDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xml, <br /> unsigned int flags)<br />
1089
</pre><p>If XML specifies a UUID, locates the specified secret and replaces all attributes of the secret specified by UUID by attributes specified in xml (any attributes not specified in xml are discarded). Otherwise, creates a new secret with an automatically chosen UUID, and initializes its attributes from xml.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>XML describing the secret.</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a the secret on success, NULL on failure.</td></tr></tbody></table></div><h3><a name="virSecretFree" id="virSecretFree"><code>virSecretFree</code></a></h3><pre class="programlisting">int virSecretFree (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1185
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>cap</tt></i>:</span></td><td>capability name</td></tr><tr><td><span class="term"><i><tt>names</tt></i>:</span></td><td>array to collect the list of node device names</td></tr><tr><td><span class="term"><i><tt>maxnames</tt></i>:</span></td><td>size of @names</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virNodeNumOfDevices" id="virNodeNumOfDevices"><code>virNodeNumOfDevices</code></a></h3><pre class="programlisting">int virNodeNumOfDevices (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * cap, <br /> unsigned int flags)<br />
1186
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>cap</tt></i>:</span></td><td>capability name</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virNodeSuspendForDuration" id="virNodeSuspendForDuration"><code>virNodeSuspendForDuration</code></a></h3><pre class="programlisting">int virNodeSuspendForDuration (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> unsigned int target, <br /> unsigned long long duration, <br /> unsigned int flags)<br />
1187
</pre><p>Attempt to suspend the node (host machine) for the given duration of time in the specified state (Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend). Schedule the node's Real-Time-Clock interrupt to resume the node after the duration is complete.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>target</tt></i>:</span></td><td>the state to which the host must be suspended to, such as: <a href="libvirt-libvirt.html#VIR_NODE_SUSPEND_TARGET_MEM">VIR_NODE_SUSPEND_TARGET_MEM</a> (Suspend-to-RAM) <a href="libvirt-libvirt.html#VIR_NODE_SUSPEND_TARGET_DISK">VIR_NODE_SUSPEND_TARGET_DISK</a> (Suspend-to-Disk) <a href="libvirt-libvirt.html#VIR_NODE_SUSPEND_TARGET_HYBRID">VIR_NODE_SUSPEND_TARGET_HYBRID</a> (Hybrid-Suspend, which is a combination of the former modes).</td></tr><tr><td><span class="term"><i><tt>duration</tt></i>:</span></td><td>the time duration in seconds for which the host has to be suspended</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success (i.e., the node will be suspended after a short delay), -1 on failure (the operation is not supported, or an attempted suspend is already underway).</td></tr></tbody></table></div><h3><a name="virSecretDefineXML" id="virSecretDefineXML"><code>virSecretDefineXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> virSecretDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xml, <br /> unsigned int flags)<br />
1188
</pre><p>If XML specifies a UUID, locates the specified secret and replaces all attributes of the secret specified by UUID by attributes specified in xml (any attributes not specified in xml are discarded). Otherwise, creates a new secret with an automatically chosen UUID, and initializes its attributes from xml.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td><a href="libvirt-libvirt.html#virConnect">virConnect</a> connection</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>XML describing the secret.</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a the secret on success, NULL on failure.</td></tr></tbody></table></div><h3><a name="virSecretFree" id="virSecretFree"><code>virSecretFree</code></a></h3><pre class="programlisting">int virSecretFree (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1090
1189
</pre><p>Release the secret handle. The underlying secret continues to exist.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>pointer to a secret</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><a name="virSecretGetConnect" id="virSecretGetConnect"><code>virSecretGetConnect</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virSecretGetConnect (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1091
1190
</pre><p>Provides the connection pointer associated with a secret. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the secret object together.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> secret</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virSecretGetUUID" id="virSecretGetUUID"><code>virSecretGetUUID</code></a></h3><pre class="programlisting">int virSecretGetUUID (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret, <br /> unsigned char * uuid)<br />
1092
1191
</pre><p>Fetches the UUID of the secret.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> secret</td></tr><tr><td><span class="term"><i><tt>uuid</tt></i>:</span></td><td>buffer of <a href="libvirt-libvirt.html#VIR_UUID_BUFLEN">VIR_UUID_BUFLEN</a> bytes in size</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success with the uuid buffer being filled, or -1 upon failure.</td></tr></tbody></table></div><h3><a name="virSecretGetUUIDString" id="virSecretGetUUIDString"><code>virSecretGetUUIDString</code></a></h3><pre class="programlisting">int virSecretGetUUIDString (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret, <br /> char * buf)<br />
1093
1192
</pre><p>Get the UUID for a secret as string. For more information about UUID see RFC4122.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>a secret object</td></tr><tr><td><span class="term"><i><tt>buf</tt></i>:</span></td><td>pointer to a <a href="libvirt-libvirt.html#VIR_UUID_STRING_BUFLEN">VIR_UUID_STRING_BUFLEN</a> bytes array</td></tr><tr><td><span class="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><a name="virSecretGetUsageID" id="virSecretGetUsageID"><code>virSecretGetUsageID</code></a></h3><pre class="programlisting">const char * virSecretGetUsageID (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1094
1193
</pre><p>Get the unique identifier of the object with which this secret is to be used. The format of the identifier is dependant on the usage type of the secret. For a secret with a usage type of <a href="libvirt-libvirt.html#VIR_SECRET_USAGE_TYPE_VOLUME">VIR_SECRET_USAGE_TYPE_VOLUME</a> the identifier will be a fully qualfied path name. The identifiers are intended to be unique within the set of all secrets sharing the same usage type. ie, there shall only ever be one secret for each volume path.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>a secret object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a string identifying the object using the secret, or NULL upon error</td></tr></tbody></table></div><h3><a name="virSecretGetUsageType" id="virSecretGetUsageType"><code>virSecretGetUsageType</code></a></h3><pre class="programlisting">int virSecretGetUsageType (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1095
1194
</pre><p>Get the type of object which uses this secret. The returned value is one of the constants defined in the <a href="libvirt-libvirt.html#virSecretUsageType">virSecretUsageType</a> enumeration. More values may be added to this enumeration in the future, so callers should expect to see usage types they do not explicitly know about.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>a secret object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a positive integer identifying the type of object, or -1 upon error.</td></tr></tbody></table></div><h3><a name="virSecretGetValue" id="virSecretGetValue"><code>virSecretGetValue</code></a></h3><pre class="programlisting">unsigned char * virSecretGetValue (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret, <br /> size_t * value_size, <br /> unsigned int flags)<br />
1096
</pre><p>Fetches the value of a secret.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> connection</td></tr><tr><td><span class="term"><i><tt>value_size</tt></i>:</span></td><td>Place for storing size of the secret value</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the secret value on success, NULL on failure. The caller must free() the secret value.</td></tr></tbody></table></div><h3><a name="virSecretGetXMLDesc" id="virSecretGetXMLDesc"><code>virSecretGetXMLDesc</code></a></h3><pre class="programlisting">char * virSecretGetXMLDesc (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret, <br /> unsigned int flags)<br />
1097
</pre><p>Fetches an XML document describing attributes of the secret.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> secret</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document on success, NULL on failure. The caller must free() the XML.</td></tr></tbody></table></div><h3><a name="virSecretLookupByUUID" id="virSecretLookupByUUID"><code>virSecretLookupByUUID</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> virSecretLookupByUUID (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const unsigned char * uuid)<br />
1195
</pre><p>Fetches the value of a secret.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> connection</td></tr><tr><td><span class="term"><i><tt>value_size</tt></i>:</span></td><td>Place for storing size of the secret value</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the secret value on success, NULL on failure. The caller must free() the secret value.</td></tr></tbody></table></div><h3><a name="virSecretGetXMLDesc" id="virSecretGetXMLDesc"><code>virSecretGetXMLDesc</code></a></h3><pre class="programlisting">char * virSecretGetXMLDesc (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret, <br /> unsigned int flags)<br />
1196
</pre><p>Fetches an XML document describing attributes of the secret.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> secret</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document on success, NULL on failure. The caller must free() the XML.</td></tr></tbody></table></div><h3><a name="virSecretLookupByUUID" id="virSecretLookupByUUID"><code>virSecretLookupByUUID</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> virSecretLookupByUUID (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const unsigned char * uuid)<br />
1098
1197
</pre><p>Try to lookup a secret on the given hypervisor based on its UUID. Uses the 16 bytes of raw data to describe the UUID</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>uuid</tt></i>:</span></td><td>the raw UUID for the secret</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new secret object or NULL in case of failure. If the secret cannot be found, then <a href="libvirt-virterror.html#VIR_ERR_NO_SECRET">VIR_ERR_NO_SECRET</a> error is raised.</td></tr></tbody></table></div><h3><a name="virSecretLookupByUUIDString" id="virSecretLookupByUUIDString"><code>virSecretLookupByUUIDString</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> virSecretLookupByUUIDString (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * uuidstr)<br />
1099
1198
</pre><p>Try to lookup a secret on the given hypervisor based on its UUID. Uses the printable string value to describe the UUID</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>uuidstr</tt></i>:</span></td><td>the string UUID for the secret</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new secret object or NULL in case of failure. If the secret cannot be found, then <a href="libvirt-virterror.html#VIR_ERR_NO_SECRET">VIR_ERR_NO_SECRET</a> error is raised.</td></tr></tbody></table></div><h3><a name="virSecretLookupByUsage" id="virSecretLookupByUsage"><code>virSecretLookupByUsage</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> virSecretLookupByUsage (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> int usageType, <br /> const char * usageID)<br />
1100
1199
</pre><p>Try to lookup a secret on the given hypervisor based on its usage The usageID is unique within the set of secrets sharing the same usageType value.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to the hypervisor connection</td></tr><tr><td><span class="term"><i><tt>usageType</tt></i>:</span></td><td>the type of secret usage</td></tr><tr><td><span class="term"><i><tt>usageID</tt></i>:</span></td><td>identifier of the object using the secret</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new secret object or NULL in case of failure. If the secret cannot be found, then <a href="libvirt-virterror.html#VIR_ERR_NO_SECRET">VIR_ERR_NO_SECRET</a> error is raised.</td></tr></tbody></table></div><h3><a name="virSecretRef" id="virSecretRef"><code>virSecretRef</code></a></h3><pre class="programlisting">int virSecretRef (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1101
1200
</pre><p>Increment the reference count on the secret. For each additional call to this method, there shall be a corresponding call to <a href="libvirt-libvirt.html#virSecretFree">virSecretFree</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 secret would increment the reference count.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>the secret to hold a reference on</td></tr><tr><td><span class="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><a name="virSecretSetValue" id="virSecretSetValue"><code>virSecretSetValue</code></a></h3><pre class="programlisting">int virSecretSetValue (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret, <br /> const unsigned char * value, <br /> size_t value_size, <br /> unsigned int flags)<br />
1102
</pre><p>Sets the value of a secret.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> secret</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>Value of the secret</td></tr><tr><td><span class="term"><i><tt>value_size</tt></i>:</span></td><td>Size of the value</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure.</td></tr></tbody></table></div><h3><a name="virSecretUndefine" id="virSecretUndefine"><code>virSecretUndefine</code></a></h3><pre class="programlisting">int virSecretUndefine (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1201
</pre><p>Sets the value of a secret.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> secret</td></tr><tr><td><span class="term"><i><tt>value</tt></i>:</span></td><td>Value of the secret</td></tr><tr><td><span class="term"><i><tt>value_size</tt></i>:</span></td><td>Size of the value</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure.</td></tr></tbody></table></div><h3><a name="virSecretUndefine" id="virSecretUndefine"><code>virSecretUndefine</code></a></h3><pre class="programlisting">int virSecretUndefine (<a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> secret)<br />
1103
1202
</pre><p>Deletes the specified secret. This does not free the associated <a href="libvirt-libvirt.html#virSecretPtr">virSecretPtr</a> object.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>secret</tt></i>:</span></td><td>A <a href="libvirt-libvirt.html#virSecret">virSecret</a> secret</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure.</td></tr></tbody></table></div><h3><a name="virStoragePoolBuild" id="virStoragePoolBuild"><code>virStoragePoolBuild</code></a></h3><pre class="programlisting">int virStoragePoolBuild (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> unsigned int flags)<br />
1104
</pre><p>Currently only filesystem pool accepts flags <a href="libvirt-libvirt.html#VIR_STORAGE_POOL_BUILD_OVERWRITE">VIR_STORAGE_POOL_BUILD_OVERWRITE</a> and <a href="libvirt-libvirt.html#VIR_STORAGE_POOL_BUILD_NO_OVERWRITE">VIR_STORAGE_POOL_BUILD_NO_OVERWRITE</a>. Build the underlying storage pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags to control pool build behaviour</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 upon failure</td></tr></tbody></table></div><h3><a name="virStoragePoolCreate" id="virStoragePoolCreate"><code>virStoragePoolCreate</code></a></h3><pre class="programlisting">int virStoragePoolCreate (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> unsigned int flags)<br />
1105
</pre><p>Starts an inactive storage pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><span class="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><a name="virStoragePoolCreateXML" id="virStoragePoolCreateXML"><code>virStoragePoolCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolCreateXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
1106
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>XML description for new pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if creation failed</td></tr></tbody></table></div><h3><a name="virStoragePoolDefineXML" id="virStoragePoolDefineXML"><code>virStoragePoolDefineXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xml, <br /> unsigned int flags)<br />
1107
</pre><p>Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>XML description for new pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if creation failed</td></tr></tbody></table></div><h3><a name="virStoragePoolDelete" id="virStoragePoolDelete"><code>virStoragePoolDelete</code></a></h3><pre class="programlisting">int virStoragePoolDelete (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> unsigned int flags)<br />
1108
</pre><p>Delete the underlying pool resources. This is a non-recoverable operation. The <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object itself is not free'd.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for obliteration process</td></tr><tr><td><span class="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><a name="virStoragePoolDestroy" id="virStoragePoolDestroy"><code>virStoragePoolDestroy</code></a></h3><pre class="programlisting">int virStoragePoolDestroy (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br />
1203
</pre><p>Currently only filesystem pool accepts flags <a href="libvirt-libvirt.html#VIR_STORAGE_POOL_BUILD_OVERWRITE">VIR_STORAGE_POOL_BUILD_OVERWRITE</a> and <a href="libvirt-libvirt.html#VIR_STORAGE_POOL_BUILD_NO_OVERWRITE">VIR_STORAGE_POOL_BUILD_NO_OVERWRITE</a>. Build the underlying storage pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virStoragePoolBuildFlags">virStoragePoolBuildFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 upon failure</td></tr></tbody></table></div><h3><a name="virStoragePoolCreate" id="virStoragePoolCreate"><code>virStoragePoolCreate</code></a></h3><pre class="programlisting">int virStoragePoolCreate (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> unsigned int flags)<br />
1204
</pre><p>Starts an inactive storage pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virStoragePoolCreateXML" id="virStoragePoolCreateXML"><code>virStoragePoolCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolCreateXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xmlDesc, <br /> unsigned int flags)<br />
1205
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xmlDesc</tt></i>:</span></td><td>XML description for new pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if creation failed</td></tr></tbody></table></div><h3><a name="virStoragePoolDefineXML" id="virStoragePoolDefineXML"><code>virStoragePoolDefineXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> virStoragePoolDefineXML (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * xml, <br /> unsigned int flags)<br />
1206
</pre><p>Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>xml</tt></i>:</span></td><td>XML description for new pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if creation failed</td></tr></tbody></table></div><h3><a name="virStoragePoolDelete" id="virStoragePoolDelete"><code>virStoragePoolDelete</code></a></h3><pre class="programlisting">int virStoragePoolDelete (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> unsigned int flags)<br />
1207
</pre><p>Delete the underlying pool resources. This is a non-recoverable operation. The <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object itself is not free'd.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virStoragePoolDeleteFlags">virStoragePoolDeleteFlags</a></td></tr><tr><td><span class="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><a name="virStoragePoolDestroy" id="virStoragePoolDestroy"><code>virStoragePoolDestroy</code></a></h3><pre class="programlisting">int virStoragePoolDestroy (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br />
1109
1208
</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 <a href="libvirt-libvirt.html#virStoragePoolCreate">virStoragePoolCreate</a>(). This does not free the associated <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="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><a name="virStoragePoolFree" id="virStoragePoolFree"><code>virStoragePoolFree</code></a></h3><pre class="programlisting">int virStoragePoolFree (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br />
1110
1209
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="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><a name="virStoragePoolGetAutostart" id="virStoragePoolGetAutostart"><code>virStoragePoolGetAutostart</code></a></h3><pre class="programlisting">int virStoragePoolGetAutostart (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> int * autostart)<br />
1111
1210
</pre><p>Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot time</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>location in which to store autostart flag</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virStoragePoolGetConnect" id="virStoragePoolGetConnect"><code>virStoragePoolGetConnect</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virStoragePoolGetConnect (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br />
1124
1223
</pre><p>Fetch a storage pool which contains a particular volume</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a <a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> object, or NULL if no matching pool is found</td></tr></tbody></table></div><h3><a name="virStoragePoolNumOfVolumes" id="virStoragePoolNumOfVolumes"><code>virStoragePoolNumOfVolumes</code></a></h3><pre class="programlisting">int virStoragePoolNumOfVolumes (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br />
1125
1224
</pre><p>Fetch the number of storage volumes within a pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of storage pools, or -1 on failure</td></tr></tbody></table></div><h3><a name="virStoragePoolRef" id="virStoragePoolRef"><code>virStoragePoolRef</code></a></h3><pre class="programlisting">int virStoragePoolRef (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br />
1126
1225
</pre><p>Increment the reference count on the pool. For each additional call to this method, there shall be a corresponding call to <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>the pool to hold a reference on</td></tr><tr><td><span class="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><a name="virStoragePoolRefresh" id="virStoragePoolRefresh"><code>virStoragePoolRefresh</code></a></h3><pre class="programlisting">int virStoragePoolRefresh (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> unsigned int flags)<br />
1127
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags to control refresh behaviour (currently unused, use 0)</td></tr><tr><td><span class="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><a name="virStoragePoolSetAutostart" id="virStoragePoolSetAutostart"><code>virStoragePoolSetAutostart</code></a></h3><pre class="programlisting">int virStoragePoolSetAutostart (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> int autostart)<br />
1226
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="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><a name="virStoragePoolSetAutostart" id="virStoragePoolSetAutostart"><code>virStoragePoolSetAutostart</code></a></h3><pre class="programlisting">int virStoragePoolSetAutostart (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> int autostart)<br />
1128
1227
</pre><p>Sets the autostart flag</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>autostart</tt></i>:</span></td><td>new flag setting</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virStoragePoolUndefine" id="virStoragePoolUndefine"><code>virStoragePoolUndefine</code></a></h3><pre class="programlisting">int virStoragePoolUndefine (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool)<br />
1129
1228
</pre><p>Undefine an inactive storage pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 on failure</td></tr></tbody></table></div><h3><a name="virStorageVolCreateXML" id="virStorageVolCreateXML"><code>virStorageVolCreateXML</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolCreateXML (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> const char * xmldesc, <br /> unsigned int flags)<br />
1130
</pre><p>Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>xmldesc</tt></i>:</span></td><td>description of volume to create</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for creation (unused, pass 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolCreateXMLFrom" id="virStorageVolCreateXMLFrom"><code>virStorageVolCreateXMLFrom</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolCreateXMLFrom (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> const char * xmldesc, <br /> <a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> clonevol, <br /> unsigned int flags)<br />
1131
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to parent pool for the new volume</td></tr><tr><td><span class="term"><i><tt>xmldesc</tt></i>:</span></td><td>description of volume to create</td></tr><tr><td><span class="term"><i><tt>clonevol</tt></i>:</span></td><td>storage volume to use as input</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for creation (unused, pass 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolDelete" id="virStorageVolDelete"><code>virStorageVolDelete</code></a></h3><pre class="programlisting">int virStorageVolDelete (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> unsigned int flags)<br />
1132
</pre><p>Delete the storage volume from the pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><a name="virStorageVolDownload" id="virStorageVolDownload"><code>virStorageVolDownload</code></a></h3><pre class="programlisting">int virStorageVolDownload (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> <a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream, <br /> unsigned long long offset, <br /> unsigned long long length, <br /> unsigned int flags)<br />
1133
</pre><p>Download the content of the volume as a stream. If @length is zero, then the remaining contents of the volume after @offset will be downloaded. This call sets up an asynchronous stream; subsequent use of stream APIs is necessary to transfer the actual data, determine how much data is successfully transferred, and detect any errors. The results will be unpredictable if another active stream is writing to the storage volume.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to volume to download from</td></tr><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>stream to use as output</td></tr><tr><td><span class="term"><i><tt>offset</tt></i>:</span></td><td>position in @vol to start reading from</td></tr><tr><td><span class="term"><i><tt>length</tt></i>:</span></td><td>limit on amount of data to download</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>future flags (unused, pass 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0, or -1 upon error.</td></tr></tbody></table></div><h3><a name="virStorageVolFree" id="virStorageVolFree"><code>virStorageVolFree</code></a></h3><pre class="programlisting">int virStorageVolFree (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br />
1229
</pre><p>Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>xmldesc</tt></i>:</span></td><td>description of volume to create</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolCreateXMLFrom" id="virStorageVolCreateXMLFrom"><code>virStorageVolCreateXMLFrom</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolCreateXMLFrom (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> const char * xmldesc, <br /> <a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> clonevol, <br /> unsigned int flags)<br />
1230
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to parent pool for the new volume</td></tr><tr><td><span class="term"><i><tt>xmldesc</tt></i>:</span></td><td>description of volume to create</td></tr><tr><td><span class="term"><i><tt>clonevol</tt></i>:</span></td><td>storage volume to use as input</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolDelete" id="virStorageVolDelete"><code>virStorageVolDelete</code></a></h3><pre class="programlisting">int virStorageVolDelete (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> unsigned int flags)<br />
1231
</pre><p>Delete the storage volume from the pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><a name="virStorageVolDownload" id="virStorageVolDownload"><code>virStorageVolDownload</code></a></h3><pre class="programlisting">int virStorageVolDownload (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> <a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream, <br /> unsigned long long offset, <br /> unsigned long long length, <br /> unsigned int flags)<br />
1232
</pre><p>Download the content of the volume as a stream. If @length is zero, then the remaining contents of the volume after @offset will be downloaded. This call sets up an asynchronous stream; subsequent use of stream APIs is necessary to transfer the actual data, determine how much data is successfully transferred, and detect any errors. The results will be unpredictable if another active stream is writing to the storage volume.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to volume to download from</td></tr><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>stream to use as output</td></tr><tr><td><span class="term"><i><tt>offset</tt></i>:</span></td><td>position in @vol to start reading from</td></tr><tr><td><span class="term"><i><tt>length</tt></i>:</span></td><td>limit on amount of data to download</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0, or -1 upon error.</td></tr></tbody></table></div><h3><a name="virStorageVolFree" id="virStorageVolFree"><code>virStorageVolFree</code></a></h3><pre class="programlisting">int virStorageVolFree (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br />
1134
1233
</pre><p>Release the storage volume handle. The underlying storage volume continues to exist.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><a name="virStorageVolGetConnect" id="virStorageVolGetConnect"><code>virStorageVolGetConnect</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virStorageVolGetConnect (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br />
1135
1234
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to a pool</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> or NULL in case of failure.</td></tr></tbody></table></div><h3><a name="virStorageVolGetInfo" id="virStorageVolGetInfo"><code>virStorageVolGetInfo</code></a></h3><pre class="programlisting">int virStorageVolGetInfo (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> <a href="libvirt-libvirt.html#virStorageVolInfoPtr">virStorageVolInfoPtr</a> info)<br />
1136
1235
</pre><p>Fetches volatile information about the storage volume such as its current allocation</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>info</tt></i>:</span></td><td>pointer at which to store info</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on failure</td></tr></tbody></table></div><h3><a name="virStorageVolGetKey" id="virStorageVolGetKey"><code>virStorageVolGetKey</code></a></h3><pre class="programlisting">const char * virStorageVolGetKey (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br />
1137
1236
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the volume key, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolGetName" id="virStorageVolGetName"><code>virStorageVolGetName</code></a></h3><pre class="programlisting">const char * virStorageVolGetName (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br />
1138
1237
</pre><p>Fetch the storage volume name. This is unique within the scope of a pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the volume name, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolGetPath" id="virStorageVolGetPath"><code>virStorageVolGetPath</code></a></h3><pre class="programlisting">char * virStorageVolGetPath (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br />
1139
1238
</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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the storage volume path, or NULL on error. The caller must free() the returned path after use.</td></tr></tbody></table></div><h3><a name="virStorageVolGetXMLDesc" id="virStorageVolGetXMLDesc"><code>virStorageVolGetXMLDesc</code></a></h3><pre class="programlisting">char * virStorageVolGetXMLDesc (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> unsigned int flags)<br />
1140
</pre><p>Fetch an XML document describing all aspects of the storage volume</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for XML generation (unused, pass 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolLookupByKey" id="virStorageVolLookupByKey"><code>virStorageVolLookupByKey</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolLookupByKey (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * key)<br />
1239
</pre><p>Fetch an XML document describing all aspects of the storage volume</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the XML document, or NULL on error</td></tr></tbody></table></div><h3><a name="virStorageVolLookupByKey" id="virStorageVolLookupByKey"><code>virStorageVolLookupByKey</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolLookupByKey (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * key)<br />
1141
1240
</pre><p>Fetch a pointer to a storage volume based on its globally unique key</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>key</tt></i>:</span></td><td>globally unique key</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a storage volume, or NULL if not found / error</td></tr></tbody></table></div><h3><a name="virStorageVolLookupByName" id="virStorageVolLookupByName"><code>virStorageVolLookupByName</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolLookupByName (<a href="libvirt-libvirt.html#virStoragePoolPtr">virStoragePoolPtr</a> pool, <br /> const char * name)<br />
1142
1241
</pre><p>Fetch a pointer to a storage volume based on its name within a pool</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pool</tt></i>:</span></td><td>pointer to storage pool</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>name of storage volume</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a storage volume, or NULL if not found / error</td></tr></tbody></table></div><h3><a name="virStorageVolLookupByPath" id="virStorageVolLookupByPath"><code>virStorageVolLookupByPath</code></a></h3><pre class="programlisting"><a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> virStorageVolLookupByPath (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br /> const char * path)<br />
1143
1242
</pre><p>Fetch a pointer to a storage volume based on its locally (host) unique path</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>conn</tt></i>:</span></td><td>pointer to hypervisor connection</td></tr><tr><td><span class="term"><i><tt>path</tt></i>:</span></td><td>locally unique path</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a storage volume, or NULL if not found / error</td></tr></tbody></table></div><h3><a name="virStorageVolRef" id="virStorageVolRef"><code>virStorageVolRef</code></a></h3><pre class="programlisting">int virStorageVolRef (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol)<br />
1144
</pre><p>Increment the reference count on the vol. For each additional call to this method, there shall be a corresponding call to <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>the vol to hold a reference on</td></tr><tr><td><span class="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><a name="virStorageVolUpload" id="virStorageVolUpload"><code>virStorageVolUpload</code></a></h3><pre class="programlisting">int virStorageVolUpload (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> <a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream, <br /> unsigned long long offset, <br /> unsigned long long length, <br /> unsigned int flags)<br />
1145
</pre><p>Upload new content to the volume from a stream. This call will fail if @offset + @length exceeds the size of the volume. Otherwise, if @length is non-zero, an error will be raised if an attempt is made to upload greater than @length bytes of data. This call sets up an asynchronous stream; subsequent use of stream APIs is necessary to transfer the actual data, determine how much data is successfully transferred, and detect any errors. The results will be unpredictable if another active stream is writing to the storage volume.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to volume to upload</td></tr><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>stream to use as input</td></tr><tr><td><span class="term"><i><tt>offset</tt></i>:</span></td><td>position to start writing to</td></tr><tr><td><span class="term"><i><tt>length</tt></i>:</span></td><td>limit on amount of data to upload</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>flags for creation (unused, pass 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0, or -1 upon error.</td></tr></tbody></table></div><h3><a name="virStorageVolWipe" id="virStorageVolWipe"><code>virStorageVolWipe</code></a></h3><pre class="programlisting">int virStorageVolWipe (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> unsigned int flags)<br />
1146
</pre><p>Ensure data previously on a volume is not accessible to future reads</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><a name="virStreamAbort" id="virStreamAbort"><code>virStreamAbort</code></a></h3><pre class="programlisting">int virStreamAbort (<a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream)<br />
1243
</pre><p>Increment the reference count on the vol. For each additional call to this method, there shall be a corresponding call to <a href="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><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>the vol to hold a reference on</td></tr><tr><td><span class="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><a name="virStorageVolResize" id="virStorageVolResize"><code>virStorageVolResize</code></a></h3><pre class="programlisting">int virStorageVolResize (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> unsigned long long capacity, <br /> unsigned int flags)<br />
1244
</pre><p>Changes the capacity of the storage volume @vol to @capacity. The operation will fail if the new capacity requires allocation that would exceed the remaining free space in the parent pool. The contents of the new capacity will appear as all zero bytes. Normally, the operation will attempt to affect capacity with a minimum impact on allocation (that is, the default operation favors a sparse resize). If @flags contains <a href="libvirt-libvirt.html#VIR_STORAGE_VOL_RESIZE_ALLOCATE">VIR_STORAGE_VOL_RESIZE_ALLOCATE</a>, then the operation will ensure that allocation is sufficient for the new capacity; this may make the operation take noticeably longer. Normally, the operation treats @capacity as the new size in bytes; but if @flags contains <a href="libvirt-libvirt.html#VIR_STORAGE_VOL_RESIZE_DELTA">VIR_STORAGE_VOL_RESIZE_DELTA</a>, then @capacity represents the size difference to add to the current size. It is up to the storage pool implementation whether unaligned requests are rounded up to the next valid boundary, or rejected. Normally, this operation should only be used to enlarge capacity; but if @flags contains <a href="libvirt-libvirt.html#VIR_STORAGE_VOL_RESIZE_SHRINK">VIR_STORAGE_VOL_RESIZE_SHRINK</a>, it is possible to attempt a reduction in capacity even though it might cause data loss. If <a href="libvirt-libvirt.html#VIR_STORAGE_VOL_RESIZE_DELTA">VIR_STORAGE_VOL_RESIZE_DELTA</a> is also present, then @capacity is subtracted from the current size; without it, @capacity represents the absolute new size regardless of whether it is larger or smaller than the current size.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>capacity</tt></i>:</span></td><td>new capacity, in bytes</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>bitwise-OR of <a href="libvirt-libvirt.html#virStorageVolResizeFlags">virStorageVolResizeFlags</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error.</td></tr></tbody></table></div><h3><a name="virStorageVolUpload" id="virStorageVolUpload"><code>virStorageVolUpload</code></a></h3><pre class="programlisting">int virStorageVolUpload (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> <a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream, <br /> unsigned long long offset, <br /> unsigned long long length, <br /> unsigned int flags)<br />
1245
</pre><p>Upload new content to the volume from a stream. This call will fail if @offset + @length exceeds the size of the volume. Otherwise, if @length is non-zero, an error will be raised if an attempt is made to upload greater than @length bytes of data. This call sets up an asynchronous stream; subsequent use of stream APIs is necessary to transfer the actual data, determine how much data is successfully transferred, and detect any errors. The results will be unpredictable if another active stream is writing to the storage volume.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to volume to upload</td></tr><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>stream to use as input</td></tr><tr><td><span class="term"><i><tt>offset</tt></i>:</span></td><td>position to start writing to</td></tr><tr><td><span class="term"><i><tt>length</tt></i>:</span></td><td>limit on amount of data to upload</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0, or -1 upon error.</td></tr></tbody></table></div><h3><a name="virStorageVolWipe" id="virStorageVolWipe"><code>virStorageVolWipe</code></a></h3><pre class="programlisting">int virStorageVolWipe (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> unsigned int flags)<br />
1246
</pre><p>Ensure data previously on a volume is not accessible to future reads</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>extra flags; not used yet, so callers should always pass 0</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error</td></tr></tbody></table></div><h3><a name="virStorageVolWipePattern" id="virStorageVolWipePattern"><code>virStorageVolWipePattern</code></a></h3><pre class="programlisting">int virStorageVolWipePattern (<a href="libvirt-libvirt.html#virStorageVolPtr">virStorageVolPtr</a> vol, <br /> unsigned int algorithm, <br /> unsigned int flags)<br />
1247
</pre><p>Similar to <a href="libvirt-libvirt.html#virStorageVolWipe">virStorageVolWipe</a>, but one can choose between different wiping algorithms.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>vol</tt></i>:</span></td><td>pointer to storage volume</td></tr><tr><td><span class="term"><i><tt>algorithm</tt></i>:</span></td><td>one of <a href="libvirt-libvirt.html#virStorageVolWipeAlgorithm">virStorageVolWipeAlgorithm</a></td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>future flags, use 0 for now</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, or -1 on error.</td></tr></tbody></table></div><h3><a name="virStreamAbort" id="virStreamAbort"><code>virStreamAbort</code></a></h3><pre class="programlisting">int virStreamAbort (<a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream)<br />
1147
1248
</pre><p>Request that the in progress data transfer be cancelled abnormally before the end of the stream has been reached. For output streams this can be used to inform the driver that the stream is being terminated early. For input streams this can be used to inform the driver that it should stop sending data.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>pointer to the stream object</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 upon error</td></tr></tbody></table></div><h3><a name="virStreamEventAddCallback" id="virStreamEventAddCallback"><code>virStreamEventAddCallback</code></a></h3><pre class="programlisting">int virStreamEventAddCallback (<a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream, <br /> int events, <br /> <a href="libvirt-libvirt.html#virStreamEventCallback">virStreamEventCallback</a> cb, <br /> void * opaque, <br /> <a href="libvirt-libvirt.html#virFreeCallback">virFreeCallback</a> ff)<br />
1148
1249
</pre><p>Register a callback to be notified when a stream becomes writable, or readable. This is most commonly used in conjunction with non-blocking data streams to integrate into an event loop</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>pointer to the stream object</td></tr><tr><td><span class="term"><i><tt>events</tt></i>:</span></td><td>set of events to monitor</td></tr><tr><td><span class="term"><i><tt>cb</tt></i>:</span></td><td>callback to invoke when an event occurs</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>application defined data</td></tr><tr><td><span class="term"><i><tt>ff</tt></i>:</span></td><td>callback to free @opaque data</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 on success, -1 upon error</td></tr></tbody></table></div><h3><a name="virStreamEventCallback" id="virStreamEventCallback"><code>virStreamEventCallback</code></a></h3><pre class="programlisting">typedef void (*virStreamEventCallback ) (<a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream, <br /> int events, <br /> void * opaque)
1149
1250
</pre><p>Callback for receiving stream events. The callback will be invoked once for each event which is pending.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>stream on which the event occurred</td></tr><tr><td><span class="term"><i><tt>events</tt></i>:</span></td><td>bitset of events from <a href="libvirt-libvirt.html#virEventHandleType">virEventHandleType</a> constants</td></tr><tr><td><span class="term"><i><tt>opaque</tt></i>:</span></td><td>user data registered with handle</td></tr></tbody></table></div><br /><h3><a name="virStreamEventRemoveCallback" id="virStreamEventRemoveCallback"><code>virStreamEventRemoveCallback</code></a></h3><pre class="programlisting">int virStreamEventRemoveCallback (<a href="libvirt-libvirt.html#virStreamPtr">virStreamPtr</a> stream)<br />