File: dbus.html.in

package info (click to toggle)
libvirt 5.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 240,844 kB
  • sloc: ansic: 584,521; xml: 176,725; sh: 9,912; python: 4,731; perl: 4,343; makefile: 3,321; ml: 465
file content (102 lines) | stat: -rw-r--r-- 2,922 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <h1>D-Bus API bindings</h1>

    <ul id="toc"></ul>

    <h2><a name="description">Description</a></h2>

    <p>
      libvirt-dbus wraps libvirt API to provide a high-level object-oriented
      API better suited for dbus-based applications.
    </p>

    <h2><a name="git">GIT source repository</a></h2>
    <p>
      The D-Bus bindings source code is maintained in a
      <a href="https://git-scm.com/">git</a> repository available on
      <a href="https://libvirt.org/git/">libvirt.org</a>:
    </p>

<pre>
git clone https://libvirt.org/git/libvirt-dbus.git
</pre>

    <p>
      They can also be browsed online:
    </p>

<pre>
<a href="https://libvirt.org/git/?p=libvirt-dbus.git">https://libvirt.org/git/?p=libvirt-dbus.git</a>
</pre>

    <h2><a name="usage">Usage</a></h2>

    <p>
      libvirt-dbus exports libvirt API using D-Bus objects with methods and
      properties described by interfaces.  Currently only local connection
      to libvirt is exported and the list of supported drivers depends
      on the type of the bus connection (session or system).
    </p>

    <p>
      The name of the libvirt-dbus service is <code>org.libvirt</code>.
      libvirt-dbus distributes an interface XML descriptions which can be
      usually found at <code>/usr/share/dbus-1/interfaces/</code>.
    </p>

    <p>
      By default unprivileged user has access only to the session D-Bus
      connection. In order to allow specific user "foo" to access the system
      D-Bus connection you need to create a file
      <code>/etc/dbus-1/system.d/org.libvirt.conf</code> that contains:
    </p>

<pre>
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"&gt;

&lt;busconfig&gt;

  &lt;policy user="foo"&gt;
    &lt;allow send_destination="org.libvirt"/&gt;
  &lt;/policy&gt;

&lt;/busconfig&gt;
</pre>

    <p>
      To get a list of supported drivers for the specific bus connection
      you can run these commands (not all drivers may be available on
      the host):
    </p>

<pre>
gdbus introspect --xml --session --dest org.libvirt --object-path /org/libvirt
gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt
</pre>

    <p>
      Every object is introspectable so you can get a list of available
      interfaces with methods, signals and properties running this command:
    </p>

<pre>
gdbus introspect --xml --system --dest org.libvirt --object-path /org/libvirt/QEMU
</pre>

    <p>
      To get a list of domains for specific connection driver you can run
      this command:
    </p>

<pre>
gdbus call --system --dest org.libvirt --object-path /org/libvirt/QEMU \
    --method org.libvirt.Connect.ListDomains 0
</pre>

  </body>
</html>