Skip to content

CP-54034: Expose expected_votes in Cluster object #6374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Vincent-lau
Copy link
Contributor

The expected_votes field in corosync represents the number of hosts that is expected by the cluster stack. In the context of corosync, this is the same as the number of hosts as in the corosync.conf file*. This is a useful field to expose to the user so that they can see how many nodes actually are expected.

We also have Cluster_host object, which represents xapi's view of what nodes should be in the cluster, but that might not be identical to corosync's view, especially when a host is disabled, but is still left in the list of Cluster_host objects.

Although one could argue that we could infer this expected_votes field from the number of enabled Cluster_hosts, it might still be useful to get this information directly from corosync.

*: there are ways in corosync to make one host cast multiple votes, but that feature is not used.

@@ -219,6 +219,9 @@ let t =
; field ~qualifier:DynamicRO ~lifecycle:[] ~ty:Int "live_hosts"
~default_value:(Some (VInt 0L))
"Current number of live hosts, according to the cluster stack"
; field ~qualifier:DynamicRO ~lifecycle:[] ~ty:Int "expected_hosts"
~default_value:(Some (VInt 0L))
"Total number of hosts expected by the cluster stack"
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand the exact meaning of "expected by the cluster stack". Is that the amount of nodes that the cluster stack has been configured with?

Copy link
Contributor

Choose a reason for hiding this comment

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

While I understand that it's useful to expose the information for debugging, the difference in semantics of these numbers is quite subtle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I understand the exact meaning of "expected by the cluster stack". Is that the amount of nodes that the cluster stack has been configured with?

Precisely

@@ -219,6 +219,9 @@ let t =
; field ~qualifier:DynamicRO ~lifecycle:[] ~ty:Int "live_hosts"
~default_value:(Some (VInt 0L))
"Current number of live hosts, according to the cluster stack"
; field ~qualifier:DynamicRO ~lifecycle:[] ~ty:Int "expected_hosts"
~default_value:(Some (VInt 0L))
"Total number of hosts expected by the cluster stack"
Copy link
Contributor

Choose a reason for hiding this comment

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

While I understand that it's useful to expose the information for debugging, the difference in semantics of these numbers is quite subtle.

@Vincent-lau Vincent-lau force-pushed the private/shul2/expected-votes branch from 0081355 to 076e7d8 Compare March 19, 2025 16:59
@Vincent-lau Vincent-lau force-pushed the private/shul2/expected-votes branch 2 times, most recently from 3ca42fe to 46a66c3 Compare April 23, 2025 12:44
The `expected_votes` field in corosync represents the number of hosts
that is expected by the cluster stack. In the context of corosync, this
is the same as the number of hosts as in the corosync.conf file*. This
is a useful field to expose to the user so that they can see how many
nodes actually are expected.

We also have `Cluster_host` object, which represents xapi's view of what
nodes should be in the cluster, but that might not be identical to
corosync's view, especially when a host is disabled, but is still left
in the list of Cluster_host objects.

Although one could argue that we could infer this `expected_votes` field
from the number of enabled Cluster_hosts, it might still be useful to
get this information directly from corosync.

*: there are ways in corosync to make one host cast multiple votes, but
that feature is not used.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
@robhoes robhoes added this pull request to the merge queue Apr 23, 2025
Merged via the queue into xapi-project:master with commit 8d8aa9a Apr 23, 2025
17 checks passed
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