mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-27 08:05:24 +00:00
3e59e29859
Saori FUKUTA).
8 lines
5.3 KiB
HTML
8 lines
5.3 KiB
HTML
<?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>Libvirt set of C code examples</title></head><body><div id="container"><div id="intro"><div id="adjustments"></div><div id="pageHeader"></div><div id="content2"><h1 class="style1">Libvirt set of C code examples</h1><p> The examples are stored per section depending on the main focus
|
|
of the example:</p><ul><li><p><a href="#Informations">Informations</a> :</p><ul><li><a href="#info1.c">info1.c</a>: Extract information about Xen domain 0</li></ul></li><li><p><a href="#Scheduling">Scheduling</a> :</p><ul><li><a href="#suspend.c">suspend.c</a>: Suspend a domain and then resume its execution</li></ul></li></ul><p> Getting the compilation options and libraries dependancies needed
|
|
to generate binaries from the examples is best done on Linux/Unix by using
|
|
the pkg-config data which should have been installed as part of <i>make
|
|
install</i> step or when installing the libvirt development package:</p><pre>gcc -o example example.c `pkg-config libvirt --libs`</pre><h2><a name="Informations" id="Informations"></a>Informations Examples</h2><h3><a name="info1.c" href="info1.c" id="info1.c">info1.c</a>: Extract information about Xen domain 0</h3><p>Demonstrate the basic use of the library to connect to the hypervisor and extract domain information.</p><p>Uses:</p><ul><li> line 29: Function <a href="../html/libvirt-libvirt.html#virConnectOpenReadOnly">virConnectOpenReadOnly</a> from libvirt.h</li><li> line 36: Function <a href="../html/libvirt-libvirt.html#virDomainLookupByID">virDomainLookupByID</a> from libvirt.h</li><li> line 43: Function <a href="../html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a> from libvirt.h</li><li> line 53: Function <a href="../html/libvirt-libvirt.html#virDomainFree">virDomainFree</a> from libvirt.h</li><li> line 55: Function <a href="../html/libvirt-libvirt.html#virConnectClose">virConnectClose</a> from libvirt.h</li></ul><p>Usage:</p><p>info1</p><p>Author: Daniel Veillard</p><h2><a name="Scheduling" id="Scheduling"></a>Scheduling Examples</h2><h3><a name="suspend.c" href="suspend.c" id="suspend.c">suspend.c</a>: Suspend a domain and then resume its execution</h3><p>Demonstrate the basic use of the library to suspend and resume a domain. If no id is given on the command line this script will suspend and resume the first domain found which is not Domain 0.</p><p>Uses:</p><ul><li> line 31: Function <a href="../html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a> from libvirt.h</li><li> line 50: Function <a href="../html/libvirt-libvirt.html#virDomainLookupByID">virDomainLookupByID</a> from libvirt.h</li><li> line 62: Function <a href="../html/libvirt-libvirt.html#virDomainSuspend">virDomainSuspend</a> from libvirt.h</li><li> line 73: Function <a href="../html/libvirt-libvirt.html#virDomainResume">virDomainResume</a> from libvirt.h</li><li> line 93: Function <a href="../html/libvirt-libvirt.html#virDomainFree">virDomainFree</a> from libvirt.h</li><li> line 100: Function <a href="../html/libvirt-libvirt.html#virConnectOpenReadOnly">virConnectOpenReadOnly</a> from libvirt.h</li><li> line 111: Function <a href="../html/libvirt-libvirt.html#virConnectListDomains">virConnectListDomains</a> from libvirt.h</li><li> line 132: Function <a href="../html/libvirt-libvirt.html#virConnectClose">virConnectClose</a> from libvirt.h</li></ul><p>Usage:</p><p>suspend [id]</p><p>Author: Daniel Veillard</p></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://virt-manager.et.redhat.com/">virt-manager</a></li><li><a href="http://search.cpan.org/~danberr/Sys-Virt-0.1.0/">Perl bindings</a></li><li><a href="http://libvirt.org/ocaml/">OCaml bindings</a></li><li><a href="http://libvirt.org/ruby/">Ruby 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>
|