Skip to content

Commit

Permalink
mon : add osdmap flags set and unset message when
Browse files Browse the repository at this point in the history
osdmap flags are already set and unset

Fixes: http://tracker.ceph.com/issues/15983

Signed-off-by: Vikhyat Umrao <vumrao@redhat.com>
  • Loading branch information
vumrao committed May 23, 2016
1 parent 0120d27 commit e2952af
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
12 changes: 12 additions & 0 deletions qa/workunits/cephtool/test.sh
Expand Up @@ -472,6 +472,18 @@ function test_tiering()
ceph osd pool delete basepoolA basepoolA --yes-i-really-really-mean-it
}

function test_osdmap_flag()
{
ceph osd set noout >& $TMPFILE || return 1
check_response "set noout"
ceph osd set noout >& $TMPFILE || return 1
check_response "noout flag is already set"
ceph osd unset noout >& $TMPFILE || return 1
check_response "unset noout"
ceph osd unset noout >& $TMPFILE || return 1
check_response "noout flag is not set"
}

function test_auth()
{
ceph auth add client.xx mon allow osd "allow *"
Expand Down
20 changes: 14 additions & 6 deletions src/mon/OSDMonitor.cc
Expand Up @@ -4806,10 +4806,14 @@ bool OSDMonitor::prepare_set_flag(MonOpRequestRef op, int flag)
ostringstream ss;
if (pending_inc.new_flags < 0)
pending_inc.new_flags = osdmap.get_flags();
pending_inc.new_flags |= flag;
ss << "set " << OSDMap::get_flag_string(flag);
if (osdmap.test_flag(flag)) {
ss << OSDMap::get_flag_string(flag) << " flag is already set";
} else {
pending_inc.new_flags |= flag;
ss << "set " << OSDMap::get_flag_string(flag);
}
wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, ss.str(),
get_last_committed() + 1));
get_last_committed() + 1));
return true;
}

Expand All @@ -4819,10 +4823,14 @@ bool OSDMonitor::prepare_unset_flag(MonOpRequestRef op, int flag)
ostringstream ss;
if (pending_inc.new_flags < 0)
pending_inc.new_flags = osdmap.get_flags();
pending_inc.new_flags &= ~flag;
ss << "unset " << OSDMap::get_flag_string(flag);
if (!osdmap.test_flag(flag)) {
ss << OSDMap::get_flag_string(flag) << " flag is not set";
} else {
pending_inc.new_flags &= ~flag;
ss << "unset " << OSDMap::get_flag_string(flag);
}
wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, ss.str(),
get_last_committed() + 1));
get_last_committed() + 1));
return true;
}

Expand Down

0 comments on commit e2952af

Please sign in to comment.