upstart/ceph-osd: make crush update on start optional

By default, we will do some (minimal) CRUSH tree adjustment.  However,
we make this update optional.

Fixes: #3993
Signed-off-by: Sage Weil <sage@inktank.com>
ceph-disk-activate: specify full path for blkid, initctl, service

/sbin apparently isn't in the path when udev runs us.

Signed-off-by: Sage Weil <sage@inktank.com>
ceph-disk-activate: auto detect init system

Look for an option 'init' in ceph.conf.  Otherwise, check if we're ubuntu.
If so, use upstart.  Otherwise, use sysvinit.

Signed-off-by: Sage Weil <sage@inktank.com>
udev: trigger ceph-disk-activate directly from udev

There is no need to depend on upstart for this.

Signed-off-by: Sage Weil <sage@inktank.com>
ceph-disk-activate: catch daemon start errors

Signed-off-by: Sage Weil <sage@inktank.com>
debian: start/stop ceph-all event on install/uninstall

This helps us avoid the confusing situation with upstart where an individual
daemon job is running (like ceph-osd id=2) but the container jobs ceph-osd-all
and ceph-all are not.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: move pg log into leveldb

log from wip-pginfo
Fix bugs in PG::read_log() handling
Eliminate compiler warnings

Feature #4075: osd: move pg log into leveldb

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: David Zafman <david.zafman@inktank.com>
PG: write_log if we read an old-format log

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: verify log versions during read_log

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: add leveldblog compatibility flag for OSD

Signed-off-by: Samuel Just <sam.just@inktank.com>
ceph_authtool.cc: use empty() instead of size()

Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

warning from cppchecker was:
[src/ceph_authtool.cc:124]: (performance) Possible inefficient
  checking for 'caps' emptiness.
[src/ceph_authtool.cc:237]: (performance) Possible inefficient
  checking for 'caps' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mds/CDentry.h: use projected.empty() instead of projected.size()

Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

warning from cppchecker was:
[src/mds/CDentry.h:234]: (performance) Possible inefficient
  checking for 'projected' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mds/MDSMap.h: use up.empty() instead of up.size()

Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

warning from cppchecker was:
[src/mds/MDSMap.h:448]: (performance) Possible inefficient
  checking for 'up' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
client/Client.cc: use empty() instead of size()

Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

warning from cppchecker was:
[src/client/Client.cc:3649]: (performance) Possible inefficient
  checking for 'mds_sessions' emptiness.
[src/client/Client.cc:7489]: (performance) Possible inefficient
  checking for 'osds' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/client/SyntheticClient.cc: use !subdirs.empty() instead of size()

Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

warning from cppchecker was:
[src/client/SyntheticClient.cc:2706]: (performance) Possible
  inefficient checking for 'subdirs' emptiness

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
cls/lock/cls_lock.cc: use !lockers.empty() instead of size()

Use empty() since it should be prefered as it has, following the
standard, a constant time complexity regardless of the containter
type. The same is not guaranteed for size().

warning from cppchecker was:
[src/cls/lock/cls_lock.cc:209]: (performance) Possible inefficient
  checking for 'lockers' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
qa: rbd/map-snapshot-io.sh: chown rbd device stuff

This is fugly, but sudo -E doesn't work.  Fix this after we are installing
debs and the path doesn't matter anymore!

Signed-off-by: Sage Weil <sage@inktank.com>
ReplicatedPG: handle missing set even for old format

Signed-off-by: Samuel Just <sam.just@inktank.com>
ceph-disk-prepare: do partprobe after setting final partition type

This is necessary to kick udev into processing the updated partition and
running its rules.

Signed-off-by: Sage Weil <sage@inktank.com>
ceph-disk-activate: use full paths for everything

We are run from udev, which doesn't get a decent PATH.

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