peter_wang [Mon, 14 Dec 2015 03:37:41 +0000 (22:37 -0500)]
Skip check whether volume is local if it's None
When force deleting a consistency group containing volumes,
manager.py tries to extract host field to check whether the volume
is local to this cinder node before deleting the volume.
Above logic is invalid if host field of faulted volume is None.
This fix will bypass above check to allow deletion of the volume.
Thang Pham [Tue, 24 Nov 2015 04:12:03 +0000 (20:12 -0800)]
Implement refresh() for cinder objects
The following patch implements the refresh functionality
in cinder objects. Instead of calling get_by_id() to get
the latest object attributes, refresh() can be called.
With this change, delete_volume() was updated to use
volume.refresh().
Helen Walsh [Tue, 1 Dec 2015 22:38:33 +0000 (22:38 +0000)]
EMC VMAX - get_short_host_name not called in find_device_number
The get_short_host_name needs to be called in find_device_number.
There are 2 reasons for this:
1. Sometimes the full host name is contained in the
connector['host'] object.
2. When the short host name still exceeds 38 characters,
it must be truncated, in order to guarantee a "contains string"
match between the host and the masking view name.
Gorka Eguileor [Mon, 14 Dec 2015 15:02:20 +0000 (16:02 +0100)]
Refactor cinder.utils.is_valid_boolstr
Method is_valid_boolstr is currently doing 8 different checks against
the same variable. This patch refactors this method to be more pythonic
by using the in operator.
Yuriy Nesenenko [Thu, 3 Dec 2015 14:28:31 +0000 (16:28 +0200)]
Add synchronization in Block Device driver
Multiple calls can get the same device. This patch adds synchronization
to create_volume, delete_volume and create_cloned_volume to avoid race
conditions. The delete_volume method is modified to avoid code duplication
in the implementation of delete_snapshot method for snapshot in the next
patch. Also it adds update provider_location and host to mark device as
used to avoid race with other threads. It uses object notation instead
of dict notation to a volume and snapshot.
Vincent Hou [Mon, 14 Dec 2015 06:08:54 +0000 (22:08 -0800)]
Volume migration: add 'name_id' as valid skippable field
New Versioned Objects expect 'name_id' as a valid input, which
is able to change '_name_id' as well, so this patch adds
'name_id' into the fields, which are going to skip for the
creation of the target volume during migration.
John Griffith [Sat, 12 Dec 2015 18:32:57 +0000 (18:32 +0000)]
Fix invalid cache image-volume creation
During the volume ref creation in clone_image_volume
we were including a _name_id attribute which is invalid
in the base olso object. The result is silent failure
for a key error. Note that the comments for the column
in the db specifcally state "do not call directly".
The variable is also denoted as private by the _ prefix.
Fix this by just popping the "_name_id' attribute.
In addition there were a number of things that needed
some cleanup:
1. Don't iterate over list of tuples to get K/V for dict
Just use Dict(xxxx)
2. Don't use delete dict.key
This isn't safe, because if the key DNE you'll get a key exception
Instead use pop which is safe if key DNE
3. Add an error message when this fails, because currently the logs
don't give an operation a chance of knowing it failed, let alone
an opportunity to debug it
Finally the cache volume creation is still calling the db
directly and doing a resource create as opposed to
using the new volume object create handler. I went ahead
and converted this to use objects, however that resulted in
breaking two of the volume-->image unit tests that use cinder
as a glance backend.
I've opened bug 1525773 for those issues and added a skip
to the tests in question.
Marian Horban [Wed, 2 Sep 2015 12:35:50 +0000 (08:35 -0400)]
Remove eventlet WSGI functionality
This commit removes eventlet WSGI server and starts using
generic eventlet WSGI server from oslo.service library.
The change where the wsgi functionality was added to
oslo.service can be referenced here:
If8840168f10cc3561f4f01e6d456d6b4fd1de8b5.
Michał Dulko [Thu, 19 Nov 2015 16:50:20 +0000 (17:50 +0100)]
Recognize extra fields in CinderObjectDictCompat
We're still in the process of transitioning to the object notation in a
lot of places and that's why we've decided to keep specialized get in
CinderObjectDictCompat. This one wasn't looking at aliases (properties)
from obj_extra_fields. This commit fixes that and adds a unit test for
this method.
We should eventually stop using it, but for Mitaka this will make a lot
of things easier.
peter_wang [Tue, 8 Dec 2015 08:18:31 +0000 (03:18 -0500)]
VNX: Fix issue in deleting cg/cgsnapshot
If user deletes a cg/cgsnapshot quickly after its creation,
driver would report 'not found' warning, and return success
for the deletion, but actually, the object underlying the VNX
is not deleted.
This fix tries to wait the cg and cg snapshot to be available
to make sure it's eligible for deletion.
During copy_volume_to_image(), this tries to return
volume['volume_type'] attribute in a volume object, but
if the volume does not have a volume type, this would
trigger a db call which raise an 404 not found error.
Volume object should check volume_type_id at first and
then decide whether returning volume_type or None to
avoid VolumeTypeNotFound exception.
Also this change includes LOG.info messages fix to show
right behavior of copy_volume_to_image().
apoorvad [Wed, 9 Dec 2015 17:42:21 +0000 (09:42 -0800)]
Retype functionality in Tintri driver
At this point default retype behavior is as follows. If a volume changes
type on the same backend then that volume will be migrated. Since Tintri
VMstore does not differentiate between volume types, we can avoid this
migration by implementing retype functionality.
Ryan McNair [Wed, 9 Dec 2015 15:29:27 +0000 (15:29 +0000)]
Fix non-migration swap with error
The fix I242c2c7c4a7197bbce04d0b3d75688f989ea1fd5 for non-migration
swap volume caused drivers which don't support volume swapping,
e.g. Ceph, to put the volumes in an incorrect state (additional
details can be found in bug #1489744 report). This patch adds an
additional check to ensure no errors occurred during the swap before
it completes the volume status updates, as well a test-case for
the non-migration swap scenario.
Dave McCowan [Mon, 7 Dec 2015 19:25:24 +0000 (14:25 -0500)]
Check context before returning cached value
The key manager caches the value of barbican client to be reused,
saving an extra call to keystone. The cached value is only
applicable to the current context, so the context must be checked
before returning the cached value.
Alex O'Rourke [Thu, 29 Oct 2015 22:04:32 +0000 (15:04 -0700)]
3PAR: Implement v2 replication (managed)
This patch implements the managed side of v2 replication in the HPE
3PAR driver.
Both sync and periodic replication modes are supported. Each
replication_device entry should have a replication_mode value set
to sync|periodic.
A volume type extra_spec value of replication:mode
should also be set. If replication:mode is periodic,
replication:sync_period should be set as well. Which replication_device
entry(s) are used is determined by the value of replication:mode set for
each volume type.
cinder.conf should have the replication config group (3parfcrep)
and at least one other target group (3parfc) as such:
Most changes in this patch:
- make sure that Request.body is set to bytes;
- replace jsonutils.dumps with jsonutils.dump_as_bytes;
- replace json.loads with oslo_serialization.jsonutils.loads;
- replace dict.iteritems with dict.items.
Helen Walsh [Sun, 8 Nov 2015 20:38:34 +0000 (20:38 +0000)]
EMC VMAX - Fix for randomly selecting a portgroup
Before now the utils function was always returning the first
portgroup in the list. This fix ensures a port group is
randomly selected from the list, where more than one value
is in the list.
Shay Halsband [Thu, 19 Nov 2015 14:42:46 +0000 (16:42 +0200)]
XtremIO: fix iscsi chap discovery bug
* The set and get parameters for discovery auth have different
names and caused a confusion that led to a bug, fixed in this
commit.
* Add unit test to make sure the right parameters are used
Sean McGinnis [Sat, 5 Dec 2015 18:19:52 +0000 (12:19 -0600)]
Fix StrOpts with integer defaults
A couple config options sneaked in defined as strings but
really expecting integer values. This causes errors with the
latest oslo.config that expects the appropriate type.
This patch changes these instances to be the expected IntOpt.
Kendall Nelson [Fri, 4 Dec 2015 00:10:39 +0000 (18:10 -0600)]
Dynamically Pull Out Option Sections
Previously in the generation of the opts.py file, the option groups
were hard coded. Now, they are pulled out as the lines are parsed.
If a group doesn't already exist in the dictionary it gets added and
then the options are added to the section. If the group already exists,
the options are added to the proper section as you would expect, and if
the options being registered don't have a group, they are added to the
default section.
This patch also moves the check for a non-zero exit code from
oslo-config-generator to the right location in the file. This
logic had been put too late in the file and was not catching
oslo-config-generator failures as it should have been.
Chris Morrell [Wed, 2 Dec 2015 22:27:37 +0000 (22:27 +0000)]
Address potential races in SolidFire VAG
While building the initial volume access group solution I realized there were
race conditions present. This patch attempts to address those by being far
more careful during VAG creation and removal. Tracking multiattach volume
detaches around VAG volume removal introduced all sorts of future race
conditions so instead multiattach volumes are treated differently and are only
removed from VAGs on volume removal. Not ideal but it'll get the job done.
Think I covered all the new branches with unit tests. Complexity was introduced
but it should be worth it due to the safety that was also introduced.
The following patch updates migrate_volume,
migrate_volume_completion, and update_migrated_volume
APIs to use volume versionedobjects. Changes were
made to be backwards compatible with older RPC clients.
It only includes changes to the core cinder code.
Changes in the drivers are left to each driver
maintainer to update.
Note that this patch DOES NOT try to use object dot
notation everywhere, since it would increase the
size of the patch. Instead, it will be done in
subsequent patches.
Gerald McBrearty [Fri, 20 Nov 2015 21:15:29 +0000 (15:15 -0600)]
Storwize: add config option to control flash copy rate
When creating a flash copy of a vdisk during a clone
or a snapshot operation the svcinfo mkfcmap operation
allows the specification of a copy rate for the flash copy.
The default copy rate is 50. The issue with 50 is it not
always an acceptable default copy rate for a particular
operator. Some operators want it slower but some want to
increase the default copy rate.
Adding a configuration option storwize_svc_flashcopy_rate
to allow an operator to specify the default flash copy
rate to be used when starting a vdisk flash copy on a
clone or snapshot operation.
Earlier, quotas used to authenticate to endpoint from not required
option located in keymgr.encryption_auth_url. Now, the required
auth_uri option from config file is used to authenticate to
keystone.
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
Change-Id: I1076527704f8def2c6755c060df49232e5ebe805
Closes-Bug: 1516085
With the current code, it's possible to end up with a zero-size
persistence file (or even corruption of the contents) if the
process gets killed or the system takes a power outage.
Switch to a "write to temp file and rename" model for writing the
persistence file. This will make it more robust against unclean
process termination or unclean system shutdown.
Kendall Nelson [Wed, 2 Dec 2015 20:59:33 +0000 (14:59 -0600)]
Adding devref about genconfig
This adds a description of the generation of opts.py and
cinder.conf.sample, the commands to generate them, and the scripts
that do the work generating them.
Eric Harney [Tue, 1 Dec 2015 23:14:17 +0000 (18:14 -0500)]
LIO: Handle initiator IQNs as case insensitive
If there is a mismatch in case between the stored
initiator IQN in the LIO ACL vs. the IQN provided
in a later call, rtstool would fail to find the
existing ACL.
Compare IQNs in a case insensitive manner to ensure
they will always match as intended. (Refer to RFC
3720 section 3.2.6.1 for details on this.)
This patch replaces usages of mox with mock in the VMDK driver unit tests.
It also refactors the unit tests for copy_volume_to_image so that those
tests test only a single method.
VMware: Unit test refactoring (image to vol - 2/2)
There are cases where a single test tests multiple methods. This
patch refactors the unit tests for the following methods in the
vmdk module to fix this issue:
* _create_virtual_disk_from_preallocated_image
* _create_virtual_disk_from_sparse_image
* _fetch_stream_optimized_image
There will be follow-up patches to fix the remaining unit tests.
VMware: Unit test refactoring (image to vol - 1/2)
There are cases where a single test tests multiple methods. This
patch refactors the unit tests for the following methods in the
vmdk module to fix this issue:
* copy_image_to_volume
* _create_volume_from_non_stream_optimized_image
There will be follow-up patches to fix the remaining unit tests.
Sean McGinnis [Fri, 27 Nov 2015 21:18:50 +0000 (15:18 -0600)]
Remove deprecated LVM ISCSI and ISER Drivers
The LVMISCSIDriver and LVMISERDrivers were deprecated in the Kilo
release. This removes both drivers and related test code.
Any existing users of LVMDriver should switch to using the
LVMVolumeDriver and set the iscsi_helper to the desire iSCSI helper
(tgtadm, lioadm, or iseradm).
Some unit tests under these driver test classes were not actually
specific to these drivers. Relevant unit tests were moved to a
different test class if they looked useful.
LisaLi [Thu, 12 Nov 2015 06:08:11 +0000 (06:08 +0000)]
Delete unused codes in rbd.retype
Before rbd.retype is called, encryption and host have
been checked so that encryptions are different and
host are same.
Meanwhile, as extra_spec is not used during the
rbd driver. As a result, even if they are different
rbd.retype can still return True which means no need
to do further migration.