diff options
author | Luca Boccassi <bluca@debian.org> | 2024-11-02 13:06:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-02 13:06:23 +0100 |
commit | 89099136d7c28310d7159817c90e970c62a995ec (patch) | |
tree | 3e5782358328f5f1608fcf217c0400538e6ce598 /src/shared | |
parent | Add support for id-mapped mounts to Exec directories (#34078) (diff) | |
parent | machine: remove redundant --more in TEST-13-NSPAWN.machined (diff) | |
download | systemd-89099136d7c28310d7159817c90e970c62a995ec.tar.xz systemd-89099136d7c28310d7159817c90e970c62a995ec.zip |
machine: introduce io.systemd.MachineImage.{Clone, Remove} methods (#34853)
This PR introduces io.systemd.MachineImage.Clone and Remove methods.
They are 1:1 mapping to DBus alternatives.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/varlink-io.systemd.MachineImage.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/shared/varlink-io.systemd.MachineImage.c b/src/shared/varlink-io.systemd.MachineImage.c index 5d3b3fd32f..813b6c8e68 100644 --- a/src/shared/varlink-io.systemd.MachineImage.c +++ b/src/shared/varlink-io.systemd.MachineImage.c @@ -53,19 +53,35 @@ static SD_VARLINK_DEFINE_METHOD_FULL( SD_VARLINK_FIELD_COMMENT("OS release information of an image. It contains an array of key value pairs read from the os-release(5) file in the image."), SD_VARLINK_DEFINE_OUTPUT(OSRelease, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY)); +#define VARLINK_DEFINE_IMAGE_LOOKUP_AND_POLKIT_FIELDS \ + SD_VARLINK_FIELD_COMMENT("The name of an image"), \ + SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0), \ + VARLINK_DEFINE_POLKIT_INPUT + static SD_VARLINK_DEFINE_METHOD( Update, - SD_VARLINK_FIELD_COMMENT("The name of a image to update."), - SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0), + VARLINK_DEFINE_IMAGE_LOOKUP_AND_POLKIT_FIELDS, SD_VARLINK_FIELD_COMMENT("If non-null the new name of the image"), SD_VARLINK_DEFINE_INPUT(newName, SD_VARLINK_STRING, SD_VARLINK_NULLABLE), SD_VARLINK_FIELD_COMMENT("If non-null value of the read-only flag of the image"), SD_VARLINK_DEFINE_INPUT(readOnly, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE), SD_VARLINK_FIELD_COMMENT("If non-null value of image quota limit"), - SD_VARLINK_DEFINE_INPUT(limit, SD_VARLINK_INT, SD_VARLINK_NULLABLE), - VARLINK_DEFINE_POLKIT_INPUT); + SD_VARLINK_DEFINE_INPUT(limit, SD_VARLINK_INT, SD_VARLINK_NULLABLE)); + +static SD_VARLINK_DEFINE_METHOD( + Clone, + VARLINK_DEFINE_IMAGE_LOOKUP_AND_POLKIT_FIELDS, + SD_VARLINK_FIELD_COMMENT("The new name of the image"), + SD_VARLINK_DEFINE_INPUT(newName, SD_VARLINK_STRING, 0), + SD_VARLINK_FIELD_COMMENT("If non-null value of the read-only flag of the image"), + SD_VARLINK_DEFINE_INPUT(readOnly, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE)); + +static SD_VARLINK_DEFINE_METHOD( + Remove, + VARLINK_DEFINE_IMAGE_LOOKUP_AND_POLKIT_FIELDS); static SD_VARLINK_DEFINE_ERROR(NoSuchImage); +static SD_VARLINK_DEFINE_ERROR(TooManyOperations); SD_VARLINK_DEFINE_INTERFACE( io_systemd_MachineImage, @@ -76,5 +92,11 @@ SD_VARLINK_DEFINE_INTERFACE( &vl_method_List, SD_VARLINK_SYMBOL_COMMENT("Update image allowing to rename or toggle read-only flag"), &vl_method_Update, + SD_VARLINK_SYMBOL_COMMENT("Clone image"), + &vl_method_Clone, + SD_VARLINK_SYMBOL_COMMENT("Remove image"), + &vl_method_Remove, SD_VARLINK_SYMBOL_COMMENT("No matching image exists"), - &vl_error_NoSuchImage); + &vl_error_NoSuchImage, + SD_VARLINK_SYMBOL_COMMENT("Too many ongoing background operations"), + &vl_error_TooManyOperations); |