Remove rescue/unrescue NotImplementedError handle

There are 2 kinds of RPC call from API layer to compute layer,
one is cast and another is call. For cast, the RPC message will
be posted and the API service will not wait for the message to
be processed. So it won't be able to catch the exception raised
in compute layer and catch and handle the exception is useless
and error leading. This patch removes code in API layer for
rescue and unrescue functions.

Change-Id: Iab8070c25a9dee505c0602efad85c41c21c2aa58
Move logs of restore state to inner logic

Currently when we rebuild instance, we will restore instance state
if it's STOPPED, but we will log it whenever it's STOPPED or not.
This may confusing operator and for ACTIVE/ERROR state, it's useless.
Also, adds instance into log to provide more info.

Change-Id: I0685484ee0b56c250071c8c9322d2ed053449fd3
libvirt: volume snapshot delete for network-attached disks

Add support for performing a volume snapshot delete for
a network/(libgfapi)-attached disk based on the proposal
at:

http://www.redhat.com/archives/libvir-list/2014-February/msg01226.html

Uses a new VIR_DOMAIN_BLOCK_COMMIT_RELATIVE flag for blockCommit
calls which keeps qcow2 backing file entries as relative filenames
rather than prepending them with path information when blockCommit
operations are performed.

Support for this flag is required and heuristically detected rather
than based on version number.

Selection of disk for blockCommit/blockRebase is handled by
searching the snapshot hierarchy and using an identifier such as
vda[2] meaning the second item in the snapshot chain for disk
'vda'.

Implements: blueprint libvirt-volume-snap-network-disk

Change-Id: I31710b787c39d23870fb45a460f460663ecb261c
Rename rbd.py to rbd_utils.py in libvirt driver directory

In libvirt driver directory, rbd.py confict with global rbd library
which is imported in rbd.py, so we rename rbd.py to rbd_utils.py.

Change-Id: Ib62e430e678fe09c4a8475a636a8ecc11a194f5c
Closes-Bug: #1352595
VMware: implement get_host_ip_addr

This patch fixes a regression caused by commit
1deb31f85a8f5d1e261b2cf1eddc537a5da7f60b. The function get_host_ip_addr
is used by the resource_tracker and if it is not implemented all resize
operations fail.

Also put back the check for missing host, user, password config options
in the driver constructor.

Closes-bug: #1356449

Change-Id: I4ba6a0f9c3b9c2ce0e1750f8414625235d01d422
libvirt: Allow specification of default machine type

The libvirt driver currently does not set the machine type for a KVM
guest by default. When not specified, libvirt will use the newest one
it knows about. Unfortunately, that can result in live migrations
failing if your environment is using different versions of the host OS
on compute nodes as the destination node may not be able to support the
machine type used when the VM was originally started.

A simple solution to this is to provide a new option which allows you
to specify the default machine type on a per compute node basis
(nova.conf option). By using this option, you can ensure that VMs are
started with a machine type that will allow it to be live migrated to
other nodes in the deployment.

This patch implements that solution by adding the hw_machine_type
option to the [libvirt] group of nova.conf.

DocImpact
Closes-bug: #1331170

Change-Id: I223c70c729315b6ffc01eb293fe70553ef827162
Fix hacking check for jsonutils

Hacking checks with logical_lines should use yield not return.

The jsonutils rule was added in:
I86ed6cd3316dd4da5e1b10b36a3ddba3739316d3

Now that the function uses yield, it can trigger twice in dumps (dump
and dump), so look for a '(' at the afterwards. Don't display the '(' at
the end of the error message since its confusing to read.

Change-Id: I277dba08fdd30734409eee36008cebda35886968
Closes-Bug: #1356687
Hacking: a new hacking check was added that used an existing number

Commit 243879f5c51fc45f03491bcb78765945ddf76be8 added in a new hacking
check that used an existing number.

The new number is 324 (and not 323)

Change-Id: I7e604a408387438105c435ad16a1fa3d6491b642
Closes-bug: #1356815
Add EC2SnapshotMapping object

Create a nova object for the mappings between snapshot UUIDs and the
corresponding EC2 ID.

Part of blueprint convert-ec2-api-to-use-nova-objects

Change-Id: Ie29db77e404faff6ab9f12877094ea042e3c9924
Use EC2SnapshotMapping for creating mappings

Use the EC2SnapshotMapping nova object to create the mappings instead
of using the db api directly.

Part of blueprint convert-ec2-api-to-use-nova-objects

Change-Id: If280b1061185faf71c632a7bc4a8530346c18c97
Get EC2 snapshot mappings with nova object

Use the EC2SnapshotMapping nova object for getting the mapping instead
of directly using the db API.

Part of blueprint convert-ec2-api-to-use-objects

Change-Id: I258ffe0a3fe3b0d7b2524bb64f1137127731bdd5
Remove unused db api methods

Remove methods that are no longer used from the db API.  New methods
were created that replaced these when the EC2SnapshotMapping object
was created in earlier commits.

Related to blueprint convert-ec2-api-to-use-nova-objects

Change-Id: I5431dd34d6a3fcea687b9d8f192a822e83ed9402
ec2: Add S3ImageMapping object

Add a nova object for another ID-UUID mapping used in the EC2 API.
This object will allow the removal of the last bit of direct db api
usage by the EC2 API code.

Part of blueprint convert-ec2-api-to-use-nova-objects

Change-Id: Icf84f2d5a50ce4c78ee7f51db8e6a2b0276afbb2
ec2: Use S3ImageMapping object

Use the S3ImageMapping in the EC2 API to remove the last bit of direct
db API usage.

Part of blueprint convert-ec2-api-to-use-nova-objects.

Change-Id: I7d66a4d05f42ffd854afe21024c88b096aeaaeaa
Merge "VMware: implement get_host_ip_addr"
Merge "libvirt: volume snapshot delete for network-attached disks"
Merge "Fix hacking check for jsonutils"
Merge "Hacking: a new hacking check was added that used an existing number"
Merge "Add EC2SnapshotMapping object"
Merge "Use EC2SnapshotMapping for creating mappings"