1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-02 04:22:27 +03:00
Commit Graph

40958 Commits

Author SHA1 Message Date
d81bc51fe3 systemctl: add new "clean" operation to systemctl
This exposes the CleanUnit() bus calls in systemctl, i.e. makes all the
infrastructure we previously added useful to people.
2019-07-11 12:18:51 +02:00
3572d3df8f shared: add generic logic for waiting for a unit to enter some state
This is a generic implementation of a client-side logic of waiting until
a unit enters or leaves some state.

This is a more generic implementation of the WaitContext logic currently
in systemctl.c, and is supposed to replace it (a later commit does
this). It's similar to bus-wait-for-jobs.c and we probably should fold
that one into it later on.

This code is more powerful and cleaner than the WaitContext logic
however. In addition to waiting for a unit to exit this also allows us
to wait for a unit to leave the "maintainance" state.

This commit only implements the generic logic, and adds no users of it
yet.
2019-07-11 12:18:51 +02:00
345f322185 core: expose per-service cleaning properties on the bus, too 2019-07-11 12:18:51 +02:00
4d3bac5645 core: expose new clean operation on the bus
This adds CanClean() and Clean() as new methods on the Unit object that
initiate the cleaning operation.
2019-07-11 12:18:51 +02:00
6b7b2ed96b core: add type of resource string table 2019-07-11 12:18:51 +02:00
89f6fe7b30 core: hook up timer unit type with clean operation
timer units maintain state on disk (the persistent touch file), hence
let's expose cleaning it up generically with the new cleaning operation
for units.

This is a much simpler implementation as for the service unit type:
instead of forking out a worker process we just remove the touch file
directly. That should be OK since we only need to remove a single
(empty) file, instead of a recursive user-controlled directory tree.

Fixes: #4930
2019-07-11 12:18:51 +02:00
4c2f584230 core: hook up service unit type with the new clean operation
The implementation is pretty straight-foward: when we get a request to
clean some type of resources we fork off a process doing that, and while
it is running we are in the "cleaning" state.
2019-07-11 12:18:51 +02:00
380dc8b0a2 core: add generic "clean" operation to units
This adds basic infrastructure to implement a "clean" operation for unit
types. This "clean" operation is supposed to remove on-disk resources of
units, and is supposed to be used in a later commit to clean our
RuntimeDirectory=, StateDirectory= and so on of service units.

Later commits will open this up to the bus, and hook up service units
with this.

This also adds a new generic ActiveState called UNIT_MAINTENANCE. It's
supposed to cover all kinds of "maintainance" state of units.
Specifically, this is supposed to cover the "cleaning" operations later
added for service units which might take a bit of time. This high-level,
generic, abstract state is called UNIT_MAINTENANCE instead of the
more specific "UNIT_CLEANING", since I think this should be kept open
for different operations possibly later on that could be nicely subsumed
under this (for example, maybe a recursive chown()ing operation could be
covered by this, and similar).
2019-07-11 12:18:51 +02:00
c0228b4fa3 rm-rf: introduce new flag REMOVE_MISSING_OK
This new flag suppresses error if the top-level path specified doesn't
exist. This is useful since suppressing this on the caller side isn't
easy, since ENOENT migh be propagate for some reason from further inside
and we can't distuingish that.

While we are at it, also be a bit more careful witht the various
combinations of flags.

