osd: use fsync+rename when writing meta files (during mkfs)

It's overkill to do the dir fsync on each file, but not worth making
efficient.

Signed-off-by: Sage Weil <sage@newdream.net>
osd: create a 'ready' file on mkfs completion

Signed-off-by: Sage Weil <sage@newdream.net>
osd: make output less ugly

Signed-off-by: Sage Weil <sage@newdream.net>
osdmap: store a uuid for each osd

Rev the extended section of the map to store it.  Dump it when the osd
exists.  Zero it out if an osd is destroyed.  Provide some accessors to
identify an osd given a uuid (linear search).

Signed-off-by: Sage Weil <sage@newdream.net>
mon: fill in osd uuid in map on boot

We may want to make this more strict, so that if it is defined it has to
match the map, and only fill it in when the map's uuid is still zeroed
(for legacy clusters)...

Signed-off-by: Sage Weil <sage@newdream.net>
mon: 'osd create <uuid>'

Make the osd create command idempotent by providing a uuid.  If you call it
multiple times with the same (or some other existing) uuid you'll get back
the osd id that is already using it.

Drop support for 'osd create <id>', which was mostly useless and
non-idempotent anyway.

Signed-off-by: Sage Weil <sage@newdream.net>
filestore: allow fsid to be fed in for mkfs

Mkfs currently always generates a new uuid.  Allow the caller to feed one
in.

Signed-off-by: Sage Weil <sage@newdream.net>
osd: allow uuid to be fed to mkfs with 'osd uuid' setting

E.g., ceph-osd --mkfs --osd-uuid <uuid> -i 123 ...

Signed-off-by: Sage Weil <sage@newdream.net>
osd: --get-{osd,journal}-uuid synonyms for --get-{osd,journal}-fsid

Signed-off-by: Sage Weil <sage@newdream.net>
vstart.sh: explicitly specify uuids during startup

This exercises all the new per-osd uuid code.

Signed-off-by: Sage Weil <sage@newdream.net>
crush: fix weights when removing items

Reweight an item to 0 before removing it, so that the parent weights are
adjusted accordingly.

Signed-off-by: Sage Weil <sage@newdream.net>
crush: add check_item_loc

The check_item_loc() method will take an item and position and tell you if
it matches the items current location.  The matching is identical to that
used for insert_item, in that a specific location constraint match means
success, even if a less specific one does not match (e.g., rack=wrongrack,
host=correcthost will return true).

Signed-off-by: Sage Weil <sage@newdream.net>
crush: implement update_item()

This is similar to insert_item(), except it will succeed if the item is
already there, and will move an item to the specified location if it is
not.  It returns 0 for no change, 1 if a chance was made.  It also makes
sure the weight and name match.

Signed-off-by: Sage Weil <sage@newdream.net>
crush: do some docs

Signed-off-by: Sage Weil <sage@newdream.net>
crushtool: add --update-item command

Similar to --add-item, except it will move, rename, or reweight the item if
it is already present in the map.

Signed-off-by: Sage Weil <sage@newdream.net>
crushtool: extent cli test to include --remove-item and --update-item

Signed-off-by: Sage Weil <sage@newdream.net>
mon: 'osd crush set ...' do an add or update

This operation will add/update/move the item to the specified location.
It is idempotent and much more useful than 'osd crush add ...'.

Signed-off-by: Sage Weil <sage@newdream.net>
vstart.sh: use 'osd crush set ...'

Signed-off-by: Sage Weil <sage@newdream.net>
mon: drop 'osd crush add ...'

'osd crush set ...' is better, us that instead.

Signed-off-by: Sage Weil <sage@newdream.net>
ceph-dencoder: ignore trailing goop after OSDMap and OSDMap::Incremental

All users pass around bufferlists and avoid encoding these structures
inline, but the dencoder tests are picky.  Disable that for these types so
that we can add new fields without noise.

Signed-off-by: Sage Weil <sage@newdream.net>