Mark Sturdevant [Mon, 5 May 2014 21:13:48 +0000 (14:13 -0700)]
eliminate the need for hp3parclient in tests
In order to eliminate the need to have the hp3parclient in the
global-requirements project, we need to remove the hp3parclient
from being imported in all 3par driver unit tests in cinder.
Dirk Mueller [Mon, 5 May 2014 11:52:31 +0000 (13:52 +0200)]
Remove explicit dependency on amqplib
amqp (or amqplib) is only accessed via kombu, and kombu
already specifies the right dependency (either amqp if new
enough or amqplib for old versions of kombu).
Jay S. Bryant [Thu, 1 May 2014 22:13:25 +0000 (17:13 -0500)]
Ensure that lun_id is an int
The map_vol_to_host function was treating the lun number
as a string rather than an int. This was causing attempts
to mount storwize_svc volumes to Hyper-V nodes to fail as they
were checking an integer type against a unicode type which
would fail.
This change casts result_lun to an integer after the value has
gone through the ssh injection attack check. This way Hyper-V
is able to verify if the found LUN is the target LUN, enabling
mount of storwize_svc volumes to Hyper-V.
Mark Sturdevant [Fri, 25 Apr 2014 17:58:42 +0000 (10:58 -0700)]
Implement validate_connector in FibreChannelDriver
The base FibreChannelDriver didn't implement the
validate_connector() method. It fell back to the
parent class which simply does a pass. Now the
FCDriver checks to ensure that the connector has
wwnns and wwpns and raises an exception if either
one is empty or not set.
This patch fixes an issue that happens when
a volume is attached to the same host
more than once. The driver wasn't looking
for the correct VLUN on the 3par after the
VLUN was created. We now get the VLUN
information in the return of the creation call.
Li Min Liu [Tue, 22 Apr 2014 02:56:54 +0000 (10:56 +0800)]
Storwize/SVC driver detach volume failed
If config two backends on the same storage, but the protocol is
different, one is FC and the other is iSCSI, that will create two
hosts on the storage.
When detaching the volume which is attached to the iSCSI host, the
driver will get FC host by default, that causes volume status keeps
'detaching'.
Kurt Martin [Mon, 21 Apr 2014 21:59:02 +0000 (14:59 -0700)]
Remove unused 3PAR driver method
Remove the "parse_create_host_error" method as it is no longer
used in the 3PAR drivers. It can safely be removed from the
3PAR common code and the unit test were no longer using the method.
Bootable Status is set to "True" automatically when user
create a volume from a image. But user have to set bootable
status manually when creating a bootable volume manually.
blueprint add-bootable-option
this commit is related to https://review.openstack.org/#/c/83691/
Jay S. Bryant [Fri, 18 Apr 2014 22:07:15 +0000 (17:07 -0500)]
Fix handling multiple WWPNs on preferred FC node
There was a bug in the code that checked to see if the
appropriate WWPN for a preferred node was available on the storage
host in intialize_connection. It was assumed that there would only
ever be one preferred WWPN. The code just checked to see if the list of
preferred WWPNs was in the list of available WWPNs. This would only work
if all of the WWPNs were available on the storage host. This resulted in
volumes not being able to be mounted when they should have been
available.
This fix changes the check of the preferred WWPNs to check each
item in the list until one is found. The first one found is used
as the target WWPN. If no match is found, the old default behavior
of selecting the first available WWPN is used. I have added a
warning message for this case as it is quite possible that this
won't work in the user's environment as was the case that uncovered
this bug.
Note that this change is only relevant for systems that are not using
multipath as systems that use multipath don't choose one WWPN, they
just send the whole available list back.
Mike Perez [Fri, 18 Apr 2014 01:46:36 +0000 (18:46 -0700)]
Fallback to None on missing Glance image attrs
It's possible for glance images to be missing attributes like name and
checksum. We'll just set those to None by default to avoid missing key
exceptions being raised.
Jon Bernard [Fri, 11 Apr 2014 14:44:55 +0000 (10:44 -0400)]
Re-raise exceptions in upload-to-image
This patch catches any exceptions returned from Glance during an
upload-to-image operation and re-raises them so that the user can see
the failure message and make the appropriate adjustments. More
specifically, this addresses an invalid container format.
ERROR: The server could not comply with the request since it is
either malformed or otherwise incorrect. (HTTP 400)
(Request-ID: req-f19bad2f-c39d-40a2-a3cc-6db9b9fe64cd)
To:
ERROR: 400 Bad Request
Invalid container format 'foobar' for image.
(HTTP 400) (HTTP 400)
(Request-ID: req-47cb2772-78c4-48b7-87ce-fb124ecfa989)
When call create volume api with image id "", it will create an empty
volume.
But when create volume with snapshot id "" or srv volume "", it will
return an 404 error.
So it should create volume fail when call create volume api with image id
"".
There is no need to rerequest the volume object from the db in
the extension because we already have a cached copy in the request.
This can potentially save hundreds of db queries in list.
Li Min Liu [Fri, 11 Apr 2014 02:50:24 +0000 (10:50 +0800)]
Add exception catch if Storwize/SVC driver failed when
retyping
If adding a copy for a volume of Storwize/SVC which is under
migration, Storwize/SVC command will fail because the
number of the copies of the volume exceed the limit which
is 2.
Modifying the volume type when adding a copy for the volume,
Storwize/SVC driver will also fail, should add exception catch.
Also add exception catch when getting the volume from the database.
This change is necessary to enable resolving bug 1305550
(https://bugs.launchpad.net/cinder/+bug/1305550 - Failed retype with
driver raised exception should set volume status to "error" ).
Julia Varlamova [Thu, 27 Feb 2014 14:31:29 +0000 (18:31 +0400)]
Replace tearDown with addCleanup - Part 5
Replace tearDown with addCleanup in:
- cinder/test.py
- cinder/tests/test_migrations.py
Remove empty tearDown methods from:
- cinder/tests/test_hp3par.py
- cinder/tests/test_hplefthand.py
- cinder/tests/test_ibmnas.py
since it does not add any functionality (and empty setUp methods as well).
Infra team has indicated that tearDown should not be used and should
be replaced with addCleanup in all places.
Julia Varlamova [Fri, 21 Feb 2014 06:50:46 +0000 (10:50 +0400)]
Replace tearDown with addCleanup - Part 4
Infra team has indicated that tearDown should not be used and should
be replaced with addCleanup in all places.
All addCleanup methods will be executed even if one of them fails, while
a failure in tearDown method can leave the rest of the tearDown un-executed,
which can leave stale state laying around.
Moreover, tearDown methods won't run if an exception raises in setUp method,
while addCleanup will run in such case.
This patch replaces tearDown with addCleanup or removes redundant tearDown
methods in cinder unit tests.
We had two types of wildcard imports in the code. Unneeded ones
in test files that are just removed, and some that we actually
want which are kept using the '#noqa' comment to tell flake8
to skip specific checks (such as H303) for that line.
Li Min Liu [Tue, 8 Apr 2014 02:18:56 +0000 (10:18 +0800)]
Storwize/SVC driver crashes when check volume copy status
Storwize/SVC driver does not clear up property of _vdiskcopyops
when deleting a volume. So if a volume which under async copy is
deleted before sync completed, the driver will crash.
When delete a volume, add a check for _vdiskcopyops, if volume
is in the dict, remove it.
Juan Manuel Olle [Fri, 21 Mar 2014 19:46:03 +0000 (16:46 -0300)]
Correct metadata ordering issue in tests
Some test including test_volume_get_all_filters
fails randomly because metadata is in a dict and
the items order is undefined.
The test comparison was changed to avoid unexpected
test results.
The volume manager should call driver.create_export()
and driver.remove_export() with an elevated context.
This is already done for remove_export() in some cases
but not in initialize_connection error paths, or for
terminate_connection.
This will at a minimum cause issues with the LVM LIO
driver as its create/remove_export methods uses database
queries requiring admin access (volume_get_iscsi_target_num,
iscsi_target_count_by_host).
John Griffith [Thu, 10 Apr 2014 00:10:08 +0000 (00:10 +0000)]
Check for silent failure of tgtadm remove
In order to work around a failure to remove targets that
had a reconnect the force flag was added to the tgt delete cmd.
(https://bugs.launchpad.net/cinder/+bug/1159948)
It turns out there's a bug in tgt where some versions will
sometimes silently fail when using the force flag.
(https://bugs.launchpad.net/ubuntu/+source/tgt/+bug/1305343)
The problem is that in the gates since we merged the force change
there's a very high number of cases where lvremove fails because
the device is still active. It appears that this is a result of
the silent force failures in target.
This patch adds a simple check after the force target removal,
if it detects the target is still present it reverts back to the old
non-force method to catch the cases that don't actually need the
force option.
This is a work-around until the version of target in the distros
is updated and can be used reliably, but closes the gate issue
bug that was reported.
GlusterFS: Delete active snapshot file on volume delete.
If a snapshot is taken of a volume that is attached to an active
instance, the volume file used by the instance will be switched to
the new snapshot file that is created. When you delete the
snapshot, the base volume file will be merged with the snapshot
file and the base volume is deleted. Upon a deleting the active
volume, the active snapshot file is not deleted because it does not
have the expected name that cinder is looking for, i.e.
volume-<uuid>. Instead, the snapshot file has the name
volume-<uuid>.<snapshot-uuid>. This patch looks at the volume info
file to find any active snapshot file and properly delete it when
the volume is deleted.
Jim Branen [Fri, 4 Apr 2014 20:36:42 +0000 (13:36 -0700)]
Fixes HP LeftHand driver with Paramiko 1.13.0
With Paramiko 1.13.0, the method exec_command now returns Unicode.
This causes a problem when the driver tries to build the XML returned
from the LeftHand array. The XML header returned from the array defines
the encoding as encoding=UTF-8. Therefore, we must now ensure the
encoding passed to the parser is utf-8.
Thang Pham [Thu, 27 Mar 2014 16:18:35 +0000 (12:18 -0400)]
Added unit test cases for _is_share_eligible in NFS driver.
The generic NFS driver (under cinder/volume/drivers/nfs.py) has
a method called _is_share_eligible, which checks if a given NFS
share meet user specified conditions, such as:
1. The ratio of actual space (used_space / total_space) is
less than 'nfs_used_ratio'.
2. There is enough space is available for the new volume.
This patch adds the corresponding unit test case for it.
Eric Harney [Tue, 8 Apr 2014 17:55:25 +0000 (13:55 -0400)]
Log initialize_connection error before remove_export
The way this code is currently structured, if
self.driver.remove_export() raises an exception, you see the
error message logged for that but the original exception
from initialize_connection() never gets logged.
Since force delete volume apis are only admin apis, force detach volume api
should also be an admin only api. Currently, the force detach api,
which uses the default rule in policy.json, can be called by admins and owners.
This patch make force detach volume api an admin only api like force
delete volume.