Jay S. Bryant [Fri, 3 Apr 2015 19:19:28 +0000 (14:19 -0500)]
Mock wait_for_volume_removal in test_brick_connector
Systems where /dev/disk/by-path did exist were failing unit
test for test_connect_volume, test_connect_volume_with_alternative_targets
and test_connect_volume_with_alternative_targets_primary_error in
cinder.tests.test_brick_connector . The problem was that the test
cases were mocking out os.path to return exists. This resulted in
the new code from commit 43029941219505bc3861dd285e3393e08c76b433
never being able to exit the wait_for_volume_removal loop.
To avoid this problem I am mocking out wait_for_volume_removal for these
test cases. wait_for_volume_removal is tested elsewhere and not relevant
for these test cases.
Tom Swanson [Thu, 2 Apr 2015 22:55:44 +0000 (17:55 -0500)]
Dell SC driver has insufficient iscsi logging
In the case where a volume was mapped but the server could not
locate the volume not enough information was being logged to
sort out the failure. Added logging to Dell SC ISCSI driver.
Now returns much more connection information on trying to map
a volume. Also tries to return iscsi properties associated with
the controller on which the volume in question is active.
Copying preallocated image to volume involves creating
a virtual disk using the image. The virtual disk has a
descriptor and an extent. The preallocated image is used
as the flat extent to create the virtual disk.
To create virtual disk from preallocated image, we first
create a temporary virtual disk (with a descriptor and
flat extent), then replace its flat extent with the
downloaded image. Since vSAN datastores do not support
flat extent, the above operation fails if such a datastore
is selected for virtual disk creation. This patch fixes
the problem by not selecting vSAN datastores for temporary
virtual disk creation.
Anton Arefiev [Thu, 2 Apr 2015 16:12:52 +0000 (19:12 +0300)]
Enable H238 hacking rule
Hacking 0.10 introduces new hacking rule H238 - old style classes
are deprecated (they are converted to new style classes - inherit
from `object`). In order to avoid any unwanted side effects all
classes should be declared using new style.
See reference on the differences:
https://www.python.org/download/releases/2.2.3/descrintro/
Fix ISCSIDriver initialized connection volume type
ISCSIDriver initialize connection is a duplicated function
left in kilo to serve drivers that don't use the new targets model.
In Kilo there is a new parameter of iscsi_protocol, that is set to
iscsi by default and can be changed to iser in order to enable RDMA.
In order support RDMA in drivers that still inherit from ISCSIDriver,
driver_volume_type should be set to iscsi_protocol parameter value
instead of a hard coded value until this function duplication will be solved.
Ray Chen [Thu, 10 Jul 2014 15:01:17 +0000 (23:01 +0800)]
Fix missing clone_image API support for sheepdog driver.
If image is backend by sheepdog, it will use create_cloned_volume
function to help to clone this image. Normally sheepdog can clone
only from snapshot.
This patch set is derived from abandoned change:
Ibd355082e7c3215c00f6576404566577f7a2601c
Tom Barron [Wed, 25 Mar 2015 15:28:08 +0000 (11:28 -0400)]
Only use operational LIFs for iscsi target details
When Nova invokes our cDOT driver's initialize_connection() method
in order to attach an iSCSI volume to an instance, we have been
returning the first target from the list of targets returned from
the filer API call to get iscsi target details. In failover mode,
this may be a target with a LIF that is down, causing the attach
attempt to fail in Nova.
This commit fixes that issue so that attaches still work in
failover by returning the first target with an *operational* LIF.
Michal Dulko [Wed, 1 Apr 2015 11:28:34 +0000 (13:28 +0200)]
Catch more general exception in manager's create_volume
When fixing issues with inaccurate allocated_capacity tracking when
create_volume flow fails (Icd6b04ac60c17cbda225d3be8bcc4435ea0cd7a8)
it was ignored that drivers may raise all kinds of exceptions and these
aren't repacked into CinderException in the flow. This commit broadens
except clause to catch Exception when deciding if rescheduling
occurred while creating a volume. Also regression unit test is added.
Sean McGinnis [Fri, 20 Mar 2015 23:42:50 +0000 (18:42 -0500)]
Logging not using oslo.i18n guidelines
Multi-patch set for easier chunks. This one addresses
the backup and common cinder directories.
There have been quite a few instances found where the
i18n guidelines are not being followed. I believe this
has helped lead to some of the confusion around how to
correctly do this. Other developers see this code and
assume it is an example of the correct usage.
This patch attempts to clean up most of those violations
in the existing codebase to hopefully help avoid some of
that confusion in reviews.
Some issues address:
* Correct log translation markers for different log levels
* Passing format values as arguments to call, not preformatting
* Not forcing translation via six.text_type and others
Guidelines can be found here:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html
Hacking checks will not be able to identify all violations of
the guidelines, but it could be useful for catching obvious ones
such as LOG.info("No markers!").
John Griffith [Mon, 30 Mar 2015 19:22:04 +0000 (13:22 -0600)]
Remove LP bug ref in remove_iscsi_device
Some like referencing bugs in code comments, others don't. In
general we try and avoid it, but I certainly don't agree with
blocking a patch solely for that reason. So instead this patch
tries to modify the previous commit to fix it up rather than
having a contest of wills to see who will bend first.
This patch puts a simple check around the 'extra_specs'
key, and makes sure it's there, while trying to inject
the multiattach capabilities filtering.
If we want to change the approach, we can do so in early
Liberty, when we enable multiattach for drivers. At this
stage of the release, lets just do the simple and safe thing.
Some folks are seeing race conditions on overloaded
or slow machines, where the time between issuing the
remove volume command, and the volume being from
/dev/disk/by-path by the kernel isn't long enough.
This patch adds a simple verify loop for iSCSI only.
It will try 3 times and wait 2 seconds between tries.
Also, This patch will only fix attaches that happen
in cinder for copy volume <--> image operations.
Nova needs a separate patch to fix any potential
issues there.
Xing Yang [Fri, 27 Mar 2015 21:07:58 +0000 (17:07 -0400)]
Fix the format of the system name in VMAX driver
There is a change in the format for system name in SMI-S for VMAX V3.
It was "SYMMETRIX+xxxxxx" previously and now it is changed to
"SYMMETRIX-+-xxxxxx". In this patch, the VMAX driver was modified
accordingly to support this format.
Copy volume to image by non-admin user fails with ImageNotAuthorized.
This is because we are setting image's is_public meta-data to True
while calling image update (for writing to image). This patch fixes
this by setting is_public using the image-meta passed in by Cinder.
Note: The oslo.vmware API which we use for upload requires is_public
meta-data which may not be needed at all for writing to image.
Till we update oslo.vmware API, we have to pass a value for is_public.
Lucian Petrut [Fri, 27 Mar 2015 11:42:22 +0000 (13:42 +0200)]
SMBFS: Fix missing volume provider location
In case of cloning volumes or creating volumes from snapshots, the
volume provider location is not set, making the volumes unusable.
This also leads to disk image leaks, because the delete volume
operation will pass without deleting the disk image if the provider
location is not present.
The SMB driver wraps base RemoteFS methods in order to set locks.
The issue is that it does not return the wrapped method return
value, which signals volume updates, in this case the provider
location.
peter_wang [Wed, 25 Mar 2015 06:35:32 +0000 (02:35 -0400)]
Enhance VNX Cinder volume creation logic
Sometimes sysadmin needs to remove broken disks and replace them
with some new disks. Before the disks are replaced and fully rebuilt,
the pool would be in "Faulted" state, and all LUNs created in this
pool would be in "Faulted" state as well.
A LUN in this "Faulted" state is still OK for IO access.
Current implementation of create_volume in VNX Cinder Driver will
wait until the VNX LUN gets into Ready State or timeout.
Thus the new volume in the back end corresponding to the pool will
be stuck at creating state for a long time before disks are replaced.
This reduces the high availability of the back end.
The change allows new volume to get into available state as long as
the corresponding VNX LUN can serve IO.
Thang Pham [Tue, 17 Mar 2015 14:24:08 +0000 (10:24 -0400)]
Properly use obj_extra_fields in objects
The following patch fixes a bug in the snapshot object,
where fields that are not part of the Snapshot model,
i.e. name and volume_name, were not specified as
obj_extra_fields in the object. It also fixes the same
problem in the volume object, i.e. name and name_id.
With this patch, those extra fields are properly loaded,
e.g. snapshot.volume_name or volume.name.
Thang Pham [Mon, 16 Mar 2015 15:48:07 +0000 (11:48 -0400)]
Create unit tests for volume objects
This is a follow up patch to cinder objects that adds
missing unit tests for volume objects. It also adds
a @base.remotable decorator to the volume save method,
which makes sure a context is properly supplied to the
method, whether it is passed in or taken from the
context stashed in the object.
Ian Denhardt [Thu, 26 Mar 2015 01:47:47 +0000 (21:47 -0400)]
Fix incorrect invocation of _add_to_threadpool
_add_to_threadpool expects to be passed the function and which is to be
run in an alternate thread, and the function's arguments. Instead, the
function (self.delete_volume) was being invoked directly, and it's
result passed to _add_to_threadpool. This results in a TypeError being
raised (the result is a bool, which is not callable), but more
importantly, it defeats the purpose of the statement - to offload the
invocation of delete_volume to another thread.
We missed an access to volume['instance_uuid']
in the multiattach patch. The instance_uuid and attached_host
were moved into the volume_attachment table.
This patch changes how we test to see if a volume is available
or not, but checking the new location.
Lucian Petrut [Wed, 25 Mar 2015 16:01:02 +0000 (18:01 +0200)]
Eager load volume extra specs
The Linux SMBFS driver uses volume extra specs in order to determine
the according image format when creating new volumes.
Accessing the extra_specs attribute can raise DetachedInstanceError
as this attribute is lazy loaded and the session might close by the
time this attribute is accessed.
This can be avoided by simply eager loading the volume extra specs.
The volume manager wasn't being safe with trying to pull an
attachment out of the attachments list. It's possible someone
is calling the manager to detach a volume that has no attachments.
This patch raises an InvalidVolume exception if we detect that
there are no attachments left to detach.
I must have missed this driver in the multiattach
patch. The attachment object is passed in to
detach_volume to give drivers a chance to deal with
a detach call.
This patch just updates the signature of the method
to be the same as the parent.
Gorka Eguileor [Mon, 2 Mar 2015 14:51:07 +0000 (15:51 +0100)]
Make lio iSCSI changes persistent to avoid lost
To avoid losing iSCSI configuration when target.service is
started/restarted we make persistent any change Cinder makes to the
configuration.
This will allow us to coordinate access from multiple rtslib users
(target daemon, targetcli, cinder...)
This patch changes rtstool and adds an additional command "save" with
optional parameter the filename where we want to save current
configuration. If no parameter is provided it saves to default location
defined by rtslib.
Thang Pham [Wed, 25 Mar 2015 14:54:23 +0000 (10:54 -0400)]
Sort list of cinder_object.changes
If PYTHONHASHSEED is set to a non-zero value,
test_objects.TestObject.test_base_attributes unit test
fails. This is because 'cinder_object.changes' key is
an unsorted list when the object is converted to a
primitive. The following patch fixes this by sorting
cinder_object.changes.
Tom Swanson [Tue, 24 Mar 2015 17:57:22 +0000 (12:57 -0500)]
Dell Storage Center API change fails init_conn
An attribute in the dell storage center REST API containing
the world wide name of the target device changed. This meant
that on intialize connection we were returning None instead of
the wwn.
The driver has been changed to look for the new attribute and
to fall back to the old. If neither is found it will not
return a target wwn of None.
Lucian Petrut [Tue, 24 Mar 2015 12:08:07 +0000 (14:08 +0200)]
Windows iSCSI: fix volume clone
In some environments, volume cloning fails when using the Windows
iSCSI volume driver. This involves creating a new VHD image and
copying the data from the source volume on top.
This can raise an error, caused by the fact that the destination
path exists.
This patch slightly changes the workflow used when cloning an image.
Instead of first creating a new WT disk and then copying the cloned
image data on top, the source image is copied, resized if needed
and then imported as a WT disk.
John Griffith [Tue, 24 Mar 2015 03:08:15 +0000 (03:08 +0000)]
Enable request-id in cinder API logs
Using common.local:store.context doesn't work correctly with
the new oslo_log module. This change removes the calls to
common.local and removes the file altogether which allows the
proper settings to be passed in to the logging module and give
us back our request-id in the API logs.
Ryan Lucio [Thu, 19 Mar 2015 10:17:17 +0000 (03:17 -0700)]
Use cached values for stats on query failures for vmem drivers
This change allows vmem drivers to return previously cached
values for free_capacity_gb and total_capacity_gb if the queries
to the backend for those stats succeed but do not contain
the data. This can happen when the mgmt plane is under heavy load.
Rushil Chugh [Thu, 19 Mar 2015 01:00:36 +0000 (21:00 -0400)]
The value of netapp_storage_protocol should default to none
The value of netapp_storage_protocol was changed from 'None' to 'iscsi'
in a recent commit. It needs to be reverted back to its correct default
value of 'None'.