CA-408048 remove SM plugins from DB if unavailable#6401
Conversation
psafont
left a comment
There was a problem hiding this comment.
Is this independent from the protect SM plugin list in xapi.conf?
There was a problem hiding this comment.
This LGTM, if a SM driver is not present in the file system, then there is no point creating an SM object in the database. But this won't help with the deletion of an existing SM though. Imagine an SM object is present in the db, and then it gets removed by the storage layer, then this code will not remove it, as it is not in the list existing
List.iter
(fun ty ->
info
"Unregistering SM plugin %s since not in the whitelist and not in-use"
ty ;
let self, _ = List.assoc ty existing in
try Db.SM.destroy ~__context ~self with _ -> ()
)
(Listext.List.set_difference (List.map fst existing) to_keep) ;|
My intention is to remove SM objects from the DB that have no corresponding plugin. I believe this is the root of the problem that we are trying to fix. Are you saying this is not sufficient? |
|
This somehow ends up with two SM objects for ifs, gfs2, tmpfs but I don't understand why. This leads to failure of pool join where we check that each type exists once. These duplicates are types that are not in the (xapi.conf) whitelist. |
38fbe79 to
4916089
Compare
| (* An SM is either implemented as a plugin - for which we check its | ||
| presence, or via an API *) | ||
| let is_available (_rf, rc) = | ||
| let ( >>= ) x y = String.compare x y >= 0 in |
There was a problem hiding this comment.
I did not want to redefine >= and indicate that we are using a non-standard relation. In general, version strings are highly ambiguous unless you restrict their syntax. What does 3a mean? Is this a string? Or a number based on an alphabet that has 0..9 and a..z? Or is this actually two fields of a number and a character and how do you define an order over this? So I think these strings are problematic.
4916089 to
d3031eb
Compare
We want to handle version strings reliably and not re-doscovering their problems over and over. Add a simple library together with tests. Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
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 <christian.lindig@cloud.com>
d3031eb to
efc5b30
Compare
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.