Skip to content

Commit 42224cd

Browse files
CA-135187: Filter out restricted device_config keys
A commit fixing SCTX-1616 now causes PBD create to throw an error if given a device_config with the SRmaster key in (internal use only). However, if this happened to exist from a time when this was not forbidden then pool join will fail since the slave uses the device_config from the master's PBD record which might contain this key. This commit filters this key out in the pool join code-path. Signed-off-by: Si Beaumont <[email protected]>
1 parent 45c85c7 commit 42224cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ocaml/xapi/create_storage.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ let create_storage (me: API.ref_host) rpc session_id __context : unit =
7979
let maybe_create_pbd_for_shared_sr s =
8080
let mpbd,mpbd_rec = List.find (fun (_,pbdr)->pbdr.API.pBD_SR = s) master_pbds in
8181
let master_devconf = mpbd_rec.API.pBD_device_config in
82-
maybe_create_pbd rpc session_id s master_devconf me (* copy device config from master *) in
83-
List.iter (fun s -> try ignore (maybe_create_pbd_for_shared_sr s) with _ -> ()) shared_sr_refs
82+
let my_devconf = List.remove_assoc "SRmaster" master_devconf in (* this should never be used *)
83+
maybe_create_pbd rpc session_id s my_devconf me
84+
in
85+
List.iter (fun s -> try ignore (maybe_create_pbd_for_shared_sr s) with _ -> ()) shared_sr_refs
8486
in
8587

8688
let other_config =

0 commit comments

Comments
 (0)