rados: improve watch command output

- hexdump the notify payload, and include all of the new metadata
- print error events too

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: separate WATCH from RECONNECT

Use WATCH op for the initial registration.  This is idempotent in that
it will succeed whether the watch information has been persisted or not.
It is used by the client if it does not know that it is registered.

The RECONNECT op is used for any subsequent session reconnect.  It will
fail if the watch state isn't already persisted on the OSD.

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: queue an error if reconnect fails

If we fail to reconnect, trigger the on_error (reusable) context to
let the user know about it.

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: send regular PING ops

Send a full PING op to the object to ensure we are still connected. For
now just use the existing ping interval; we may want to change this in
the future.

Signed-off-by: Sage Weil <sage@redhat.com>
clean up CEPH_WATCH_EVENT_* namespace, and make COMPLETE distinct

Use a proper prefix and make a separate event for the notify completion
message.

Signed-off-by: Sage Weil <sage@redhat.com>
ceph_test_rados_api_watch_notify: s/handle/cookie/

Use consist nameing for C and C++ tests.

Signed-off-by: Sage Weil <sage@redhat.com>
ceph_test_rados_api_watch_notify: verify we get the right # of notifies

Signed-off-by: Sage Weil <sage@redhat.com>
osd/Watch: fix comment typo

Signed-off-by: Sage Weil <sage@redhat.com>
osd/Watch: drop redundant in_progress_watchers

This is essentially watchers.size() at all times and obfuscates the code.
In particular this makes the maybe_complete_notify() logic much clearer.

Signed-off-by: Sage Weil <sage@redhat.com>
librados: behave if errcb is NULL

Signed-off-by: Sage Weil <sage@redhat.com>
librados: EINVAL on bad args to watch2

Signed-off-by: Sage Weil <sage@redhat.com>
osd/Watch: inform watchers when they cause a notify timeout

If a watcher doesn't ack in time, let them know that they triggered a
notify failure.

Signed-off-by: Sage Weil <sage@redhat.com>
librados: tell watcher if we cause a notify timeout

If we are a watcher and we fail to notify in a timely manner, or
circumstances otherwise conspire to prevent out ack from arriving in time,
initiate a callback.

Signed-off-by: Sage Weil <sage@redhat.com>
osd, librados: distinguish between old and new watchers

Use a new watch op code that is different from the legacy one so we can
tell when the client is doing all the new stuff (like sending pings).

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: only ping watches (not notifies)

Signed-off-by: Sage Weil <sage@redhat.com>
make ping verify we are connected
osd/Watch: set timeout event for new watchers

For a new watcher, we set the timeout event on connect, and reset it when
we get a ping.

For an old watcher, we continue to set the timeout on disconnect() and
rely on the msgr Connection reset.

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: stop sending pings once we get an error

If we get ENOTCONN or ETIMEDOUT we can stop pinging.

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: objecter_inject_no_watch_ping

Tunable to prevent PINGs.  This will let us test paths the client gets
disconnected from the OSD (at least from the client's perspective).

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: skip ping if PAUSERD

Signed-off-by: Sage Weil <sage@redhat.com>