]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mon: AuthMonitor: change 'auth add' behaviour
authorJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 30 Jul 2013 20:53:46 +0000 (21:53 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 6 Aug 2013 20:59:33 +0000 (13:59 -0700)
commit5c6dc1c8c1c79c5a3009623d2d257aa90e08e71d
tree0ce011597d3d9ea1c39f479b189c96d013376223
parent94002c43deea7602588f8baff02b4cf367e750e8
mon: AuthMonitor: change 'auth add' behaviour

If an entity already existed, 'auth add' would smash its key and caps
with whatever was on the supplied keyring file; if a keyring weren't
specified, we would simply generate a new key and destroy all existing
caps (unless caps were specified and happened to be different from the
already in-place caps).  This behaviour is obviously sketchy.

With this patch we now enforce the following behaviour:

- if entity does not exist in current state, check if we are about to
  create it (by checking the pending state); if so, wait for the new state
  to be committed and re-handle the command then, so we don't get bad
  results from pending request
- if the command reproduces the current state (same key, same caps), we
  return 0; else,
- if entity exists and supplied key OR caps are different, return -EINVAL
- else create a new entity.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/mon/AuthMonitor.cc