diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-02-17 17:19:57 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-02-17 17:49:21 +0100 |
commit | 90adaa25e894a580930ef2c3e65ab8db8295515a (patch) | |
tree | 32cefc482936a9dc4d6f6183fa900d917b443504 /src/machine/machined-dbus.c | |
parent | 0974a682d155a5874123ba7de9c1e314c6681e0f (diff) |
machined: move logic for bind mounting into containers from machinectl to machined
This extends the bus interface, adding BindMountMachine() for bind
mounting directories from the host into the container.
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index ac19695c92..2b06d994a8 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -559,6 +559,27 @@ static int method_open_machine_login(sd_bus *bus, sd_bus_message *message, void return bus_machine_method_open_login(bus, message, machine, error); } +static int method_bind_mount_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { + Manager *m = userdata; + Machine *machine; + const char *name; + int r; + + assert(bus); + assert(message); + assert(m); + + r = sd_bus_message_read(message, "s", &name); + if (r < 0) + return r; + + machine = hashmap_get(m->machines, name); + if (!machine) + return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name); + + return bus_machine_method_bind_mount(bus, message, machine, error); +} + static int method_remove_image(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_(image_unrefp) Image* i = NULL; const char *name; @@ -672,6 +693,7 @@ const sd_bus_vtable manager_vtable[] = { SD_BUS_METHOD("RenameImage", "ss", NULL, method_rename_image, 0), SD_BUS_METHOD("CloneImage", "ssb", NULL, method_clone_image, 0), SD_BUS_METHOD("MarkImageReadOnly", "sb", NULL, method_mark_image_read_only, 0), + SD_BUS_METHOD("BindMountMachine", "sssbb", NULL, method_bind_mount_machine, 0), SD_BUS_SIGNAL("MachineNew", "so", 0), SD_BUS_SIGNAL("MachineRemoved", "so", 0), SD_BUS_VTABLE_END |