]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/org.freedesktop.import1.xml
man: run dbus api docs through the updater
[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>
28 is a system service which may be used to import, export and download additional system images, for
29 running them as local containers using tools such as
30 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> The
31 service is used as backend for <command>machinectl pull-raw</command> and <command>machinectl
32 pull-tar</command> and related commands.
33 This page describes the D-Bus interface.</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> bus API, c.f.
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
ZJS
113
114 <refsect2>
115 <title>Methods</title>
116
117 <para><function>ImportTar()</function> and <function>ImportRaw()</function> import a system image and
118 place it into <filename>/var/lib/machines/</filename>. The first argument should be a file descriptor
119 (opened for reading) referring to the tar or raw file to import. It should reference either a file on
120 disk or a pipe or socket. When <function>ImportTar()</function> is used the file descriptor should
121 refer to a tar file, optionally compressed with
122 <citerefentry project="die-net"><refentrytitle>gzip</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
123 <citerefentry project="die-net"><refentrytitle>bzip2</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
124 or
125 <citerefentry project="die-net"><refentrytitle>xz</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
126 <command>systemd-importd</command> will detect the used compression scheme (if any) automatically. When
127 <function>ImportRaw()</function> is used the file descriptor should refer to a raw or qcow2 disk image
128 containing an MBR or GPT disk label, also optionally compressed with gzip, bzip2 or xz. In either case,
129 if the file is specified as file descriptor on disk, progress information is generated for the import
130 operation (since the size on disk is known then), if a socket or pipe is specified this is not
131 available. The file descriptor argument is followed by a local name for the image. This should be a
132 name suitable as a hostname and will be used to name the imported image below
133 <filename>/var/lib/machines</filename>. A tar import is placed as directory tree or
134 <citerefentry project="man-pages"><refentrytitle>btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
135 subvolume below <filename>/var/lib/machines/</filename>, under the name specified with no suffix
136 appended. A raw import is placed as file in <filename>/var/lib/machines/</filename> with the
137 <filename>.raw</filename> suffix appended. The <option>force</option> argument controls whether any
138 pre-existing image with the same name shall be removed for the operation. If true, it is removed, if
139 false the operation fails on a name conflict. Finally, the <option>read_only</option> argument controls
140 whether to create a writable or read-only image. The two calls return immediately after invocation,
141 with the import transfer ongoing. They return a pair of transfer identifier and object path, which may
142 be used to retrieve progress information about the transfer, or cancel it. The transfer identifier is a
143 simple numeric identifier, the object path references an
144 <interfacename>org.freedesktop.import1.Transfer</interfacename> object, see below. Listen for a
145 <function>TransferRemoved</function> signal for the transfer ID it order to detect when a transfer is
146 complete. The returned transfer object is useful to determine the current progress or log output of the
147 ongoing import operation.</para>
148
149 <para><function>ExportTar()</function> and <function>ExportRaw()</function> implement the reverse
150 operation, and may be used to export a system image in order to place it in a tar or raw image. They
151 take the machine name to export as first parameter, followed by a file descriptor (opened for writing)
152 where the tar or raw file will be written. It may either reference a file on disk or a pipe/socket. The
153 third argument specifies in which compression format to write the image. It takes one of
154 <literal>uncompressed</literal>, <literal>xz</literal>, <literal>bzip2</literal> or
155 <literal>gzip</literal>, depending on which compression scheme is required. The image written to the
156 specified file descriptor will be a tar file in case of <function>ExportTar()</function> or a raw disk
157 image in case of <function>ExportRaw()</function>. Note that currently raw disk images may not be
158 exported as tar files, and vice versa, however this restriction might be lifted eventually. The call
159 returns a transfer identifier and object path for canceling or tracking the export operation, similar
160 to <function>ImportTar()</function> or <function>ImportRaw()</function> described above.</para>
161
162 <para><function>PullTar()</function> and <function>PullRaw()</function> may be used to download, verify
163 and import a system image from a web site. They take an URL argument, that should reference a tar or
164 raw file on the <literal>http://</literal> or <literal>https://</literal> protocols, possibly
165 compressed with xz, bzip2 or gzip. The second argument is a local name for the image. It should be
166 suitable as hostname, similar to the matching argument of the <function>ImportTar()</function> and
167 <function>ImportRaw()</function> calls above. The third argument indicates the verification mode for
168 the image. It may be one of <literal>no</literal>, <literal>checksum</literal>,
169 <literal>signature</literal>. <literal>no</literal> turns of any kind of verification of the image;
170 <literal>checksum</literal> looks for a <filename>SHA256SUM</filename> file next to the downloaded
171 image, and verifies any SHA256 hash value in that file again the image; <literal>signature</literal>
172 does the same but also tries to authenticate the <filename>SHA256SUM</filename> file via
173 <citerefentry project="man-pages"><refentrytitle>gpg</refentrytitle><manvolnum>8</manvolnum></citerefentry>
174 first. The last argument indicates whether to replace a possibly pre-existing image with the same local
175 name (if <literal>true</literal>), or whether to fail (if <literal>false</literal>). Like the import
176 and export calls above these calls return a pair of transfer identifier and object path for the ongoing
177 download.</para>
178
179 <para><function>ListTransfers()</function> returns a list of ongoing import, export or download
180 operations, as created with the six calls described above. It returns an array of structures, which
181 consist of the numeric transfer identifier, a string indicating the operation (one of
182 <literal>import-tar</literal>, <literal>import-raw</literal>, <literal>export-tar</literal>,
183 <literal>export-raw</literal>, <literal>pull-tar</literal> or <literal>pull-raw</literal>), a string
184 describing the remote file (in case of download operations this is the source URL, in case of
185 import/export operations this is a short string describing the file descriptor passed in), a string
186 with the local machine image name, a progress value between 0.0 (for 0%) and 1.0 (for 100%), as well as
187 the transfer object path.</para>
188
189 <para><function>CancelTransfer()</function> may be used to cancel an ongoing import, export or download
190 operation. Simply specify the transfer identifier to cancel.</para>
191 </refsect2>
192
193 <refsect2>
194 <title>Signals</title>
195
196 <para>The <function>TransferNew</function> signal is generated each time a new transfer is added with
197 the import, export or download calls described above. It carries the transfer ID and object path just
198 created.</para>
199
200 <para>The <function>TransferRemoved</function> signal is sent each time a transfer was completed,
201 canceled or failed. It also carries the transfer ID and object path, followed by a string indicating
202 the result of the operation, which is one of <literal>done</literal> (on success),
203 <literal>canceled</literal> or <literal>failed</literal>.</para>
204 </refsect2>
205 </refsect1>
206
207 <refsect1>
208 <title>The Transfer Object</title>
209
210 <programlisting>
211$ gdbus introspect --system \
212 --dest org.freedesktop.import1 \
213 --object-path /org/freedesktop/import1/transfer/_1
214
215node /org/freedesktop/import1/transfer/_1 {
216 interface org.freedesktop.import1.Transfer {
217 methods:
218 Cancel();
219 signals:
220 LogMessage(u priority,
221 s line);
222 properties:
4fb222c4
ZJS
223 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
224 readonly u Id = ...;
225 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
226 readonly s Local = '...';
227 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
228 readonly s Remote = '...';
229 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
230 readonly s Type = '...';
231 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
232 readonly s Verify = '...';
233 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
234 readonly d Progress = ...;
2fe60ff1 235 };
4fb222c4
ZJS
236 interface org.freedesktop.DBus.Peer { ... };
237 interface org.freedesktop.DBus.Introspectable { ... };
238 interface org.freedesktop.DBus.Properties { ... };
2fe60ff1 239};
4fb222c4
ZJS
240 </programlisting>
241
242 <!--signal LogMessage is not documented!-->
2fe60ff1
ZJS
243
244 <refsect2>
245 <title>Methods</title>
246
247 <para>The <function>Cancel()</function> method may be used to cancel the transfer. It takes no
248 parameters. This call is pretty much equivalent to the <function>CancelTransfer()</function> call on
249 the <structname>Manager</structname> interface (see above), but is exposed on the
250 <structname>Transfer</structname> object itself instead of taking a transfer ID.</para>
251 </refsect2>
252
253 <refsect2>
254 <title>Properties</title>
255
256 <para>The <varname>Id</varname> property exposes the numeric transfer ID of the transfer object.</para>
257
258 <para>The <varname>Local</varname>, <varname>Remote</varname>, <varname>Type</varname> properties
259 expose the local container name of this transfer, the remote source (in case of download: the URL, in
260 case of import/export a string describing the file descriptor passed in), and the type of operation
261 (see the Manager's <function>ListTransfer()</function> call above for an explanation of the possible
262 values).</para>
263
264 <para>The <varname>Verify</varname> property exposes the selected verification setting, and is only
265 defined for download operations (see above).</para>
266
267 <para>The <varname>Progress</varname> property exposes the current progress of the transfer, as a value
268 between 0.0 and 1.0. To show a progress bar on screen it recommend to query this value in regular
269 intervals, for example every 500 ms or so.</para>
270 </refsect2>
271 </refsect1>
272
273 <refsect1>
274 <title>Versioning</title>
275
276 <para>These D-Bus interfaces follow <ulink url="http://0pointer.de/blog/projects/versioning-dbus.html">
277 the usual interface versioning guidelines</ulink>.</para>
278 </refsect1>
279</refentry>