(Note that in some cases rm_rf() was already ignoring ENOENT from
unlink() or rmdir(), however that was pretty useless, since we always
open() the top-level path with O_DIRECTORY and if that hit ENOENT we
didn't ignore the failure).
2019-07-11 12:18:51 +02:00
6b39223cd3 sd-bus: when installing a match make sure not to apply it to already queued messages
This tweaks match installation a bit: the match callbacks are now only
called for messages read after the AddMatch() reply was received and
never anything already read before. Thus, installing a match gives you a
time guarantee: only messages received after it will be matched.

This is useful when listening to PropertiesChanged signals as an example
to ensure that only changes after the point the match was installed are
honoured, nothing before.
2019-07-11 12:18:51 +02:00
3cf8dd5359 sd-bus: destroy AddMatch() reply slot in failure case too
If AddMatch() doesn't work, let's destroy the slot for it too as soon as
we received the failure for it.

This way the mere existance of the slot tells us whether the AddMatch()
method call is still pending or is complete.
2019-07-11 12:18:51 +02:00
f1617a3b61 sd-bus: maintain a counter for incoming msgs
Let's count incoming messages and attach the current counter when we
first read them to the message objects. This allows us to nicely order
messages later on.
2019-07-11 12:18:51 +02:00
66d3159739 Merge pull request #13018 from yuwata/network-tunnel-follow-up-13016
network: drop assertions about Tunnel.family
2019-07-11 12:10:39 +02:00
67da2cc883 test-alloc-util: assert on the return value to appease coverity
Coverity is right that we should check the return value…
CID#1403006.
2019-07-11 11:19:19 +02:00
0121d1f28d pid1: shorten dump output a bit by not repeating unit id twice
Most units have just one name, but we'd print it twice:
-> Unit systemd-sysctl.service:
        ...
	Name: systemd-sysctl.service

Let's only print the "main" name once, and call the other names Aliases.
2019-07-11 11:19:19 +02:00
cef94248ff test-network: drop test_udev_driver as it is unstable
The test unexpectedly succeeds on KVM with sanitizer CI.
At least tentatively, let's drop the test.
2019-07-11 11:17:20 +02:00
7e82b4059b Merge pull request #13006 from yuwata/network-split-dhcp-12917
networkd: DHCPv6 - separate DHCPv6 options from DHCPv4 options
2019-07-11 10:28:03 +02:00
bb08b2a940 Merge pull request #13010 from poettering/fsck-usr-wants
generator: downgrade Requires= → Wants= of fsck from /usr mount unit
2019-07-11 15:13:51 +09:00
42a29fcb12 test-network: add testcases Tunnel.Remote=any and Local=any 2019-07-11 15:09:50 +09:00
dfc3365593 network: ip6tnl and vti6 does not support the case both Local= and Remote= are any
This partially revert feb0c8b86f.

This also drop assertions about Tunnel.family.
2019-07-11 15:09:09 +09:00
db105415d3 Merge pull request #13013 from yuwata/network-xfrm-follow-ups
network: follow-ups for XFRM netdevs and introduce AssignToLoopback= for Tunnel devices
2019-07-11 15:08:13 +09:00
e64dc40615 test-network: add test for Xfrm netdev 2019-07-11 11:51:23 +09:00
95082dbef5 test-network: add test for AssignToLoopback= setting 2019-07-11 09:59:06 +09:00
8c9c703c55 network: add AssignToLoopback= setting to [Tunnel] section
networkd does not manage loopback interface lo. So, previously, we have
no way to assign tunnel devices to lo.
2019-07-11 09:59:06 +09:00
3140e8a55a network: simplify the condition about xfrm 2019-07-11 09:59:06 +09:00
8e27167cc9 Merge pull request #13011 from keszybz/auto-erase
Remove string_erase and friends
2019-07-11 01:05:01 +02:00
feb0c8b86f network: support gre tunnel or friends with Local=any Remote=any
Fixes #13014.
2019-07-11 00:03:57 +02:00
261e7d9270 Merge pull request #12755 from keszybz/short-identifiers
Allow using unit names in status messages
2019-07-11 00:00:51 +02:00
08945b59d1 Merge pull request #12926 from keszybz/urlify-logs
Urlify CONFIG_FILE and improve SYSTEMD_LOG_LOCATION
2019-07-11 00:00:34 +02:00
bdd0f4b6d1 Merge pull request #13009 from keszybz/efi-feature-xbootldr
sd-boot feature xbootldr
2019-07-11 00:00:12 +02:00
6f209cb01d Merge pull request #12965 from keszybz/auto-erase
_cleanup_(erase_and_freep)
2019-07-10 16:20:50 +02:00
a082157282 Merge pull request #13005 from keszybz/fix-gcc-warning
Fix two gcc warnings
2019-07-10 16:20:31 +02:00
afb7e1ceb9 tmpfiles: use log_syntax() for complaining about configuration file errors
In the light of #12926 I needed some log messages for testing. This
tmpfiles one came to mind, since it's frequently seen on typical Fedora
systems. Alas, they didn't actually use log_syntax, and thus weren't
recognizable by the new config file urlifaction code. Let's fix that.
2019-07-10 16:20:08 +02:00
afacf3fc8a generator: downgrade Requires= → Wants= of fsck from /usr mount unit
Fixes #5099
2019-07-10 16:19:31 +02:00
cbdc9cfe2b core: spaces rock 2019-07-10 16:19:31 +02:00
f392c06566 Merge pull request #12863 from 1848/if_xfrm
Added support for xfrm interfaces
2019-07-10 23:04:49 +09:00
b7700511ef Fixed condition checked twice 2019-07-10 23:02:24 +09:00
98d20a17a9 Added support for xfrm interfaces 2019-07-10 23:02:19 +09:00
3a76fbe01c bootctl,sd-boot: define EFI_LOADER_FEATURE_XBOOTLDR
It was added back in fa2a3bbdd8, but we
forgot to add the feature define.
2019-07-10 15:02:33 +02:00
91b08bb00f boot,shared: share the definitions of EFI_LOADER_FEATURE macros
This means the the code needs to be kept compatible in the shared header,
but I think that still nicer than having two places to declare the same
things.

I added src/boot to -I, so that efi/foo.h needs to be used. This reduces
the potential for accidentally including the wrong header.
2019-07-10 14:59:48 +02:00
ba40f0399e Merge pull request #12939 from yuwata/lgtm-fixes
make LGTM quiet
2019-07-10 14:57:14 +02:00
b4f386d53b test-strv: test strv_free_erase() a little bit 2019-07-10 14:43:44 +02:00
309c6b19a7 Remove string_erase 2019-07-10 14:43:44 +02:00
79dc477f2f shared/logs-show: urlify CONFIG_FILE in verbose mode
Now all short-*, verbose, with-unit modes are handled. cat, export, json-* are
not, but those are usually used for post-processing, so I don't think it'd be
useful there.
2019-07-10 14:20:09 +02:00
76f7cc3fe4 shared/logs-show: urlify CONFIG_FILE in short mode
v2:
- check that the filename is terminated by ':', ' ', or EOS
- fix grep highlight overlap check
2019-07-10 14:19:26 +02:00
9ae4ef49cd Remove string_free_erase 2019-07-10 13:48:55 +02:00
2a8f53c67b Use unit->id instead of description in messages
v2:
- rename unit_identifier to unit_status_string
2019-07-10 13:35:26 +02:00
36cf45078c Add config and kernel commandline option to use short identifiers
No functional change, just docs and configuration and parsing.

v2:
- change ShortIdentifiers=yes|no to StatusUnitFormat=name|description.
2019-07-10 13:35:26 +02:00
c1d95b713a pid1: tiny simplification
v2:
- use empty_to_root()
2019-07-10 13:35:17 +02:00
e04df06f58 systemctl: allow "cat" on units with bad settings
That's precisely the state where 'cat' is particularly useful ;).
2019-07-10 12:32:52 +02:00