public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Kefu Chai <k.chai@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager 2/5] ceph: add pveceph upgrade-check command
Date: Tue, 28 Apr 2026 10:45:35 +0800	[thread overview]
Message-ID: <20260428024538.3559017-3-k.chai@proxmox.com> (raw)
In-Reply-To: <20260428024538.3559017-1-k.chai@proxmox.com>

Expose the Ceph upgrade checks via a new 'pveceph upgrade-check'
subcommand, so operators can run a post-upgrade Ceph readiness check
against the release they are currently running, independently of a PVE
major-version upgrade.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
---
 PVE/CLI/pveceph.pm | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm
index d8867106..e5bbbdce 100755
--- a/PVE/CLI/pveceph.pm
+++ b/PVE/CLI/pveceph.pm
@@ -24,6 +24,7 @@ use PVE::Tools qw(run_command);
 use PVE::Ceph::Releases;
 use PVE::Ceph::Services;
 use PVE::Ceph::Tools;
+use PVE::Ceph::UpgradeCheck;
 
 use PVE::API2::Ceph;
 use PVE::API2::Ceph::FS;
@@ -498,6 +499,49 @@ __PACKAGE__->register_method({
     },
 });
 
+__PACKAGE__->register_method({
+    name => 'upgrade-check',
+    path => 'upgrade-check',
+    method => 'GET',
+    description =>
+        "Run post-upgrade Ceph readiness checks for the currently installed release.",
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            node => get_standard_option('pve-node'),
+        },
+    },
+    returns => { type => 'null' },
+    code => sub {
+        my ($param) = @_;
+
+        my $supported_release = PVE::Ceph::Tools::get_local_version(1);
+        if (!$supported_release) {
+            my $default_codename = PVE::Ceph::Releases::get_default_ceph_release_codename();
+            my $info = PVE::Ceph::Releases::get_ceph_release_info($default_codename);
+            $supported_release = int($info->{release}) if $info;
+        }
+        die "could not determine local Ceph major release\n" if !$supported_release;
+
+        my $messages = PVE::Ceph::UpgradeCheck::run_checks(
+            nodename => $param->{node},
+            supported_release => $supported_release,
+        );
+
+        my $counters = { pass => 0, info => 0, notice => 0, warn => 0, fail => 0, skip => 0 };
+        for my $m ($messages->@*) {
+            $counters->{ $m->{level} }++ if exists $counters->{ $m->{level} };
+            print uc($m->{level}) . ": $m->{msg}\n";
+        }
+
+        print "\n";
+        print "Summary: $counters->{pass} pass, $counters->{notice} notices,"
+            . " $counters->{warn} warnings, $counters->{fail} failures.\n";
+
+        return undef;
+    },
+});
+
 my $format_osddetails = sub {
     my ($data, $schema, $options) = @_;
 
@@ -616,6 +660,7 @@ our $cmddef = {
     install => [__PACKAGE__, 'install', []],
     purge => [__PACKAGE__, 'purge', []],
     status => [__PACKAGE__, 'status', []],
+    'upgrade-check' => [__PACKAGE__, 'upgrade-check', [], { node => $nodename }],
 };
 
 1;
-- 
2.47.3





  parent reply	other threads:[~2026-04-28  2:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  2:45 [PATCH manager 0/5] ceph: add 'pveceph upgrade-check' subcommand Kefu Chai
2026-04-28  2:45 ` [PATCH manager 1/5] pve8to9: extract ceph checks into PVE::Ceph::UpgradeCheck Kefu Chai
2026-04-28  2:45 ` Kefu Chai [this message]
2026-04-28  2:45 ` [PATCH manager 3/5] ceph: add require_osd_release upgrade check Kefu Chai
2026-04-28  2:45 ` [PATCH manager 4/5] ceph: add require_min_compat_client " Kefu Chai
2026-04-28  2:45 ` [PATCH manager 5/5] ceph: drop duplicate release-to-codename map in upgrade checks Kefu Chai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260428024538.3559017-3-k.chai@proxmox.com \
    --to=k.chai@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal