machine: introduce io.systemd.MachineImage.Update varlink method

io.systemd.MachineImage.Update implements the following dbus org.freedesktop.machine1.Manager interfaces:

- RenameImage
- MarkImageReadOnly
- SetImageLimit
This commit is contained in:
Ivan Kruglov
2024-10-14 11:09:18 +02:00
parent fb0ea6a6a3
commit 7809bd3ba7
5 changed files with 112 additions and 1 deletions
@@ -43,6 +43,18 @@ 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));
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),
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);
static SD_VARLINK_DEFINE_ERROR(NoSuchImage);
SD_VARLINK_DEFINE_INTERFACE(
@@ -50,5 +62,7 @@ SD_VARLINK_DEFINE_INTERFACE(
"io.systemd.MachineImage",
SD_VARLINK_SYMBOL_COMMENT("List images"),
&vl_method_List,
SD_VARLINK_SYMBOL_COMMENT("Update image allowing to rename or toggle read-only flag"),
&vl_method_Update,
SD_VARLINK_SYMBOL_COMMENT("No matching image exists"),
&vl_error_NoSuchImage);