Commit Graph
914 Commits
Author SHA1 Message Date
Luca Boccassi d99fe076b5 introduce report_errno_and_exit() helper (#35028)
This is a follow for https://github.com/systemd/systemd/pull/34853. In
particular, this comment
https://github.com/systemd/systemd/pull/34853#discussion_r1825837705.
2024-11-06 13:51:10 +00:00
Ivan Kruglov a686bedb88 machine: introduce io.systemd.Machine.Open method 2024-11-06 11:37:51 +01:00
Ivan Kruglov b0eca6dee0 machine: machine_default_shell_path() & machine_default_shell_args() helper functions 2024-11-06 11:37:51 +01:00
Ivan Kruglov 41f1f283d7 machine: introduce machine_start_getty() and machine_start_shell() helpers 2024-11-06 11:37:51 +01:00
Ivan Kruglov a567de392d process-util: introduce report_errno_and_exit() as part of src/basic/process-util.{h,c} 2024-11-06 11:18:38 +01:00
Ivan Kruglov 88d0b72833 machine: use ImageUpdateParameters in io.systemd.MachineImage.Update 2024-11-01 15:30:39 +01:00
Ivan Kruglov 1663455b63 machine: introduce io.systemd.MachineImage.Remove method 2024-11-01 15:30:39 +01:00
Ivan Kruglov 38a0cf4172 machine: introduce io.systemd.MachineImage.Clone method 2024-11-01 15:30:34 +01:00
Ivan Kruglov 95d5b9097b machine: use report_errno_and_exit() in dbus code 2024-11-01 15:21:22 +01:00
Ivan Kruglov 30a34657b8 machine: introduce report_errno_and_exit() 2024-11-01 15:21:22 +01:00
Ivan Kruglov a52ce4a29d machine: align polkit verb of io.systemd.MachineImage.Update with the rest of the code 2024-11-01 15:20:59 +01:00
Luca Boccassi fdccba15be util-lib/systemd-run: implement race-free PTY peer opening (#34953)
This makes use of the new TIOCGPTPEER pty ioctl() for directly opening a
PTY peer, without going via path names. This is nice because it closes a
race around allocating and opening the peer. And also has the nice
benefit that if we acquired an fd originating from some other
namespace/container, we can directly derive the peer fd from it, without
having to reenter the namespace again.
2024-11-01 11:29:19 +00:00
Yu Watanabe 76423f301e machine: lookup_machine_by_name_or_pidref() returns negative errno on failure
This effectively reverts d2c1451b73.

After the commit d2ebf5cc1d, sd_varlink_error()
returns negative errno, hence the function always return negative errno
on failure.
2024-10-31 11:02:35 +09:00
Yu Watanabe 0ef4a21b09 machine: use JSON_BUILD_PAIR_STRV_ENV_PAIR_NON_EMPTY()
Also use JSON_BUILD_PAIR_UNSIGNED_NOT_EQUAL().
2024-10-31 11:02:35 +09:00
Yu Watanabe 20e1237ce1 machined: ACQUIRE_METADATA_NO is zero
Follow-ups for a94fbcaa35 and
9de215219c.
2024-10-31 10:59:14 +09:00
Yu Watanabe f283816acb machine: use sd_json_variant_append_arraybo() and JSON_BUILD_PAIR_VARIANT_NON_NULL()
Follow-up for 45755275e5.
2024-10-31 10:59:14 +09:00
Lennart Poettering 42c8f1c761 machined: port to pty_open_peer_racefree() 2024-10-30 22:37:44 +01:00
Ivan Kruglov 10a48938ef machine: operation should not send a response when 'done' callback set 2024-10-26 02:45:53 +09:00
Ivan Kruglov 9de215219c machine: use AcquireMetadata in io.systemd.MachineImage.List method 2024-10-21 17:42:37 +02:00
Ivan Kruglov 45755275e5 machine: add Addresses field in varlink io.systemd.Machine.List output
This is equivalent to DBus implementation of GetMachineAddresses.
2024-10-21 17:38:29 +02:00
Ivan Kruglov a94fbcaa35 machine: add OSRelease and UIDShift fields in varlink io.systemd.Machine.List output
This commit adds support of the above mentioned fields. This is equivalent to DBus implementation of:
- GetMachineOSRelease
- GetMachineUIDShift
2024-10-21 17:38:28 +02:00
Ivan Kruglov 16b1b304ba machine: enum AcquireMetadata 2024-10-21 17:34:11 +02:00
Ivan Kruglov d8964f9d4d machine: rework Operation logic to reuse in varlink interface 2024-10-21 17:08:14 +02:00
Yu Watanabe cd4b71b861 machine: fix typo
Follow-up for ad0d4f9a4c.
2024-10-17 00:48:43 +09:00
Yu Watanabe 7a3ee9217e machine: add MachineImage interface
Follow-up for fb0ea6a6a3.
Fixes #34772.
2024-10-15 20:44:13 +09:00
Lennart Poettering 6f9826b6d8 Merge pull request #34723 from poettering/machined-pidref-more
machined: switch remaining Varlink overs over to use json_dispatch_pidref() and friends
2024-10-15 11:37:39 +02:00
Yu Watanabe 10230b8251 machine: trivial coding style cleanups 2024-10-15 14:24:58 +09:00
Yu Watanabe d1ac7d76b4 machine: fix memleak in vl_method_list_images()
Fixes an issue in fb0ea6a6a3.
2024-10-15 14:24:58 +09:00
Yu Watanabe d2c1451b73 machine: lookup_machine_by_name_or_pid() may return 1 on error and it is already replied
Follow-ups for 1bd979dddb and later
commits.

Fixes #34764.
2024-10-15 14:24:58 +09:00
Lennart Poettering 6bca1a7c6c machined: port all varlink APIs over to new PidRef serialization 2024-10-14 12:47:17 +02:00
Ivan Kruglov 84d7447a88 machine: listen on io.systemd.MachineImage socket 2024-10-14 11:09:18 +02:00
Ivan Kruglov 7809bd3ba7 machine: introduce io.systemd.MachineImage.Update varlink method
io.systemd.MachineImage.Update implements the following dbus org.freedesktop.machine1.Manager interfaces:

- RenameImage
- MarkImageReadOnly
- SetImageLimit
2024-10-14 11:09:18 +02:00
Ivan Kruglov fb0ea6a6a3 machine: introduce io.systemd.MachineImage.List varlink method
io.systemd.MachineImage.List implements the following dbus org.freedesktop.machine1.Manager interfaces:

- GetImage
- ListImages
- GetImageHostname
- GetImageMachineID
- GetImageMachineInfo
- GetImageOSRelease
2024-10-14 10:57:36 +02:00
Ivan Kruglov dd2d5952c9 machine: generalize rename_image_and_update_cache() logic
This is a prep step to reuse the function in varlink interface
2024-10-14 10:42:47 +02:00
Ivan Kruglov ad0d4f9a4c machine: move manager_acquire_image to src/machine/machined-core.c
This is a prep step to reuse the function in varlink interface.
2024-10-14 10:42:47 +02:00
Lennart Poettering 1fef1773c0 Merge pull request #34703 from poettering/pidref-varlink
Serialize "PidRef" in a reasonable way in Varlink interfaces
2024-10-11 13:33:44 +02:00
Lennart Poettering 755cb018c9 machined: also take new ProcessId structure when registering processes 2024-10-11 10:48:07 +02:00
Lennart Poettering 0fc530d157 machined: make List() varlink method return a full pidref JSON object for leader
This new call has not been released yet, hence we can still change the
encoding of the "leader" field.
2024-10-11 10:48:07 +02:00
Ivan Kruglov d8aefe88c8 machine: use sd_json_dispatch_pid() in varlink code 2024-10-10 13:40:45 +02:00
Ivan Kruglov f6cb4d4afb machine: switch to use PidRef when lookup machine by pid in dbus and varlink interfaces
This commit includes adding introduce manager_get_machine_by_pidref() as a replacement for manager_get_machine_by_pid()
and moving surrounding code to utilise PidRef.
2024-10-10 13:40:45 +02:00
Ivan Kruglov 45a20e41df machine: use sd_json_dispatch_signal() in varlink code 2024-10-10 13:40:45 +02:00
Ivan Kruglov 18897460cf machine: remove redundant else if lookup_machine_by_name_or_pid() 2024-10-10 12:34:45 +02:00
Lennart Poettering 50ed3b1682 machined: use sd_json_dispatch_uint() when parsing CID
This is preferable, because we will accept CIDs encoded as strings too
now, as we do for all other integers. Also, it's shorter. Yay!
2024-10-10 11:34:47 +02:00
Daan De Meyer 61808636a7 Merge pull request #34679 from DaanDeMeyer/bus-log
Various logging improvements
2024-10-09 11:42:26 +02:00
Daan De Meyer d8a77d55e6 bus-util: Log more information when connecting to a bus socket fails
Let's log about which bus we're trying to connect to and what transport
we're using to do it.
2024-10-09 10:27:53 +02:00
Ivan Kruglov 144128d317 machine: extend io.systemd.Machine.List output with sshPrivateKeyPath field
Effectivelly, this is an implementation of GetMachineSSHInfo in dbus.
2024-10-07 14:50:16 +02:00
Ivan Kruglov 0c3191a506 machine: use JSON_BUILD_PAIR_STRING_NON_EMPTY() in io.systemd.Machine.List output 2024-10-07 14:49:55 +02:00
Ivan Kruglov 17d9f172eb machine: introduce io.systemd.Machine.Kill varlink method 2024-10-07 14:45:49 +02:00
Ivan Kruglov 6bb6354b4f machine: introduce io.systemd.Machine.Terminate varlink method 2024-10-07 14:45:49 +02:00
Ivan Kruglov 7999aa2c79 machine: introduce io.systemd.Machine.Unregister varlink method 2024-10-07 14:45:49 +02:00