]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: adjust pgp_num_target down along with pg_num_target as needed
authorSage Weil <sage@redhat.com>
Tue, 10 Apr 2018 16:16:42 +0000 (11:16 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 17:08:40 +0000 (12:08 -0500)
If the user asks to reduce pg_num, reduce pg_num_target too at the same
time.

Don't completely hide pgp_num yet (by increasing it when pg_num_target
increases).

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index ce47155e78e5f1917b94139f1b3c0f0ccec41e3c..6773a79203dacac83c9da737f94304939766c9ec 100644 (file)
@@ -6935,14 +6935,13 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
        ss << "nautilus OSDs are required to adjust pg_num_pending";
        return -EPERM;
       }
-      if (n < (int)p.get_pgp_num_target()) {
-       ss << "specified pg_num " << n
-          << " < pgp_num " << p.get_pgp_num_target();
-       return -EINVAL;
-      }
     }
     // set target; mgr will adjust pg_num_actual later
     p.set_pg_num_target(n);
+    // adjust pgp_num_target down too (as needed)
+    if (p.get_pgp_num_target() > n) {
+      p.set_pgp_num_target(n);
+    }
   } else if (var == "pgp_num_actual") {
     if (p.has_flag(pg_pool_t::FLAG_NOPGCHANGE)) {
       ss << "pool pgp_num change is disabled; you must unset nopgchange flag for the pool first";