tools: rados put /dev/null should write() and not create()

In the rados.cc special case to handle put an empty objects, use
write_full() instead of create().

A special case was introduced 6843a0b81f10125842c90bc63eccc4fd873b58f2
to create() an object if the rados put file is empty. Prior to this fix
an attempt to rados put an empty file was a noop. The problem with this
fix is that it is not idempotent. rados put an empty file twice would
fail the second time and rados put a file with one byte would succeed as
expected.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
mon/MonClient: use generic Messenger factory

Signed-off-by: Sage Weil <sage@redhat.com>
msg/Message: drop unneeded #include

Signed-off-by: Sage Weil <sage@redhat.com>
msg: make messenger type configurable

Eventaully we may want to override this by passing the type in as an
arg, but let's do that later.

Signed-off-by: Sage Weil <sage@redhat.com>
msg: use localized cct for derr

Signed-off-by: Sage Weil <sage@redhat.com>
librados: use Messenger factory method

Signed-off-by: Sage Weil <sage@redhat.com>
msg: move SimpleMessenger to msg/simple/

Signed-off-by: Sage Weil <sage@redhat.com>
common: do not set ioprio if pid is not set

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
common: set_ioprio debug message including pid

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
osd: log error if set_ioprio fails to parse class

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
common: ceph_ioprio_string_to_class always returns -EINVAL

The l string is always empty because std::transform needs a
pre-allocated string. Replace with the in-place version. Add unit tests.

http://tracker.ceph.com/issues/9677 Fixes: #9677

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
Merge pull request #2652 from ceph/wip-msgr

msgr: fix remaining direct references to "new SimpleMessenger" by replacing with the factory method

Reorganize the src/msg hierarchy to push SimpleMessenger down into a subfolder to make way for organizing new in-tree implementations.

Reviewed-by: Greg Farnum <greg@inktank.com>
Merge pull request #2626 from dachary/wip-rados-empty-file

tools: rados put /dev/null should write() and not create()

Reviewed-by: Sage Weil <sage@redhat.com>
Merge pull request #2654 from dachary/wip-9677-ioprio-class

common: ceph_ioprio_string_to_class always returns -EINVAL

Reviewed-by: Sage Weil <sage@redhat.com>
doc: update debian compilation dependencies

Using the content of debian/control.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
ceph-disk: run partprobe after zap

Not running partprobe after zapping a device can lead to the following:

* ceph-disk prepare /dev/loop2
* links are created in /dev/disk/by-partuuid
* ceph-disk zap /dev/loop2
* links are not removed from /dev/disk/by-partuuid
* ceph-disk prepare /dev/loop2
* some links are not created in /dev/disk/by-partuuid

This is assuming there is a bug in the way udev events are handled by
the operating system.

http://tracker.ceph.com/issues/9665 Fixes: #9665

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
ceph-disk: implement init=none for block devices

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
tests: helper to run unit / function tests in docker

For instance

   test/docker-test.sh --os-type ubuntu --os-version 14.04 \
        test/ceph-disk.sh

runs test/ceph-disk.sh in a ubuntu 14.04 docker container. Once the
container is populated and ceph compiled, running a test script roughly
requires entering the container and running make TESTS=tests/foo.sh check

* docker pull ubuntu:14.04
* docker run apt-get install ceph compilation / run dependencies
* docker commit ceph-ubuntu-14.04 # to re-use
* git clone the-local-clone ceph-ubuntu-14.04
* docker run ceph-ubuntu-14.04 make -j4 in the ceph-ubuntu-14.04 clone
* docker run test/ceph-disk.sh

test/docker-test.sh is the command line interface for
test/docker-test-helper.sh which can be invoked from shell scripts.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
ceph-disk: test prepare / activate on a device

This indirectly tests that partprobe is called after zap because it
would fail to map the partitions to /dev/disk/by-partuuid otherwise.

It also indirectly test the implementation of init=none when using a
block device because the test would fail to put an object into the rbd
pool using the device otherwise.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
autotools: add --enable-docker

Docker based tests should be explicit instead of auto-detected. It is
good that they do not run if docker is not available. It would be bad if
they run when the developer does not expect them to create docker
containers.

Signed-off-by: Loic Dachary <loic-201408@dachary.org>