mirror of https://gitee.com/openkylin/libvirt.git
* src/hash.c src/internal.h src/libvirt.c src/virterror.c
src/xml.h include/libvirt.h[.in] include/virterror.h: started adding new APIs, some still TODO, and not tested yet Daniel
This commit is contained in:
parent
7b38f418cb
commit
bfee5cd2cd
|
@ -1,3 +1,9 @@
|
|||
Fri Apr 28 18:31:49 EDT 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/hash.c src/internal.h src/libvirt.c src/virterror.c
|
||||
src/xml.h include/libvirt.h[.in] include/virterror.h: started
|
||||
adding new APIs, some still TODO, and not tested yet
|
||||
|
||||
Thu Apr 27 14:17:04 EDT 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/xml.c src/xend_internal.c TODO: added uuid to the XML
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><link rel="stylesheet" type="text/css" href="libvirt.css" /><link rel="SHORTCUT ICON" href="/32favicon.png" /><title>API Alphabetic Index t-z for libvirt</title></head><body><div id="container"><div id="intro"><div id="adjustments"></div><div id="pageHeader"></div><div id="content2"><h1 class="style1">API Alphabetic Index t-z for libvirt</h1><h2 align="center"><a href="APIchunk0.html">A-c</a>
|
||||
<a href="APIchunk1.html">d-m</a>
|
||||
<a href="APIchunk2.html">n-s</a>
|
||||
<a href="APIchunk3.html">t-z</a>
|
||||
</h2><h2>Letter t:</h2><dl><dt>target</dt><dd><a href="html/libvirt-virterror.html#virConnCopyLastError">virConnCopyLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virCopyLastError">virCopyLastError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSetMemory">virDomainSetMemory</a><br />
|
||||
</dd><dt>terminated</dt><dd><a href="html/libvirt-libvirt.html#virConnectGetType">virConnectGetType</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a><br />
|
||||
</dd><dt>that</dt><dd><a href="html/libvirt-virterror.html#virConnCopyLastError">virConnCopyLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virConnGetLastError">virConnGetLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virConnResetLastError">virConnResetLastError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetName">virDomainGetName</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainReboot">virDomainReboot</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainShutdown">virDomainShutdown</a><br />
|
||||
</dd><dt>their</dt><dd><a href="html/libvirt-libvirt.html#virConnectListDomains">virConnectListDomains</a><br />
|
||||
</dd><dt>then</dt><dd><a href="html/libvirt-libvirt.html#virConnectOpenReadOnly">virConnectOpenReadOnly</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetMaxMemory">virDomainGetMaxMemory</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSetMaxMemory">virDomainSetMaxMemory</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSetMemory">virDomainSetMemory</a><br />
|
||||
</dd><dt>there</dt><dd><a href="html/libvirt-libvirt.html#virConnectClose">virConnectClose</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainReboot">virDomainReboot</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainShutdown">virDomainShutdown</a><br />
|
||||
<a href="html/libvirt-virterror.html#virErrorFunc">virErrorFunc</a><br />
|
||||
<a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a><br />
|
||||
</dd><dt>thereafter</dt><dd><a href="html/libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainFree">virDomainFree</a><br />
|
||||
</dd><dt>this</dt><dd><a href="html/libvirt-virterror.html#_virError">_virError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetMaxMemory">virDomainGetMaxMemory</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSave">virDomainSave</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSetMaxMemory">virDomainSetMaxMemory</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSetMemory">virDomainSetMemory</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virInitialize">virInitialize</a><br />
|
||||
</dd><dt>those</dt><dd><a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a><br />
|
||||
</dd><dt>threads</dt><dd><a href="html/libvirt-libvirt.html#_virNodeInfo">_virNodeInfo</a><br />
|
||||
</dd><dt>time</dt><dd><a href="html/libvirt-libvirt.html#_virDomainInfo">_virDomainInfo</a><br />
|
||||
</dd><dt>two</dt><dd><a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd><dt>type</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetOSType">virDomainGetOSType</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd></dl><h2>Letter u:</h2><dl><dt>uniform</dt><dd><a href="html/libvirt-libvirt.html#_virNodeInfo">_virNodeInfo</a><br />
|
||||
</dd><dt>unknown</dt><dd><a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd><dt>unsigned</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetID">virDomainGetID</a><br />
|
||||
</dd><dt>unused</dt><dd><a href="html/libvirt-libvirt.html#virConnectOpen">virConnectOpen</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virConnectOpenReadOnly">virConnectOpenReadOnly</a><br />
|
||||
</dd><dt>usable</dt><dd><a href="html/libvirt-libvirt.html#virConnectOpenReadOnly">virConnectOpenReadOnly</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainReboot">virDomainReboot</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainShutdown">virDomainShutdown</a><br />
|
||||
</dd><dt>use</dt><dd><a href="html/libvirt-virterror.html#virConnGetLastError">virConnGetLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virErrorFunc">virErrorFunc</a><br />
|
||||
<a href="html/libvirt-virterror.html#virGetLastError">virGetLastError</a><br />
|
||||
</dd><dt>used</dt><dd><a href="html/libvirt-libvirt.html#_virDomainInfo">_virDomainInfo</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virConnectGetType">virConnectGetType</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainDestroy">virDomainDestroy</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainFree">virDomainFree</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainReboot">virDomainReboot</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSuspend">virDomainSuspend</a><br />
|
||||
</dd><dt>user</dt><dd><a href="html/libvirt-virterror.html#virConnSetErrorFunc">virConnSetErrorFunc</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a><br />
|
||||
<a href="html/libvirt-virterror.html#virErrorFunc">virErrorFunc</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virNodeGetInfo">virNodeGetInfo</a><br />
|
||||
<a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a><br />
|
||||
</dd></dl><h2>Letter v:</h2><dl><dt>value</dt><dd><a href="html/libvirt-libvirt.html#virConnectGetVersion">virConnectGetVersion</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd><dt>values</dt><dd><a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd><dt>version</dt><dd><a href="html/libvirt-libvirt.html#LIBVIR_VERSION_NUMBER">LIBVIR_VERSION_NUMBER</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virConnectGetVersion">virConnectGetVersion</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd><dt>virConnCopyLastError</dt><dd><a href="html/libvirt-virterror.html#virConnGetLastError">virConnGetLastError</a><br />
|
||||
</dd><dt>virCopyLastError</dt><dd><a href="html/libvirt-virterror.html#virGetLastError">virGetLastError</a><br />
|
||||
</dd><dt>virDomainCreateLinux</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a><br />
|
||||
</dd><dt>virDomainFlags</dt><dd><a href="html/libvirt-libvirt.html#_virDomainInfo">_virDomainInfo</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainCreateLinux">virDomainCreateLinux</a><br />
|
||||
</dd><dt>virDomainGetXMLDesc</dt><dd><a href="html/libvirt-libvirt.html#virDomainCreateLinux">virDomainCreateLinux</a><br />
|
||||
</dd><dt>virDomainInfo</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a><br />
|
||||
</dd><dt>virDomainRestore</dt><dd><a href="html/libvirt-libvirt.html#virDomainSave">virDomainSave</a><br />
|
||||
</dd><dt>virDomainResume</dt><dd><a href="html/libvirt-libvirt.html#virDomainSuspend">virDomainSuspend</a><br />
|
||||
</dd><dt>virDomainSave</dt><dd><a href="html/libvirt-libvirt.html#virDomainRestore">virDomainRestore</a><br />
|
||||
</dd><dt>virError</dt><dd><a href="html/libvirt-virterror.html#virResetError">virResetError</a><br />
|
||||
</dd><dt>virErrorNumber</dt><dd><a href="html/libvirt-virterror.html#_virError">_virError</a><br />
|
||||
</dd><dt>virNodeInfo</dt><dd><a href="html/libvirt-libvirt.html#virNodeGetInfo">virNodeGetInfo</a><br />
|
||||
</dd><dt>virResetError</dt><dd><a href="html/libvirt-virterror.html#virConnCopyLastError">virConnCopyLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virCopyLastError">virCopyLastError</a><br />
|
||||
</dd><dt>virSuspendDomain</dt><dd><a href="html/libvirt-libvirt.html#virDomainResume">virDomainResume</a><br />
|
||||
</dd><dt>virtual</dt><dd><a href="html/libvirt-libvirt.html#_virDomainInfo">_virDomainInfo</a><br />
|
||||
</dd></dl><h2>Letter w:</h2><dl><dt>was</dt><dd><a href="html/libvirt-virterror.html#virConnCopyLastError">virConnCopyLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virCopyLastError">virCopyLastError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainResume">virDomainResume</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd><dt>when</dt><dd><a href="html/libvirt-virterror.html#virErrorFunc">virErrorFunc</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virInitialize">virInitialize</a><br />
|
||||
</dd><dt>where</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetMaxMemory">virDomainGetMaxMemory</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainResume">virDomainResume</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSetMaxMemory">virDomainSetMaxMemory</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSetMemory">virDomainSetMemory</a><br />
|
||||
</dd><dt>which</dt><dd><a href="html/libvirt-virterror.html#virConnGetLastError">virConnGetLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virConnSetErrorFunc">virConnSetErrorFunc</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virConnectClose">virConnectClose</a><br />
|
||||
<a href="html/libvirt-virterror.html#virGetLastError">virGetLastError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
<a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a><br />
|
||||
</dd><dt>while</dt><dd><a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
</dd><dt>will</dt><dd><a href="html/libvirt-virterror.html#virConnCopyLastError">virConnCopyLastError</a><br />
|
||||
<a href="html/libvirt-virterror.html#virConnSetErrorFunc">virConnSetErrorFunc</a><br />
|
||||
<a href="html/libvirt-virterror.html#virCopyLastError">virCopyLastError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetName">virDomainGetName</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainRestore">virDomainRestore</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSave">virDomainSave</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainSuspend">virDomainSuspend</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virGetVersion">virGetVersion</a><br />
|
||||
<a href="html/libvirt-virterror.html#virSetErrorFunc">virSetErrorFunc</a><br />
|
||||
</dd><dt>with</dt><dd><a href="html/libvirt-virterror.html#virConnCopyLastError">virConnCopyLastError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virConnectClose">virConnectClose</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virConnectGetVersion">virConnectGetVersion</a><br />
|
||||
<a href="html/libvirt-virterror.html#virCopyLastError">virCopyLastError</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a><br />
|
||||
</dd><dt>without</dt><dd><a href="html/libvirt-libvirt.html#virDomainSuspend">virDomainSuspend</a><br />
|
||||
</dd><dt>work</dt><dd><a href="html/libvirt-libvirt.html#virConnectGetVersion">virConnectGetVersion</a><br />
|
||||
</dd></dl><h2>Letter x:</h2><dl><dt>xen</dt><dd><a href="html/libvirt-libvirt.html#virConnectOpen">virConnectOpen</a><br />
|
||||
</dd></dl><h2>Letter y:</h2><dl><dt>yet</dt><dd><a href="html/libvirt-libvirt.html#virDomainGetXMLDesc">virDomainGetXMLDesc</a><br />
|
||||
<a href="html/libvirt-libvirt.html#virDomainReboot">virDomainReboot</a><br />
|
||||
</dd></dl><h2>Letter z:</h2><dl><dt>zero</dt><dd><a href="html/libvirt-libvirt.html#virConnectGetType">virConnectGetType</a><br />
|
||||
</dd></dl><h2 align="center"><a href="APIchunk0.html">A-c</a>
|
||||
<a href="APIchunk1.html">d-m</a>
|
||||
<a href="APIchunk2.html">n-s</a>
|
||||
<a href="APIchunk3.html">t-z</a>
|
||||
</h2></div></div><div class="linkList2"><div class="llinks2"><h3 class="links2"><span>main menu</span></h3><ul><li><a href="index.html">Home</a></li><li><a href="html/index.html">API Menu</a></li><li><a href="examples/index.html">C code examples</a></li><li><a href="ChangeLog.html">Recent Changes</a></li></ul></div><div class="llinks2"><h3 class="links2"><span>related links</span></h3><ul><li><a href="https://www.redhat.com/archives/libvir-list/">Mail archive</a></li><li><a href="https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora+Core&component=libvirt&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=MODIFIED&short_desc_type=allwordssubstr&short_desc=&long_desc_type=allwordssubstr">Open bugs</a></li><li><a href="http://hg.berrange.com/libraries/sys-virt">Perl bindings</a></li><li><a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen project</a></li><li><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="12" value="Search..." /><input name="submit" type="submit" value="Go" /></form></li><li><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-90x34.gif" alt="Made with Libxml2 Logo" /></a></li></ul><p class="credits">Graphics and design by <a href="mail:dfong@redhat.com">Diana Fong</a></p></div></div><div id="bottom"><p class="p1"></p></div></div></body></html>
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>libvirt: </title>
|
||||
<meta name="generator" content="Libvirt devhelp stylesheet"/>
|
||||
<link rel="start" href="index.html" title="libvirt Reference Manual"/>
|
||||
<link rel="up" href="index.html" title="libvirt Reference Manual"/>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
<link rel="chapter" href="index.html" title="libvirt Reference Manual"/>
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
|
||||
<tr valign="middle">
|
||||
<td>
|
||||
<a accesskey="u" href="index.html">
|
||||
<img src="up.png" width="24" height="24" border="0" alt="Up"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a accesskey="h" href="index.html">
|
||||
<img src="home.png" width="24" height="24" border="0" alt="Home"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a accesskey="n" href="libvirt-libvirt.html">
|
||||
<img src="right.png" width="24" height="24" border="0" alt="Next"/>
|
||||
</a>
|
||||
</td>
|
||||
<th width="100%" align="center">libvirt Reference Manual</th>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>
|
||||
<span class="refentrytitle">libvirt API Modules</span>
|
||||
</h2>
|
||||
<p><a href="libvirt-libvirt.html">libvirt</a> - core interfaces for the libvirt library<br/><a href="libvirt-virterror.html">virterror</a> - error handling interfaces for the libvirt library<br/></p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>libvirt Reference Manual</title>
|
||||
<meta name="generator" content="Libvirt devhelp stylesheet"/>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
|
||||
<tr valign="middle">
|
||||
<td>
|
||||
<a accesskey="h" href="index.html">
|
||||
<img src="home.png" width="24" height="24" border="0" alt="Home"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a accesskey="n" href="general.html">
|
||||
<img src="right.png" width="24" height="24" border="0" alt="Next"/>
|
||||
</a>
|
||||
</td>
|
||||
<th width="100%" align="center">libvirt Reference Manual</th>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>
|
||||
<span class="refentrytitle">libvirt Reference Manual</span>
|
||||
</h2>
|
||||
<p>Libvir is a C toolkit to interract with the virtualization capabilities of
|
||||
recent versions of Linux (and other OSes). It is free software available
|
||||
under the <a href="http://www.opensource.org/licenses/lgpl-license.html">GNU
|
||||
Lesser General Public License</a>. Virtualization of the Linux Operating
|
||||
System means the ability to run multiple instances of Operating Systems
|
||||
concurently on a single hardware system where the basic resources are driven
|
||||
by a Linux instance. The library aim at providing long term stable C API
|
||||
initially for the <a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen
|
||||
paravirtualization</a> but should be able to integrate other virtualization
|
||||
mechanisms if needed.</p>
|
||||
<p> If you get lost searching for some specific API use, try
|
||||
<a href="http://libvirt.org/search.php">the online search
|
||||
engine</a> hosted on <a href="http://libvirt.org/">libvirt.org</a>
|
||||
it indexes the project page, the APIs as well as the mailing-list archives. </p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,326 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>libvirt: core interfaces for the libvirt library</title>
|
||||
<meta name="generator" content="Libvirt devhelp stylesheet"/>
|
||||
<link rel="start" href="index.html" title="libvirt Reference Manual"/>
|
||||
<link rel="up" href="general.html" title="API"/>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
<link rel="chapter" href="general.html" title="API"/>
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
|
||||
<tr valign="middle">
|
||||
<td>
|
||||
<a accesskey="u" href="general.html">
|
||||
<img src="up.png" width="24" height="24" border="0" alt="Up"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a accesskey="h" href="index.html">
|
||||
<img src="home.png" width="24" height="24" border="0" alt="Home"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a accesskey="n" href="libvirt-virterror.html">
|
||||
<img src="right.png" width="24" height="24" border="0" alt="Next"/>
|
||||
</a>
|
||||
</td>
|
||||
<th width="100%" align="center">libvirt Reference Manual</th>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>
|
||||
<span class="refentrytitle">libvirt</span>
|
||||
</h2>
|
||||
<p>libvirt - core interfaces for the libvirt library</p>
|
||||
<p>Provides the interfaces of the libvirt library to handle Xen domains from a process running in domain 0 </p>
|
||||
<p>Author(s): Daniel Veillard <veillard@redhat.com> </p>
|
||||
<div class="refsynopsisdiv">
|
||||
<h2>Synopsis</h2>
|
||||
<pre class="synopsis">#define <a href="#LIBVIR_VERSION_NUMBER">LIBVIR_VERSION_NUMBER</a>;
|
||||
typedef <a href="libvirt-libvirt.html#virNodeInfo">virNodeInfo</a> * <a href="#virNodeInfoPtr">virNodeInfoPtr</a>;
|
||||
typedef <a href="libvirt-libvirt.html#virDomainInfo">virDomainInfo</a> * <a href="#virDomainInfoPtr">virDomainInfoPtr</a>;
|
||||
typedef <a href="libvirt-libvirt.html#virDomainKernel">virDomainKernel</a> * <a href="#virDomainKernelPtr">virDomainKernelPtr</a>;
|
||||
typedef <a href="libvirt-libvirt.html#virConnect">virConnect</a> * <a href="#virConnectPtr">virConnectPtr</a>;
|
||||
typedef struct _virDomainKernel <a href="#virDomainKernel">virDomainKernel</a>;
|
||||
typedef struct _virNodeInfo <a href="#virNodeInfo">virNodeInfo</a>;
|
||||
typedef enum <a href="#virDomainState">virDomainState</a>;
|
||||
typedef enum <a href="#virDeviceMode">virDeviceMode</a>;
|
||||
typedef struct _virDomain <a href="#virDomain">virDomain</a>;
|
||||
typedef <a href="libvirt-libvirt.html#virDomain">virDomain</a> * <a href="#virDomainPtr">virDomainPtr</a>;
|
||||
typedef enum <a href="#virDomainRestart">virDomainRestart</a>;
|
||||
typedef struct _virConnect <a href="#virConnect">virConnect</a>;
|
||||
typedef enum <a href="#virDomainCreateFlags">virDomainCreateFlags</a>;
|
||||
typedef struct _virDomainInfo <a href="#virDomainInfo">virDomainInfo</a>;
|
||||
int <a href="#virDomainGetInfo">virDomainGetInfo</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> <a href="libvirt-libvirt.html#virDomainInfoPtr">virDomainInfoPtr</a> info);
|
||||
int <a href="#virDomainShutdown">virDomainShutdown</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
int <a href="#virGetVersion">virGetVersion</a> (unsigned long * libVer, <br/> const char * type, <br/> unsigned long * typeVer);
|
||||
<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> <a href="#virDomainLookupByName">virDomainLookupByName</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * name);
|
||||
int <a href="#virDomainRestore">virDomainRestore</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * from);
|
||||
const char * <a href="#virConnectGetType">virConnectGetType</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn);
|
||||
int <a href="#virDomainSave">virDomainSave</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * to);
|
||||
int <a href="#virConnectListDomains">virConnectListDomains</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int * ids, <br/> int maxids);
|
||||
<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> <a href="#virDomainLookupByUUID">virDomainLookupByUUID</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const unsigned char * uuid);
|
||||
<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> <a href="#virDomainLookupByID">virDomainLookupByID</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int id);
|
||||
char * <a href="#virDomainGetOSType">virDomainGetOSType</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
int <a href="#virNodeGetInfo">virNodeGetInfo</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> <a href="libvirt-libvirt.html#virNodeInfoPtr">virNodeInfoPtr</a> info);
|
||||
int <a href="#virDomainGetUUID">virDomainGetUUID</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned char * uuid);
|
||||
int <a href="#virConnectNumOfDomains">virConnectNumOfDomains</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn);
|
||||
int <a href="#virDomainSetMaxMemory">virDomainSetMaxMemory</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory);
|
||||
unsigned long <a href="#virDomainGetMaxMemory">virDomainGetMaxMemory</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
int <a href="#virConnectGetVersion">virConnectGetVersion</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> unsigned long * hvVer);
|
||||
int <a href="#virDomainFree">virDomainFree</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> <a href="#virConnectOpen">virConnectOpen</a> (const char * name);
|
||||
int <a href="#virDomainSuspend">virDomainSuspend</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
int <a href="#virConnectClose">virConnectClose</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn);
|
||||
int <a href="#virDomainReboot">virDomainReboot</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned int flags);
|
||||
int <a href="#virInitialize">virInitialize</a> (void);
|
||||
unsigned int <a href="#virDomainGetID">virDomainGetID</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
int <a href="#virDomainResume">virDomainResume</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> <a href="#virDomainCreateLinux">virDomainCreateLinux</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * xmlDesc, <br/> unsigned int flags);
|
||||
int <a href="#virDomainSetMemory">virDomainSetMemory</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory);
|
||||
int <a href="#virDomainDestroy">virDomainDestroy</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
char * <a href="#virDomainGetXMLDesc">virDomainGetXMLDesc</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int flags);
|
||||
const char * <a href="#virDomainGetName">virDomainGetName</a> (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain);
|
||||
<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> <a href="#virConnectOpenReadOnly">virConnectOpenReadOnly</a> (const char * name);
|
||||
</pre>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<h2>Description</h2>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<h2>Details</h2>
|
||||
<div class="refsect2" lang="en">
|
||||
<div class="refsect2" lang="en"><h3><a name="LIBVIR_VERSION_NUMBER">Macro </a>LIBVIR_VERSION_NUMBER</h3><pre class="programlisting">#define <a href="#LIBVIR_VERSION_NUMBER">LIBVIR_VERSION_NUMBER</a>;
|
||||
</pre><p>Macro providing the version of the library as version * 1,000,000 + minor * 1000 + micro</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnect">Structure </a>virConnect</h3><pre class="programlisting">struct _virConnect {
|
||||
The content of this structure is not made public by the API.
|
||||
} virConnect;
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectPtr">Typedef </a>virConnectPtr</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnect">virConnect</a> * virConnectPtr;
|
||||
</pre><p>a <a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> is pointer to a <a href="libvirt-libvirt.html#virConnect">virConnect</a> private structure, this is the type used to reference a connection to the Xen Hypervisor in the API.</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDeviceMode">Enum </a>virDeviceMode</h3><pre class="programlisting">enum <a href="#virDeviceMode">virDeviceMode</a> {
|
||||
<a name="VIR_DEVICE_DEFAULT">VIR_DEVICE_DEFAULT</a> = 0 /* Default mode */
|
||||
<a name="VIR_DEVICE_RO">VIR_DEVICE_RO</a> = 1 /* Access read-only */
|
||||
<a name="VIR_DEVICE_RW">VIR_DEVICE_RW</a> = 2 /* Access read-write */
|
||||
<a name="VIR_DEVICE_RW_FORCE">VIR_DEVICE_RW_FORCE</a> = 3 /* Forced read-write even if already used */
|
||||
};
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomain">Structure </a>virDomain</h3><pre class="programlisting">struct _virDomain {
|
||||
The content of this structure is not made public by the API.
|
||||
} virDomain;
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainCreateFlags">Enum </a>virDomainCreateFlags</h3><pre class="programlisting">enum <a href="#virDomainCreateFlags">virDomainCreateFlags</a> {
|
||||
<a name="VIR_DOMAIN_NONE">VIR_DOMAIN_NONE</a> = 0
|
||||
};
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainInfo">Structure </a>virDomainInfo</h3><pre class="programlisting">struct _virDomainInfo {
|
||||
unsigned char state : the running state, one of virDomainFlags
|
||||
unsigned long maxMem : the maximum memory in KBytes allowed
|
||||
unsigned long memory : the memory in KBytes used by the domain
|
||||
unsigned short nrVirtCpu : the number of virtual CPUs for the domain
|
||||
unsigned long long cpuTime : the CPU time used in nanoseconds
|
||||
} virDomainInfo;
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainInfoPtr">Typedef </a>virDomainInfoPtr</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainInfo">virDomainInfo</a> * virDomainInfoPtr;
|
||||
</pre><p>a <a href="libvirt-libvirt.html#virDomainInfoPtr">virDomainInfoPtr</a> is a pointer to a <a href="libvirt-libvirt.html#virDomainInfo">virDomainInfo</a> structure.</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainKernel">Structure </a>virDomainKernel</h3><pre class="programlisting">struct _virDomainKernel {
|
||||
const char * kernel : filename pointing to the kernel image
|
||||
const char * ramdisk : an optional init ramdisk
|
||||
const char * root : an optional root block device
|
||||
const char * extra : optional kernel command line parameters
|
||||
} virDomainKernel;
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainKernelPtr">Typedef </a>virDomainKernelPtr</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainKernel">virDomainKernel</a> * virDomainKernelPtr;
|
||||
</pre><p>a <a href="libvirt-libvirt.html#virDomainKernelPtr">virDomainKernelPtr</a> is a pointer to a <a href="libvirt-libvirt.html#virDomainKernel">virDomainKernel</a> structure.</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainPtr">Typedef </a>virDomainPtr</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomain">virDomain</a> * virDomainPtr;
|
||||
</pre><p>a <a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> is pointer to a <a href="libvirt-libvirt.html#virDomain">virDomain</a> private structure, this is the type used to reference a Xen domain in the API.</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainRestart">Enum </a>virDomainRestart</h3><pre class="programlisting">enum <a href="#virDomainRestart">virDomainRestart</a> {
|
||||
<a name="VIR_DOMAIN_DESTROY">VIR_DOMAIN_DESTROY</a> = 1 /* destroy the domain */
|
||||
<a name="VIR_DOMAIN_RESTART">VIR_DOMAIN_RESTART</a> = 2 /* restart the domain */
|
||||
<a name="VIR_DOMAIN_PRESERVE">VIR_DOMAIN_PRESERVE</a> = 3 /* keep as is, need manual destroy, for debug */
|
||||
<a name="VIR_DOMAIN_RENAME_RESTART">VIR_DOMAIN_RENAME_RESTART</a> = 4 /* restart under an new unique name */
|
||||
};
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainState">Enum </a>virDomainState</h3><pre class="programlisting">enum <a href="#virDomainState">virDomainState</a> {
|
||||
<a name="VIR_DOMAIN_NOSTATE">VIR_DOMAIN_NOSTATE</a> = 0 /* no state */
|
||||
<a name="VIR_DOMAIN_RUNNING">VIR_DOMAIN_RUNNING</a> = 1 /* the domain is running */
|
||||
<a name="VIR_DOMAIN_BLOCKED">VIR_DOMAIN_BLOCKED</a> = 2 /* the domain is blocked on resource */
|
||||
<a name="VIR_DOMAIN_PAUSED">VIR_DOMAIN_PAUSED</a> = 3 /* the domain is paused by user */
|
||||
<a name="VIR_DOMAIN_SHUTDOWN">VIR_DOMAIN_SHUTDOWN</a> = 4 /* the domain is being shut down */
|
||||
<a name="VIR_DOMAIN_SHUTOFF">VIR_DOMAIN_SHUTOFF</a> = 5 /* the domain is shut off */
|
||||
<a name="VIR_DOMAIN_CRASHED">VIR_DOMAIN_CRASHED</a> = 6 /* the domain is crashed */
|
||||
};
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virNodeInfo">Structure </a>virNodeInfo</h3><pre class="programlisting">struct _virNodeInfo {
|
||||
charmodel[32] model : string indicating the CPU model
|
||||
unsigned long memory : memory size in kilobytes
|
||||
unsigned int cpus : the number of active CPUs
|
||||
unsigned int mhz : expected CPU frequency
|
||||
unsigned int nodes : the number of NUMA cell, 1 for uniform mem access
|
||||
unsigned int sockets : number of CPU socket per node
|
||||
unsigned int cores : number of core per socket
|
||||
unsigned int threads : number of threads per core
|
||||
} virNodeInfo;
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virNodeInfoPtr">Typedef </a>virNodeInfoPtr</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virNodeInfo">virNodeInfo</a> * virNodeInfoPtr;
|
||||
</pre><p>a <a href="libvirt-libvirt.html#virNodeInfoPtr">virNodeInfoPtr</a> is a pointer to a <a href="libvirt-libvirt.html#virNodeInfo">virNodeInfo</a> structure.</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectClose"/>virConnectClose ()</h3><pre class="programlisting">int virConnectClose (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
|
||||
</pre><p>This function closes the connection to the Hypervisor. This should not be called if further interaction with the Hypervisor are needed especially if there is running domain which need further monitoring by the application.</p>
|
||||
<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>0 in case of success or -1 in case of error.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectGetType"/>virConnectGetType ()</h3><pre class="programlisting">const char * virConnectGetType (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
|
||||
</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.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectGetVersion"/>virConnectGetVersion ()</h3><pre class="programlisting">int virConnectGetVersion (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> unsigned long * hvVer)<br/>
|
||||
</pre><p>Get the version level of the Hypervisor running. This may work only with hypervisor call, i.e. with priviledged 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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectListDomains"/>virConnectListDomains ()</h3><pre class="programlisting">int virConnectListDomains (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int * ids, <br/> int maxids)<br/>
|
||||
</pre><p>Collect the list of active domains, and store their ID in @maxids</p>
|
||||
<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>ids</tt></i>:</span></td><td>array to collect the list of IDs of active domains</td></tr><tr><td><span class="term"><i><tt>maxids</tt></i>:</span></td><td>size of @ids</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of domain found or -1 in case of error</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectNumOfDomains"/>virConnectNumOfDomains ()</h3><pre class="programlisting">int virConnectNumOfDomains (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
|
||||
</pre><p>Provides the number of active domains.</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 domain found or -1 in case of error</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectOpen"/>virConnectOpen ()</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpen (const char * name)<br/>
|
||||
</pre><p>This function should be called first to get a connection to the Hypervisor and xen store</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>optional argument currently unused, pass NULL</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</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnectOpenReadOnly"/>virConnectOpenReadOnly ()</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> virConnectOpenReadOnly (const char * name)<br/>
|
||||
</pre><p>This function should be called first to get a restricted connection to the libbrary functionalities. The set of APIs usable are then restricted on the available methods to control the domains.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>optional argument currently unused, pass NULL</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</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainCreateLinux"/>virDomainCreateLinux ()</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/>
|
||||
</pre><p>Launch a new Linux guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires priviledged access to the hypervisor.</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>an XML description of the domain</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>an optional set of virDomainFlags</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainDestroy"/>virDomainDestroy ()</h3><pre class="programlisting">int virDomainDestroy (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</pre><p>Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. The data structure is freed and should not be used thereafter if the call does not return an error. This function may requires priviledged access</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainFree"/>virDomainFree ()</h3><pre class="programlisting">int virDomainFree (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</pre><p>Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter.</p>
|
||||
<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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainGetID"/>virDomainGetID ()</h3><pre class="programlisting">unsigned int virDomainGetID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainGetInfo"/>virDomainGetInfo ()</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/>
|
||||
</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 informations 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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainGetMaxMemory"/>virDomainGetMaxMemory ()</h3><pre class="programlisting">unsigned long virDomainGetMaxMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</pre><p>Retrieve the maximum amount of physical memory allocated to a domain. If domain is NULL, then this get the amount of memory reserved to Domain0 i.e. the domain where the application runs.</p>
|
||||
<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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainGetName"/>virDomainGetName ()</h3><pre class="programlisting">const char * virDomainGetName (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainGetOSType"/>virDomainGetOSType ()</h3><pre class="programlisting">char * virDomainGetOSType (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainGetUUID"/>virDomainGetUUID ()</h3><pre class="programlisting">int virDomainGetUUID (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned char * uuid)<br/>
|
||||
</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 16 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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainGetXMLDesc"/>virDomainGetXMLDesc ()</h3><pre class="programlisting">char * virDomainGetXMLDesc (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> int flags)<br/>
|
||||
</pre><p>Provide an XML description of the domain. The description may be reused later to relaunch the domain with virDomainCreateLinux().</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>and OR'ed set of extraction flags, not used yet</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainLookupByID"/>virDomainLookupByID ()</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByID (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> int id)<br/>
|
||||
</pre><p>Try to find a domain based on the hypervisor ID number</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>id</tt></i>:</span></td><td>the domain ID number</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainLookupByName"/>virDomainLookupByName ()</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByName (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * name)<br/>
|
||||
</pre><p>Try to lookup a domain on the given hypervisor based on its name.</p>
|
||||
<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>name 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</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainLookupByUUID"/>virDomainLookupByUUID ()</h3><pre class="programlisting"><a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> virDomainLookupByUUID (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const unsigned char * uuid)<br/>
|
||||
</pre><p>Try to lookup a domain on the given hypervisor based on its UUID.</p>
|
||||
<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 UUID string 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</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainReboot"/>virDomainReboot ()</h3><pre class="programlisting">int virDomainReboot (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned int flags)<br/>
|
||||
</pre><p>Reboot a domain, the domain object is still usable there after but the domain OS is being stopped for a restart. Note that the guest OS may ignore the request.</p>
|
||||
<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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainRestore"/>virDomainRestore ()</h3><pre class="programlisting">int virDomainRestore (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> const char * from)<br/>
|
||||
</pre><p>This method will restore a domain saved to disk by virDomainSave().</p>
|
||||
<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</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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainResume"/>virDomainResume ()</h3><pre class="programlisting">int virDomainResume (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</pre><p>Resume an suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain(). This function may requires priviledged 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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainSave"/>virDomainSave ()</h3><pre class="programlisting">int virDomainSave (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> const char * to)<br/>
|
||||
</pre><p>This method will suspend a domain and save its memory contents to a file on disk. After the call, if successful, the domain is not listed as running anymore (this may be a problem). Use virDomainRestore() to restore a domain after saving.</p>
|
||||
<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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainSetMaxMemory"/>virDomainSetMaxMemory ()</h3><pre class="programlisting">int virDomainSetMaxMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory)<br/>
|
||||
</pre><p>Dynamically change the maximum amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. This function requires priviledged 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>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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainSetMemory"/>virDomainSetMemory ()</h3><pre class="programlisting">int virDomainSetMemory (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain, <br/> unsigned long memory)<br/>
|
||||
</pre><p>Dynamically change the target amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. This function may requires priviledged 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>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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainShutdown"/>virDomainShutdown ()</h3><pre class="programlisting">int virDomainShutdown (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</pre><p>Shutdown a domain, the domain object is still usable there after but the domain OS is being stopped. Note that the guest OS may ignore the request. TODO: should we add an option for reboot, knowing it may not be doable in the general case ?</p>
|
||||
<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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDomainSuspend"/>virDomainSuspend ()</h3><pre class="programlisting">int virDomainSuspend (<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain)<br/>
|
||||
</pre><p>Suspends an active domain, the process is frozen without further access to CPU resources and I/O but the memory used by the domain at the hypervisor level will stay allocated. Use virDomainResume() to reactivate the domain. This function may requires priviledged 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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virGetVersion"/>virGetVersion ()</h3><pre class="programlisting">int virGetVersion (unsigned long * libVer, <br/> const char * type, <br/> unsigned long * typeVer)<br/>
|
||||
</pre><p>Provides two information back, @libVer is the version of the library while @typeVer will be the version of the hypervisor type @type against which the library was compiled. If @type is NULL, "Xen" is assumed, if @type is unknown or not availble, an error code will be returned and @typeVer will be 0.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>libVer</tt></i>:</span></td><td>return value for the library version (OUT)</td></tr><tr><td><span class="term"><i><tt>type</tt></i>:</span></td><td>hypervisor type</td></tr><tr><td><span class="term"><i><tt>typeVer</tt></i>:</span></td><td>return value for the version of the hypervisor (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 and @typeVer have the format major * 1,000,000 + minor * 1,000 + release.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virInitialize"/>virInitialize ()</h3><pre class="programlisting">int virInitialize (void)<br/>
|
||||
</pre><p>Initialize the library. It's better to call this routine at startup in multithreaded applications to avoid potential race when initializing the library.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><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></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virNodeGetInfo"/>virNodeGetInfo ()</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/>
|
||||
</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></div>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,184 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>virterror: error handling interfaces for the libvirt library</title>
|
||||
<meta name="generator" content="Libvirt devhelp stylesheet"/>
|
||||
<link rel="start" href="index.html" title="libvirt Reference Manual"/>
|
||||
<link rel="up" href="general.html" title="API"/>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
<link rel="chapter" href="general.html" title="API"/>
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
|
||||
<tr valign="middle">
|
||||
<td>
|
||||
<a accesskey="p" href="libvirt-libvirt.html">
|
||||
<img src="left.png" width="24" height="24" border="0" alt="Prev"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a accesskey="u" href="general.html">
|
||||
<img src="up.png" width="24" height="24" border="0" alt="Up"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a accesskey="h" href="index.html">
|
||||
<img src="home.png" width="24" height="24" border="0" alt="Home"/>
|
||||
</a>
|
||||
</td>
|
||||
<th width="100%" align="center">libvirt Reference Manual</th>
|
||||
</tr>
|
||||
</table>
|
||||
<h2>
|
||||
<span class="refentrytitle">virterror</span>
|
||||
</h2>
|
||||
<p>virterror - error handling interfaces for the libvirt library</p>
|
||||
<p>Provides the interfaces of the libvirt library to handle errors raised while using the library. </p>
|
||||
<p>Author(s): Daniel Veillard <veillard@redhat.com> </p>
|
||||
<div class="refsynopsisdiv">
|
||||
<h2>Synopsis</h2>
|
||||
<pre class="synopsis">typedef <a href="libvirt-virterror.html#virError">virError</a> * <a href="#virErrorPtr">virErrorPtr</a>;
|
||||
typedef enum <a href="#virErrorLevel">virErrorLevel</a>;
|
||||
typedef enum <a href="#virErrorDomain">virErrorDomain</a>;
|
||||
typedef enum <a href="#virErrorNumber">virErrorNumber</a>;
|
||||
typedef struct _virError <a href="#virError">virError</a>;
|
||||
int <a href="#virCopyLastError">virCopyLastError</a> (<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> to);
|
||||
void <a href="#virConnSetErrorFunc">virConnSetErrorFunc</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> void * userData, <br/> <a href="libvirt-virterror.html#virErrorFunc">virErrorFunc</a> handler);
|
||||
void <a href="#virResetLastError">virResetLastError</a> (void);
|
||||
typedef void <a href="#virErrorFunc">virErrorFunc</a> (void * userData, <br/> <a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> error);
|
||||
void <a href="#virResetError">virResetError</a> (<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> err);
|
||||
<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> <a href="#virConnGetLastError">virConnGetLastError</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn);
|
||||
void <a href="#virDefaultErrorFunc">virDefaultErrorFunc</a> (<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> err);
|
||||
<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> <a href="#virGetLastError">virGetLastError</a> (void);
|
||||
void <a href="#virSetErrorFunc">virSetErrorFunc</a> (void * userData, <br/> <a href="libvirt-virterror.html#virErrorFunc">virErrorFunc</a> handler);
|
||||
int <a href="#virConnCopyLastError">virConnCopyLastError</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> <a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> to);
|
||||
void <a href="#virConnResetLastError">virConnResetLastError</a> (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn);
|
||||
</pre>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<h2>Description</h2>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<h2>Details</h2>
|
||||
<div class="refsect2" lang="en">
|
||||
<div class="refsect2" lang="en"><h3><a name="virError">Structure </a>virError</h3><pre class="programlisting">struct _virError {
|
||||
int code : The error code, a <a href="libvirt-virterror.html#virErrorNumber">virErrorNumber</a>
|
||||
int domain : What part of the library raised this error
|
||||
char * message : human-readable informative error message
|
||||
<a href="libvirt-virterror.html#virErrorLevel">virErrorLevel</a> level : how consequent is the error
|
||||
<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn : the connection if available
|
||||
<a href="libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> dom : the domain if available
|
||||
char * str1 : extra string information
|
||||
char * str2 : extra string information
|
||||
char * str3 : extra string information
|
||||
int int1 : extra number information
|
||||
int int2 : extra number information
|
||||
} virError;
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virErrorDomain">Enum </a>virErrorDomain</h3><pre class="programlisting">enum <a href="#virErrorDomain">virErrorDomain</a> {
|
||||
<a name="VIR_FROM_NONE">VIR_FROM_NONE</a> = 0
|
||||
<a name="VIR_FROM_XEN">VIR_FROM_XEN</a> = 1 /* Error at Xen hypervisor layer */
|
||||
<a name="VIR_FROM_XEND">VIR_FROM_XEND</a> = 2 /* Error at connection with xend daemon */
|
||||
<a name="VIR_FROM_XENSTORE">VIR_FROM_XENSTORE</a> = 3 /* Error at connection with xen store */
|
||||
<a name="VIR_FROM_SEXPR">VIR_FROM_SEXPR</a> = 4 /* Error in the S-Epression code */
|
||||
<a name="VIR_FROM_XML">VIR_FROM_XML</a> = 5 /* Error in the XML code */
|
||||
<a name="VIR_FROM_DOM">VIR_FROM_DOM</a> = 6 /* Error when operating on a domain */
|
||||
};
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virErrorLevel">Enum </a>virErrorLevel</h3><pre class="programlisting">enum <a href="#virErrorLevel">virErrorLevel</a> {
|
||||
<a name="VIR_ERR_NONE">VIR_ERR_NONE</a> = 0
|
||||
<a name="VIR_ERR_WARNING">VIR_ERR_WARNING</a> = 1 /* A simple warning */
|
||||
<a name="VIR_ERR_ERROR">VIR_ERR_ERROR</a> = 2 /* An error */
|
||||
};
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virErrorNumber">Enum </a>virErrorNumber</h3><pre class="programlisting">enum <a href="#virErrorNumber">virErrorNumber</a> {
|
||||
<a name="VIR_ERR_OK">VIR_ERR_OK</a> = 0
|
||||
<a name="VIR_ERR_INTERNAL_ERROR">VIR_ERR_INTERNAL_ERROR</a> = 1 /* internal error */
|
||||
<a name="VIR_ERR_NO_MEMORY">VIR_ERR_NO_MEMORY</a> = 2 /* memory allocation failure */
|
||||
<a name="VIR_ERR_NO_SUPPORT">VIR_ERR_NO_SUPPORT</a> = 3 /* no support for this connection */
|
||||
<a name="VIR_ERR_UNKNOWN_HOST">VIR_ERR_UNKNOWN_HOST</a> = 4 /* could not resolve hostname */
|
||||
<a name="VIR_ERR_NO_CONNECT">VIR_ERR_NO_CONNECT</a> = 5 /* can't connect to hypervisor */
|
||||
<a name="VIR_ERR_INVALID_CONN">VIR_ERR_INVALID_CONN</a> = 6 /* invalid connection object */
|
||||
<a name="VIR_ERR_INVALID_DOMAIN">VIR_ERR_INVALID_DOMAIN</a> = 7 /* invalid domain object */
|
||||
<a name="VIR_ERR_INVALID_ARG">VIR_ERR_INVALID_ARG</a> = 8 /* invalid function argument */
|
||||
<a name="VIR_ERR_OPERATION_FAILED">VIR_ERR_OPERATION_FAILED</a> = 9 /* a command to hypervisor failed */
|
||||
<a name="VIR_ERR_GET_FAILED">VIR_ERR_GET_FAILED</a> = 10 /* a HTTP GET command to failed */
|
||||
<a name="VIR_ERR_POST_FAILED">VIR_ERR_POST_FAILED</a> = 11 /* a HTTP POST command to failed */
|
||||
<a name="VIR_ERR_HTTP_ERROR">VIR_ERR_HTTP_ERROR</a> = 12 /* unexpected HTTP error code */
|
||||
<a name="VIR_ERR_SEXPR_SERIAL">VIR_ERR_SEXPR_SERIAL</a> = 13 /* failure to serialize an S-Expr */
|
||||
<a name="VIR_ERR_NO_XEN">VIR_ERR_NO_XEN</a> = 14 /* could not open Xen hypervisor control */
|
||||
<a name="VIR_ERR_XEN_CALL">VIR_ERR_XEN_CALL</a> = 15 /* failure doing an hypervisor call */
|
||||
<a name="VIR_ERR_OS_TYPE">VIR_ERR_OS_TYPE</a> = 16 /* unknown OS type */
|
||||
<a name="VIR_ERR_NO_KERNEL">VIR_ERR_NO_KERNEL</a> = 17 /* missing kernel information */
|
||||
<a name="VIR_ERR_NO_ROOT">VIR_ERR_NO_ROOT</a> = 18 /* missing root device information */
|
||||
<a name="VIR_ERR_NO_SOURCE">VIR_ERR_NO_SOURCE</a> = 19 /* missing source device information */
|
||||
<a name="VIR_ERR_NO_TARGET">VIR_ERR_NO_TARGET</a> = 20 /* missing target device information */
|
||||
<a name="VIR_ERR_NO_NAME">VIR_ERR_NO_NAME</a> = 21 /* missing domain name information */
|
||||
<a name="VIR_ERR_NO_OS">VIR_ERR_NO_OS</a> = 22 /* missing domain OS information */
|
||||
<a name="VIR_ERR_NO_DEVICE">VIR_ERR_NO_DEVICE</a> = 23 /* missing domain devices information */
|
||||
<a name="VIR_ERR_NO_XENSTORE">VIR_ERR_NO_XENSTORE</a> = 24 /* could not open Xen Store control */
|
||||
<a name="VIR_ERR_DRIVER_FULL">VIR_ERR_DRIVER_FULL</a> = 25 /* too many drivers registered */
|
||||
<a name="VIR_ERR_CALL_FAILED">VIR_ERR_CALL_FAILED</a> = 26 /* not supported by the drivers */
|
||||
};
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virErrorPtr">Typedef </a>virErrorPtr</h3><pre class="programlisting"><a href="libvirt-virterror.html#virError">virError</a> * virErrorPtr;
|
||||
</pre><p/>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virErrorFunc"/>Function type virErrorFunc</h3><pre class="programlisting">void virErrorFunc (void * userData, <br/> <a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> error)<br/>
|
||||
</pre><p>Signature of a function to use when there is an error raised by the library.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>user provided data for the error callback</td></tr><tr><td><span class="term"><i><tt>error</tt></i>:</span></td><td>the error being raised.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnCopyLastError"/>virConnCopyLastError ()</h3><pre class="programlisting">int virConnCopyLastError (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> <a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> to)<br/>
|
||||
</pre><p>Copy the content of the last error caught on that connection One will need to free the result with virResetError()</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>to</tt></i>:</span></td><td>target to receive the copy</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if no error was found and the error code otherwise and -1 in case of parameter error.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnGetLastError"/>virConnGetLastError ()</h3><pre class="programlisting"><a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> virConnGetLastError (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
|
||||
</pre><p>Provide a pointer to the last error caught on that connection Simpler but may not be suitable for multithreaded accesses, in which case use virConnCopyLastError()</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>a pointer to the last error or NULL if none occured.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnResetLastError"/>virConnResetLastError ()</h3><pre class="programlisting">void virConnResetLastError (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn)<br/>
|
||||
</pre><p>Reset the last error caught on that 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></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virConnSetErrorFunc"/>virConnSetErrorFunc ()</h3><pre class="programlisting">void virConnSetErrorFunc (<a href="libvirt-libvirt.html#virConnectPtr">virConnectPtr</a> conn, <br/> void * userData, <br/> <a href="libvirt-virterror.html#virErrorFunc">virErrorFunc</a> handler)<br/>
|
||||
</pre><p>Set a connection error handling function, if @handler is NULL it will reset to default which is to pass error back to the global library handler.</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>userData</tt></i>:</span></td><td>pointer to the user data provided in the handler callback</td></tr><tr><td><span class="term"><i><tt>handler</tt></i>:</span></td><td>the function to get called in case of error or NULL</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virCopyLastError"/>virCopyLastError ()</h3><pre class="programlisting">int virCopyLastError (<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> to)<br/>
|
||||
</pre><p>Copy the content of the last error caught at the library level One will need to free the result with virResetError()</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>to</tt></i>:</span></td><td>target to receive the copy</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 if no error was found and the error code otherwise and -1 in case of parameter error.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virDefaultErrorFunc"/>virDefaultErrorFunc ()</h3><pre class="programlisting">void virDefaultErrorFunc (<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> err)<br/>
|
||||
</pre><p>Default routine reporting an error to stderr.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>err</tt></i>:</span></td><td>pointer to the error.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virGetLastError"/>virGetLastError ()</h3><pre class="programlisting"><a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> virGetLastError (void)<br/>
|
||||
</pre><p>Provide a pointer to the last error caught at the library level Simpler but may not be suitable for multithreaded accesses, in which case use virCopyLastError()</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the last error or NULL if none occured.</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virResetError"/>virResetError ()</h3><pre class="programlisting">void virResetError (<a href="libvirt-virterror.html#virErrorPtr">virErrorPtr</a> err)<br/>
|
||||
</pre><p>Reset the error being pointed to</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>err</tt></i>:</span></td><td>pointer to the <a href="libvirt-virterror.html#virError">virError</a> to clean up</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virResetLastError"/>virResetLastError ()</h3><pre class="programlisting">void virResetLastError (void)<br/>
|
||||
</pre><p>Reset the last error caught at the library level.</p>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="refsect2" lang="en"><h3><a name="virSetErrorFunc"/>virSetErrorFunc ()</h3><pre class="programlisting">void virSetErrorFunc (void * userData, <br/> <a href="libvirt-virterror.html#virErrorFunc">virErrorFunc</a> handler)<br/>
|
||||
</pre><p>Set a library global error handling function, if @handler is NULL, it will reset to default printing on stderr. The error raised there are those for which no handler at the connection level could caught.</p>
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>pointer to the user data provided in the handler callback</td></tr><tr><td><span class="term"><i><tt>handler</tt></i>:</span></td><td>the function to get called in case of error or NULL</td></tr></tbody></table></div></div>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
.memdump
|
||||
Makefile.in
|
||||
Makefile
|
||||
info1
|
||||
suspend
|
|
@ -274,6 +274,17 @@ int virDomainSetMemory (virDomainPtr domain,
|
|||
char * virDomainGetXMLDesc (virDomainPtr domain,
|
||||
int flags);
|
||||
|
||||
/*
|
||||
* defined but not running domains
|
||||
*/
|
||||
virDomainPtr virDomainDefineXML (virConnectPtr conn,
|
||||
const char *xml);
|
||||
int virDomainUndefine (virDomainPtr domain);
|
||||
int virConnectListDefinedDomains(virConnectPtr conn,
|
||||
const char **names,
|
||||
int maxnames);
|
||||
int virDomainCreate (virDomainPtr domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -274,6 +274,17 @@ int virDomainSetMemory (virDomainPtr domain,
|
|||
char * virDomainGetXMLDesc (virDomainPtr domain,
|
||||
int flags);
|
||||
|
||||
/*
|
||||
* defined but not running domains
|
||||
*/
|
||||
virDomainPtr virDomainDefineXML (virConnectPtr conn,
|
||||
const char *xml);
|
||||
int virDomainUndefine (virDomainPtr domain);
|
||||
int virConnectListDefinedDomains(virConnectPtr conn,
|
||||
const char **names,
|
||||
int maxnames);
|
||||
int virDomainCreate (virDomainPtr domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -274,6 +274,17 @@ int virDomainSetMemory (virDomainPtr domain,
|
|||
char * virDomainGetXMLDesc (virDomainPtr domain,
|
||||
int flags);
|
||||
|
||||
/*
|
||||
* defined but not running domains
|
||||
*/
|
||||
virDomainPtr virDomainDefineXML (virConnectPtr conn,
|
||||
const char *xml);
|
||||
int virDomainUndefine (virDomainPtr domain);
|
||||
int virConnectListDefinedDomains(virConnectPtr conn,
|
||||
const char **names,
|
||||
int maxnames);
|
||||
int virDomainCreate (virDomainPtr domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -274,6 +274,17 @@ int virDomainSetMemory (virDomainPtr domain,
|
|||
char * virDomainGetXMLDesc (virDomainPtr domain,
|
||||
int flags);
|
||||
|
||||
/*
|
||||
* defined but not running domains
|
||||
*/
|
||||
virDomainPtr virDomainDefineXML (virConnectPtr conn,
|
||||
const char *xml);
|
||||
int virDomainUndefine (virDomainPtr domain);
|
||||
int virConnectListDefinedDomains(virConnectPtr conn,
|
||||
const char **names,
|
||||
int maxnames);
|
||||
int virDomainCreate (virDomainPtr domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -101,7 +101,9 @@ typedef enum {
|
|||
VIR_ERR_NO_DEVICE, /* missing domain devices information */
|
||||
VIR_ERR_NO_XENSTORE,/* could not open Xen Store control */
|
||||
VIR_ERR_DRIVER_FULL, /* too many drivers registered */
|
||||
VIR_ERR_CALL_FAILED /* not supported by the drivers */
|
||||
VIR_ERR_CALL_FAILED, /* not supported by the drivers */
|
||||
VIR_ERR_XML_ERROR, /* an XML description is not well formed or broken */
|
||||
VIR_ERR_DOM_EXIST /* the domain already exist */
|
||||
} virErrorNumber;
|
||||
|
||||
/**
|
||||
|
|
|
@ -101,7 +101,9 @@ typedef enum {
|
|||
VIR_ERR_NO_DEVICE, /* missing domain devices information */
|
||||
VIR_ERR_NO_XENSTORE,/* could not open Xen Store control */
|
||||
VIR_ERR_DRIVER_FULL, /* too many drivers registered */
|
||||
VIR_ERR_CALL_FAILED /* not supported by the drivers */
|
||||
VIR_ERR_CALL_FAILED, /* not supported by the drivers */
|
||||
VIR_ERR_XML_ERROR, /* an XML description is not well formed or broken */
|
||||
VIR_ERR_DOM_EXIST /* the domain already exist */
|
||||
} virErrorNumber;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
virsh
|
|
@ -636,6 +636,7 @@ virGetDomain(virConnectPtr conn, const char *name, const char *uuid) {
|
|||
}
|
||||
ret->magic = VIR_DOMAIN_MAGIC;
|
||||
ret->conn = conn;
|
||||
ret->handle = -1;
|
||||
if (uuid != NULL)
|
||||
memcpy(&(ret->uuid[0]), uuid, 16);
|
||||
|
||||
|
@ -700,6 +701,8 @@ virFreeDomain(virConnectPtr conn, virDomainPtr domain) {
|
|||
domain->handle = -1;
|
||||
if (domain->path != NULL)
|
||||
free(domain->path);
|
||||
if (domain->xml)
|
||||
free(domain->xml);
|
||||
if (domain->name)
|
||||
free(domain->name);
|
||||
free(domain);
|
||||
|
|
|
@ -128,7 +128,8 @@ struct _virConnect {
|
|||
*/
|
||||
|
||||
enum {
|
||||
DOMAIN_IS_SHUTDOWN = (1 << 0) /* the domain is being shutdown */
|
||||
DOMAIN_IS_SHUTDOWN = (1 << 0), /* the domain is being shutdown */
|
||||
DOMAIN_IS_DEFINED = (1 << 1) /* the domain is defined not running */
|
||||
} virDomainFlags;
|
||||
|
||||
/**
|
||||
|
@ -145,6 +146,7 @@ struct _virDomain {
|
|||
int handle; /* internal handle for the domnain ID */
|
||||
int flags; /* extra flags */
|
||||
unsigned char uuid[16]; /* the domain unique identifier */
|
||||
char *xml; /* the XML description for defined domains */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
161
src/libvirt.c
161
src/libvirt.c
|
@ -18,6 +18,9 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#include <xs.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
@ -1411,3 +1414,161 @@ virNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
|
|||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Handling of defined but not running domains *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* virDomainDefineXML:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
* @xml: the XML description for the domain, preferably in UTF-8
|
||||
*
|
||||
* define a domain, but does not start it
|
||||
*
|
||||
* Returns NULL in case of error, a pointer to the domain otherwise
|
||||
*/
|
||||
virDomainPtr
|
||||
virDomainDefineXML(virConnectPtr conn, const char *xml) {
|
||||
virDomainPtr ret = NULL;
|
||||
const char *name = NULL;
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlXPathObjectPtr obj = NULL;
|
||||
xmlXPathContextPtr ctxt = NULL;
|
||||
|
||||
if (!VIR_IS_CONNECT(conn)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
return (NULL);
|
||||
}
|
||||
if (xml == NULL) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the XML description is at least well formed and extract the
|
||||
* name.
|
||||
* TODO: a full validation based on RNG for example should be done there
|
||||
*/
|
||||
doc = xmlReadMemory(xml, strlen(xml), "domain_define.xml", NULL, 0);
|
||||
if (doc == NULL) {
|
||||
virLibConnError(conn, VIR_ERR_XML_ERROR, __FUNCTION__);
|
||||
goto done;
|
||||
}
|
||||
ctxt = xmlXPathNewContext(doc);
|
||||
if (ctxt == NULL) {
|
||||
goto done;
|
||||
}
|
||||
obj = xmlXPathEval(BAD_CAST "string(/domain/name[1])", ctxt);
|
||||
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
|
||||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
|
||||
virLibConnError(conn, VIR_ERR_NO_NAME, xml);
|
||||
goto done;
|
||||
}
|
||||
name = (const char *) obj->stringval;
|
||||
|
||||
/*
|
||||
* Now look it up in the domain pool and check it's not an already run
|
||||
* domain.
|
||||
*/
|
||||
ret = virGetDomain(conn, name, NULL);
|
||||
if (ret == NULL) {
|
||||
goto done;
|
||||
}
|
||||
/*
|
||||
* TODO: the lifecycle of domains, especially predefined ones need to be
|
||||
* explicitely written down
|
||||
*/
|
||||
if (ret->handle != -1) {
|
||||
virLibConnError(conn, VIR_ERR_DOM_EXIST, name);
|
||||
virFreeDomain(conn, ret);
|
||||
ret = NULL;
|
||||
goto done;
|
||||
}
|
||||
if ((ret->uses > 1) && (!(ret->flags & DOMAIN_IS_DEFINED))) {
|
||||
virLibConnError(conn, VIR_ERR_DOM_EXIST, name);
|
||||
virFreeDomain(conn, ret);
|
||||
ret = NULL;
|
||||
goto done;
|
||||
}
|
||||
ret->flags |= DOMAIN_IS_DEFINED;
|
||||
if (ret->xml != NULL) {
|
||||
free(ret->xml);
|
||||
}
|
||||
ret->xml = strdup(xml);
|
||||
if (ret->xml == NULL) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
virFreeDomain(conn, ret);
|
||||
ret = NULL;
|
||||
goto done;
|
||||
}
|
||||
/* TODO shall we keep a list of defined domains there ? */
|
||||
|
||||
done:
|
||||
if (obj != NULL)
|
||||
xmlXPathFreeObject(obj);
|
||||
if (ctxt != NULL)
|
||||
xmlXPathFreeContext(ctxt);
|
||||
if (doc != NULL)
|
||||
xmlFreeDoc(doc);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainUndefine:
|
||||
* @domain: pointer to a defined domain
|
||||
*
|
||||
* undefine a domain but does not stop it if it is running
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of error
|
||||
*/
|
||||
int
|
||||
virDomainUndefine(virDomainPtr domain) {
|
||||
int ret;
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
/* TODO shall we keep a list of defined domains there ? */
|
||||
|
||||
ret = virFreeDomain(domain->conn, domain);
|
||||
if (ret < 0)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* virConnectListDefinedDomains:
|
||||
* @conn: pointer to the hypervisor connection
|
||||
* @names: pointer to an array to store the names
|
||||
* @maxnames: size of the array
|
||||
*
|
||||
* list the defined domains, stores the pointers to the names in @names
|
||||
*
|
||||
* Returns the number of names provided in the array or -1 in case of error
|
||||
*/
|
||||
int
|
||||
virConnectListDefinedDomains(virConnectPtr conn, const char **names,
|
||||
int maxnames) {
|
||||
TODO
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainCreate:
|
||||
* @domain: pointer to a defined domain
|
||||
*
|
||||
* launch a defined domain. If the call succeed the domain moves from the
|
||||
* defined to the running domains pools.
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of error
|
||||
*/
|
||||
int
|
||||
virDomainCreate(virDomainPtr domain) {
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -503,6 +503,18 @@ __virErrorMsg(virErrorNumber error, const char *info)
|
|||
else
|
||||
errmsg = "library call %s failed, possibly not supported";
|
||||
break;
|
||||
case VIR_ERR_XML_ERROR:
|
||||
if (info == NULL)
|
||||
errmsg = "XML description not well formed or invalid";
|
||||
else
|
||||
errmsg = "XML description for %s is not well formed or invalid";
|
||||
break;
|
||||
case VIR_ERR_DOM_EXIST:
|
||||
if (info == NULL)
|
||||
errmsg = "this domain exists already";
|
||||
else
|
||||
errmsg = "domain %s exists already";
|
||||
break;
|
||||
}
|
||||
return (errmsg);
|
||||
}
|
||||
|
|
20
src/xml.h
20
src/xml.h
|
@ -16,17 +16,17 @@ extern "C" {
|
|||
*
|
||||
* A buffer structure.
|
||||
*/
|
||||
typedef struct _virBuffer virBuffer;
|
||||
typedef virBuffer *virBufferPtr;
|
||||
struct _virBuffer {
|
||||
char *content; /* The buffer content UTF8 */
|
||||
unsigned int use; /* The buffer size used */
|
||||
unsigned int size; /* The buffer size */
|
||||
};
|
||||
typedef struct _virBuffer virBuffer;
|
||||
typedef virBuffer *virBufferPtr;
|
||||
struct _virBuffer {
|
||||
char *content; /* The buffer content UTF8 */
|
||||
unsigned int use; /* The buffer size used */
|
||||
unsigned int size; /* The buffer size */
|
||||
};
|
||||
|
||||
int virBufferAdd(virBufferPtr buf, const char *str, int len);
|
||||
int virBufferVSprintf(virBufferPtr buf, const char *format, ...);
|
||||
char *virDomainParseXMLDesc(const char *xmldesc, char **name);
|
||||
int virBufferAdd(virBufferPtr buf, const char *str, int len);
|
||||
int virBufferVSprintf(virBufferPtr buf, const char *format, ...);
|
||||
char *virDomainParseXMLDesc(const char *xmldesc, char **name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue