exit 1
fi
+echo "Check mgr_status to ensure 'pending_modules' is empty..."
+expected='[]'
+mgr_status=$("$ceph" tell mgr mgr_status | jq -c '.pending_modules')
+if [[ "$mgr_status" == "$expected" ]]; then
+ echo "PASS: No modules are pending."
+else
+ echo "FAIL: Some modules are pending when they shouldn't be."
+ echo "Expected: $expected"
+ echo "Actual: $mgr_status"
+ exit 1
+fi
+
# ------ Test 2 ------
echo "Select balancer module to receive loading delays..."
"$ceph" config set mgr mgr_module_load_delay_name balancer
-echo "Test 2: Inject small delay (10000 ms) that should not exceed max loading retries"
+echo "Test 2: Inject small delay (10000 ms) that should not exceed max loading expiration"
"$ceph" config set mgr mgr_module_load_delay 10000
"$ceph" mgr fail
exit 1
fi
+echo "Check mgr_status to ensure 'pending_modules' is empty..."
+expected='[]'
+mgr_status=$("$ceph" tell mgr mgr_status | jq -c '.pending_modules')
+if [[ "$mgr_status" == "$expected" ]]; then
+ echo "PASS: No modules are pending."
+else
+ echo "FAIL: Some modules are pending when there shouldn't be."
+ echo "Expected: $expected"
+ echo "Actual: $mgr_status"
+ exit 1
+fi
+
# ------ Test 3 ------
-echo "Test 3: Inject large delay (10000000000 ms) that exceeds max loading retries and emits cluster error"
+echo "Test 3: Inject large delay (10000000000 ms) that exceeds max loading expiration and emits cluster error"
"$ceph" config set mgr mgr_module_load_delay 10000000000
"$ceph" mgr fail
exit 1
fi
+echo "Check mgr_status to ensure 'pending_modules' is populated with modules we expect..."
+expected='["balancer","cephadm","crash","devicehealth","iostat","nfs","orchestrator","pg_autoscaler","progress","rbd_support","status","telemetry","volumes"]'
+mgr_status=$("$ceph" tell mgr mgr_status | jq -c '.pending_modules')
+if [[ "$mgr_status" == "$expected" ]]; then
+ echo "PASS: Expected modules are pending."
+else
+ echo "FAIL: Expected output does not match actual."
+ echo "Expected: $expected"
+ echo "Actual: $mgr_status"
+ exit 1
+fi
+
# ----- Test 4 -----
echo "Test 4: Disable the problematic module and confirm that the health error goes away"
exit 1
fi
+echo "Check mgr_status to ensure 'pending_modules' is empty..."
+expected='[]'
+mgr_status=$("$ceph" tell mgr mgr_status | jq -c '.pending_modules')
+if [[ "$mgr_status" == "$expected" ]]; then
+ echo "PASS: No modules are pending."
+else
+ echo "FAIL: Some modules are pending when there shouldn't be."
+ echo "Expected: $expected"
+ echo "Actual: $mgr_status"
+ exit 1
+fi
+
+echo "Re-enabling the balancer module..."
+"$ceph" mgr module enable balancer
+
+# Give the health error a bit of time to clear
+sleep 10
+
echo "All tests passed."
try {
if (admin_command == "mgr_status") {
f->open_object_section("mgr_status");
- cluster_state.with_mgrmap(
- [f](const MgrMap& mm) {
- f->dump_unsigned("mgrmap_epoch", mm.get_epoch());
- });
- f->dump_bool("initialized", initialized);
+ {
+ cluster_state.with_mgrmap(
+ [f](const MgrMap& mm) {
+ f->dump_unsigned("mgrmap_epoch", mm.get_epoch());
+ });
+ f->dump_bool("initialized", initialized);
+ f->open_array_section("pending_modules");
+ for (auto& mod : py_module_registry->get_pending_modules()) {
+ f->dump_string("module", mod);
+ }
+ f->close_section();
f->close_section();
+ }
return 0;
} else {
return -ENOSYS;