1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 19:21:53 +03:00
Commit Graph

8458 Commits

Author SHA1 Message Date
Lennart Poettering
f2b6878955 service: introduce Type=idle and use it for gettys
Type=idle is much like Type=simple, however between the fork() and the
exec() in the child we wait until PID 1 informs us that no jobs are
left.

This is mostly a cosmetic fix to make gettys appear only after all boot
output is finished and complete.

Note that this does not impact the normal job logic as we do not delay
the completion of any jobs. We just delay the invocation of the actual
binary, and only for services that otherwise would be of Type=simple.
2012-04-24 14:42:24 +02:00
Lennart Poettering
8d8e945624 manager: drop MountAuto= and SwapAuto= options
The ability to set MountAuto=no and SwapAuto=no was useful during the
adoption phase of systemd, so that distributions could stick to their
classic mount scripts a bit longer. It is about time to get rid of it
now.
2012-04-24 13:53:34 +02:00
Lennart Poettering
25f5971b5e man: rework nspawn man page to suggest yum --installroot instead of mock 2012-04-24 13:14:40 +02:00
Lennart Poettering
3b2d5b02ae readahead: rather than checking for virtualization in the C code, use ConditionVirtualization= in the unit 2012-04-24 13:14:40 +02:00
Michal Schmidt
5273510e9f transaction: cancel jobs non-recursively on isolate
Recursive cancellation of jobs would trigger OnFailure actions of
dependent jobs. This is not desirable when isolating.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=798328
2012-04-23 08:13:02 +02:00
Michal Schmidt
39a18c60d0 job: serialize jobs properly
Jobs were not preserved correctly over a daemon-reload operation.
A systemctl process waiting for a job completion received a job removal
signal. The job itself changed its id. The job timeout started ticking all
over again.

This fixes the deficiencies.
2012-04-24 01:54:15 +02:00
Michal Schmidt
1b9cea0caa transaction: abort does not need to use recursive deletion
Recursion is unnecessary, because we're deleting all transaction jobs
anyway. And the recursive deletion produces debug messages that are
pointless in transaction abort.
2012-04-24 01:54:15 +02:00
Michal Schmidt
4e7bd268ae transaction: fix detection of cycles involving installed jobs
A transaction can be acyclic, but when it's added to installed jobs,
a cycle may result.

transaction_verify_order_one() attempts to detect these cases, but it
fails because the installed jobs often have the exact generation number
that makes them look as if they were walked already.

Fix it by resetting the generation numbers of all installed jobs before
detecting cycles.

An alternative fix could be to add the generation counter to the
Manager and use it instead of starting always from 1 in
transaction_activate(). But I prefer not having to worry about it
wrapping around.
2012-04-24 01:54:14 +02:00
Michal Schmidt
055163ad15 transaction: improve readability
The functions looked complicated with the nested loops with breaks,
continues, and "while (again)".
Here using goto actually makes them easier to understand.

Also correcting the comment about redundant jobs.
2012-04-24 01:54:14 +02:00
Lennart Poettering
ff64462375 shutdown: don't try to shut down DM devices in a container 2012-04-22 15:50:52 +02:00
Lennart Poettering
fb3d2b8fec hostname: if there's already a hostname set when PID 1 is invoked, don't complain 2012-04-22 15:47:38 +02:00
Lennart Poettering
78ff1acdfe job: the status messages are proper sentences, hence end them with a full stop 2012-04-22 15:39:26 +02:00
Lennart Poettering
e3f7277c6e units: remount file systems only if /etc/fstab actually exists 2012-04-22 15:35:35 +02:00
Lennart Poettering
e0295d2651 mount: don't fail if fstab doesn't exist 2012-04-22 15:33:43 +02:00
Lennart Poettering
59e132a7f4 transaction: downgrade warnings about masked units 2012-04-22 15:22:52 +02:00
Lennart Poettering
7c0436b94c transaction: add missing emacs and license headers 2012-04-22 15:22:27 +02:00
Lennart Poettering
8e47b1d2eb machine-id: fix spelling 2012-04-22 15:07:35 +02:00
Lennart Poettering
ab94af9201 util: unify getenv() logic for other PID 2012-04-22 15:00:42 +02:00
Lennart Poettering
144f0fc0c8 nspawn: add --uuid= switch to allow setting the machine id for the container 2012-04-22 14:48:21 +02:00
Lennart Poettering
5cd6eef69b units: don't try to load kernel modules if CAP_SYS_MODULE is missing 2012-04-22 14:11:32 +02:00
Lennart Poettering
2c8049f3d3 units: skip root fsck if the root directory is writable 2012-04-22 14:11:32 +02:00
Lennart Poettering
0f0dbc46cc nspawn: add -b switch to automatically look for an init binary 2012-04-22 14:11:32 +02:00
Lennart Poettering
acda6a054f default to v102 everywhere, instead of vt100, to synchronize with agetty 2012-04-22 02:45:39 +02:00
Lennart Poettering
d1122ad5e3 login: assing /dev/console logins to seat0 2012-04-22 02:41:18 +02:00
Lennart Poettering
337eebb936 container: spawn a getty instead of a sulogin in a container 2012-04-22 02:41:18 +02:00
Lennart Poettering
cc1368e3b3 loginctl: avoid segfault for kill-session and kill-user commands
As reported by Mantas Mikulėnas.

