Skip to content

CA-426596: Supports SM feature removing#7042

Merged
changlei-li merged 2 commits intoxapi-project:26.1-lcmfrom
changlei-li:private/changleli/CA-426596-LCM
Apr 29, 2026
Merged

CA-426596: Supports SM feature removing#7042
changlei-li merged 2 commits intoxapi-project:26.1-lcmfrom
changlei-li:private/changleli/CA-426596-LCM

Conversation

@changlei-li
Copy link
Copy Markdown
Contributor

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. If one host reports the feature is removed, it should be removed from pool-level db.

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. If one host reports the feature
is removed, it should be removed from pool-level db.

Signed-off-by: Changlei Li <changlei.li@citrix.com>
Signed-off-by: Changlei Li <changlei.li@citrix.com>
@changlei-li changlei-li force-pushed the private/changleli/CA-426596-LCM branch from 557ac3b to f44069e Compare April 28, 2026 10:43
@changlei-li
Copy link
Copy Markdown
Contributor Author

changlei-li commented Apr 28, 2026

Test:

Apr 28 10:24:59 genuk-47-01d xapi: [debug||0 |dbsync (update_env) R:1c90a70d6e24|xapi_sm] Xapi_sm.update_from_query_result.(fun): removing features SR_PROBE:1

before xfs plugin update:

features (MRO): LARGE_VDI: 1; SR_ATTACH: 1; SR_CREATE: 1; SR_DELETE: 1; SR_DETACH: 1; SR_METADATA: 1; SR_PROBE: 1; SR_SCAN: 1; SR_UPDATE: 1; THIN_PROVISIONING: 1; VDI_ACTIVATE: 1; VDI_ACTIVATE_READONLY: 1; VDI_ATTACH: 1; VDI_ATTACH_OFFLINE: 1; VDI_CLONE: 1; VDI_COMPOSE: 1; VDI_CONFIG_CBT: 1; VDI_CREATE: 1; VDI_DEACTIVATE: 1; VDI_DELETE: 1; VDI_DETACH: 1; VDI_INTRODUCE: 1; VDI_RESET_ON_BOOT: 2; VDI_RESIZE: 1; VDI_SNAPSHOT: 1; VDI_UPDATE: 1

after xfs plugin update (and restart xapi):

features (MRO): LARGE_VDI: 1; SR_ATTACH: 1; SR_CREATE: 1; SR_DELETE: 1; SR_DETACH: 1; SR_METADATA: 1; SR_SCAN: 1; SR_UPDATE: 1; THIN_PROVISIONING: 1; VDI_ACTIVATE: 1; VDI_ACTIVATE_READONLY: 1; VDI_ATTACH: 1; VDI_ATTACH_OFFLINE: 1; VDI_CLONE: 1; VDI_COMPOSE: 1; VDI_CONFIG_CBT: 1; VDI_CREATE: 1; VDI_DEACTIVATE: 1; VDI_DELETE: 1; VDI_DETACH: 1; VDI_INTRODUCE: 1; VDI_RESET_ON_BOOT: 2; VDI_RESIZE: 1; VDI_SNAPSHOT: 1; VDI_UPDATE: 1

Comment thread ocaml/xapi/xapi_sm.ml
List.iter
(fun (f, v) -> debug "%s: removing features %s:%Ld" __FUNCTION__ f v)
removed_features ;
let retained_features =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an observation: the retained_features and removed_features are just the partition of whether each feature in existing_features being in query_features or not.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done in ocaml with

let retained_features, removed_features =
  List.partition (fun x -> List.mem x query_features) existing_features
in

@changlei-li changlei-li added this pull request to the merge queue Apr 29, 2026
Merged via the queue into xapi-project:26.1-lcm with commit 1c83d6d Apr 29, 2026
14 checks passed
pull Bot pushed a commit to acefei/xen-api that referenced this pull request Apr 29, 2026
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. If one host
reports the feature is removed, it should be removed from pool-level db.

This the forward port of PR xapi-project#7042.
@changlei-li changlei-li deleted the private/changleli/CA-426596-LCM branch April 30, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants