Cleanup:Use get_type()instead of get_header().type

Cleanup the code ,use get_type() instead of get_header().type
for messages.

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
crush/CrushWrapper: fix _search_item_exists

Reported-by: Pawel Sadowski <ceph@sadziu.pl>
Signed-off-by: Sage Weil <sage@redhat.com>
crush/builder: prevent bucket weight underflow on item removal

It is possible to set a bucket weight that is not the sum of the item
weights if you manually modify/build the CRUSH map.  Protect against any
underflow on the bucket weight when removing items.

Signed-off-by: Sage Weil <sage@redhat.com>
crush/CrushWrapper: fix create_or_move_item when name exists but item does not

We were using item_exists(), which simply checks if we have a name defined
for the item.  Instead, use _search_item_exists(), which looks for an
instance of the item somewhere in the hierarchy.  This matches what
get_item_weightf() is doing, which ensures we get a non-negative weight
that converts properly to floating point.

Backport: giant, firefly
Fixes: #9998
Reported-by: Pawel Sadowski <ceph@sadziu.pl>
Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #3126 from ceph/wip-cleanup-removal

osd: Remove dead code related to old pg removal mechanism

Reviewed-by: Samuel Just <sjust@redhat.com>
tests: docker tests only need a workdir, not a clone

Instead of cloning the repository, create a work directory that has
symbolic links to the original .git, using

https://github.com/git/git/blob/master/contrib/workdir/git-new-workdir

It resolves the problem of fetching a commit that is not attached to any
ref, which is apparently not implemented in the git protocol (discussed
on irc.freenode.net#git).

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

Signed-off-by: Loic Dachary <ldachary@redhat.com>
tests: update centos docker file to epel 7.5

Signed-off-by: Loic Dachary <ldachary@redhat.com>
tests: install hdparm in containers

The ceph-disk tests use hdparm, install it in containers that run
them.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
tests: install parted in centos container

Because ceph-disk depends on it.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
documentation: simplify running make check

Encapsulate the compilation steps (install dependencies, autogen.sh,
configure, make check) in the run-make-check.sh script. Update the
developer documentation to point to this script instead of multiple
steps.

It is intended as a tool to help new developer make sure their patch is
sane, it focuses on efficiency (runs make check in parallel if possible)
and coverage (enables docker based tests if possible).

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

Signed-off-by: Loic Dachary <ldachary@redhat.com>
ceph-disk: don't change the journal partition uuid

We observe that the new /dev/disk/by-partuuid/<journal_uuid>
symlink is not always created by udev when reusing a journal
partition. Fix by not changing the uuid of a journal partition
in this case -- instead we can reuse the existing uuid (and
journal_symlink) instead. We also now assert that the symlink
exists before further preparing the OSD.

Fixes: #10146
Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
Tested-by: Dan van der Ster <daniel.vanderster@cern.ch>
ceph-disk: fix get_partition_uuid for loop/cciss

Loopback and cciss devices have an extra 'p' before the partition
number. Add exceptional handling of these devices.

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
ceph-disk: test re-using an existing journal partition

Add a ceph-disk test to first setup an OSD with a separate journal
block device, then tear down the OSD (simulating a failure) and create
a new OSD which re-uses the same journal device.

Add create_dev / destroy_dev helpers that encapsulate the operations
that ensure the partition table is up to date in the kernel and the
symlinks are created as expected. In particular it makes sure the kernel
is aware that the partition table of a newly created device is
empty. If the device previously existed and the kernel was not informed
of the latest partition table updates via partprobe / partx, it may
have cached an old partition table which can create all sorts of
unexpected behaviors such as a failure to create the by-partuuid
symbolic links as described in http://tracker.ceph.com/issues/10146
Refs: #10146

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
Signed-off-by: Loic Dachary <ldachary@redhat.com>
ceph-disk: LOG.info instead of print

When a non fatal error happens with parted, use LOG.info to display it
instead of print.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
Merge pull request #3172 from dachary/wip-10146-retrigger-udev

ceph-disk: test re-using an existing journal partition

Reviewed-by: Loic Dachary <ldachary@redhat.com>
tests: fix signedness compilation warnings

Signed-off-by: Loic Dachary <ldachary@redhat.com>
Merge pull request #3112 from xiaoxichen/cleanup_getheader

Cleanup:Use get_type()instead of get_header().type

Reviewed-by: Loic Dachary <ldachary@redhat.com>
qa: add script to test how libceph handles huge auth tickets

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
Merge pull request #2986 from ceph/wip-9998

crush: fix weight underfloat issue

Reviewed-by: Loic Dachary <ldachary@redhat.com>
Merge pull request #3174 from dachary/wip-warning

tests: fix signedness compilation warnings