Skip to content
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

CP-49634: Add alerting for Corosync upgrade #5646

Merged

Conversation

Vincent-lau
Copy link
Contributor

@Vincent-lau Vincent-lau commented May 21, 2024

Xapi will send alert when the user is running on a Corosync 2 cluster and prompting them to upgrade. This should only happen on XS 9 and is behind the corosync3 feature flag.

XenCenter can take advantage of this alert message, but should have its own warning message to tell the user why/how to perform the upgrade.

Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #5646     +/-   ##
========================================
- Coverage    51.4%   44.7%   -6.7%     
========================================
  Files          13      16      +3     
  Lines        1928    2206    +278     
========================================
- Hits          991     988      -3     
- Misses        937    1218    +281     

see 5 files with indirect coverage changes

Flag Coverage Δ
python2.7 45.5% <ø> (?)
python3.11 51.3% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@Vincent-lau
Copy link
Contributor Author

Vincent-lau commented May 21, 2024

emm I did not change any python scripts, why do I get lower coverage?

@psafont
Copy link
Member

psafont commented May 22, 2024

I don't think we've changed the CI lately to make these appear? I'll take a look into why

@Vincent-lau Vincent-lau force-pushed the private/shul2/corosync3-msg branch from 7a26270 to d321bb4 Compare May 22, 2024 16:23
@@ -517,6 +517,12 @@ module Watcher = struct
performing update"
__FUNCTION__ (Printexc.to_string exn)

let cluster_change_watcher : Thread.t option ref = ref None
Copy link
Member

Choose a reason for hiding this comment

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

Is the modern OCaml 5-ready way to use Atomic for this now?

| None ->
debug "%s: No cluster host, no need to watch" __FUNCTION__
) ;
Ptime.Span.of_d_ps (7, 0L)
Copy link
Member

Choose a reason for hiding this comment

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

This is waiting for seven days?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new implementation is going to send this as a one-off message

Comment on lines 573 to 609
let body =
"The current cluster stack version of Corosync 2 is out of date, \
consider updating to Corosync 3"
in
let name, priority = Api_messages.cluster_stack_out_of_date in
let host_uuid = Db.Host.get_uuid ~__context ~self:host in

Helpers.call_api_functions ~__context (fun rpc session_id ->
ignore
@@ Client.Client.Message.create ~rpc ~session_id ~name ~priority
~cls:`Host ~obj_uuid:host_uuid ~body
)
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we are missing () to include this in the then block.

Also, if we have detected Corosync 3, then we can just exit the thread?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can do that as well. I was thinking about sending periodic notifications to the user urging them to do the upgrade, which has a 7-day period

Copy link
Member

Choose a reason for hiding this comment

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

With this code, a cluster_stack_out_of_date message is sent even if the cluster stack is not out of date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are absolutely right, I am missing a bracket around the if statement

Copy link
Member

@robhoes robhoes left a comment

Choose a reason for hiding this comment

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

The alert is raised outside of the conditional that checks for the Corosync version, so even when running Corosync 3.

@Vincent-lau
Copy link
Contributor Author

Vincent-lau commented Jun 19, 2024

Let's wait for #5696 for the watcher refactoring code, and Atomic before making changes to this PR.

@Vincent-lau Vincent-lau force-pushed the private/shul2/corosync3-msg branch from d321bb4 to b6def12 Compare June 21, 2024 11:34
@Vincent-lau Vincent-lau force-pushed the private/shul2/corosync3-msg branch 2 times, most recently from 08ad258 to c65117a Compare July 11, 2024 09:52
@Vincent-lau
Copy link
Contributor Author

#5696 merged, and issues fixed, ready for review again

@Vincent-lau Vincent-lau requested a review from robhoes July 15, 2024 13:37
@Vincent-lau Vincent-lau force-pushed the private/shul2/corosync3-msg branch 2 times, most recently from 0821b2b to 6577325 Compare July 16, 2024 15:54
Xapi will send alert when the user is running on a Corosync 2 cluster
and prompting them to upgrade. This should only happen on XS 9 and is
behind the corosync3 feature flag.

XenCenter can take advantage of this alert message, but should have its
own warning message to tell the user why/how to perform the upgrade.

Signed-off-by: Vincent Liu <[email protected]>
@Vincent-lau Vincent-lau merged commit 9f654a1 into xapi-project:master Jul 18, 2024
15 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.

3 participants