glusterfs: Honor mount options when restarting cinder service

When restarting cinder service (cinder-volume specifically),
ensure that the gluster mounts are unmounted and remounted so
that any new mount options added to the shares config file
is taken effect, post service restart.

Change-Id: I9fe3442cd4899770b4c9ea4a73a7fe62967f2c64
GlusterFS: Various unit test improvements

Fixed bug that "_ensure_share_writable" was not mocked and therefore
"GlusterfsException" was thrown earlier than expected with an unexpected
error message.

To better guard against situations like this, I've added a helper method
"assertRaisesAndMessageMatches" to test for the thrown exception AND its
message.

Added "mox.VerifyAll()" where it was missing and cleaned up unused
mocks.

Fixed test for "create_volume_from_snapshot" (which actually tested
"create_cloned_volume").

Added tests for driver function "copy_volume_to_image".

Overall, code coverage for volume/drivers/glusterfs.py improved from 74%
to 82%.

Change-Id: I872eb477351c5406d07bbf5b748ebde2d878120a
Fixes cinder volume from image on Windows

When creating a volume from an image, after the volume is created,
qemu-img is supposed to copy the downloaded image to the volume.
This fails as the disk is enabled and is not accessible.

Also, Windows does not support using dynamic vhds as iSCSI disks
and as qemu-img cannot create fixed vhd images, there must be an
intermediate conversion before importing the disk.

In order to be able to modify an iSCSI disk, it must be disabled
first.

Closes-Bug: #1300906

Change-Id: I726b23287c5b710227288d6215538f01dfb0f979
VMware: Optional create backing parameters

The current create backing methods do not support specifying an adapter
type for the backing VM. These methods always create a backing VM with
a single disk and LSI logic adapter. This change adds optional parameters
to create backing methods so that a backing VM can be created without a
disk or with a specific adapter type.

Partial-Bug: #1284284
Partial-Bug: #1287185
Partial-Bug: #1287176
Change-Id: Ifff64eb2be4af1c4218e810366e25dbecdc5847f
VMware:Fix params for copy-image-to-volume

While creating a volume from stream-optimized image, the adapter type
in the image meta-data and the profile in the volume type extra spec
are ignored. This change fix those missing parameters.

Partial-Bug: #1284284
Closes-Bug: #1332482
Change-Id: I46c4755989fe61e0e654ca6daa3c3af0655071f0
test_storwize_vdisk_copy_ops fails if green thread context switch

There is loopingcall(green thread)will cause _rm_vdisk_copy_op() run
twice.On the second time, the exception KeyError is not caught.

Closes-Bug: #1302670

Change-Id: I788f07c33f76693a13f0d581e687a32c6736a394
Update _resize_volume_file() to support appropriate permissions

ibmnas driver inherits _set_rw_permissions_for_all() from nfs.py
which sets 666 to the volumes. Changes are expected to be made in
nfs.py such that it sets 600 or 660 permissions, by doing so
ibmnas driver fails performing the operation _resize_volume_file()

Adding run_as_root in resize_volume operation.

Change-Id: Iecaf111f96f93b4e24bd81edd6aa82829113b4bb
Closes-Bug: #1333252
Merge "Update _resize_volume_file() to support appropriate permissions"
Merge "GlusterFS: Various unit test improvements"
Merge "glusterfs: Honor mount options when restarting cinder service"
Remove check_volume_az_zone functor and associated passing

To make it easier to understand why a volume is being rejected
when its availability zone is not allowed remove the functor
that does this check and use the set of valid availability zones
as the master list of valid zones that can be used (and use this
inside the task that validates this data).

Change-Id: Ib8462dbbbc33242edbbf02a7c737746d3142d043
Make rbd driver string encoding checks consistent

All string checks should use strutils.safe_encode()

Closes-Bug: 1333446
Change-Id: I56c9ccbcedd34c83793620561da17c47cb5f551c
Merge "test_storwize_vdisk_copy_ops fails if green thread context switch"
Merge "VMware: Optional create backing parameters"
Merge "VMware:Fix params for copy-image-to-volume"
Merge "Make rbd driver string encoding checks consistent"
Merge "Fixes cinder volume from image on Windows"
Merge "Remove check_volume_az_zone functor and associated passing"