Fix EC2 instance type for a volume backed instance.

EC2 reports 'instance-store' type for a volume backed instance
which was booted with short root device name (no '/dev/' prefix).

This fix make instance type detection independent of addition
'dev' prefix to the instance root device name.

Change-Id: I6c2be09eaa91341e401bbc128b3efc79c60e345e
Closes-Bug: #1324400
Cells: Update set_admin_password for objects

Cells code was calling the compute/api set_admin_password method with an
old-world style instance and failing on the task_state attribute access.
This adds set_admin_password to the list of methods handled via the
cells RPC redirect method which is objects compatible.

Change-Id: I12e212260ed62dc9380202de31fda928a9498dcb
Closes-Bug: #1335315
Remove snapshot_id from _volume_snapshot_create()

There is an argument "snapshot_id" in _volume_snapshot_create(), but
the argument is not used in _volume_snapshot_create().
This patch removes it for cleanup.

Change-Id: Ibaad290e149a863c749c74ace3ba702870b8dd1b
libvirt: improve unit test time

There were unit tests that were taking more than 4 seconds.

nova.tests.virt.libvirt.test_driver.LibvirtConnTestCase.test_clean_shutdown_failure    5.091
nova.tests.virt.libvirt.test_driver.LibvirtConnTestCase.test_clean_shutdown_with_retry 4.093

TrivialFix

Change-Id: I75cdb74dca69a1e31d6b974148c9590328c362e1
Closes-bug: #1366549
Remove exclude coverage regex from coverage job

This commit removes the regex to exclude the coverage extension from
the tox coverage job. The regex was needed for the unit tests on the
coverage extension, (which would mock out coverage) however that
extension has since been removed from nova. So we no longer need to
exclude tests that don't exist anymore.

Change-Id: I45685b1113ecc78eda92f13755ff2274ff517829
Adds a test for raw_cpu_arch in _node_resource

Commit 5fd0500e7e262c602dc7bbbff456326598da41bc
makes it such that the cpu_arch is not
made canonical for scheduling, this adds a unit
test to cover the change.

Change-Id: I89080a0178b1098c2a297b7268fad279ece680c2
Related-Bug: #1366859
Make sure libvirt VIR_ERR_NO_DOMAIN errors are handled correctly

Some libvirt VIR_ERR_NO_DOMAIN errors leak outside of the libvirt
driver, which may result in instances being set to ERROR state.

Make sure such errors are either ignored (during destroy) or
otherwise turned into InstanceNotFound errors.

Change-Id: I0ac2989062247a05162825760367488f4f90bd04
Closes-Bug: #1368404
virt: use compute.virttype constants and validate virt type

Where we have hardcoded hypervisor types, use compute.hvtype
constants. Where we get hypervisor types from external systems,
validate them against the list of acceptable names.

The Xen hypervisor is reporting a virt type of 'xapi' for
supported instances which is confusing the virtualization
type with the hypervisor API access method. It should be
reporting 'xen' as the virtualization type.

On the other side, the ImagePropertiesFilter will canonicalize
the hvtype it fetches from image metadata, so that 'xapi' gets
remapped to 'xen' during comparison.

Upgrade-impact: the hyervisor type will intentionally no longer
  distinguish libvirt Xen from XenAPI within a compute cloud.
  The driver name should be used instead
Closes-bug: #1348623
Change-Id: I2c740e8eb068a5d93ba5f72292fb30d899931ea5
Don't swallow exceptions in deallocate_port_for_instance

This uses the new _delete_ports method to (1) still
ignore 404 errors but also (2) raise up non-404 errors
from the neutron client when deleting the port fails as
we shouldn't be masking over this since the nova-api
call wouldn't be failing even though the underlying
operation failed.

Change-Id: Id05ea47ba03e0b60ae3a296920159e8189f9dd55
Related-Bug: #1292243
delete python bytecode before every test run

Bring over the cleaning line from run_tests.sh for the pyc files to
all the tox runs.

This should eliminate the need to clean -x -i to kill pyc files in
your local directory to get tests to pass.

Closes-Bug: #1368661

Change-Id: Idf3a46d8c95806f2d2ce28ce84ced12b625e53df
Updated from global requirements

Change-Id: Ia631e585f9133f4d2f606394a6ffe47c323a9242
check network ambiguity before external network auth

This change refactors the logic in the neutronv2 api to check for
network ambiguity before checking permission to attach external
network. In the scenario when there is a network available in the
client's tenant and an external shared network available in a
different tenant, the client was receiving a Forbidden error
because the external network was in the list of available networks
even though the client did have access to the other network in the
list.

With this change, the client receives a NetworkAmbiguous error instead
the same scenario, as they could succeed in booting an instance while
specifying --nic with the net-id of the network they can access.

Closes-Bug: #1364344

Change-Id: Ia94c25ff0ffd6a368da272fc6d883986156a0362
correct inverted subtraction in quota check

From a user reported bug: we were doing the subtraction backwards
here, causing int overflow, causing all kinds of invalid. Instead
actually subtract the smaller number from the bigger number.

Change-Id: I7c099df5e31aa25b8be65c570e2e0b8a3e93c277
Closes-Bug: #1363324
Fix parsing sloppiness from iscsiadm discover

As reported by a user, iscsiadm might spew some other random gorp when
it starts up, and if it does, nova explodes poorly. Put a modicum of
sanity testing into the parsing of the output to make this less
likely.

Change-Id: Iaf55438bb3ec412187158e80f9fbc1d8e7071207
Closes-Bug: #1308649
Correct baremetal/ironic consume_from_instance...

In 2bc74e66d90b6fae3c5ca8f79f99e75169da644f we recently changed
the HostState.consume_from_instance method parameters to include a
context. This patch updates the relevate baremetal/ironic host state
classes to do likewise.

This fixes a critical TypeError that occurs when trying to use
Ironic or Nova Baremetal otherwise.

Change-Id: I46eebce19603cb4c4a934b1647ff6433d75799ad
Closes-bug: #1369151
Make obj_make_compatible consistent

The code was originally copy pasted code with an incorrect function
name. It was modified in e274c45dcd37f49d66cc3cce72c2fd97f444151c
to have the proper function names, but no tests were added. The call
is inconsistently used as well. This modifies all the call sites
to work the same and adds a test for one of them.

Change-Id: I79d295ff49057f42f1e6609cecb5bcd38e73f8d9
Fix race condition in update_dhcp

This modifies linux_net to only make one query for the fixed ips.
Previously it was getting the list of fixed ips twice. It also
merges the convoluted logic around single_default_gateway into
the single query so that it doesn't make a db request per fixed ip.
This prevents a race condition that could lead to ips not allocating
properly if an instance is deleted while the dhcp config was being
updated. Also, e274c45dcd37f49d66cc3cce72c2fd97f444151c missed a
call to obj_make_compatible for instance version. This adds it
since it will be in a conflicting spot.

Change-Id: Iffdc60063b26c9e3f6b8dbe5b67301cbc19b2564
Resolves-bug: #1359510
Merge "Fix parsing sloppiness from iscsiadm discover"
Merge "Remove snapshot_id from _volume_snapshot_create()"
Merge "Adds a test for raw_cpu_arch in _node_resource"