Delete iSCSI devices after volume detached

Previously, after detaching from a volume, the iSCSI device
remains attached on the compute node until all LUNs for a given
IQN are detached -- causing issues when LUNs are reused for
different volumes. This change will delete the device(s)
associated with the detached volume so LUNs can be reused.

Fixes bug 1112483
Change-Id: Icae3ec4d1ee2036fbba7b9eb5c03a1c86014fcc0
Rename instance_type to flavor in xenapi virt driver

Renames 'instance_type' to 'flavor' in the xenapi virt driver and
associated tests.

Part of blueprint flavor-instance-type-dedup

Change-Id: I0f1a17b725102eab30ce90714b50444d8d140da0
Whitelist external netaddr requirement

* tox.ini(testenv.install_command): Use the --allow-external and
--allow-insecure options so that pip 1.5 and later will assent to
retrieve the netaddr package even though it's not hosted on PyPI.
The --allow-insecure option is aliased to a clearer
--allow-unverified wording in 1.5, but the old form is being used to
avoid breaking users of 1.4.x and will be valid at least through
1.6.x according to comments in the pip source.

Partial-Bug: #1266513

Change-Id: I005e752c8cb9bca78b1ebe777eb5230e9bf05bd8
Cleanup object usage in the rebuild path

This patch removes a redundant fetch of instance system_metadata
that was used to refresh our notion since the first get. Now that
the rest of the code is using instance.save(), it has an updated
view of system_metadata at effectively the same point.

Related to blueprint icehouse-objects

Change-Id: I357daa5ae627e8959b77bd0cb00e152810f9c0eb
Don't deallocate/reallocate networks on reschedules

If network allocation is not host dependent we don't need to deallocate
and reallocate a network for each reschedule.  Only baremetal has host
dependent allocation so for that driver networks are de/reallocated on a
reschedule.

The current method in the code which checks for the length of the list
returned from _get_instance_nw_info() doesn't work because it can't
distinguish between an unallocated network and one that doesn't return
network information.

Part of bp remove-cast-to-schedule-run-instance

Change-Id: Ic427715f46cb5179a37c593c4217f239c65544c3
Docker Driver doesn't respect CPU limit

The docker driver doesn't respect the CPU settings of the configured
flavor.

Docker/LXC supports only relative cpu allocation. The relative
cpu allocation doesn't prevent that a container can use all CPUs but it
can at least ensure that a container with more CPUs gets more CPU
cycles.

DocImpact - Docker containers are now given CPU shares according to
the vcpu setting of the flavor used when creating the container.
Previously, the vcpu field was ignored and all containers got equal
CPU shares, regardless of the vcpu setting.

Change-Id: I7184eddfd8bbd2cbaa07a48ebb40bc9aa3fbd4a9
Closes-Bug: #1256264
Merge "Rename instance_type to flavor in xenapi virt driver"
Merge "Better exception handling for deletes during build"
Merge "Don't deallocate/reallocate networks on reschedules"
Merge "Whitelist external netaddr requirement"
Merge "Delete iSCSI devices after volume detached"
Merge "Cleanup object usage in the rebuild path"
Merge "Docker Driver doesn't respect CPU limit"
Stats refactor

Change-Id: I1651d758dd21c87ccd768fdd86c910ec5080c71c