]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/org.freedesktop.import1.xml
sd-bus: Add sd_bus_list_names docs
[thirdparty/systemd.git] / man / org.freedesktop.import1.xml
CommitLineData
2fe60ff1
ZJS
1<?xml version='1.0'?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" >
4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6<refentry id="org.freedesktop.import1" conditional='ENABLE_IMPORTD'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8 <refentryinfo>
9 <title>org.freedesktop.import1</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>org.freedesktop.import1</refentrytitle>
15 <manvolnum>5</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>org.freedesktop.import1</refname>
20 <refpurpose>The D-Bus interface of systemd-importd</refpurpose>
21 </refnamediv>
22
23 <refsect1>
24 <title>Introduction</title>
25
26 <para>
27 <citerefentry><refentrytitle>systemd-importd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
b441a1d4
DDM
28 is a system service which may be used to import, export and download additional system images. These
29 images can be used by tools such as
30 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
31 to run local containers. The service is used as the backend for <command>machinectl pull-raw</command>,
32 <command>machinectl pull-tar</command> and related commands. This page describes the D-Bus interface.
33 </para>
2fe60ff1
ZJS
34
35 <para>Note that
36 <citerefentry><refentrytitle>systemd-importd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
37 is mostly a small companion service for
38 <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
b441a1d4 39 Many operations to manipulate local container and VM images are hence available via the <command>systemd-machined</command> D-Bus API, c.f.
2fe60ff1
ZJS
40 <citerefentry><refentrytitle>org.freedesktop.machine1.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
41 </para>
42 </refsect1>
43
44 <refsect1>
45 <title>The Manager Object</title>
46
47 <para>The service exposes the following interfaces on the Manager object on the bus:</para>
48
49 <programlisting>
50$ gdbus introspect --system \
51 --dest org.freedesktop.import1 \
52 --object-path /org/freedesktop/import1
53
54node /org/freedesktop/import1 {
55 interface org.freedesktop.import1.Manager {
56 methods:
57 ImportTar(in h fd,
58 in s local_name,
59 in b force,
60 in b read_only,
61 out u transfer_id,
62 out o transfer_path);
63 ImportRaw(in h fd,
64 in s local_name,
65 in b force,
66 in b read_only,
67 out u transfer_id,
68 out o transfer_path);
4fb222c4
ZJS
69 ImportFileSystem(in h fd,
70 in s local_name,
71 in b force,
72 in b read_only,
73 out u transfer_id,
74 out o transfer_path);
2fe60ff1
ZJS
75 ExportTar(in s local_name,
76 in h fd,
77 in s format,
78 out u transfer_id,
79 out o transfer_path);
80 ExportRaw(in s local_name,
81 in h fd,
82 in s format,
83 out u transfer_id,
84 out o transfer_path);
85 PullTar(in s url,
86 in s local_name,
87 in s verify_mode,
88 in b force,
89 out u transfer_id,
90 out o transfer_path);
91 PullRaw(in s url,
92 in s local_name,
93 in s verify_mode,
94 in b force,
95 out u transfer_id,
96 out o transfer_path);
4fb222c4 97 ListTransfers(out a(usssdo) transfers);
2fe60ff1
ZJS
98 CancelTransfer(in u transfer_id);
99 signals:
100 TransferNew(u transfer_id,
101 o transfer_path);
102 TransferRemoved(u transfer_id,
103 o transfer_path,
104 s result);
105 };
4fb222c4
ZJS
106 interface org.freedesktop.DBus.Peer { ... };
107 interface org.freedesktop.DBus.Introspectable { ... };
108 interface org.freedesktop.DBus.Properties { ... };
2fe60ff1 109};
4fb222c4
ZJS
110 </programlisting>
111
112 <!--method ImportFileSystem is not documented!-->
2fe60ff1 113
00bb75d7
ZJS
114 <!--Autogenerated cross-references for systemd.directives, do not edit-->
115
116 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Manager"/>
117
118 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Manager"/>
119
120 <variablelist class="dbus-method" generated="True" extra-ref="ImportTar()"/>
121
122 <variablelist class="dbus-method" generated="True" extra-ref="ImportRaw()"/>
123
124 <variablelist class="dbus-method" generated="True" extra-ref="ImportFileSystem()"/>
125
126 <variablelist class="dbus-method" generated="True" extra-ref="ExportTar()"/>
127
128 <variablelist class="dbus-method" generated="True" extra-ref="ExportRaw()"/>
129
130 <variablelist class="dbus-method" generated="True" extra-ref="PullTar()"/>
131
132 <variablelist class="dbus-method" generated="True" extra-ref="PullRaw()"/>
133
134 <variablelist class="dbus-method" generated="True" extra-ref="ListTransfers()"/>
135
136 <variablelist class="dbus-method" generated="True" extra-ref="CancelTransfer()"/>
137
138 <variablelist class="dbus-signal" generated="True" extra-ref="TransferNew"/>
139
140 <variablelist class="dbus-signal" generated="True" extra-ref="TransferRemoved"/>
141
142 <!--End of Autogenerated section-->
143
2fe60ff1
ZJS
144 <refsect2>
145 <title>Methods</title>
146
147 <para><function>ImportTar()</function> and <function>ImportRaw()</function> import a system image and
148 place it into <filename>/var/lib/machines/</filename>. The first argument should be a file descriptor
b441a1d4
DDM
149 (opened for reading) referring to the tar or raw file to import. It should reference a file on disk,
150 a pipe or a socket. When <function>ImportTar()</function> is used the file descriptor should
2fe60ff1
ZJS
151 refer to a tar file, optionally compressed with
152 <citerefentry project="die-net"><refentrytitle>gzip</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
153 <citerefentry project="die-net"><refentrytitle>bzip2</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
154 or
155 <citerefentry project="die-net"><refentrytitle>xz</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
156 <command>systemd-importd</command> will detect the used compression scheme (if any) automatically. When
157 <function>ImportRaw()</function> is used the file descriptor should refer to a raw or qcow2 disk image
158 containing an MBR or GPT disk label, also optionally compressed with gzip, bzip2 or xz. In either case,
b441a1d4
DDM
159 if the file is specified as a file descriptor on disk, progress information is generated for the import
160 operation (as in that case we know the total size on disk). If a socket or pipe is specified, progress information is not
2fe60ff1
ZJS
161 available. The file descriptor argument is followed by a local name for the image. This should be a
162 name suitable as a hostname and will be used to name the imported image below
b441a1d4 163 <filename>/var/lib/machines</filename>. A tar import is placed as a directory tree or a
2fe60ff1 164 <citerefentry project="man-pages"><refentrytitle>btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
b441a1d4
DDM
165 subvolume below <filename>/var/lib/machines/</filename> under the specified name with no suffix
166 appended. A raw import is placed as a file in <filename>/var/lib/machines/</filename> with the
167 <filename>.raw</filename> suffix appended. If the <option>force</option> argument is true, any
168 pre-existing image with the same name is removed before starting the operation. Otherwise, the
169 operation fails if an image with the same name already exists. Finally, the
170 <option>read_only</option> argument controls
171 whether to create a writable or read-only image. Both methods return immediately after starting the import,
2fe60ff1 172 with the import transfer ongoing. They return a pair of transfer identifier and object path, which may
b441a1d4 173 be used to retrieve progress information about the transfer or to cancel it. The transfer identifier is a
2fe60ff1
ZJS
174 simple numeric identifier, the object path references an
175 <interfacename>org.freedesktop.import1.Transfer</interfacename> object, see below. Listen for a
b441a1d4 176 <function>TransferRemoved</function> signal for the transfer ID in order to detect when a transfer is
2fe60ff1
ZJS
177 complete. The returned transfer object is useful to determine the current progress or log output of the
178 ongoing import operation.</para>
179
180 <para><function>ExportTar()</function> and <function>ExportRaw()</function> implement the reverse
181 operation, and may be used to export a system image in order to place it in a tar or raw image. They
b441a1d4 182 take the machine name to export as their first parameter, followed by a file descriptor (opened for writing)
2fe60ff1
ZJS
183 where the tar or raw file will be written. It may either reference a file on disk or a pipe/socket. The
184 third argument specifies in which compression format to write the image. It takes one of
185 <literal>uncompressed</literal>, <literal>xz</literal>, <literal>bzip2</literal> or
186 <literal>gzip</literal>, depending on which compression scheme is required. The image written to the
187 specified file descriptor will be a tar file in case of <function>ExportTar()</function> or a raw disk
188 image in case of <function>ExportRaw()</function>. Note that currently raw disk images may not be
89fc6fd3 189 exported as tar files, and vice versa. This restriction might be lifted eventually. The method
b441a1d4
DDM
190 returns a transfer identifier and object path for cancelling or tracking the export operation, similar
191 to <function>ImportTar()</function> or <function>ImportRaw()</function> as described above.</para>
2fe60ff1
ZJS
192
193 <para><function>PullTar()</function> and <function>PullRaw()</function> may be used to download, verify
b441a1d4 194 and import a system image from a URL. They take an URL argument which should point to a tar or
2fe60ff1
ZJS
195 raw file on the <literal>http://</literal> or <literal>https://</literal> protocols, possibly
196 compressed with xz, bzip2 or gzip. The second argument is a local name for the image. It should be
b441a1d4
DDM
197 suitable as a hostname, similar to the matching argument of the <function>ImportTar()</function> and
198 <function>ImportRaw()</function> methods above. The third argument indicates the verification mode for
2fe60ff1 199 the image. It may be one of <literal>no</literal>, <literal>checksum</literal>,
b441a1d4 200 <literal>signature</literal>. <literal>no</literal> turns off any kind of verification of the image;
2fe60ff1 201 <literal>checksum</literal> looks for a <filename>SHA256SUM</filename> file next to the downloaded
b441a1d4 202 image and verifies any SHA256 hash value in that file against the image; <literal>signature</literal>
2fe60ff1
ZJS
203 does the same but also tries to authenticate the <filename>SHA256SUM</filename> file via
204 <citerefentry project="man-pages"><refentrytitle>gpg</refentrytitle><manvolnum>8</manvolnum></citerefentry>
205 first. The last argument indicates whether to replace a possibly pre-existing image with the same local
206 name (if <literal>true</literal>), or whether to fail (if <literal>false</literal>). Like the import
b441a1d4 207 and export calls above, these calls return a pair of transfer identifier and object path for the ongoing
2fe60ff1
ZJS
208 download.</para>
209
210 <para><function>ListTransfers()</function> returns a list of ongoing import, export or download
b441a1d4 211 operations as created with the six calls described above. It returns an array of structures which
2fe60ff1
ZJS
212 consist of the numeric transfer identifier, a string indicating the operation (one of
213 <literal>import-tar</literal>, <literal>import-raw</literal>, <literal>export-tar</literal>,
214 <literal>export-raw</literal>, <literal>pull-tar</literal> or <literal>pull-raw</literal>), a string
215 describing the remote file (in case of download operations this is the source URL, in case of
216 import/export operations this is a short string describing the file descriptor passed in), a string
217 with the local machine image name, a progress value between 0.0 (for 0%) and 1.0 (for 100%), as well as
218 the transfer object path.</para>
219
220 <para><function>CancelTransfer()</function> may be used to cancel an ongoing import, export or download
b441a1d4 221 operation. Simply specify the transfer identifier to cancel the ongoing operation.</para>
2fe60ff1
ZJS
222 </refsect2>
223
224 <refsect2>
225 <title>Signals</title>
226
b441a1d4
DDM
227 <para>The <function>TransferNew</function> signal is generated each time a new transfer is started with
228 the import, export or download calls described above. It carries the transfer ID and object path that
229 have just been created.</para>
2fe60ff1 230
b441a1d4
DDM
231 <para>The <function>TransferRemoved</function> signal is sent each time a transfer finishes,
232 is canceled or fails. It also carries the transfer ID and object path, followed by a string indicating
2fe60ff1
ZJS
233 the result of the operation, which is one of <literal>done</literal> (on success),
234 <literal>canceled</literal> or <literal>failed</literal>.</para>
235 </refsect2>
236 </refsect1>
237
238 <refsect1>
239 <title>The Transfer Object</title>
240
241 <programlisting>
242$ gdbus introspect --system \
243 --dest org.freedesktop.import1 \
244 --object-path /org/freedesktop/import1/transfer/_1
245
246node /org/freedesktop/import1/transfer/_1 {
247 interface org.freedesktop.import1.Transfer {
248 methods:
249 Cancel();
250 signals:
251 LogMessage(u priority,
252 s line);
253 properties:
4fb222c4
ZJS
254 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
255 readonly u Id = ...;
256 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
257 readonly s Local = '...';
258 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
259 readonly s Remote = '...';
260 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
261 readonly s Type = '...';
262 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
263 readonly s Verify = '...';
264 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
265 readonly d Progress = ...;
2fe60ff1 266 };
4fb222c4
ZJS
267 interface org.freedesktop.DBus.Peer { ... };
268 interface org.freedesktop.DBus.Introspectable { ... };
269 interface org.freedesktop.DBus.Properties { ... };
2fe60ff1 270};
4fb222c4
ZJS
271 </programlisting>
272
273 <!--signal LogMessage is not documented!-->
2fe60ff1 274
00bb75d7
ZJS
275 <!--Autogenerated cross-references for systemd.directives, do not edit-->
276
277 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Transfer"/>
278
279 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Transfer"/>
280
281 <variablelist class="dbus-method" generated="True" extra-ref="Cancel()"/>
282
283 <variablelist class="dbus-signal" generated="True" extra-ref="LogMessage"/>
284
285 <variablelist class="dbus-property" generated="True" extra-ref="Id"/>
286
287 <variablelist class="dbus-property" generated="True" extra-ref="Local"/>
288
289 <variablelist class="dbus-property" generated="True" extra-ref="Remote"/>
290
291 <variablelist class="dbus-property" generated="True" extra-ref="Type"/>
292
293 <variablelist class="dbus-property" generated="True" extra-ref="Verify"/>
294
295 <variablelist class="dbus-property" generated="True" extra-ref="Progress"/>
296
297 <!--End of Autogenerated section-->
298
2fe60ff1
ZJS
299 <refsect2>
300 <title>Methods</title>
301
302 <para>The <function>Cancel()</function> method may be used to cancel the transfer. It takes no
89fc6fd3
DDM
303 parameters. This method is pretty much equivalent to the <function>CancelTransfer()</function> method
304 on the <structname>Manager</structname> interface (see above), but is exposed on the
2fe60ff1
ZJS
305 <structname>Transfer</structname> object itself instead of taking a transfer ID.</para>
306 </refsect2>
307
308 <refsect2>
309 <title>Properties</title>
310
311 <para>The <varname>Id</varname> property exposes the numeric transfer ID of the transfer object.</para>
312
b441a1d4 313 <para>The <varname>Local</varname>, <varname>Remote</varname> and <varname>Type</varname> properties
2fe60ff1 314 expose the local container name of this transfer, the remote source (in case of download: the URL, in
b441a1d4
DDM
315 case of import/export: a string describing the file descriptor passed in), and the type of operation
316 (see the Manager's <function>ListTransfer()</function> method above for an explanation of the possible
2fe60ff1
ZJS
317 values).</para>
318
b441a1d4 319 <para>The <varname>Verify</varname> property exposes the selected verification setting and is only
2fe60ff1
ZJS
320 defined for download operations (see above).</para>
321
b441a1d4
DDM
322 <para>The <varname>Progress</varname> property exposes the current progress of the transfer as a value
323 between 0.0 and 1.0. To show a progress bar on screen we recommend to query this value in regular
2fe60ff1
ZJS
324 intervals, for example every 500 ms or so.</para>
325 </refsect2>
326 </refsect1>
327
328 <refsect1>
329 <title>Versioning</title>
330
331 <para>These D-Bus interfaces follow <ulink url="http://0pointer.de/blog/projects/versioning-dbus.html">
332 the usual interface versioning guidelines</ulink>.</para>
333 </refsect1>
334</refentry>