Added sample tests to FlavorDisabled API.

Partially implements blueprint nova-api-samples
Fixes bug 1070161

Change-Id: I889a5b2e85d31fda1e9a8a82043ba7e9ddf1b7a6
Fix race condition of resize confirmation

Currently, the db update of migration status is after the db update of
instance's vm_state in _finish_resize, so a race condition occurs when an
instance's vm_state is updated but the migration status doesn't, and at
this moment a resize confirmation is performed, then an exception
'MigrationNotFoundByStatus' is raised.

Fixes: bug #1066140

Change-Id: I1dac98cc99d3491c92faaad2b9dcc40d7c0524b5
Add html reports to report action in coverage extension.

This makes a few minor cleanups and 2 additions to the
coverage extension. First, it adds a new optional field to the
report action: 'html'. This will generate an html report instead
of either the text or xml reports that the extension can
generate.

The second change is that it adds a return for the stop action.
Now upon successful completion of the stop action the directory
where the coverage data files will be returned.

Change-Id: If1aa25fc7237e9bb5100d2a4a8e560f0a68eba61
Eliminate race conditions in floating association

This makes associating and disassociating floating ips atomic and
idempotent. This means multiple concurrent messages will not leave
behind iptables rules and concurrent request will not cause odd
failures.

Fixes bug 1092762 and bug 1092761.

Change-Id: Idbcad6c1d2a3d4881cf7180b848ed3844fac4054
Enable nova exception format checking in tests.

Updates the Nova test runner so that it enables
'fatal_exception_format_errors' for testing.

Fixes a slew of issues in the tests including:
 -adds a whole bunch of missing kwarg's to exception constructors
 -removing an extra print statement in ec2/test_cloud
  (this was causing failures...)
 -removing a duplicate (and misnamed) flavor test case:
    test_remove_tenant_access_with_bad_access
 -removing an odd test case which tested throwing an exception with
  and without kwargs explicitly (the part testing without kwargs was
  removed)
 -explicitly update test/test_misc.py's test_exceptions_raise to disable
  formatting checks for now. This allows it to continue to pass.

Change-Id: Ibb5083c93f1a5de6edadb1b613292ff9eb26ddf0
Remove inconsistent usage of variable from hyperv.

Portions of the code use instance_name, while others use
instance['name']. In some cases, within the same function. See
lines 123, 153, and 156.

Change-Id: I69763e62a1db79b4c5a4468104fd26ad9b3aad5a
db.security_group_rule_destroy() method performance optimization

1 db requst instead of 2

blueprint db-session-cleanup

Change-Id: I094632c422aa9d10278c1b85ec9f4d51a54541b1
Fix error in test_get_all_by_multiple_options_at_once()

We should not use 0 as id. It will conflict with db-unique-keys.

Since soft_delete() stores `id` value in `deleted` column, and
checking whether entry is deleted softly is made through comparison of
`id` and `deleted` column values, created entry will look like already
deleted softly.

blueprint db-unique-keys

Change-Id: Icb7a4880886301a3cc72c6ea0e455b867952812e
Ensure that Quantum uses configured fixed IP

Fixes bug 1094897

The fix ensures that the fixed IP address specified by the user
is correctly passed to Quantum. That is, when the Quantum port
is created it is created with the specified IP address.

Change-Id: I8191ac2497037e2592b0679962e4606cd24d7844
Add unit test to revert resize server action

Add a unit test to check the revert resize to an invaid server

Fix bug: 1088874
Partially implements blueprint nova-v2-api-audit

Change-Id: I19128ac1a99e85721e7911176fa6d6c78bd5c256
Add unit test to update server metadata

Fixes bug: 1088878
Partially implements blueprint nova-v2-api-audit

The bug description points to 4 situations to be tested, although those
situations are already tested on create metadata tests which use the same
method as update_all to operate over metadata (_update_instance_metadata) so no
more tests are needed.

