osdmap: 4 decimal places for osd tree

This makes it print out more nicely for reasonable weights.

Signed-off-by: Sage Weil <sage@inktank.com>
crush: get_item_weight[f]()

Get the weight for an item, or at least the first instance of an item in
the tree.

Signed-off-by: Sage Weil <sage@inktank.com>
crush: create_or_move_item()

Create an item if it doesn't exist, with the specified weight.  If it is
already in the tree, move it, but do not adjust the weight.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: 'osd crush create-or-move <id> <initial-weight> <loc ...>'

Create an item in the tree with the given weight, or move it (without
touching the weight) if it is already present.

Closes: #3101
Signed-off-by: Sage Weil <sage@inktank.com>
mon: fail on trailing characters after parsing numbers

parse '8' but not '8asdf'.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: parse '<id>' or 'osd.<id>' for 'osd crush create-or-move ...'

Signed-off-by: Sage Weil <sage@inktank.com>
ceph tool: add 'osd crush create-or-move ...' to help

Signed-off-by: Sage Weil <sage@inktank.com>
mon: make redundant osd.NNN argument optional

Instead of 'osd crush set NNN osd.NNN weight loc...', make the second
osd.NNN option optional, and allow either NNN or osd.NNN to specify the
osd id.  This makes the usage much more sane, but maintains backward
compatibility.

Signed-off-by: Sage Weil <sage@inktank.com>
doc: make note of crush usage change

Even tho it is compatible.

Signed-off-by: Sage Weil <sage@inktank.com>
doc/control.rst: add 'osd crush create-or-move ...'

Signed-off-by: Sage Weil <sage@inktank.com>
crush: add const string& versions of accessors

Signed-off-by: Sage Weil <sage@inktank.com>
crush: constify loc map arguments

Signed-off-by: Sage Weil <sage@inktank.com>
mon: move loc map parsing into a helper

Signed-off-by: Sage Weil <sage@inktank.com>
mon: adjust number of req args for loc

At least one loc key/value pair is required to do anything useful with
these commands.

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

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
upstart: Add ceph-create-keys.conf to package.

Signed-off-by: Tommi Virtanen <tv@inktank.com>
Merge remote-tracking branch 'gh/wip-crush'

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
upstart: Use "ceph osd crush create-or-move".

Now the weight is only set when adding the OSD to the CRUSH map for
the first time. Once it's there, it's only moved, and the weight is
left untouched.

Change the ceph.conf option for the initial weight from
osd_crush_weight to osd_crush_initial_weight, to reflect this.

If you don't want new OSDs to store data automatically (to minimize
balancing and keep a human in the control loop), you can now
set osd_crush_initial_weight=0.

Closes: #3101
Signed-off-by: Tommi Virtanen <tv@inktank.com>
upstart: Start mds,mon,radosgw after a reboot.

They had no "start on" stanzas, so they didn't get started earlier.
upstart: Give everything a stop on stanza.

These are all tasks, and expected to exit somewhat quickly,
but e.g. ceph-create-keys has a loop where it waits for mon
to reach quorum, so it might still be in that loop when the
machine is shut down.