Increase sleeps in baremetal driver

The current sleeps are not long enough in some cases, increasing them
very simply makes the driver far more reliable.

Change-Id: Ida5591f9e4d1eb61e229096d541a8285803efeb5
Closes-Bug: #1316350
Add plan for kilo blueprints: when is a blueprint needed

At the nova mid-cycle we agreed that while specs have made our
process significantly better, we think the current approach still leaves
much to be desired. This document is the outcome of the discussion at
the mid-cycle on how we want to manage blueprints in kilo.

This proposal is being placed in devref, as we want to use gerrit's
workflow (two core reviews, inline comments, revisions etc) and this is
a document for developers.

It turns out adding the specs requirement to blueprints adds a
non-trivial amount of overhead, revisit when a blueprint and spec is
needed to minimize overhead in cases where it isn't helpful.

Change-Id: Iaaadc26f3f51ee091419beaa12e0508623eed99e
postgresql: use postgres db instead of template1

In PostgreSQL template1 database is kind of special, as all new databases are
copied from it, when you do CREATE DATABASE. This implies a few restrictions:
e.g. you can't have more than one active session to template1, if one of them
tries to create a database. It will fail with:

    ERROR: source database "template1" is being accessed by other users

Using of postgres database instead of template1 resolves this issue.

Closes-Bug: #1355929

Change-Id: I8b1a36163984fbef6be66964456072d32da6a9d0
VMware: fix broken mock of ds_util.mkdir

Change I788e33dbcb3dedc41831b976137607274b1c02ca introduced an
incorrect use of mock which had side-effects for other tests. This
change fixes it.

Change-Id: I71188ec7c12d51c2b4a253f13a5f51cc8bc0ae36
Fix unset extra_spec for a flavor

A flavor extra_specs key cannot be deleted using 'nova flavor-key'.
Updates to a flavor's extra_specs are not being registered by
NovaObject, such that when NovaObject.obj_what_changed is called,
no changes in the extra_specs field are picked up. In order for
changes in extra_specs to be picked up, the updated extra_specs
has to be compared against the _orig_extra_specs. The same approach
also applies to the flavor's projects, where the updated projects
has to be compared against the _orig_projects.

Also, if you delete the last remaining extra_specs key, nova would
throw an sqlalchemy warning, i.e. 'SAWarning: The IN-predicate on
"instance_type_extra_specs.key" was invoked with an empty sequence'.
This was caused by calling db.flavor_extra_specs_update_or_create
with an empty dict of keys to add or update. This patch fixes it
calling db.flavor_extra_specs_update_or_create only on a non-empty
dict of keys.

Change-Id: Icea492134239296f1570b2a4208eb0868315aa5f
Closes-Bug: #1340885
VMware: Improve logging of DatastorePath in error messages

Change-Id: I8ad6dc52c460d11f71c750e8cc287b36d8238106
VMware: trivial formatting fix in fake driver

Change-Id: Ie6029896edb51c613bd53b5441df4825588b2334
Remove usage of self.__dict__ for message var replacement

This is the same as using locals() for variable replacement in a log
message which violates hacking rule H501.  On Cinder this actually
caused the cinder-api process to hang on python 2.6.

Nova has the same code so this fixes the hacking violation.

Note that the H501 rule was updated in commit 55e96ee but it's not in a
released version of hacking yet (and won't be in time for Juno).

Closes-Bug: #1365901

Change-Id: I1be0db327a2fa1e866328eecd2e7c3dd3ee3cc93
VMware: Make DatastorePath hashable

Make DatastorePath work properly when used as a key value in a dict or
set.

This change specifically enables a subsequent change in the fake
driver, which stores DatastorePath objects in a set. However, it's
probably a good idea in general as I spent quite some time trying to
work out why it didn't work when I hit it.

Change-Id: Ia5519b84bc47ea1e0a5a70f9368806f762d12db5
Undo changes to obj_make_compatible

Commit 7cdfdccf1bb936d559bd3e247094a817bb3c03f4 attempted to make
the obj_make_compatible calls consistent, but it actually changed
them the wrong way. This fixes them to unwrap nova_object.data
and updates the test that was testing the reverse.

Change-Id: I1a5db4e9817390ba3c2423d33387f780c890de64
Closes-Bug: #1373535
Merge "Fix unset extra_spec for a flavor"
Merge "Add plan for kilo blueprints: when is a blueprint needed"
Merge "Remove usage of self.__dict__ for message var replacement"
Merge "VMware: fix broken mock of ds_util.mkdir"
Merge "VMware: Improve logging of DatastorePath in error messages"
Merge "VMware: trivial formatting fix in fake driver"
Merge "VMware: Make DatastorePath hashable"
Merge "Undo changes to obj_make_compatible"
Merge "Increase sleeps in baremetal driver"
Merge "postgresql: use postgres db instead of template1"