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.
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.
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.
Li Min Liu [Tue, 1 Apr 2014 09:08:37 +0000 (17:08 +0800)]
Change iogrp property when retyping for Storwize/SVC
If need migration when retyping, Storwize/SVC driver will add a copy
of the volume first, and then start a task to check volume sync
progress which will run each 10 mins. At last delete the origin copy
when sync finished.
But iogrp property is not a parameter of addvdiskcopy, so the iogrp
of the copy volume is the same as the origin. If iogrp property is
diff between the old and new volume type, the property will not
change when retyped.
Mike Perez [Thu, 3 Apr 2014 00:52:11 +0000 (17:52 -0700)]
Allow deprecated volume update keys in v2
Keys like display_name and display_description were deprecated for other
actions in v2 like creating volumes, so for consistency they should work
with updating.
Chris Buccella [Thu, 3 Apr 2014 04:02:45 +0000 (04:02 +0000)]
_translate_from_glance() can cause an unnecessary HTTP request
After returning from a get() call to python-glanceclient, cinder runs a
translation function on the returned Image to get the data it wants. Part of
this process is checking for an expected set of attributes, one of which is
the deletion time ('deleted_at'). However, if the image has not been deleted,
deleted_at key will not exist. This forces another call to glance to occur for
the same image. A similar problem exists for the checksum attribute, which does
not exist before an image is active. The fix here is to only consider
deleted_at and checksum if they are expected to be present.
Bryan D. Payne [Mon, 31 Mar 2014 22:50:43 +0000 (15:50 -0700)]
Adds ionice command permutations to rootwrap filters
When setting volume_clear_ionice, the ionice command is prepended to a dd
command before executing it. Previously, this would have failed because it
wasn't allowed through the default rootwrap filters. This commit fixes this
problem.
Note that due to the way that the RegExpFilter works, we need three different
expressions to cover all cases. This is because the various options result
in a different number of arguments. And this filter will fail immediately
if the number of arguments is incorrect.
Sasikanth [Thu, 27 Mar 2014 15:14:50 +0000 (20:44 +0530)]
Append nas_opts to IBMNAS_NFSDriver configuration
'nas_opts' were added in the NFS Driver (nfs.py), but were not appended
to the IBMNAS driver configuration, causing failure with the multi-backend
configuration of driver.
Steven Kaufer [Mon, 31 Mar 2014 20:32:39 +0000 (20:32 +0000)]
GET details REST API next link missing 'details'
When executing a pagination query a "next" link is included in the
API reply when there are more items then the specified limit.
See pagination documentation for more information:
http://docs.openstack.org/api/openstack-compute/2/content/
Paginated_Collections-d1e664.html
The caller should be able to invoke the "next" link (without
having to re-format it) in order to get the next page of data.
The documentation states "Subsequent links will honor the
initial page size. Thus, a client may follow links to traverse
a paginated collection without having to input the marker parameter."
The problem is that the "next" link is always scoped to the non-
detailed query.
For example, if you execute "/v2/<tenant>/volumes/detail?limit=1",
the "next" link does not have the URL for a detailed query and is
formatted as "/v2/<tenant>/volumes?limit=1&marker=<marker>". In this
case the "next" link needs to be scoped to "/v2/<tenant>/volumes/detail".
The user could work around this issue my manually inserting '/details'
into the "next" link URL.
Test code is included to verify that the '/details' URL is correctly added
when the "next" link is included in a detailed pagination query. Also,
existing tests were changed to ensure that the correct controller function
(ie, 'index' vs. 'detail) are invoked for the appropriate query
(ie, non-detailed or detailed) -- 'index' was previously alwayed invoked
for detailed URL requests.
Thang Pham [Mon, 31 Mar 2014 19:22:47 +0000 (15:22 -0400)]
GlusterFS: Delete volume-<uuid>.info file when volume is deleted.
glusterfs creates a file named volume-<uuid>.info to hold volume
data, mapping cinder snapshot UUIDs and filenames. When the
volume and its associated snapshots are both deleted, this file
remains. This patch deletes the volume-<uuid>.info (if one exists)
when the volume is deleted.
Andreas Jaeger [Sat, 29 Mar 2014 05:38:52 +0000 (06:38 +0100)]
Fix Jenkins translation jobs
The jobs cinder-propose-translation-update and
cinder-upstream-translation-update do not update from
transifex since our po files contain duplicate entries where
obsolete entries duplicate normal entries.