Handle a flavor create failed better

Catch FlavorCreateFailed exceptions which when flavor creation fails.
This type of flavor creation failure is caused by an internal nova problem.
Return an internal server error (500) to the user so they know
to contact their cloud provider.

Closes-Bug: #1292309

Change-Id: I268c84dae290b0170448d789509af781555df9b0
libvirt: Remove unecessary suffix defaulting

The defaulting of suffix is being done in function signature, so the
additional check in the function body is unecessary.

Change-Id: I8fb6c2d0d71761818430b5d6500e49fc70dad890
Fix NotImplementedError in floating-ip-list

A list of existing floating IP (nova floating-ip-list) fails
when using VMwareVCDriver/LibvirtDriver and nova-network.
The following error is thrown: "NotImplementedError: Cannot load
'instance' in the base class". The problem is caused by
_normalize_ip, which tries to set an 'instance' field in
FloatingIP that is needed by _translate_floating_ip_view. The
instance is derived from the FixedIP that is assigned to the
'fixed_ip' field in FloatingIP. However, FixedIP may not have
an 'instance' field set, which can cause the NotImplementedError.

The following patch removes _normalize_ip and assigns the
'instance_id' required by _translate_floating_ip_view to
the 'instance_uuid' in FixedIP, since only the instance ID
is required and not the entire instance object.

Change-Id: I2d7937e969bd87e53557842a22f3861f0d307b5e
Closes-Bug: #1356051
VMware: add adapter type constants

Commit 6a55d4281dbdd5462eafa08321207e7f71d5ebb0 introduced
default constants. This patch creates constants for different
adapter types used.

TrivialFix

Change-Id: I96481b86e8c90f754da05cfbfbd9cb89a7450d98
Update RESP message when failed to create flavor

The response message is unexpected(not easy to understand),if
requested resource exceeded limitation when to create flavor.
Because the error message used DB model fields but not that
used by API body. Such as following response message:
"Invalid input received: memory_mb must be <= 2147483647"
'memory_mb' is DB model field but 'ram' used in REST API

Change "memory_mb" to "ram", "root_gb" to "disk" and
"ephemeral_gb" to "ephemeral".

Change-Id: I43e2f307d21325a6b54815edf157f3d5fa1135e5
Fixes: bug #1350751
Preserve exception text during schedule retries

This fix preserves the exception text (as intended) when the number
of scheduling retries exceeds the maximum attempts.  We don't pop
the exception message anymore in _log_compute_error so that the
final "max attempts" error message has an opportunity to dump it
as well.

This defect caused the exception text (from the compute process) to
ALWAYS be None, thus making it difficult to triage compute errors.

Change-Id: I5c7cac1d79dc583cca523270bb0a96d3353ca1f6
Closes-Bug: #1361097
Fix CellStateManagerFile init to failure

Currently, specifying a cells_config file in nova.conf causes
CellStateManager to fail and in turn stops the nova-cells service from
starting. The reason is that CellsManager creates an instance of
CellStateManager with no arguments. CellStateManager __new__ runs and
creates an instance of CellStateManagerFile which runs __new__ and
__init__ with cell_state_cls and cells_config_path set. At this point
__new__ returns CellStateManagerFile and the new instance's __init__
method is invoked (CellStateManagerFile.__init__) with the original
arguments (there weren't any) which then results in:
2014-04-29 11:52:05.240 16759 TRACE nova self.state_manager =
cell_state_manager()
2014-04-29 11:52:05.240 16759 TRACE nova TypeError: __init__() takes
exactly 3 arguments (1 given)

It seems reasonable for CellStateManagerFile to derive the
cells_config_path info for itself so I have updated the code with that
change and added unit tests to catch this bug and to check that the
correct managers are still returned

Change-Id: I9021640515142a3ca95c2d9e7b03e19b529bc175
Closes-Bug: #1314677
Check vlan parameter is valid

Now, we can create network with invalid vlan with nova-network.
Check if vlan parameter is greater than 4094 or less than 1.

Change-Id: I27a74fb76ba575f43fee669c0c495e0ef96d4b18
Closes-Bug: #1334563
Updated from global requirements

Change-Id: I5161bbd3b32acc612a9bf2ccf575ace7f748806d
Remove duplicated negative factors in keypair test

In test_keypair_create_fail_policy, there are two negative factors.
One is a policy violation, and another is a bad request body.
The purpose of the test is checking the policy violation, so a bad
request body is not right for this test.
This patch removes a bad request body from the test.

Change-Id: Ia165e08410b0576950efe83e5ab6a92c9c7f6a50
libvirt: Uses correct imagebackend for configdrive

When the configdrive file is created it must be moved to the
configured imagebackend, not always the raw one.

Otherwise nova can't boot an instance with a configdrive attached
when the rbd backend is configured.

Related to bug #1246201
Closes-bug: #1361840

Change-Id: I59578d9b87a36ff4417a30ff14c5774c54698cf3
Merge "Fix NotImplementedError in floating-ip-list"
Merge "Handle a flavor create failed better"
Merge "libvirt: Uses correct imagebackend for configdrive"
Merge "Updated from global requirements"
Merge "Check vlan parameter is valid"
Merge "Update RESP message when failed to create flavor"
Merge "Fix CellStateManagerFile init to failure"
Merge "VMware: add adapter type constants"
Merge "Remove duplicated negative factors in keypair test"