From 3bc032ad0e5416e2de472458c7919b628d8520df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 6 Jul 2021 14:13:44 +0200 Subject: [PATCH] pve6to7: use new flags API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the old one is not available post-upgrade, let's use a single codepath for this. the new API only allows querying user-settable flags, but the only flags we check besides 'noout' are not relevant for an upgrade of PVE 6.x to 7.x (PVE 6.x only supports Nautilus+ which requires these flags to be set in order to work) so we can just drop those outdated checks instead of extending/refactoring the API. Signed-off-by: Fabian Grünbichler --- PVE/CLI/pve6to7.pm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/PVE/CLI/pve6to7.pm b/PVE/CLI/pve6to7.pm index 41e8d9af..05460490 100644 --- a/PVE/CLI/pve6to7.pm +++ b/PVE/CLI/pve6to7.pm @@ -8,6 +8,7 @@ use PVE::API2::Ceph; use PVE::API2::LXC; use PVE::API2::Qemu; use PVE::API2::Certificates; +use PVE::API2::Cluster::Ceph; use PVE::AccessControl; use PVE::Ceph::Tools; @@ -392,9 +393,12 @@ sub check_ceph { log_info("getting Ceph status/health information.."); my $ceph_status = eval { PVE::API2::Ceph->status({ node => $nodename }); }; - my $osd_flags = eval { PVE::API2::Ceph->get_flags({ node => $nodename }); }; + my $noout = eval { PVE::API2::Cluster::Ceph->get_flag({ flag => "noout" }); }; + if ($@) { + log_fail("failed to get 'noout' flag status - $@"); + } + my $noout_wanted = 1; - my $noout = $osd_flags && $osd_flags =~ m/noout/; if (!$ceph_status || !$ceph_status->{health}) { log_fail("unable to determine Ceph status!"); @@ -412,17 +416,6 @@ sub check_ceph { } } - log_info("getting Ceph OSD flags.."); - eval { - if (!$osd_flags) { - log_fail("unable to get Ceph OSD flags!"); - } else { - if (!($osd_flags =~ m/recovery_deletes/ && $osd_flags =~ m/purged_snapdirs/)) { - log_fail("missing 'recovery_deletes' and/or 'purged_snapdirs' flag, scrub of all PGs required before upgrading to Nautilus!"); - } - } - }; - # TODO: check OSD min-required version, if to low it breaks stuff! log_info("getting Ceph daemon versions..");