mon/OSDMonitor: Add key/value arguments for pool tagging

Enable the OSDMon to add keys and values to pool tags by application.

Signed-off-by: Douglas Fuller <dfuller@redhat.com>
This commit is contained in:
Douglas Fuller 2017-08-23 16:34:07 -04:00
parent e31075fd1d
commit d812569dbd
2 changed files with 11 additions and 3 deletions

View File

@ -3130,7 +3130,9 @@ void OSDMonitor::check_pg_creates_sub(Subscription *sub)
}
void OSDMonitor::do_application_enable(int64_t pool_id,
const std::string &app_name)
const std::string &app_name,
const std::string &app_key,
const std::string &app_value)
{
assert(paxos->is_plugged() && is_writeable());
@ -3147,7 +3149,11 @@ void OSDMonitor::do_application_enable(int64_t pool_id,
p = pending_inc.new_pools[pool_id];
}
p.application_metadata.insert({app_name, {}});
if (app_key.empty()) {
p.application_metadata.insert({app_name, {}});
} else {
p.application_metadata.insert({app_name, {{app_key, app_value}}});
}
p.last_change = pending_inc.epoch;
pending_inc.new_pools[pool_id] = p;
}

View File

@ -539,7 +539,9 @@ public:
void check_osdmap_sub(Subscription *sub);
void check_pg_creates_sub(Subscription *sub);
void do_application_enable(int64_t pool_id, const std::string &app_name);
void do_application_enable(int64_t pool_id, const std::string &app_name,
const std::string &app_key="",
const std::string &app_value="");
void add_flag(int flag) {
if (!(osdmap.flags & flag)) {