rgw: radosgw-admin object rewrite

A radosgw-admin command that copies the object into itself while
preserving mtime and attributes so that data can be restriped.
Especially useful when migrating from argonaut (where objects
weren't striped).

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 292c3c16fa87ed9b6d6abb22f45527ea2487c2a6)

Conflicts:
	src/rgw/rgw_admin.cc
radosgw-admin: check params for object rewrite

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 28c716bccd955eaf68e9c739139c901ca4f419f7)
radosgw-admin: new 'bucket rewrite' command

Iterates through objects and rewrites them.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 3af09b9f9f6eaf2c80f0f0fd2ea87ac16c7ffcf8)

Conflicts:
	src/rgw/rgw_admin.cc
radosgw-admin: add some conditions for bucket rewrite

 --min-rewrite-size, --max-rewrite-size to specify object size
 conditions

 --start-date, --end-date to specify object mtime conditions (format is
 YYYY-MM-DD[ HH:MM:SS])

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit dbb2013eaf1eedf2a5cbcae1d314385ea033dbb8)
rgw: update bucket / object rewrite

Get code up to date for firefly, need to pass bucket owner for quota
related functionality.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Simple mechanical cleanups

* Removed trailing and useless whitespaces
* Removed useless imports.

Signed-off-by: Christopher Glass <christopher.glass@canonical.com>
stringify: use ostringstream instead of stringstream

Use ostringstream, as we don't need both input and output of the
stringstream in stringify().

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
rbd: use stringify() in options parsing routines

Use stringify() in map_option_{uuid,ip,int}_cb() instead of essentially
open-coding it.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
configure: check for blkid/blkid.h header

The check for the presence of blkid/blkid.h was missing.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Makefile: build common/secret.c with libtool

Turn common/secret.c into a libtool convenience library, libsecret.la.
Currently it is build directly, twice: for mount.ceph and rbd binaries.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
common: add module_{load,has_parameter}()

Add two kernel module helpers: module_{module,has_parameter}().  They
are going to live in common/module.[ch].

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
0.80-rc1
client: avoid releasing caps that are being used

To avoid releasing caps that are being used, encode_inode_release()
should send implemented caps to MDS.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
client: check cap ID when handling cap export message

handle following sequence of events:
- mds0 exports an inode to mds1. client receives the cap import
  message from mds1. caps from mds0 are removed while handling
  the cap import message.
- mds1 exports an inode to mds0. client receives the cap export
  message from mds1. handle_cap_export() adds placeholder caps
  for mds0
- client receives the first cap export message (for exporting
  inode from mds0 to mds1)

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
rbd: add libkrbd convenience library

Add libkrbd libtool convenience library to provide an interface for
mapping and unmapping rbd images programmatically.  This will be used
by the rbd binary itself and the librbd_fsx testing tool.

libkrbd takes care of the kernel module stuff (common/module.h) and
makes use of libudev to be able to properly wait for block device
creation and deletion and tell which block device got assigned by the
kernel to the newly created mapping.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
mount.ceph: switch to module_load()

Implement modprobe() in terms of module_load() from common/module.h

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
rbd: switch to libkrbd for 'rbd {map,showmapped,unmap}' operations

Thanks to libkrbd, 'rbd map' now outputs the device node it mapped to
to stdout:

    $ sudo rbd map foo
    /dev/rbd0

This will allow us to get rid of a lot of ad-hoc poll/sleep code in our
qa scripts.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
doc: do not mention modprobe in rbd docs

rbd binary will load rbd.ko itself, with appropriate options.  Loading
it by hand with default options is undesirable.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
doc: 'rbd showmapped' doesn't need privileges

No need to run 'rbd showmapped' with sudo.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
rbd: deprecate --no-settle option

Waiting for udev has been the default for a while now, and, after
switching to libkrbd, is no longer an option.  (libkrbd waits for
specific devices to show up, the old behaviour was to wait for
everything udev.)

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>