Commit Graph

37074 Commits

Author SHA1 Message Date
Lennart Poettering 35a1ff4cfe add new run-generator
This is really useful for running commands like this:

        # systemd-run -i someimage.raw -b systemd.run='"some command line"'

This will now run the command line inside a small Type=oneshot service
and even propagate the exit code of the command back to the parent. And
all that with the full system booted up.

By default this causes the system to shutdown right after the command
completed, but this can be tweaked with systemd.run_success_action= and
systemd.run_failure_action=.

Note that when used in VMs the exit status can of course not be
propagate, as VMs don't really know a concept for that.
2018-11-27 09:44:40 +01:00
Lennart Poettering 7af67e9a8b core: allow to set exit status when using SuccessAction=/FailureAction=exit in units
This adds SuccessActionExitStatus= and FailureActionExitStatus= that may
be used to configure the exit status to propagate in when
SuccessAction=exit or FailureAction=exit is used.

When not specified let's also propagate the exit status of the main
process we fork off for the unit.
2018-11-27 09:44:40 +01:00
Yu Watanabe 9b6ffef372 man: update explanation for boolean options 2018-11-27 15:07:58 +09:00
Yu Watanabe 025314d97d man: improve the explanation of "Defaults to unset" 2018-11-27 14:40:25 +09:00
Lennart Poettering 79411bbcce test: add test for setting service manager environment variables
This is a follow-up for #10594. I somehow forgot to commit this when I
worked on that.
2018-11-27 14:25:17 +09:00
Yu Watanabe 2fb14a12cf
Merge pull request #10947 from poettering/sd-radv-fixes
sd-radv fixes
2018-11-27 14:24:43 +09:00
Lennart Poettering 30acbadc6a journald: don't try to rotate user journals in /var/log/journal/ if we are still in log-to-runtime-journal mode
Fixes: #10879
2018-11-27 11:09:15 +09:00
Susant Sahani 2266864b04 networkd: Add support for ERSPAN tunnel
Please see: https://patchwork.ozlabs.org/patch/800327/
```
[NetDev]
Name=erspan-test
Kind=erspan

[Tunnel]
Independent=true
ERSPANIndex=123
Local = 172.16.1.200
Remote = 172.16.1.100
Key=101
SerializeTunneledPackets=true
```
2018-11-27 11:04:42 +09:00
Claudius Ellsel 5c6b51ff79 First restructuration of Logitech mice in 70-mouse.hwdb
Untested, just carefully copy and pasted under the created sections. First approach to #10941
2018-11-27 11:02:21 +09:00
Lennart Poettering d2c8eed219 sd-radv: use struct initializers 2018-11-26 22:31:15 +01:00
Lennart Poettering a3a98776ff sd-radv: per our CODING_STYLE don't use 'bool' in public headers 2018-11-26 22:31:15 +01:00
Lennart Poettering f474884cb9 sd-radv: no need to initialize r to zero 2018-11-26 22:31:15 +01:00
Lennart Poettering 5a9fca258b sd-radv: make sure we can deal with in_addr_to_string() failing 2018-11-26 22:31:15 +01:00
Lennart Poettering cfffddeac5 sd-radv: when receiving a too short packet, make sure we dequeue it 2018-11-26 22:31:15 +01:00
Lennart Poettering e55a6eaeb9 sd-radv: propagate OOM, it's reason to fail 2018-11-26 22:31:15 +01:00
Lennart Poettering e866e17b0f sd-radv: follow our usualy rule that destructors can take NULL 2018-11-26 22:31:15 +01:00
Lennart Poettering dc0ec5e251 sd-radv: simplify IPv6 address is-null check 2018-11-26 22:31:15 +01:00
Lennart Poettering 83ef9d141b sd-radv: drop const from non-ptr argument 2018-11-26 22:31:15 +01:00
Lennart Poettering ae25915d24 sd-radv: use ether_addr_is_null() where appropriate 2018-11-26 22:31:15 +01:00
Lennart Poettering ff9bf8d012 units: make fsck/grows/makefs/makeswap units conflict against shutdown.target
They are the only units we shipped/generated where this was missing really. Let's fix these.

