NetApp fix for vsadmin role failure for ssc

The ssc feature does not work with vserver admin
role. If the user is a vsadmin then he does cannot
use the ssc feature fully. This fix checks the access
and issues apis appropriately and also handles error
conditions.

Closes-Bug: #1253657

Change-Id: Ibc4409e5d5e6e36bba41e5f59dd94c05b87b1cde
(cherry picked from commit 20667f7d49eed88ddd528be73293a624b3af1ba0)
Add valid check and unit tests on quota class

1.Cinder quota class hard_limit’s value should larger than -1 (-1 is a flag
value for unlimited).
2.Add unit tests for quota class.
3.Add quota_classes extension enabled in unitest, so as to do
unitest for quota_classes' update operation.

Closes-bug: #1245360

Change-Id: Ie483db1bdbd4fac875de26abab8ebebd96f4938b
(cherry picked from commit 8b6d51ea04a65d846b0e92a11e191327360d7427)
Hiding postgresql password in connection string

Closes-Bug: #1266804
Change-Id: Iafc820d6201acf5b563b62bd9f20a715901f1ab4
Support volume_readonly_update using XML format

Almost all API support JSON and XML format together,
But this API does not support xml format.
In the request of xml format,
the type of parameter "readonly" in the body is string.
In the request of JSON format,
the type of parameter "readonly" in the body is bool.
But the code only support bool, not support string.
This branch is to solve this problem.

Closes-bug #1244848

Change-Id: I7f2b09a0063df9daad3fdd09789f8e19c43b0aa3
(cherry picked from commit 76497ce9607df98e9e10fb1de1b6e607432f731b)
Fix volume transfer href issue

The volume transfer collection in url defined as "os-volume-tranfer",
but I got another define "tranfers" in href url. They are different.
So it should be modify.

closes-bug: #1242980
Change-Id: I69a43012f2bb70ce5fc7b0331d2759527a261170
(cherry picked from commit b104d1c0c70898b59b6668970e05cebadecd064a)
GlusterFS: Synchronize additional operations

create_cloned_volume() and copy_volume_to_image() should also be
locked against other driver operations to prevent collisions
from concurrent updates of snapshot metadata or volume file data.

Closes-Bug: #1267983

(cherry picked from commit 06999f610afc3a123f7a54895e39d690301a8eba)

Change-Id: Idd6158bfbe4dc049c33fa58b40d3d570fc244d01
GlusterFS: Fix deadlock in volume clone

The create_cloned_volume path could deadlock due to
create_cloned_volume and create/delete_snapshot using the same
lock for synchronization.

Refactor the calls to create/delete snapshot to call the inner
method which does not use a lock.

Introduced by "06999f6 GlusterFS: Synchronize additional op..."

Related-Bug: 1267983
Closes-Bug: 1272092

(cherry picked from commit e9722f09dfd4b58e40afbf285ab9a7738a641dca)

Note: Effectively includes most changes from "8772714 Pylint fixes ..."
to resolve conflicts.
(cherry picked from commit 8772714b4fcb2d05ae7f0bfe5cfd0fa660ab9100)

Conflicts:
        cinder/volume/drivers/glusterfs.py

Change-Id: I84ca34b201c10644faa047f1c9274c14bcdd0359
Catch ImageBusy exception when deleting rbd volume

If we try to delete an rbd volume that has 'watchers' on it
i.e. client connections that have not yet been closed
possibly because a client crashed, the remove() will throw an
ImageBusy exception. We now catch this exception and raise
VolumeIsBusy with a useful message.

If the volume delete fails in this way it will now stay as
'available' instead of going to 'error_deleting' so that the
delete can be retried (since it is expected to work on a
retry after waiting for the connection to timeout).

Change-Id: I5bc9a5f71bdb0f9c5d12b5577e68377e66561f5b
Closes-bug: 1256259
(cherry picked from commit f31d62a178a370ae9d736c09a3186ea9a3c92ee3)
Delete volume transfer in volume_destroy function

Doing volume force delete operation on volume-A will change volume-A's
status to 'deleted', so all related data about volume-A should be deleted.
Now current version's volume_destroy function doesn't delete related data
of volume transfer. If there is volume transfer about volume-A, first do
force delete operation on volume A, and thus the volume-A's transfer data
would be residual. So remove the related data of volume transfer in
volume_destroy function.

Change-Id: Id80a6e0cc061fccb02af60706244be043abdd72d
Closes-Bug: #1270785
(cherry picked from commit 19d8040d61d453ec3916d74c628189ca0b54ac59)
Update quota-set throw 500 error

The server doesn't check whether the parameter "quota_set" or
"quota_class_set" is in request
body.So the 500 error has been thrown.

We should catch the KeyError and transfer the KeyError to
400(HTTPBadRequest) instead of 500.

Closes-Bug: #1249971
(cherry picked from commit 2ed2f3aff8eee70e02eb995780af292057cfcad4)
Change-Id: I01260c77efa50324f3d203888689cdb1e94d2c21
Add db2 communication error code when check the db connection

bug 1244092

Change-Id: I17882e407afa00167e550a565081219f9e432a31
Don't raise MySQL 2013 'Lost connection' errors

Closes-bug: #1276510

Although this code error is part of the `ping_listener` tests, it was
missing from the list of known - and ignored - connection errors.

The code error 2013 refers to a connection lost during a query, see:
https://dev.mysql.com/doc/refman/5.0/en/error-messages-client.html#error_cr_server_lost

Without this error code, the session won't try to reconnect to mysql,
which makes `max_retries` useless.

Change-Id: If2667cf83ac656666ffe00aa90e3454516b080db
Ensures NetApp iSCSI driver correctly compares int values for size

The NetApp iSCSI driver needs to verify that the new size requested
during an extend operation does not exceed the max_resize of the
lun.  However, the driver was doing a >= compare against str values
of the sizes rather than the int values.  This caused the incorrect
code path to be used in certain situations.

Change-Id: I8bc66c71db6b469c7adf00ce8b5091513fccb740
Closes-Bug: 1281279
(cherry picked from commit a1d78df1b7c95dbb5024023662932cd94313dd58)
Merge "Add db2 communication error code when check the db connection" into stable/havana
Merge "Catch ImageBusy exception when deleting rbd volume" into stable/havana
Merge "Don't raise MySQL 2013 'Lost connection' errors" into stable/havana
Merge "Support volume_readonly_update using XML format" into stable/havana
Raise max header size to accommodate large tokens

The max header is exceeded in the following scenario
- Auth tokens built with a keystone v3 API catalog
- A catalog with approximately 8 or more endpoints defined

An equivalent fix will be required for all projects which use
eventlet.wsgi.

Copied from https://review.openstack.org/#/c/33362/

Closes-Bug: 1190149

Change-Id: I3fcb196b25a7a477b799c8dfa2ff5115977ca06d
(cherry picked from commit aa1ba1f0176af286506e4188628e5acbb8f7f0e6)
Cast the quota set values to integer before checking their validity

Closes-Bug: #1280159
(cherry picked from commit a444ca8646103042d665536796168252a8ca1031)

Conflicts:
	cinder/api/contrib/quotas.py

Change-Id: I56409607d435a5e2ff702ccb9f19c5d12b432570
Merge "Hiding postgresql password in connection string" into stable/havana