Merge PR #26727 into master

* refs/pull/26727/head:
	qa/standalone/osd/pg-split-merge: fix import_after_merge_and_gap
	osd: add 'send_beacon' tell/asok command(s)

Reviewed-by: Neha Ojha <nojha@redhat.com>
This commit is contained in:
Sage Weil 2019-03-04 08:13:34 -06:00
commit 0040c9915d
2 changed files with 39 additions and 8 deletions

View File

@ -53,20 +53,38 @@ function TEST_import_after_merge_and_gap() {
ceph osd set nodown
ceph osd unset nodown
done
# poke and prod to ensure last_epech_clean is big, reported to mon, and
# the osd is able to trim old maps
rados -p foo bench 1 write -b 1024 --no-cleanup || return 1
wait_for_clean || return 1
ceph osd down 0
sleep 3
wait_for_clean || return 1
ceph tell osd.0 send_beacon
sleep 5
ceph osd set nodown
ceph osd unset nodown
sleep 5
kill_daemons $dir TERM osd.0 || return 1
# this should fail.. 1.1 still doesn't exist
! ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 || return 1
# this should not
ceph-objectstore-tool --data-path $dir/0 --op export-remove --pgid 1.0 --force --file $dir/1.0.later || return 1
# this should fail too because of the gap
! ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 || return 1
! ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0 || return 1
# we can force it...
ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 --force || return 1
ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0 --force || return 1
# ...but the osd won't start, so remove it again.
ceph-objectstore-tool --data-path $dir/0 --op remove --pgid 1.0 --force || return 1
ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.1 --file $dir/1.1 || return 1
ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0 || return 1
ceph-objectstore-tool --data-path $dir/0 --op remove --pgid 1.1 --force || return 1
ceph-objectstore-tool --data-path $dir/0 --op import --pgid 1.0 --file $dir/1.0.later --force || return 1
activate_osd $dir 0 || return 1

View File

@ -2699,6 +2699,10 @@ will start to track new ops received afterwards.";
f->dump_string("device", "/dev/" + dev);
}
f->close_section();
} else if (admin_command == "send_beacon") {
if (is_active()) {
send_beacon(ceph::coarse_mono_clock::now());
}
} else {
ceph_abort_msg("broken asok registration");
}
@ -3360,6 +3364,9 @@ void OSD::final_init()
r = admin_socket->register_command("list_devices", "list_devices",
asok_hook,
"list OSD devices.");
r = admin_socket->register_command("send_beacon", "send_beacon",
asok_hook,
"send OSD beacon to mon immediately");
test_ops_hook = new TestOpsSocketHook(&(this->service), this->store);
// Note: pools are CephString instead of CephPoolname because
@ -6433,6 +6440,9 @@ COMMAND("cache drop",
COMMAND("cache status",
"Get OSD caches statistics",
"osd", "r")
COMMAND("send_beacon",
"Send OSD beacon to mon immediately",
"osd", "r")
};
void OSD::do_command(
@ -6958,8 +6968,11 @@ int OSD::_do_command(
store->dump_cache_stats(ds);
}
}
else {
else if (prefix == "send_beacon") {
if (is_active()) {
send_beacon(ceph::coarse_mono_clock::now());
}
} else {
ss << "unrecognized command '" << prefix << "'";
r = -EINVAL;
}