From 91575e3a5ad4fe107d2e73e5b790d4b8d0069d6d Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 12 May 2026 12:54:13 +0200 Subject: [PATCH] varlink-io.systemd.MachineInstance,vmspawn: treat AddStorage/RemoveStorage name as opaque The 'name' field on AddStorage and RemoveStorage was documented as ':' and enforced via machine_storage_name_split() at the varlink boundary. That form is only the convention machinectl inherits from the StorageProvider routing path; the API itself only needs a unique identifier the caller can re-use to detach the binding. Drop the strict format check, require only a non-empty string, and update the IDL docs to describe the field as a caller-supplied identifier with machinectl's convention as a non-normative example. Signed-off-by: Christian Brauner (Amutable) --- src/shared/varlink-io.systemd.MachineInstance.c | 4 ++-- src/vmspawn/vmspawn-varlink.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/varlink-io.systemd.MachineInstance.c b/src/shared/varlink-io.systemd.MachineInstance.c index b496ea565c4..8aad8babb98 100644 --- a/src/shared/varlink-io.systemd.MachineInstance.c +++ b/src/shared/varlink-io.systemd.MachineInstance.c @@ -29,14 +29,14 @@ static SD_VARLINK_DEFINE_METHOD( AddStorage, SD_VARLINK_FIELD_COMMENT("Index of the attached file descriptor for the storage volume"), SD_VARLINK_DEFINE_INPUT(fileDescriptorIndex, SD_VARLINK_INT, 0), - SD_VARLINK_FIELD_COMMENT("Unique storage name of the form ':' identifying this binding for later removal"), + SD_VARLINK_FIELD_COMMENT("Caller-supplied identifier for this binding (any non-empty string; machinectl uses ':' from the StorageProvider, but the form is not required)"), SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0), SD_VARLINK_FIELD_COMMENT("Backend-specific configuration"), SD_VARLINK_DEFINE_INPUT(config, SD_VARLINK_STRING, SD_VARLINK_NULLABLE)); static SD_VARLINK_DEFINE_METHOD( RemoveStorage, - SD_VARLINK_FIELD_COMMENT("Unique storage name ':' to detach"), + SD_VARLINK_FIELD_COMMENT("Identifier of the binding to detach (as supplied to AddStorage)"), SD_VARLINK_DEFINE_INPUT(name, SD_VARLINK_STRING, 0)); static SD_VARLINK_DEFINE_METHOD( diff --git a/src/vmspawn/vmspawn-varlink.c b/src/vmspawn/vmspawn-varlink.c index cb56a5a5979..ebfdd878761 100644 --- a/src/vmspawn/vmspawn-varlink.c +++ b/src/vmspawn/vmspawn-varlink.c @@ -197,7 +197,7 @@ static int vl_method_add_storage(sd_varlink *link, sd_json_variant *parameters, if (r != 0) return r; - if (machine_storage_name_split(p.name, /* ret_provider= */ NULL, /* ret_volume= */ NULL) < 0) + if (isempty(p.name)) return sd_varlink_error_invalid_parameter_name(link, "name"); if (disk_type_from_bind_volume_config(p.config) < 0) @@ -239,7 +239,7 @@ static int vl_method_remove_storage(sd_varlink *link, sd_json_variant *parameter if (r != 0) return r; - if (machine_storage_name_split(p.name, /* ret_provider= */ NULL, /* ret_volume= */ NULL) < 0) + if (isempty(p.name)) return sd_varlink_error_invalid_parameter_name(link, "name"); return vmspawn_qmp_remove_block_device(ctx->bridge, link, p.name); -- 2.47.3