]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/portable/portablectl.c
portable: add 'reattach' verb and DBUS interface 18440/head
authorLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 1 Feb 2021 14:29:40 +0000 (14:29 +0000)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Wed, 10 Feb 2021 19:07:36 +0000 (19:07 +0000)
commite26fe5f91158a0d9133e61347650dfb73aadd6bb
tree1c64821ec0b4ade12c447e1f7ea6f98664d7b592
parent9e4079d4111894db0cbd6c51e9f8252c9fd22330
portable: add 'reattach' verb and DBUS interface

Add 'reattach' verb to portablectl, and corresponding DBUS interface
to systemd-portabled.
Takes the same parameters as 'attach', but it will do a 'detach' (and
it will refuse to proceed if it cannot be done) first, matching on
the unversioned prefix of the new image. Eg:

portablectl reattach /tmp/foo_2.raw

will cause foo_1.raw to be detached, and foo_2.raw to be attached.

The key difference with a manual 'detach old' plus 'attach new' is that
the running units are not disturbed until after the attach completed,
and if --now is passed they are then restarted.
A 'detach' is not allowed normally if the units are running.

By using a restart-after-deploy method, 'reattach' allows for minimal
interruption of service and also for features that only work on restart
(eg: file descriptor store) to work as intended.

The DBUS interface returns two lists: first the removals from the detach
that were not immediately re-added in the attach, so that the caller
can stop the relevant units, and then the list of additions that are
either new or updates, so that the caller can restart/enable the
relevant units. portablectl already implements this with the existing
--now/--enable switches.
14 files changed:
man/portablectl.xml
shell-completion/bash/portablectl
src/portable/org.freedesktop.portable1.conf
src/portable/portable.c
src/portable/portable.h
src/portable/portablectl.c
src/portable/portabled-bus.c
src/portable/portabled-bus.h
src/portable/portabled-image-bus.c
src/portable/portabled-image-bus.h
test/TEST-58-PORTABLE/Makefile [new symlink]
test/TEST-58-PORTABLE/test.sh [new file with mode: 0755]
test/units/testsuite-58.service [new file with mode: 0644]
test/units/testsuite-58.sh [new file with mode: 0755]