@@ -111,13 +111,12 @@ exception Message_switch_failure
111111let on_xapi_start ~__context =
112112 (* An SM is either implemented as a plugin - for which we check its
113113 presence, or via an API *)
114- let is_available ( _rf , rc ) =
114+ let is_available rc =
115115 Sys. file_exists rc.API. sM_driver_filename
116116 || Version.String. ge rc.sM_required_api_version " 5.0"
117117 in
118118 let existing =
119119 Db.SM. get_all_records ~__context
120- |> List. filter is_available
121120 |> List. map (fun (rf , rc ) -> (rc.API. sM_type, (rf, rc)))
122121 in
123122 let explicitly_configured_drivers =
@@ -172,6 +171,9 @@ let on_xapi_start ~__context =
172171 in
173172 (* Add all the running SMAPIv2 drivers *)
174173 let to_keep = to_keep @ running_smapiv2_drivers in
174+ let unavailable =
175+ List. filter (fun (_ , (_ , rc )) -> not (is_available rc)) existing
176+ in
175177 (* Delete all records which aren't configured or in-use *)
176178 List. iter
177179 (fun ty ->
@@ -181,7 +183,12 @@ let on_xapi_start ~__context =
181183 let self, _ = List. assoc ty existing in
182184 try Db.SM. destroy ~__context ~self with _ -> ()
183185 )
184- (Listext.List. set_difference (List. map fst existing) to_keep) ;
186+ (List. concat
187+ [
188+ Listext.List. set_difference (List. map fst existing) to_keep
189+ ; List. map fst unavailable
190+ ]
191+ ) ;
185192
186193 (* Synchronize SMAPIv1 plugins *)
187194
0 commit comments