[[ ! -z $TEST_EXIT_ON_ERROR ]] && exit_on_error=$TEST_EXIT_ON_ERROR
+if [ `uname` = FreeBSD ]; then
+ ETIMEDOUT=60
+else
+ ETIMEDOUT=110
+fi
+
+# monitor drops the subscribe message from client if it does not have enough caps
+# for read from mon. in that case, the client will be waiting for mgrmap in vain,
+# if it is instructed to send a command to mgr. "pg dump" is served by mgr. so,
+# we need to set a timeout for testing this scenario.
+export CEPH_ARGS='--rados-mon-op-timeout=5'
+
expect()
{
cmd=$1
expect "ceph -k $tmp.foo.keyring --user foo auth export" 13
expect "ceph -k $tmp.foo.keyring --user foo auth del client.bazar" 13
expect "ceph -k $tmp.foo.keyring --user foo osd dump" 13
-expect "ceph -k $tmp.foo.keyring --user foo pg dump" 13
+expect "ceph -k $tmp.foo.keyring --user foo pg dump" $ETIMEDOUT
expect "ceph -k $tmp.foo.keyring --user foo quorum_status" 13
ceph auth del client.foo
expect "ceph -k $tmp.bar.keyring --user bar auth export" 13
expect "ceph -k $tmp.bar.keyring --user bar auth del client.foo" 13
expect "ceph -k $tmp.bar.keyring --user bar osd dump" 13
-expect "ceph -k $tmp.bar.keyring --user bar pg dump" 13
+expect "ceph -k $tmp.bar.keyring --user bar pg dump" $ETIMEDOUT
expect "ceph -k $tmp.bar.keyring --user bar quorum_status" 13
ceph auth del client.bar
from ceph_argparse import \
concise_sig, descsort_key, parse_json_funcsigs, \
matchnum, validate_command, find_cmd_target, \
- send_command, json_command, run_in_thread
+ json_command, run_in_thread
from ceph_daemon import admin_socket, DaemonWatcher, Termsize
except KeyboardInterrupt:
print('Interrupted')
return ret, '', ''
-
+ if ret == errno.ETIMEDOUT:
+ ret = -ret
+ if not outs:
+ outs = ("Connection timed out. Please check the client's " +
+ "permission and connection.")
return ret, outbuf, outs
cond.Wait(lock);
return rval;
}
+
+ /// Wait until the \c secs expires or \c complete() is called
+ int wait_for(double secs) {
+ utime_t interval;
+ interval.set_from_double(secs);
+ Mutex::Locker l{lock};
+ cond.WaitInterval(lock, interval);
+ return done ? rval : ETIMEDOUT;
+ }
};
#endif