Skip to content

Commit 2caf397

Browse files
committed
CA-293335: Don't add extra sr_uuid to device_config on SR.attach
Remove this layering violation, where we always added an extra sr_uuid key to device_config before calling SR.attach. This is something that older versions of our own xapi-storage-plugins used, PVS did not use sr_uuid, so we can just remove this code completely. Signed-off-by: Gabor Igloi <[email protected]>
1 parent 00b6d1f commit 2caf397

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

main.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ module Compat(V : sig val version : string option ref end) : sig
135135
volumes in the output match the new volume record type and are
136136
successfully parsed by rpclib. *)
137137

138-
val compat_uri : device_config -> (compat_in, Storage_interface.Exception.exnty) Deferred.Result.t
139-
(** For the old PVS version, adds the uri parameter to the call from
140-
device_config, for newer versions, removes the uri key from device_config *)
141-
142138
val sr_create : device_config -> (device_config * compat_in * compat_out, Storage_interface.Exception.exnty) Deferred.Result.t
143139
(** Compatiblity for the old PVS version of SR.create, which had signature
144140
[uri -> name -> desc -> config -> unit] *)
141+
142+
val sr_attach : device_config -> (compat_in, Storage_interface.Exception.exnty) Deferred.Result.t
143+
(** Compatiblity for the old PVS version of SR.attach, which had signature
144+
[uri -> sr (=string)] *)
145145
end = struct
146146

147147
type device_config = (Core.String.t, string) Core.List.Assoc.t
@@ -182,6 +182,8 @@ end = struct
182182
let compat_out_volumes =
183183
add_fields_to_record_list_output ["sharable", R.Bool false]
184184

185+
(** Adds the uri parameter to the call from device_config when talking to the
186+
old PVS scripts *)
185187
let compat_uri device_config =
186188
if !V.version = Some pvs_version then
187189
match List.Assoc.find ~equal:String.equal device_config "uri" with
@@ -201,6 +203,8 @@ end = struct
201203
else rpc
202204
in
203205
return (Ok (device_config, compat_in, compat_out))
206+
207+
let sr_attach = compat_uri
204208
end
205209

206210
let check_plugin_version_compatible query_result =
@@ -685,11 +689,7 @@ let process_smapiv2_requests ~volume_script_dir =
685689
| { R.name = "SR.attach"; R.params = [ args ] } ->
686690
let args = Args.SR.Attach.request_of_rpc args in
687691
let device_config = args.Args.SR.Attach.device_config in
688-
Compat.compat_uri device_config >>>= fun compat_in ->
689-
let device_config =
690-
let uuid = args.Args.SR.Attach.sr in
691-
("sr_uuid", uuid) :: device_config
692-
in
692+
Compat.sr_attach device_config >>>= fun compat_in ->
693693
return_volume_rpc (fun () -> Sr_client.attach (volume_rpc ~compat_in) args.Args.SR.Attach.dbg device_config)
694694
>>>= fun attach_response ->
695695
let sr = args.Args.SR.Attach.sr in

0 commit comments

Comments
 (0)