rbd.cc: propagate some errors to user-space when they're available

There was a bunch of situations in which we would have a proper error to
propagate to user-space but we would always return '1' (EXIT_FAILURE).

Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
(cherry picked from commit 7e722245a717038c49f432ae19d9874c25066bb6)
rgw: fix leak in RGWMetadataManager::remove()

Backport: dumpling
Fixes: #6445
handler->get() returns a newly allocated obj, need to delete it when
done.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Invoke python with /usr/bin/env python instead of directly

Fixes: #6311
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Merge pull request #662 from dmick/next

Invoke python with /usr/bin/env python instead of directly
librados: pool async create / delete does not delete completion handle

Backport: dumpling
The pool async delete / create function used to delete the internal
completion object. However, caller still holds the allocated completion
object, which it can't drop a reference to (as it'd try to deallocate
the already freed internal object). This fix removes the internal object
deletion, a following commit will fix a related leak (#6444) by having
the application (radosgw) drop the reference even if got an error.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: drop async pool create completion reference

Fixes: #6444
Backport: dumpling
If pool creation fails (e.g., due to -EEXIST) then we leak the
completion object. Earlier we couldn't just drop the reference, as
librados have already removed the internal completion object. This fix
drop the completion reference even if got an error, which is now
possible.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
PendingReleaseNotes: update regarding librados change

Fix related to issue #6444

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Merge pull request #665 from ceph/wip-6444

Wip 6444
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
ceph_argparse.py: clean up error reporting when required param missing

Treat "need 1, got 0" as a special case, and change the message to
"missing required parameter <x>".  Also, when failing for that reason,
print the command concise description and its helptext.

Fixes: #6384
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Merge pull request #664 from ceph/wip-6445

Wip 6445
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Add unit_to_bytesize test for 'k' on input; continues fix for #4612

Signed-off-by: Dan Mick <dan.mick@inktank.com>
osd/osd_types: replace bool lost with a flags field

This is more generic.  We could also fold uses_tmap flag into here,
but the encoding change for that is non-trivial.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: add WHITEOUT flag to object_info_t

Signed-off-by: Sage Weil <sage@inktank.com>
osd/ReplicatedPG: update all find_object_context() users to handle whiteouts

In each case, we treat the whiteout as if we got an ENOENT.

We do not change the semantics of bool exists to avoid breaking lots of
potentially fragile code.  We are only interested in changing the
user-visible behavior of the object, not the way it is internally stored
or managed.

This will likely be refined as we grow acutal users for whiteoutes in the
pool caching code.

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: convert object_info_t::uses_tmap to a flag

Treat the second encoded bool as bits 9-16 of a (now) 16-bit flags field,
and use bit 9 (what used to be set by the use_tmap bool) as FLAG_USES_TMAP.

No encoding compatibility change.

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #670 from ceph/wip-osd-whiteout

osd: add basic whiteout infrastructure

Reviewed-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
Merge pull request #666 from dmick/wip-6384

ceph.in: clean up error message when missing required parameter
rados: do not dump usage on invalid command

I hate this; it makes it impossible to see that there was an error message.

We made this same change a while back with rbd.

Signed-off-by: Sage Weil <sage@inktank.com>
rbd: be helpful with invalid command

$ rbd asdf
rbd: error parsing command 'asdf'; -h or --help for usage

Signed-off-by: Sage Weil <sage@inktank.com>
osd/osd_types: bump encoding from 11 -> 12

Meant to do this in a1b82f2a568ba211601c12b0b33474e982a3be6f or
d421b66293fb3d815ad2cd4c787dd2c39f48d6e8 but forgot!

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