]> git.ipfire.org Git - thirdparty/systemd.git/commit
vmspawn: implement io.systemd.MachineInstance.AddStorage / RemoveStorage
authorChristian Brauner <brauner@kernel.org>
Fri, 1 May 2026 11:36:21 +0000 (13:36 +0200)
committerChristian Brauner <brauner@kernel.org>
Wed, 6 May 2026 08:30:17 +0000 (10:30 +0200)
commite7eac392ef87879451fdca337bb2ccd0113c1a86
tree95c0b119f62c6a229deb6bb96299dd24a13302db
parent413fd62dd79c1983d4c2ec93570fb85f8167d242
vmspawn: implement io.systemd.MachineInstance.AddStorage / RemoveStorage

Wire up the runtime hotplug Varlink methods on the per-VM control
socket:

  AddStorage  → take fd from the link, look up the DiskType from the
                'config' field, build a DriveInfo flagged
                QMP_DRIVE_REMOVABLE, dispatch to
                vmspawn_qmp_add_block_device(). Reply delivered async
                by on_add_device_add_complete() once the guest sees
                the device.

  RemoveStorage → forward the user-visible name to
                  vmspawn_qmp_remove_block_device(); the existing
                  device_del / DEVICE_DELETED / blockdev-del chain
                  replies on the link.

Add SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT to the server flags so
clients can push storage fds across via sd_varlink_push_fd().

Maps -EEXIST → StorageExists and -EOPNOTSUPP/-EINVAL →
ConfigNotSupported in the AddStorage handler so callers see the
specific MachineInstance errors.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
src/vmspawn/vmspawn-varlink.c