GlusterFS: Ensure Cinder can write to shares

Ensure the Cinder user can write to the GlusterFS share.  This
is required for snapshot functionality, and means the admin
does not have to set this permission manually.

Closes-Bug: #1236966
Change-Id: I4a9ea40df9681ca6931ad6b390aa21b09d6cfec9
Make volume_glance_metadata_create compat with DB2

As DB2 does not support SQL insert via raw number type if
table column data type is "CLOB" ("TEXT" in sqlalchemy), we need
to convert numerical values to string before insert operations.

This problem was discovered through the
test_volume_create_get_update_delete_from_image test case in
tempest.api.volume.test_volumes_get.  The test case fails with
a DBError without this change in place.

Partial-blueprint db2-database

Change-Id: I5b378cce5b639df23d7003548f49bdab1eecf6a0
Remove the redundant judgment for 'restore'

In the function 'restore', there is redundant judgment for the body, it
should be removed.

Change-Id: Icfc5ae20141fad9d72de227cf5c06ca8504bd22c
Closes-Bug: 1254671
Fix _update_volume_stats typos

Fix _update_volume_stats typos in 'cinder/volume/driver.py' and
'cinder/volume/drivers/eqlx.py'.
'_update_volume_status' to '_update_volume_stats'

Change-Id: I0642bdb911ca72517ed655f795e0055f4c4654b8
Closes-Bug: #1254978
Fix Storwize terminate_connection with no host

Nova may pass a connector to Cinder with no 'host' field, which was
causing a KeyError in the Storwize driver. This patch resolves this case
by doing the following:
1. If the volume is mapped to only 1 host, unmap it
2. If the volume was not mapped or mapped to multiple hosts, print a
   warning but don't raise an exception

Change-Id: I0ec1c24adbdfbcf1c4868b4981a2e2618d4b411c
Closes-Bug: #1244257
Redundant body validation for volume_upload_image

The body validation is redundant for os-volume_upload_image,should remove
the redundant validation.

Change-Id: Iba7a4d5f917615f8a8d6320b5fe18af66e4011e0
Closes-Bug: #1254975
Add chance weigher to scheduler

Adds chance weigher to scheduler to allow distribution of requests
randomly between a number of volume managers.

Change-Id: I3f652caf200c406965b52b94cebb244d3bc1779a
Handle NotFound exception in snapshots API code

Passing tests in the gate leave unhandled trace/error messages
for a VolumeNotFound issue.

These are caused by the test_volumes_snapshots_negative test
which requests a non-existent volume and the tests pass however
the log files are a bit messed up due to the unhandled exception.

This change just adds a try/catch block around the volume get calls
in the snapshot modules and raises HTTPNotFound as appropriate.

Change-Id: I2096f2da7c68ef7924fc8e69b2d5c2afea578512
Closes-Bug: #1255214
Add volume migration code to Nexenta iSCSI volume driver

Utilize ZFS-specific optimizations for direct host-to-host
volume migration

DocImpact
Implements: blueprint nexenta-iscsi-volume-migrate
Change-Id: Ib9f2fa7e1ccb93dbdbc951ddc3a0eda55cb001d5
Parse out '@' in volume['host'] to do discovery

The backup method of getting iscsi info is to use
iscsiadm discovery, however currently that method
just uses volume['host'] which in the case of
multi-backend will use "host@backend-name".

This will cause the discovery to fail of course, so
this change just parses out the '@' symbol if it's present
and avoids the problem in the first place.

This also beefs up the error logging and exception catching
a bit.

Parsing out the '@' symbol all the time should be safe as
the accepted valid chars for hostnames are digits, a-z and
hyphens.

Change-Id: Ic45a38bf4c56a4aec6847ab0d29e3b41d35bd3d2
Closes-Bug: #1250673
Merge "Remove the redundant judgment for 'restore'"
Fix the wrong verification for 'readonly'

A mistake verification for 'readonly', fix it, and add some tests.

Change-Id: Iea20245eef2e884cf4c0d8e62c2da4f1cd967106
Closes-Bug: #1255802
Merge "Handle NotFound exception in snapshots API code"
Merge "Fix the wrong verification for 'readonly'"
Merge "Parse out '@' in volume['host'] to do discovery"
Merge "Add volume migration code to Nexenta iSCSI volume driver"
Fix suppressed exceptions for migration downgrade

In SQLAlchemy migration versions 009, 010 and 020, we missed
reraising exceptions while logging errors in case of a downgrade.
We don't want exceptions to pass silently. This patch fixes that.

Closes-bug: 1227881

Change-Id: Id11b1c5d2e26d208e88bb84e5b46c4b7affc3f9f
Remove unused import and CinderNode sqlalchemy model

Class CinderNode is never used,
attribute_mapped_collection from sqlalchemy.orm.collections imported but unused.

Change-Id: I5d72aaf0922eab001f2db5b884b65632481df937
Updates .gitignore

To ignore swap files from getting into repository
currently the implemented ignore is *.swp
however vim adds more swap files if .swp exists,
so improving this with .*.sw?

Closes-Bug: #1255857

Change-Id: I22b6fa351dd565d4783f432c01785c706acd8397
Fixing check order for empty body in get_body()

Cinder API logged the following debug message for each request with
empty body:
"Unrecognized Content-Type provided in request get_body"
Check order was fixed in get_body function to follow the correct flow
and display the right message (empty body).

Change-Id: Ie561983a4da791a412fea3fc390dab718dfce191
Closes-Bug: #1252692