Skip to content

Commit 88aa9a7

Browse files
committed
Only run SR.create compat fallback for PVS version of SM scripts
This makes the code stricter - previously we ran the compat code for all versions, and as a result we accepted an empty response, even from newer versions. This change will make the code stricter, and probably safer, now we'll fail if the newer storage scripts return an invalid, empty response from SR.create. Signed-off-by: Gabor Igloi <[email protected]>
1 parent 2caf397 commit 88aa9a7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

main.ml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,15 @@ end = struct
196196

197197
let sr_create device_config =
198198
compat_uri device_config >>>= fun compat_in ->
199-
let compat_out rpc =
200-
(* The PVS version will return nothing *)
201-
if rpc = R.Null then
202-
Rpcmarshal.marshal Xapi_storage.Control.typ_of_configuration device_config
203-
else rpc
199+
let compat_out =
200+
if !V.version = Some pvs_version then begin
201+
fun rpc ->
202+
(* The PVS version will return nothing *)
203+
if rpc = R.Null then
204+
Rpcmarshal.marshal Xapi_storage.Control.typ_of_configuration device_config
205+
else rpc
206+
end
207+
else id
204208
in
205209
return (Ok (device_config, compat_in, compat_out))
206210

0 commit comments

Comments
 (0)