Moved tests for server._action_rebuild

Move tests to separate class as a preparation for code
deduplication.

This work continues in https://review.openstack.org/34556

bp nova-tests-code-duplication

Change-Id: I985232fa0a9b2d5b73034047b06138a8a3d7e390
Code dedup in tests for server._action_rebuild

Externed common parts to setUp():
- request body
- request object
- test image UUID
- test image URL
These parts were equal in the most part of the methods.

bp nova-tests-code-duplication

Change-Id: Ie29dd090075915a4065ee395b4e50fc178f72f3b
Missed message -> msg_fmt conversion

We recently changed NovaException's to define `msg_fmt` instead of `message`
on the class. Looks like this exception was missed for some reason.

Fixes bug 1202255

Change-Id: If828bf42fa077665d1d92e08758fbddd342ab626
Fix inconsistency between Nova-Net and Neutron

The neutron client raises NeutronClientException (status_code 404)
that is not unknown for nova, and is translated in 500 computeFault.
Catching this exception in nova/nova/network/neutronv2/api.py and
raising more generic exception as exception.NotFound solves the problem.

Added also an unitary test to test neutronv2 api

bug #1160309
bug #1200175

Change-Id: Ib2f1a0d49a12114b28f0cd5ce0bb7119f864d1a6
Sync gettextutils from oslo

Bring in some needed extra code for handling Nova translations

Partially implements bp user-locale-api

Change-Id: Id66010eacb24c86e32f5455c5d869f9f037cff23
Add indexes to sqlite

Migration `133_folsom.py` do not create indexes for sqlite.
Added missed indexes with tests.

Fixes bug 1191838

Change-Id: I018e29ba46f2017241c13742169896625944194e
Use timeutils.utcnow() throughout the code

timeutils.utcnow() should be used instead of direct calls to
datetime.datetime.utcnow() to make it easy to override its return
value in tests.

Add a hacking rule to prevent regressions.

Fixes bug 1200141.

Change-Id: I170dbd7c9093bd627e2a0d5984b7ad1bf105c8d5
Move _validate_int_value controller func to utils

This patch moves the _validate_int_value private method of the servers API
controller (intorduced in change
I18ac285d5b3c8200d7706c7d577809b15d6ab9e8) to utils, in order to make it
usable by code outside of the controller class. This method is very
general - it checks weather an input is a valid integer.

It also changes what exceptions it raises from HTTPBadRequest to
InvalidInput - all in the spirit of being more reusable.

Finally, it adds tests and fixes a small string formatting bug that was
uncovered by adding them.

Change-Id: I65f2b6474d572ed601d20dca9dda9936d306a219
blueprint: improve-block-device-handling
Make admin API state resets use Instance.save()

This removes the 'update_state' compute API method in favor of having
the admin API use the Instance object's save() method.

This also removes the non-unity cells test for resetting state.  Cells
behavior is tested via tests on Instance.save().

Related to blueprint compute-api-objects

Change-Id: I28d1ca9d711679cc55375774e879870f457a5b0b
Make shelve pass old-world instance object to conductor

The conductor interface for notify_usage_exists() doesn't yet
work with a new-world object, so convert it with the compatibility
function before passing it from shelve().

Related to blueprint unified-object-model

Change-Id: I6c2c2dc6dedf521ed7b0c566411d6f0035038b7c
Make InfoCache.network_info be the network model

Instead of storing the DB version of network_info (which is a JSON
version of network.model.NetworkInfo) on the object, go ahead and turn
it into its native object as well.  This means that all uses of the
object don't need to worry about hydrating network_info themselves.

This adjusts all uses in the code understand the old and new ways of
life.

There's also a small issue with the get_by_instance_uuid() method that
would cause a traceback when no entry was found.  This method is not
being used yet anywhere, but this is fixed to raise a NotFound.

Related to blueprint unified-object-model

Change-Id: I882311c8a9f9df927c5650946e6398eeb33e74d0
Convert network API to use InfoCache object

This converts the db.info_cache_update() call in network/api to use
objects.  The save() method has been extended to support what we need
for cells.

Converting to the object allows us to ditch the conductor_api kwarg on
some methods.

Related to blueprint unified-object-model

Change-Id: I1722c03d20511d67acc0a8947de1d4273dc78597
Unit-ify compute_api delete tests

This makes the delete and soft_delete tests unit-like in nature,
and moves them to test_compute_api, as has been done recently
for others that we're moving to objects.

Related to blueprint compute-api-objects

Change-Id: I5e024871e5159f08cbba05fa261a9a2d08e4b8e5
Merge "Make admin API state resets use Instance.save()"
Merge "Make shelve pass old-world instance object to conductor"
Merge "Make InfoCache.network_info be the network model"
Merge "Use timeutils.utcnow() throughout the code"
Merge "Convert network API to use InfoCache object"
Merge "Unit-ify compute_api delete tests"
Merge "Moved tests for server._action_rebuild"