@@ -14406,6 +14406,33 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
1440614406 wait_for_commit (op, new Monitor::C_Command (mon, op, 0 , rs,
1440714407 get_last_committed () + 1 ));
1440814408 return true ;
14409+ } else if (prefix == " osd pool clear-availability-status" ) {
14410+ if (!g_conf ().get_val <bool >(" enable_availability_tracking" )) {
14411+ ss << " Availability tracking is disabled. Availability status can not be cleared "
14412+ << " while the feature is disabled. Enable it by setting the config "
14413+ << " option enable_availability_tracking to ``true`` then try again." ;
14414+ err = -EOPNOTSUPP;
14415+ goto reply_no_propose;
14416+ }
14417+
14418+ string pool_name;
14419+ cmd_getval (cmdmap, " pool" , pool_name);
14420+ int64_t pool_id = osdmap.lookup_pg_pool_name (pool_name);
14421+ // check if pool exists
14422+ if (pool_id < 0 ) {
14423+ ss << " unrecognized pool '" << pool_name << " '" ;
14424+ err = -ENOENT;
14425+ goto reply_no_propose;
14426+ }
14427+ std::map<uint64_t , PoolAvailability> pool_availability = mon.mgrstatmon ()->get_pool_availability ();
14428+ // check if pool exists in pool_availability
14429+ if (pool_availability.find (pool_id) == pool_availability.end ()){
14430+ ss << " unrecognized pool '" << pool_name << " '" ;
14431+ err = -ENOENT;
14432+ goto reply_no_propose;
14433+ }
14434+ // clear existing calculations
14435+ mon.mgrstatmon ()->clear_pool_availability (pool_id);
1440914436 } else if (prefix == " osd pool availability-status" ) {
1441014437 if (!g_conf ().get_val <bool >(" enable_availability_tracking" )) {
1441114438 ss << " availability tracking is disabled; you can enable it by setting the config option enable_availability_tracking" ;
0 commit comments