]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
varlink-io.systemd.MachineInstance,vmspawn: treat AddStorage/RemoveStorage name as... 42017/head
authorChristian Brauner <brauner@kernel.org>
Tue, 12 May 2026 10:54:13 +0000 (12:54 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 12 May 2026 20:54:08 +0000 (22:54 +0200)
The 'name' field on AddStorage and RemoveStorage was documented as
'<provider>:<volume>' 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) <brauner@kernel.org>
src/shared/varlink-io.systemd.MachineInstance.c
src/vmspawn/vmspawn-varlink.c

index b496ea565c48134999cea2627c525e4d93c6f568..8aad8babb98f7e7bd691c5f71a237c42a8aa98cf 100644 (file)
@@ -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 '<provider>:<volume>' identifying this binding for later removal"),
+                SD_VARLINK_FIELD_COMMENT("Caller-supplied identifier for this binding (any non-empty string; machinectl uses '<provider>:<volume>' 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 '<provider>:<volume>' 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(
index cb56a5a59799632c95db6e8aaa676920e193ab46..ebfdd878761bd0d0dd22acaca40fc29a5dfff259 100644 (file)
@@ -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);