Fix retyping attached volumes requiring migration

Modifies retype method so that volume db entry only updated if the
volume isn't migrated.

The migrate_volume_completion method is made responsible for detaching
the old volume and attaching the new one. This takes the requirement
from nova because the calls need to be done in a certain order which
isn't guaranteed when performed by nova.

attach_volume now marks the migration_status as complete because it is
the final action by cinder.

Change-Id: Ia15636893be4f0077a4f75e746a8ab1a8798c44b
Partial-Bug: 1316079
Fix unsaved exception in backup/drivers

When an exception occurs during exception handling, it loses the
information of the first exception.

We should use the excutils.save_and_reraise_exception() in some cases.

Change-Id: I5d0ea53ba6c52138c71cca61aedbdf06338f2a7d
Closes-Bug: #1292380
Only warn about deprecation warnings once

Instead of repeatly emitting data about which
modules are deprecated again and again just warn
about those deprecation once and then never warn
about them again.

This is a good thing to have, and will be needed
as taskflow moves one of its classes used in cinder
to a new and longer-term location and will emit
deprecation about the usage of the old location.

Change-Id: I962f9bab920a03eca235c9e4591d367687e44954
Add cinder volume driver support for Nimble Storage.

The set of changes introduces the cinder iSCSI volume driver support for
Nimble Storage. It implements the minimum set of features required by the
icehouse release. Please see the blueprint nimble-iscsi-volume-driver for
more information.

Change-Id: I48781fc890b8fefb33027da3db2b1ff56c5deed4
Implements: blueprint nimble-iscsi-volume-driver
Fix host option isn't set when using multiple backend

When using multiple volume backend, and volume driver is
cinder.volume.drivers.block_device.BlockDeviceDriver, host
option isn't set so a call to get volumes of a host returns none,
This patch changes to use self.host instead of self.configuration.host

Change-Id: Ide34ed29adad14b778b1a7388e9dc313241fa243
Closes-Bug: 1332909
Restore osapi_volume_workers config option

osapi_volume_worker was introduced when enabling multi-process API
support for Cinder. However, this config option was accidentally
dropped in commit 464277220ddb800ac69562649fde62e5ca9358c4
(https://review.openstack.org/#/c/67657/20/cinder/service.py).
As a result, the value in cinder.conf wouldn't be honored.  This
change restore this config option.

Closes-bug: #1335295

Change-Id: Ib2d8532d3e6d0f48da0bc4dd6f6e64bfff8973ea
Use (# of CPUs) osapi_volume_workers by default

This changes the default number of cinder API workers to be equal to the
number of CPUs available on the host, rather than defaulting to 1 as it
did before.

Commit 75c96a48fc7e5dfb59d8258142b01422f81b0253 did the same thing in
Nova in Icehouse. Similar changes are being made to Glance and Trove as
well.

DocImpact: osapi_volume_workers will now be equal to the number of
           CPUs available by default if not explicitly specified
           in cinder.conf.

UpgradeImpact: Anyone upgrading to this change that does not have
           osapi_volume_workers specified in cinder.conf will now be
           running multiple API workers by default when they restart
           the cinder-api service.

Closes-Bug: #1333370

Change-Id: I8dec104800c18618e0c8422bbb93d5dc19c12876
Fix begin_detach logic

Fix begin_detach logic so it checks that a volume is in-use AND
attached.

Change-Id: I6f0e584070a5fc02c55c26ea92cb8b0c2a2cda3e
Closes-Bug: #1337088
Replace tearDown with addCleanup - Part 3

Replace tearDown with addCleanup in some cinder unit tests.

Infra team has indicated that tearDown should not be used and should
be replaced with addCleanup in all places.

Implements blueprint replace-teardown-with-addcleanup

Change-Id: I8469ffb5c896d40f9979cd6d1f8da81be763ec14
Enable E121,E122,E123,E126,E128 hacking rules

This change enables E121,E122,E123,E126,E128 hacking rule and fixes
all violations found in Cinder.

Change-Id: Ibfdcb3e286393d932e1534500e31a5f90c031adf
Ceph rbd volume manage/unmanage support

Ceph rbd support for managing and unmanaging volumes.
Partially Implements: blueprint add-export-import-volumes

Change-Id: I272f65621a3dac50a154b7f2caa545ae6fb0e54f
Correct lvm_mirrors help message

The description is not correct if someone sets
lvm_mirrors=0.  Also clarify LVs vs. lvms.

Change-Id: I7ec74fc8beaef5e638bc1a5dac3d7d97f1c474d3
volume_image_metadata missing from volume list

The volume_image_metadata field was missing from the volume list
because we tried to filter VolumeGlanceMetadata against a non-existent
project_id field. Filtering should be done on the Volume associated
to the VolumeGlanceMetadata instead.

Move project_id filtering out of model_query as it assumes
the project_id field is in the queried model itself.
Build the filter ourselves against Volume.

Change-Id: I6053708296f2b5e24513dc87ed63da0f67c220ae
Closes-bug: #1337526
Merge "Fix host option isn't set when using multiple backend"
Merge "Correct lvm_mirrors help message"
Imported Translations from Transifex

Change-Id: I7295f2dda30117f7fca31c83aae799f885756cc4
Merge "Fix retyping attached volumes requiring migration"
Imported Translations from Transifex

Change-Id: Ic5c214bb7e55322c1b32c52691535bef4ac23937
Updated from global requirements

Change-Id: I218171b2e3581ea05a14719a821c131dd47c8eb5
Merge "Imported Translations from Transifex"