http://lists.freedesktop.org/archives/systemd-devel/2012-April/004993.html
2012-04-22 02:04:12 +02:00
Lennart Poettering
3d9a412243 util: fix tty_is_vc_resolve() in a container where /sys/class/tty/console/active is misleading 2012-04-22 01:59:11 +02:00
Lennart Poettering
d29b05a461 log: include syslog identifier in default log properties, to avoid comm truncation 2012-04-22 01:01:54 +02:00
Lennart Poettering
3a74cea5e4 nspawn: be more careful when initializing the hostname from the directory name 2012-04-22 01:01:22 +02:00
Lennart Poettering
eaeb18dba9 mount-setup: ignore common container bind mounts 2012-04-22 01:00:57 +02:00
Lennart Poettering
9efaf380a7 update TODO 2012-04-22 00:33:24 +02:00
Lennart Poettering
f1e5dfe2c0 nspawn: make /dev/kmsg unavailable in the container, but allow access to /proc/kmsg 2012-04-22 00:32:53 +02:00
Lennart Poettering
461282d52a watchdog: fix default configuration fragment for watchdog 2012-04-21 15:47:38 +02:00
Kay Sievers
33e48d472e man: doc-sync - properly delete no longer existing stuff on remote server 2012-04-21 00:28:02 +02:00
Michal Schmidt
6530407524 transaction: add starting requirements for JOB_RESTART
While having a Requires= dependency between units, the dependency is started
automatically on "systemctl start", but it's not started on "systemctl
restart".

JOB_RESTART jobs did not pull the dependencies for starting into the
transaction.

https://bugzilla.redhat.com/show_bug.cgi?id=802770

Note that the other bug noted in comment #2 has been fixed already by avoiding
the deletion of anchor jobs.
2012-04-20 17:12:29 +02:00
Michal Schmidt
97e6a11996 dbus-job: allow multiple bus clients
Merging of jobs can result in more than one client being interested in a job.
2012-04-20 17:12:29 +02:00
Michal Schmidt
d6a093d098 transaction: remove checks for installed
Transactions cannot contain installed jobs anymore. Remove the now pointless
checks.
2012-04-20 17:12:29 +02:00
Michal Schmidt
656bbffc6c transaction: rework merging with installed jobs
Previously transactions could reference installed jobs. It made some issues
difficult to fix.

This sets new rules for jobs:
A job cannot be both a member of a transaction and installed. When jobs are
created, they are linked to a transaction. The whole transaction is constructed
(with merging of jobs within, etc.). When it's complete, all the jobs are
unlinked from it one by one and let to install themselves. It is during the
installation when merging with previously installed jobs (from older
transactions) is contemplated.

Merging with installed jobs has different rules than merging within a
transaction:
 - An installed conflicting job gets cancelled. It cannot be simply deleted,
   because someone might be waiting for its completion on DBus.
 - An installed, but still waiting, job can be safely merged into.
 - An installed and running job can be tricky. For some job types it is safe to
   just merge. For the other types we merge anyway, but put the job back into
   JOB_WAITING to allow it to run again. This may be suboptimal, but it is not
   currently possible to have more than one installed job for a unit.

Note this also fixes a bug where the anchor job could be deleted during merging
within the transaction.
2012-04-20 17:12:29 +02:00
Michal Schmidt
05d576f1f7 job: separate job_install()
Let the jobs install themselves.
2012-04-20 17:12:28 +02:00
Michal Schmidt
f1c2bdca42 transaction: remove a couple of asserts
We already asserted these facts in the previous loop.
2012-04-20 17:12:28 +02:00
Michal Schmidt
e6eda1f23e transaction: remove the anchor link
tr->anchor_job is sufficient.
2012-04-20 17:12:28 +02:00
Michal Schmidt
38809d9dfe transaction: avoid garbage collecting the anchor job
Make sure the anchor job is never considered garbage, even if it has no links
leading to it (this will be allowed in the next patch).
2012-04-20 17:12:28 +02:00
Michal Schmidt
0d9989aa68 transaction: simplify transaction_find_jobs_that_matter_to_anchor() 2012-04-20 17:12:28 +02:00
Michal Schmidt
4483f69498 transaction: change the linking of isolate jobs to the anchor
When isolating, the JOB_STOP jobs have no parent job, so they are all peers
of the real anchor job. This is a bit odd.

Link them from the anchor job.
2012-04-20 17:12:28 +02:00
Michal Schmidt
b94fbd3078 transaction: maintain anchor_job
Track which job is the anchor in the transaction.
2012-04-20 17:12:28 +02:00
Michal Schmidt
3c956cfee2 transaction: do not add installed jobs to the transaction
Do not attempt to optimize away the job creation by refering to installed jobs.
We do not want to disturb installed jobs until commiting the transaction.

(A later patch to job merging will make the separation of transaction jobs and
installed jobs complete.)
2012-04-20 17:12:28 +02:00
Michal Schmidt
1da4264fbd job: jobs shouldn't need to know about transaction anchors
Let the transactions maintain their own anchor links.
2012-04-20 17:12:28 +02:00
Michal Schmidt
668ad332a4 job: job_new() can find the manager from the unit 2012-04-20 17:12:27 +02:00
Michal Schmidt
75778e21df manager: split transaction.[ch]
manager.c takes care of the main loop, unit management, signal handling, ...
transaction.c computes transactions.

After split:
manager.c:     65 KB
transaction.c: 40 KB
2012-04-20 17:12:27 +02:00
Michal Schmidt
7527cb5275 manager: Transaction as an object
This makes it obvious that transactions are short-lived. They are created in
manager_add_job() and destroyed after the application of jobs.
It also prepares for a split of the transaction code to a new source.
2012-04-20 17:12:27 +02:00