Skip to content

Commit efc5b30

Browse files
author
Christian Lindig
committed
CA-408048 remove SM plugins from DB if unavailable
An SM plugin might become unavailable; we have to remove its record on xapi startup. The canonical case is an upgrade from XS8 to XS9. Signed-off-by: Christian Lindig <[email protected]>
1 parent c3ec050 commit efc5b30

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ocaml/xapi/storage_access.ml

+9-3
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,16 @@ exception Message_switch_failure
109109
(** Synchronise the SM table with the SMAPIv1 plugins on the disk and the SMAPIv2
110110
plugins mentioned in the configuration file whitelist. *)
111111
let on_xapi_start ~__context =
112+
(* An SM is either implemented as a plugin - for which we check its
113+
presence, or via an API *)
114+
let is_available (_rf, rc) =
115+
Sys.file_exists rc.API.sM_driver_filename
116+
|| Version.String.ge rc.sM_required_api_version "5.0"
117+
in
112118
let existing =
113-
List.map
114-
(fun (rf, rc) -> (rc.API.sM_type, (rf, rc)))
115-
(Db.SM.get_all_records ~__context)
119+
Db.SM.get_all_records ~__context
120+
|> List.filter is_available
121+
|> List.map (fun (rf, rc) -> (rc.API.sM_type, (rf, rc)))
116122
in
117123
let explicitly_configured_drivers =
118124
List.filter_map

0 commit comments

Comments
 (0)