Change-Id: Ifae3c69c0e00c361ae36f5a8dede835c96568d11
Move block_device_mapping update operations to conductor

This patch moves the uses of the following methods in compute/manager
to the conductor:

 - block_device_mapping_create()
 - block_device_mapping_update()
 - block_device_mapping_update_or_create()

As in the past with adding multiple similar operations to conductor,
only one method is actually added to the manager and RPC API, which
is similar to the update_or_create variant above. The public API for
conductor maintains all three variants and their original calling
conventions.

Related to blueprint no-db-compute-manager

Change-Id: Ibcb721ebd0ba8639ccb2ba2f7bed1dcf499e4edb
Move block_device_mapping get operations to conductor

This patch moves the block_device_mapping_get_by_instance()
uses from compute/manager to the conductor. This also includes
some nasty refactoring in some of compute's helper methods to
pass around instances instead of just uuids so that we can
properly pass the former to the conductor.

Related to blueprint no-db-compute-manager

Change-Id: Ib5223274d21096a9e47b3420c3de801b978b253d
Fix race in resource tracker

Fix a race in resource tracker where usage can get under reported if the
audit process runs after an instance gets set to vm_state=DELETED, but
before the DB record itself is deleted.

bug 1095403

Change-Id: I47943d12155a6484c6cb3adb31dfa4db0191cf26
Fix spelling mistakes in nova.virt

Change-Id: Ic5ff80af956726b768610290e4fae7dd46549711
Delete pointless nova.virt.VIFDriver class

There is a nova.virt.VIFDriver class which the hypervisor
VIF drivers inherit from. None of the hypervisor subclasses
pay any attention to the API contract defined to the parent
class. Some of the hypervisors don't bother trying to use
the VIFDriver class at all (hyperv, baremetal).

It is not worth trying to make the hypervisor subclasses
follow the same API contract, since the base parent class
offers no re-usable functionality of its own. The hypervisor
base classs nova.virt.ComputeDriver also has no need for the
VIFDriver API to exist, since its integration point is the
'plug_vifs' method.

As such the nova.virt.VIFDriver class serves no purpose
other than to mislead reviewers into thinking there is a
common API where none actually exists. It should thus be
deleted

Change-Id: Id287f7e66143a248a5f106e010510a3f09d2b1e7
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Remove unused VMWare VIF driver abstraction

There is only a single VMWare VIF driver impl and that is
entirely a no-op in the plug & unplug methods. The VMWare
driver does call a 'ensure_vlan_bridge' method, which is
essentially a static helper for creating a bridge device.

Remove the VMWareVlanBridgeDriver class entirely and simply
have a single static method instead

Change-Id: I7d0873798e0e7261e17e8894237fd4339be7c3cd
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
fix resize of unpartitioned images with libguestfs

Following on from I9c974e138ff90e8b7a5a40f5b31dcdb25a59622d
Ensure that the libguestfs path also throws a NovaException,
handled by can_resize_fs().

* nova/virt/disk/vfs/guestfs.py (setup): Move the debug message
and guestfs handle outside the exception handler as we
don't want to map failure of those to a NovaException
that indicates an issue with the image as opposed to the
nova code or libguestfs installation.  Change to a more explicit
exception thrown by guestfs, so as to avoid masking other issues.
(teardown): Remove redundant calls to str().
* nova/virt/disk/api.py (can_resize_fs): Cleanup the debug messages,
and use the newer vfs API directly, rather than the slightly
hacky call to inject_data() with no data to inject.

Fixes bug: 1094373
Change-Id: I3e1305cf6bb64278a8caf37e4c5005cb9683f632
Invalid EC2 ids should make the entire request fail.

Resolves bug 836978. I suspect there are many other cases where we
should add this check.

Change-Id: I027e44db2e27eb1ef913ddad8560cca08388906b
Merge "Enable nova exception format checking in tests."