Skip to content

Commit f3e3bea

Browse files
committed
CA-426596: Supports SM feature removing
In current xapi_sm.ml, the quired new sm features at XAPI start goes to pending_features. After all hosts reporting the new sm features, they are set in xapi-db. However, when the sm feature is removed, the item still exists. For example, xapi-storage-plugins-xfs remove SR_PROB as it is not implemented, but XAPI doesn't detect it. It leads to fresh-installed host (withour xfs SR_PROB) can't join the pool (with xfs SR_PROB) due to POOL_JOINING_SM_FEATURES_INCOMPATIBLE. Considering the pending_features, it wants to keep the minimal common features all over the hosts. As the same principle, the removed feature shall be removed immediately in the pool-level sm table. One host reports the feature is removed, it be removed from pool-level db. Signed-off-by: Changlei Li <changlei.li@citrix.com>
1 parent d317bbf commit f3e3bea

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

ocaml/xapi/xapi_sm.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,18 @@ let update_from_query_result ~__context (self, r) q_result =
109109
if _type <> "storage_access" then (
110110
let driver_filename = Sm_exec.cmd_name q_result.driver in
111111
let existing_features = Db.SM.get_features ~__context ~self in
112+
let query_features = Smint.Feature.parse_string_int64 q_result.features in
113+
let retained_features =
114+
List.filter (fun x -> List.mem x query_features) existing_features
115+
in
112116
let new_features =
113-
Smint.Feature.parse_string_int64 q_result.features
117+
query_features
114118
|> find_pending_features existing_features
115119
|> addto_pending_hosts_features ~__context self
116120
|> valid_hosts_pending_features ~__context
117121
in
118122
remove_valid_features_from_pending ~__context ~self new_features ;
119-
let features = existing_features @ new_features in
123+
let features = retained_features @ new_features in
120124
List.iter
121125
(fun (f, v) -> debug "%s: declaring new features %s:%Ld" __FUNCTION__ f v)
122126
new_features ;

0 commit comments

Comments
 (0)