<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="next" href="Libvirt.Domain.html"> <link rel="Up" href="Libvirt.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Libvirt" rel="Chapter" href="Libvirt.html"> <link title="Libvirt_version" rel="Chapter" href="Libvirt_version.html"><title>Libvirt.Connect</title> </head> <body> <div class="navbar"> <a class="up" href="Libvirt.html" title="Libvirt">Up</a> <a class="post" href="Libvirt.Domain.html" title="Libvirt.Domain">Next</a> </div> <h1>Module <a href="type_Libvirt.Connect.html">Libvirt.Connect</a></h1> <pre><span class="keyword">module</span> Connect: <code class="code">sig</code> <a href="Libvirt.Connect.html">..</a> <code class="code">end</code></pre><div class="info"> Module dealing with connections. <code class="code">Connect.t</code> is the connection object.<br> </div> <hr width="100%"> <pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'rw</code> t</span> </pre> <div class="info"> Connection. Read-only connections have type <code class="code">ro Connect.t</code> and read-write connections have type <code class="code">rw Connect.t</code>.<br> </div> <pre><code><span id="TYPEnode_info"><span class="keyword">type</span> <code class="type"></code>node_info</span> = {</code></pre><table class="typetable"> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.model">model</span> :<code class="type">string</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >CPU model</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.memory">memory</span> :<code class="type">int64</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >memory size in kilobytes</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.cpus">cpus</span> :<code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >number of active CPUs</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.mhz">mhz</span> :<code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >expected CPU frequency</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.nodes">nodes</span> :<code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >number of NUMA nodes (1 = UMA)</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.sockets">sockets</span> :<code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >number of CPU sockets per node</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.cores">cores</span> :<code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >number of cores per socket</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr> <tr> <td align="left" valign="top" > <code> </code></td> <td align="left" valign="top" > <code><span id="TYPEELTnode_info.threads">threads</span> :<code class="type">int</code>;</code></td> <td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" >number of threads per core</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td> </tr></table> } <pre><span id="VALconnect"><span class="keyword">val</span> connect</span> : <code class="type">?name:string -> unit -> <a href="Libvirt.html#TYPErw">Libvirt.rw</a> <a href="Libvirt.Connect.html#TYPEt">t</a></code></pre><pre><span id="VALconnect_readonly"><span class="keyword">val</span> connect_readonly</span> : <code class="type">?name:string -> unit -> <a href="Libvirt.html#TYPEro">Libvirt.ro</a> <a href="Libvirt.Connect.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">connect ~name ()</code> connects to the hypervisor with URI <code class="code">name</code>. <p> <code class="code">connect ()</code> connects to the default hypervisor. <p> <code class="code">connect_readonly</code> is the same but connects in read-only mode.<br> </div> <pre><span id="VALclose"><span class="keyword">val</span> close</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">close conn</code> closes and frees the connection object in memory. <p> The connection is automatically closed if it is garbage collected. This function just forces it to be closed and freed right away.<br> </div> <pre><span id="VALget_type"><span class="keyword">val</span> get_type</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> string</code></pre><div class="info"> Returns the name of the driver (hypervisor).<br> </div> <pre><span id="VALget_version"><span class="keyword">val</span> get_version</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the driver version <code class="code">major * 1_000_000 + minor * 1000 + release</code><br> </div> <pre><span id="VALget_hostname"><span class="keyword">val</span> get_hostname</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> string</code></pre><div class="info"> Returns the hostname of the physical server.<br> </div> <pre><span id="VALget_uri"><span class="keyword">val</span> get_uri</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> string</code></pre><div class="info"> Returns the canonical connection URI.<br> </div> <pre><span id="VALget_max_vcpus"><span class="keyword">val</span> get_max_vcpus</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> ?type_:string -> unit -> int</code></pre><div class="info"> Returns the maximum number of virtual CPUs supported by a guest VM of a particular type.<br> </div> <pre><span id="VALlist_domains"><span class="keyword">val</span> list_domains</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int -> int array</code></pre><div class="info"> <code class="code">list_domains conn max</code> returns the running domain IDs, up to a maximum of <code class="code">max</code> entries. <p> Call <a href="Libvirt.Connect.html#VALnum_of_domains"><code class="code">Libvirt.Connect.num_of_domains</code></a> first to get a value for <code class="code">max</code>. <p> See also: <a href="Libvirt.Domain.html#VALget_domains"><code class="code">Libvirt.Domain.get_domains</code></a>, <a href="Libvirt.Domain.html#VALget_domains_and_infos"><code class="code">Libvirt.Domain.get_domains_and_infos</code></a>.<br> </div> <pre><span id="VALnum_of_domains"><span class="keyword">val</span> num_of_domains</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the number of running domains.<br> </div> <pre><span id="VALget_capabilities"><span class="keyword">val</span> get_capabilities</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> <a href="Libvirt.html#TYPExml">Libvirt.xml</a></code></pre><div class="info"> Returns the hypervisor capabilities (as XML).<br> </div> <pre><span id="VALnum_of_defined_domains"><span class="keyword">val</span> num_of_defined_domains</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the number of inactive (shutdown) domains.<br> </div> <pre><span id="VALlist_defined_domains"><span class="keyword">val</span> list_defined_domains</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int -> string array</code></pre><div class="info"> <code class="code">list_defined_domains conn max</code> returns the names of the inactive domains, up to a maximum of <code class="code">max</code> entries. <p> Call <a href="Libvirt.Connect.html#VALnum_of_defined_domains"><code class="code">Libvirt.Connect.num_of_defined_domains</code></a> first to get a value for <code class="code">max</code>. <p> See also: <a href="Libvirt.Domain.html#VALget_domains"><code class="code">Libvirt.Domain.get_domains</code></a>, <a href="Libvirt.Domain.html#VALget_domains_and_infos"><code class="code">Libvirt.Domain.get_domains_and_infos</code></a>.<br> </div> <pre><span id="VALnum_of_networks"><span class="keyword">val</span> num_of_networks</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the number of networks.<br> </div> <pre><span id="VALlist_networks"><span class="keyword">val</span> list_networks</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int -> string array</code></pre><div class="info"> <code class="code">list_networks conn max</code> returns the names of the networks, up to a maximum of <code class="code">max</code> entries. Call <a href="Libvirt.Connect.html#VALnum_of_networks"><code class="code">Libvirt.Connect.num_of_networks</code></a> first to get a value for <code class="code">max</code>.<br> </div> <pre><span id="VALnum_of_defined_networks"><span class="keyword">val</span> num_of_defined_networks</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the number of inactive networks.<br> </div> <pre><span id="VALlist_defined_networks"><span class="keyword">val</span> list_defined_networks</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int -> string array</code></pre><div class="info"> <code class="code">list_defined_networks conn max</code> returns the names of the inactive networks, up to a maximum of <code class="code">max</code> entries. Call <a href="Libvirt.Connect.html#VALnum_of_defined_networks"><code class="code">Libvirt.Connect.num_of_defined_networks</code></a> first to get a value for <code class="code">max</code>.<br> </div> <pre><span id="VALnum_of_pools"><span class="keyword">val</span> num_of_pools</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the number of storage pools.<br> </div> <pre><span id="VALlist_pools"><span class="keyword">val</span> list_pools</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int -> string array</code></pre><div class="info"> Return list of storage pools.<br> </div> <pre><span id="VALnum_of_defined_pools"><span class="keyword">val</span> num_of_defined_pools</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int</code></pre><div class="info"> Returns the number of storage pools.<br> </div> <pre><span id="VALlist_defined_pools"><span class="keyword">val</span> list_defined_pools</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int -> string array</code></pre><div class="info"> Return list of storage pools.<br> </div> <pre><span id="VALget_node_info"><span class="keyword">val</span> get_node_info</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> <a href="Libvirt.Connect.html#TYPEnode_info">node_info</a></code></pre><div class="info"> Return information about the physical server.<br> </div> <pre><span id="VALnode_get_free_memory"><span class="keyword">val</span> node_get_free_memory</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int64</code></pre><div class="info"> <code class="code">node_get_free_memory conn</code> returns the amount of free memory (not allocated to any guest) in the machine.<br> </div> <pre><span id="VALnode_get_cells_free_memory"><span class="keyword">val</span> node_get_cells_free_memory</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> int -> int -> int64 array</code></pre><div class="info"> <code class="code">node_get_cells_free_memory conn start max</code> returns the amount of free memory on each NUMA cell in kilobytes. <code class="code">start</code> is the first cell for which we return free memory. <code class="code">max</code> is the maximum number of cells for which we return free memory. Returns an array of up to <code class="code">max</code> entries in length.<br> </div> <pre><span id="VALmaxcpus_of_node_info"><span class="keyword">val</span> maxcpus_of_node_info</span> : <code class="type"><a href="Libvirt.Connect.html#TYPEnode_info">node_info</a> -> int</code></pre><div class="info"> Calculate the total number of CPUs supported (but not necessarily active) in the host.<br> </div> <pre><span id="VALcpumaplen"><span class="keyword">val</span> cpumaplen</span> : <code class="type">int -> int</code></pre><div class="info"> Calculate the length (in bytes) required to store the complete CPU map between a single virtual and all physical CPUs of a domain.<br> </div> <pre><span id="VALuse_cpu"><span class="keyword">val</span> use_cpu</span> : <code class="type">string -> int -> unit</code></pre><div class="info"> <code class="code">use_cpu cpumap cpu</code> marks <code class="code">cpu</code> as usable in <code class="code">cpumap</code>.<br> </div> <pre><span id="VALunuse_cpu"><span class="keyword">val</span> unuse_cpu</span> : <code class="type">string -> int -> unit</code></pre><div class="info"> <code class="code">unuse_cpu cpumap cpu</code> marks <code class="code">cpu</code> as not usable in <code class="code">cpumap</code>.<br> </div> <pre><span id="VALcpu_usable"><span class="keyword">val</span> cpu_usable</span> : <code class="type">string -> int -> int -> int -> bool</code></pre><div class="info"> <code class="code">cpu_usable cpumaps maplen vcpu cpu</code> checks returns true iff the <code class="code">cpu</code> is usable by <code class="code">vcpu</code>.<br> </div> <pre><span id="VALconst"><span class="keyword">val</span> const</span> : <code class="type">[> `R ] <a href="Libvirt.Connect.html#TYPEt">t</a> -> <a href="Libvirt.html#TYPEro">Libvirt.ro</a> <a href="Libvirt.Connect.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">const conn</code> turns a read/write connection into a read-only connection. Note that the opposite operation is impossible.<br> </div> </body></html>