Follow-up for: #10933
2018-11-26 22:18:16 +01:00
Lennart Poettering 020b39497a tree-wide: use SWAP_TWO a bit more 2018-11-26 22:17:34 +01:00
Yu Watanabe f5050e48ae test-network: add tests for #5430 and GatewayOnLink= 2018-11-26 18:47:52 +01:00
Lennart Poettering f5d9a12780
Merge pull request #10928 from yuwata/fix-9940
network: also load foo.netdev.d/*.conf
2018-11-26 18:46:47 +01:00
Lennart Poettering 077c40bc52 man: link Delegate= documentation up with the markdown docs 2018-11-26 18:43:23 +01:00
Lennart Poettering e2391ce0bc docs: document the .control/ subcgroup contract in the docs 2018-11-26 18:43:23 +01:00
Lennart Poettering 78f93209fc core: when Delegate=yes is set for a unit, run ExecStartPre= and friends in a subcgroup of the unit
Otherwise we might conflict with the "no-processes-in-inner-cgroup" rule
of cgroupsv2. Consider nspawn starting up and initializing its cgroup
hierarchy with "supervisor/" and "payload/" as subcgroup, with itself
moved into the former and the payload into the latter. Now, if an
ExecStartPre= is run right after it cannot be placed in the main cgroup,
because that is now in inner cgroup with populated children.

Hence, let's run these helpers in another sub-cgroup .control/ below it.

This is somewhat ugly since it weakens the clear separation of
ownership, but given that this is an explicit contract, and double opt-in should be acceptable.

Fixes: #10482
2018-11-26 18:43:23 +01:00
Lennart Poettering 5b262f74e4 unit: tweak status output a bit
Let's highlight the unit description string in the status updates, to
separate them a bit more the english sentence they are part of, and thus
make the different casing less surprising.
2018-11-26 18:24:12 +01:00
Lennart Poettering ccfc08d4bc show-status: use free_and_replace() where we can 2018-11-26 18:24:12 +01:00
Lennart Poettering a885727a64 show-status: fold two bool flags function arguments into a flags
parameter
2018-11-26 18:24:12 +01:00
Lennart Poettering fe1bff158e update TODO 2018-11-26 18:09:01 +01:00
Lennart Poettering f5095a6af0 test: add simple test for importd
It tests importing and exporting, and a few other machinectl commands.

It currently does not test pulling (i.e. http downloads), but we might
want to add that later on.
2018-11-26 18:09:01 +01:00
Lennart Poettering d02bfa50f6 import: properly fail if tar exited non-zero, not just when it segfaulted or such 2018-11-26 18:09:01 +01:00
Lennart Poettering 82f299e74e export-tar: check tar result as well
Let's make sure we properly notice when tar doesn't actually work: let's
propagate the error.
2018-11-26 18:09:01 +01:00
Lennart Poettering e288e0599e machinectl: be more careful when generating machine name from path name
Let's use our new path_extract_filename() for extracting the basename
from a path in a safe fashion.

Let's do this for all our three local import calls.
2018-11-26 18:09:01 +01:00
Lennart Poettering 176a05c24b importd: immediately validate whether fd is of right type when receiving it
Just some paranoia.
2018-11-26 18:09:01 +01:00
Lennart Poettering 844416b64c stat-util: add fd_verify_directory(), similar to fd_verify_regular() 2018-11-26 18:09:01 +01:00
Lennart Poettering 0c9448fa82 copy: remove reflinking debug message
It pretty much ends up in an inner loop most of the time, hence let's
just remove it. This is pretty easily debuggable with strace anyway...
2018-11-26 18:09:01 +01:00
Lennart Poettering a60c8eee10 path-util: add helper for extracting last filename from path 2018-11-26 18:09:01 +01:00
Lennart Poettering 77e0a1b5e0 path-util: handle NULL inputs in last_path_component() 2018-11-26 18:09:01 +01:00
Lennart Poettering 5f7ecd610c import: drop logic of setting up /var/lib/machines as btrfs loopback mount
Let's simplify things and drop the logic that /var/lib/machines is setup
as auto-growing btrfs loopback file /var/lib/machines.raw.

THis was done in order to make quota available for machine management,
but quite frankly never really worked properly, as we couldn't grow the
file system in sync with its use properly. Moreover philosophically it's
problematic overriding the admin's choice of file system like this.

Let's hence drop this, and simplify things. Deleting code is a good
feeling.

Now that regular file systems provide project quota we could probably
add per-machine quota support based on that, hence the btrfs quota
argument is not that interesting anymore (though btrfs quota is a bit
more powerful as it allows recursive quota, i.e. that the machine pool
gets an overall quota in addition to per-machine quota).
2018-11-26 18:09:01 +01:00
Lennart Poettering e21b7229ff import: rerrange tarball/fs imports that have a single top-level directory containing the OS tree
Let's handle tarball imports nicer that have a single top-level
directory containing the OS tree: let's move everything down during
import, so that the OS tree is ready to use automatically.

Fixes: #2116
2018-11-26 18:09:01 +01:00
Lennart Poettering 1d7579c473 machine: add support for importing containers from plain directories
Fixes: #2728

This is also supposed to be preparation for doing #10234 eventually,
where a very similar operation is requested: instead of importing a tree
to /var/lib/machines it would need to be imported into
/var/lib/portables/.
2018-11-26 18:09:01 +01:00
Lennart Poettering b3cade0c27 copy: support getting progress feedback from the various copy functions
This adds two optional functions that may be passed to the various copy
functions. One is invoked whenever we start copying a new file object,
the other while we copy file payload in each loop iteration.

When the caller passes one or both they can get notifications about copy
progress, for example to log where things are.
2018-11-26 18:09:01 +01:00
Lennart Poettering 576cf244a4 man: document that machinectl is also happy with block devices these days 2018-11-26 18:09:01 +01:00
Lennart Poettering 9cb0509c5f polkit: add missing method calls
These were missing, hence the polkit hook-up for them never worked...
2018-11-26 18:09:01 +01:00
Lennart Poettering 5a8582fbff import: use parse_percent() where appropriate 2018-11-26 18:09:01 +01:00
Lennart Poettering b11591af27 import-util: downgrade log message about quota to LOG_DEBUG
We invoke this usually on a temporary path before renaming it into
place. This means the log message is quite suprising as it mentions a
weird path with random characters in it. Hence, let's downgrade the
message in order not to confuse the user.
2018-11-26 18:09:01 +01:00
Lennart Poettering 1295c9066a import: prefer fd_get_path() over readlink_malloc() where applicable 2018-11-26 18:09:01 +01:00
Lennart Poettering fd67de0152 tree-wide: fix a few missing includes 2018-11-26 18:09:01 +01:00
Lennart Poettering b0325c991e import: tiny modernization/simplification
Less indentation and fewer {} are always a good thing.
2018-11-26 18:09:01 +01:00