Debian Codegraph @

man/org.freedesktop.import1.xml

raw
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.5/docbookx.dtd" >
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
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>
28 is a system service which may be used to import, export and download disk images. These images can be
29 used by tools such as
30 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> to run
31 local containers. The service is used as the backend for <command>importctl pull-raw</command>,
32 <command>importctl pull-tar</command> and related commands. This page describes the D-Bus interface.
33 </para>
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>.
39 Many operations to manipulate local container and VM images are hence available via the <command>systemd-machined</command> D-Bus API, c.f.
40 <citerefentry><refentrytitle>org.freedesktop.machine1</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 executable="systemd-importd" node="/org/freedesktop/import1" interface="org.freedesktop.import1.Manager">
50 node /org/freedesktop/import1 {
51 interface org.freedesktop.import1.Manager {
52 methods:
53 ImportTar(in h fd,
54 in s local_name,
55 in b force,
56 in b read_only,
57 out u transfer_id,
58 out o transfer_path);
59 ImportTarEx(in h fd,
60 in s local_name,
61 in s class,
62 in t flags,
63 out u transfer_id,
64 out o transfer_path);
65 ImportRaw(in h fd,
66 in s local_name,
67 in b force,
68 in b read_only,
69 out u transfer_id,
70 out o transfer_path);
71 ImportRawEx(in h fd,
72 in s local_name,
73 in s class,
74 in t flags,
75 out u transfer_id,
76 out o transfer_path);
77 ImportFileSystem(in h fd,
78 in s local_name,
79 in b force,
80 in b read_only,
81 out u transfer_id,
82 out o transfer_path);
83 ImportFileSystemEx(in h fd,
84 in s local_name,
85 in s class,
86 in t flags,
87 out u transfer_id,
88 out o transfer_path);
89 ExportTar(in s local_name,
90 in h fd,
91 in s format,
92 out u transfer_id,
93 out o transfer_path);
94 ExportTarEx(in s local_name,
95 in s class,
96 in h fd,
97 in s format,
98 in t flags,
99 out u transfer_id,
100 out o transfer_path);
101 ExportRaw(in s local_name,
102 in h fd,
103 in s format,
104 out u transfer_id,
105 out o transfer_path);
106 ExportRawEx(in s local_name,
107 in s class,
108 in h fd,
109 in s format,
110 in t flags,
111 out u transfer_id,
112 out o transfer_path);
113 PullTar(in s url,
114 in s local_name,
115 in s verify_mode,
116 in b force,
117 out u transfer_id,
118 out o transfer_path);
119 PullTarEx(in s url,
120 in s local_name,
121 in s class,
122 in s verify_mode,
123 in t flags,
124 out u transfer_id,
125 out o transfer_path);
126 PullRaw(in s url,
127 in s local_name,
128 in s verify_mode,
129 in b force,
130 out u transfer_id,
131 out o transfer_path);
132 PullRawEx(in s url,
133 in s local_name,
134 in s class,
135 in s verify_mode,
136 in t flags,
137 out u transfer_id,
138 out o transfer_path);
139 PullOci(in s ref,
140 in s local_name,
141 in s class,
142 in t flags,
143 out u transfer_id,
144 out o transfer_path);
145 ListTransfers(out a(usssdo) transfers);
146 ListTransfersEx(in s class,
147 in t flags,
148 out a(ussssdo) transfers);
149 CancelTransfer(in u transfer_id);
150 ListImages(in s class,
151 in t flags,
152 out a(ssssbtttttt) images);
153 signals:
154 TransferNew(u transfer_id,
155 o transfer_path);
156 TransferRemoved(u transfer_id,
157 o transfer_path,
158 s result);
159 };
160 interface org.freedesktop.DBus.Peer { ... };
161 interface org.freedesktop.DBus.Introspectable { ... };
162 interface org.freedesktop.DBus.Properties { ... };
163 };
164 </programlisting>
165
166 <!--Autogenerated cross-references for systemd.directives, do not edit-->
167
168 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Manager"/>
169
170 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Manager"/>
171
172 <variablelist class="dbus-method" generated="True" extra-ref="ImportTar()"/>
173
174 <variablelist class="dbus-method" generated="True" extra-ref="ImportTarEx()"/>
175
176 <variablelist class="dbus-method" generated="True" extra-ref="ImportRaw()"/>
177
178 <variablelist class="dbus-method" generated="True" extra-ref="ImportRawEx()"/>
179
180 <variablelist class="dbus-method" generated="True" extra-ref="ImportFileSystem()"/>
181
182 <variablelist class="dbus-method" generated="True" extra-ref="ImportFileSystemEx()"/>
183
184 <variablelist class="dbus-method" generated="True" extra-ref="ExportTar()"/>
185
186 <variablelist class="dbus-method" generated="True" extra-ref="ExportTarEx()"/>
187
188 <variablelist class="dbus-method" generated="True" extra-ref="ExportRaw()"/>
189
190 <variablelist class="dbus-method" generated="True" extra-ref="ExportRawEx()"/>
191
192 <variablelist class="dbus-method" generated="True" extra-ref="PullTar()"/>
193
194 <variablelist class="dbus-method" generated="True" extra-ref="PullTarEx()"/>
195
196 <variablelist class="dbus-method" generated="True" extra-ref="PullRaw()"/>
197
198 <variablelist class="dbus-method" generated="True" extra-ref="PullRawEx()"/>
199
200 <variablelist class="dbus-method" generated="True" extra-ref="PullOci()"/>
201
202 <variablelist class="dbus-method" generated="True" extra-ref="ListTransfers()"/>
203
204 <variablelist class="dbus-method" generated="True" extra-ref="ListTransfersEx()"/>
205
206 <variablelist class="dbus-method" generated="True" extra-ref="CancelTransfer()"/>
207
208 <variablelist class="dbus-method" generated="True" extra-ref="ListImages()"/>
209
210 <variablelist class="dbus-signal" generated="True" extra-ref="TransferNew()"/>
211
212 <variablelist class="dbus-signal" generated="True" extra-ref="TransferRemoved()"/>
213
214 <!--End of Autogenerated section-->
215
216 <refsect2>
217 <title>Methods</title>
218
219 <para><function>ImportTar()</function>/<function>ImportTarEx()</function> and
220 <function>ImportRaw()</function>/<function>ImportRawEx()</function> import a disk image and place it
221 into the image directory. The first argument should be a file descriptor (opened for reading) referring
222 to the tar or raw file to import. It should reference a file on disk, a pipe or a socket. When
223 <function>ImportTar()</function>/<function>ImportTarEx()</function> is used the file descriptor should
224 refer to a tar file, optionally compressed with <citerefentry project="die-net"><refentrytitle>gzip</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
225 <citerefentry project="die-net"><refentrytitle>zstd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
226 <citerefentry project="die-net"><refentrytitle>bzip2</refentrytitle><manvolnum>1</manvolnum></citerefentry>, or
227 <citerefentry project="die-net"><refentrytitle>xz</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
228 <command>systemd-importd</command> will detect the used compression scheme (if any) automatically. When
229 <function>ImportRaw()</function>/<function>ImportRawEx()</function> is used the file descriptor should
230 refer to a raw or qcow2 disk image containing an MBR or GPT disk label, also optionally compressed with
231 gzip, zstd, bzip2 or xz. In either case, if the file is specified as a file descriptor on disk, progress
232 information is generated for the import operation (as in that case we know the total size on disk). If
233 a socket or pipe is specified, progress information is not available. The file descriptor argument is
234 followed by a local name for the image. This should be a name suitable as a hostname and will be used
235 to name the imported image below <filename>/var/lib/machines/</filename>. A tar import is placed as a
236 directory tree or a <citerefentry project="url"><refentrytitle url="https://btrfs.readthedocs.io/en/latest/btrfs.html">btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
237 subvolume below the image directory under the specified name with no suffix appended. A raw import is
238 placed as a file in the image directory with the <filename>.raw</filename> suffix appended. In case of
239 <function>ImportTar()</function>/<function>ImportRaw()</function>, if the <option>force</option>
240 argument is true, any pre-existing image with the same name is removed before starting the
241 operation. Otherwise, the operation fails if an image with the same name already exists. The
242 <option>read_only</option> argument controls whether to create a writable or read-only image. In case
243 of <function>ImportTarEx()</function>/<function>ImportRawEx()</function> these boolean flags are
244 provided via a 64bit flags parameter instead, with bit 0 mapping to the <option>force</option>
245 parameter, and bit 1 mapping to <option>read_only</option>. The <option>class</option> parameter
246 specifies the image class, and takes one of <literal>machine</literal>, <literal>portable</literal>,
247 <literal>sysext</literal>, <literal>confext</literal>. All four methods return immediately after
248 starting the import, with the import transfer ongoing. They return a pair of transfer identifier and
249 object path, which may be used to retrieve progress information about the transfer or to cancel it. The
250 transfer identifier is a simple numeric identifier, the object path references an
251 <interfacename>org.freedesktop.import1.Transfer</interfacename> object, see below. Listen for a
252 <function>TransferRemoved()</function> signal for the transfer ID in order to detect when a transfer is
253 complete. The returned transfer object is useful to determine the current progress or log output of the
254 ongoing import operation.</para>
255
256 <para><function>ExportTar()</function>/<function>ExportTarEx()</function> and
257 <function>ExportRaw()</function>/<function>ExportRaw()</function> implement the reverse operation, and
258 may be used to export a system image in order to place it in a tar or raw image. They take the machine
259 name to export as their first parameter, followed by a file descriptor (opened for writing) where the
260 tar or raw file will be written. It may either reference a file on disk or a pipe/socket. The third
261 argument specifies in which compression format to write the image. It takes one of
262 <literal>uncompressed</literal>, <literal>xz</literal>, <literal>bzip2</literal>,
263 <literal>gzip</literal> or <literal>zstd</literal>, depending on which compression scheme is required.
264 The image written to the specified file descriptor will be a tar file in case of
265 <function>ExportTar()</function>/<function>ExportTarEx()</function> or a raw disk image in case of
266 <function>ExportRaw()</function>/<function>ExportRawEx()</function>. Note that currently raw disk
267 images may not be exported as tar files, and vice versa. This restriction might be lifted
268 eventually. The method returns a transfer identifier and object path for cancelling or tracking the
269 export operation, similarly to <function>ImportTar()</function>/<function>ImportTarEx()</function> or
270 <function>ImportRaw()</function>/<function>ImportRawEx()</function> as described
271 above. <function>ExportTarEx()</function>/<function>ExportRawEx()</function> expect the image class as
272 additional parameter, as well as a 64bit flags parameter that currently must be specified as
273 zero.</para>
274
275 <para><function>PullTar()</function>/<function>PullTarEx()</function> and
276 <function>PullRaw()</function>/<function>PullRawEx()</function> may be used to download, verify and
277 import a system image from a URL. They take a URL argument which should point to a tar or raw file on
278 the <literal>http://</literal> or <literal>https://</literal> protocols, possibly compressed with xz,
279 bzip2, gzip or zstd. The second argument is a local name for the image. It should be suitable as a
280 hostname, similarly to the matching argument of the
281 <function>ImportTar()</function>/<function>ImportTarEx()</function> and
282 <function>ImportRaw()</function>/<function>ImportRawEx()</function> methods above. The third argument
283 indicates the verification mode for the image. It may be one of <literal>no</literal>,
284 <literal>checksum</literal>, <literal>signature</literal>. <literal>no</literal> turns off any kind of
285 verification of the image; <literal>checksum</literal> looks for a <filename>SHA256SUM</filename> file
286 next to the downloaded image and verifies any SHA256 hash value in that file against the image;
287 <literal>signature</literal> does the same but also tries to authenticate the
288 <filename>SHA256SUM</filename> file via <citerefentry project="man-pages"><refentrytitle>gpg</refentrytitle><manvolnum>8</manvolnum></citerefentry> first. In
289 case of <function>PullTar()</function>/<function>PullRaw()</function> the last argument indicates
290 whether to replace a possibly pre-existing image with the same local name (if <literal>true</literal>),
291 or whether to fail (if <literal>false</literal>). In case of
292 <function>PullTarEx()</function>/<function>PullRawEx()</function> the last argument is a 64bit flags
293 parameter, where bit 0 controls the <literal>force</literal> flag, bit 1 is a
294 <literal>read_only</literal> flag that controls whether the created image shall be marked read-only,
295 and bit 2 is a <literal>keep_download</literal> flag that indicates whether a pristine, read-only copy
296 of the downloaded image shell be kept, in addition for the local copy of the image. The
297 <function>…_Ex()</function> variants also expect an image class string (as above). Like the import and
298 export calls above, these calls return a pair of transfer identifier and object path for the ongoing
299 download.</para>
300
301 <para><function>PullOci()</function> is similar to <function>PullTarEx()</function> or
302 <function>PullRawEx()</function> and may be used to download and import an OCI container image from an
303 OCI registry. It takes an OCI container reference as argument. The second argument is a local name for
304 the image (which will be generated as
305 <citerefentry><refentrytitle>systemd.mstack</refentrytitle><manvolnum>7</manvolnum></citerefentry>
306 directory referencing the OCI layers). It should be suitable as a hostname, similarly to the matching
307 argument of the <function>PullTar()</function>/<function>PullTarEx()</function> and
308 <function>PullRaw()</function>/<function>PullRawEx()</function> methods above. The last argument is a
309 64bit flags parameter, where bit 0 controls the <literal>force</literal> flag, bit 1 is a
310 <literal>read_only</literal> flag that controls whether the created image shall be marked
311 read-only. Like the pull calls above, this call return a pair of transfer identifier and object path
312 for the ongoing download.</para>
313
314 <para><function>ImportFileSystem()</function>/<function>ImportFileSystemEx()</function> are similar to
315 <function>ImportTar()</function>/<function>ImportTarEx()</function> but import a directory tree. The
316 first argument must refer to a directory file descriptor for the source hierarchy to import.</para>
317
318 <para><function>ListTransfers()</function>/<function>ListTransfersEx()</function> return a list of
319 ongoing import, export or download operations as created with the six calls described above. They
320 return an array of structures which consist of the numeric transfer identifier, a string indicating the
321 operation (one of <literal>import-tar</literal>, <literal>import-raw</literal>,
322 <literal>export-tar</literal>, <literal>export-raw</literal>, <literal>pull-tar</literal> or
323 <literal>pull-raw</literal>), a string describing the remote file (in case of download operations this
324 is the source URL, in case of import/export operations this is a short string describing the file
325 descriptor passed in), a string with the local machine image name, the image class (only in case of
326 <function>ListTransfersEx()</function>; one of <literal>machine</literal>, <literal>portable</literal>,
327 <literal>sysext</literal>, <literal>confext</literal>), a progress value between 0.0 (for 0%) and 1.0
328 (for 100%), as well as the transfer object path.</para>
329
330 <para><function>CancelTransfer()</function> may be used to cancel an ongoing import, export or download
331 operation. Simply specify the transfer identifier to cancel the ongoing operation.</para>
332
333 <para><function>ListImages()</function> returns a list of currently installed images. It takes a image
334 class string and a flags parameter. The image class is either the empty string or specifies one of the
335 four image classes, by which it will then filter. The flags parameter must be zero at this time. It
336 returns an array of items, each describing one image. The item fields are in order: the image class,
337 the local image name, the image type, the image path, the read-only flag, the creation and modification
338 times (in microseconds since the UNIX epoch), as well as the current disk usage in bytes (both overall,
339 and exclusive), as well as any size limit in bytes set on the image (both overall and
340 exclusive).</para>
341 </refsect2>
342
343 <refsect2>
344 <title>Signals</title>
345
346 <para>The <function>TransferNew()</function> signal is generated each time a new transfer is started with
347 the import, export or download calls described above. It carries the transfer ID and object path that
348 have just been created.</para>
349
350 <para>The <function>TransferRemoved()</function> signal is sent each time a transfer finishes,
351 is canceled or fails. It also carries the transfer ID and object path, followed by a string indicating
352 the result of the operation, which is one of <literal>done</literal> (on success),
353 <literal>canceled</literal> or <literal>failed</literal>.</para>
354 </refsect2>
355 </refsect1>
356
357 <refsect1>
358 <title>The Transfer Object</title>
359
360 <programlisting executable="systemd-importd" node="/org/freedesktop/import1/transfer/_1" interface="org.freedesktop.import1.Transfer">
361 node /org/freedesktop/import1/transfer/_1 {
362 interface org.freedesktop.import1.Transfer {
363 methods:
364 Cancel();
365 signals:
366 LogMessage(u priority,
367 s line);
368 ProgressUpdate(d progress);
369 properties:
370 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
371 readonly u Id = ...;
372 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
373 readonly s Local = '...';
374 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
375 readonly s Remote = '...';
376 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
377 readonly s Type = '...';
378 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
379 readonly s Verify = '...';
380 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
381 readonly d Progress = ...;
382 };
383 interface org.freedesktop.DBus.Peer { ... };
384 interface org.freedesktop.DBus.Introspectable { ... };
385 interface org.freedesktop.DBus.Properties { ... };
386 };
387 </programlisting>
388
389 <!--Autogenerated cross-references for systemd.directives, do not edit-->
390
391 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Transfer"/>
392
393 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.import1.Transfer"/>
394
395 <variablelist class="dbus-method" generated="True" extra-ref="Cancel()"/>
396
397 <variablelist class="dbus-signal" generated="True" extra-ref="LogMessage()"/>
398
399 <variablelist class="dbus-signal" generated="True" extra-ref="ProgressUpdate()"/>
400
401 <variablelist class="dbus-property" generated="True" extra-ref="Id"/>
402
403 <variablelist class="dbus-property" generated="True" extra-ref="Local"/>
404
405 <variablelist class="dbus-property" generated="True" extra-ref="Remote"/>
406
407 <variablelist class="dbus-property" generated="True" extra-ref="Type"/>
408
409 <variablelist class="dbus-property" generated="True" extra-ref="Verify"/>
410
411 <variablelist class="dbus-property" generated="True" extra-ref="Progress"/>
412
413 <!--End of Autogenerated section-->
414
415 <refsect2>
416 <title>Methods</title>
417
418 <para>The <function>Cancel()</function> method may be used to cancel the transfer. It takes no
419 parameters. This method is pretty much equivalent to the <function>CancelTransfer()</function> method
420 on the <structname>Manager</structname> interface (see above), but is exposed on the
421 <structname>Transfer</structname> object itself instead of taking a transfer ID.</para>
422 </refsect2>
423
424 <refsect2>
425 <title>Properties</title>
426
427 <para>The <varname>Id</varname> property exposes the numeric transfer ID of the transfer object.</para>
428
429 <para>The <varname>Local</varname>, <varname>Remote</varname> and <varname>Type</varname> properties
430 expose the local container name of this transfer, the remote source (in case of download: the URL, in
431 case of import/export: a string describing the file descriptor passed in), and the type of operation
432 (see the Manager's <function>ListTransfer()</function> method above for an explanation of the possible
433 values).</para>
434
435 <para>The <varname>Verify</varname> property exposes the selected verification setting and is only
436 defined for download operations (see above).</para>
437
438 <para>The <varname>Progress</varname> property exposes the current progress of the transfer as a value
439 between 0.0 and 1.0. To show a progress bar on screen we recommend to query this value in regular
440 intervals, for example every 500 ms or so.</para>
441 </refsect2>
442
443 <refsect2>
444 <title>Signals</title>
445
446 <para>The <function>LogMessage()</function> signal is emitted for log messages generated by a transfer. It
447 carries a pair of syslog log level integer and log string.</para>
448
449 <para>The <function>ProgressUpdate()</function> signal is emitted in regular intervals when new
450 download progress information is available for a transfer. It carries a double precision floating
451 pointer number between 0.0 and 1.0 indicating the transfer progress.</para>
452 </refsect2>
453 </refsect1>
454
455 <refsect1>
456 <title>Examples</title>
457
458 <example>
459 <title>Introspect <interfacename>org.freedesktop.import1.Manager</interfacename> on the bus</title>
460
461 <programlisting>$ gdbus introspect --system \
462 --dest org.freedesktop.import1 \
463 --object-path /org/freedesktop/import1
464 </programlisting>
465 </example>
466
467 <example>
468 <title>Introspect <interfacename>org.freedesktop.import1.Transfer</interfacename> on the bus</title>
469
470 <programlisting>$ gdbus introspect --system \
471 --dest org.freedesktop.import1 \
472 --object-path /org/freedesktop/import1/transfer/_1
473 </programlisting>
474 </example>
475 </refsect1>
476
477 <xi:include href="org.freedesktop.locale1.xml" xpointer="versioning"/>
478
479 <refsect1>
480 <title>History</title>
481 <refsect2>
482 <title>The Manager Object</title>
483 <para><function>ImportTarEx()</function>, <function>ImportRawEx()</function>,
484 <function>ImportFileSystemEx()</function>, <function>ExportTarEx()</function>,
485 <function>ExportRawEx()</function>, <function>PullTarEx()</function>, <function>PullRawEx()</function>,
486 <function>ListTransfersEx()</function>, <function>ListImages()</function> were added in version
487 256.</para>
488 <para><function>PullOci()</function> was added in version 260.</para>
489 </refsect2>
490 <refsect2>
491 <title>Transfer Objects</title>
492 <para><function>ProgressUpdate()</function> was added in version 256.</para>
493 </refsect2>
494 </refsect1>
495
496 <refsect1>
497 <title>See Also</title>
498 <para><simplelist type="inline">
499 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
500 <member><citerefentry><refentrytitle>systemd-importd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
501 <member><citerefentry><refentrytitle>importctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
502 </simplelist></para>
503 </refsect1>
504
505 </refentry>