Thang Pham [Tue, 27 Oct 2015 22:38:54 +0000 (15:38 -0700)]
Update create_volume API to use versionedobjects
The following patch updates create_volume API 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.
Co-Authored-By: Michal Dulko <michal.dulko@intel.com>
Change-Id: Ic1b0f09132f8fc500b29650abbd57f18ea8bd9dd
Partial-Implements: blueprint cinder-objects
Matt Riedemann [Tue, 10 Nov 2015 20:55:46 +0000 (12:55 -0800)]
Test for object version hash changes
Use the ObjectVersionChecker fixture from oslo.versionedobjects to check
when Cinder's registered objects have a change (new remotable method,
new field, etc) that require a version bump.
Fixes some registration problems along the way:
1. CinderObject doesn't need to be registered.
2. TestObject should be registered where it's used, not globally.
Removes deps=requirements.txt from tox.ini since it's not necessary and
prevents us from pip installing oslo.versionedobjects[fixtures].
Matt Riedemann [Tue, 10 Nov 2015 23:45:29 +0000 (15:45 -0800)]
Fix cinder objects unit test registration
The base test case was extending test code from oslo_versionedobjects
which is bad because (1) it was adding test objects from the o.vo
registry into the cinder object registry and (2) it was extending
internal private test classes from o.vo which are subject to change and
would break cinder.
This cleans up the base test case and object registration to basically
do it the same way that nova does.
It also moves the duplicate _compare() method into the base class and
fixes a bug where db obj fields that were lists were compared
incorrectly against object lists.
This will allow us to verify object version hashes using o.vo's
ObjectVersionChecker fixture in a follow on change without the
extraneous object registrations from o.vo messing with the results.
Xing Yang [Tue, 25 Aug 2015 04:46:53 +0000 (00:46 -0400)]
CG driver function should not access db
Currently the following CG driver interfaces don't pass in volumes
or snapshots to the driver. As a result, drivers have to retrieve info
from db. In this patch, these interfaces are changed so that drivers
don't have to access db.
Removing the access to db from driver CG functions will be handled by
separate patches.
chenying [Tue, 10 Nov 2015 07:17:57 +0000 (15:17 +0800)]
Use oslo_config new type PortOpt for port options
The oslo_config library provides new type PortOpt to validate the
range of port now.
ref: https://github.com/openstack/oslo.config/blob/2.6.0/oslo_config/cfg.py#L1114
Currently, cinder scheduler schedules the CG creation
on pool level, that means if there are multiple volume
types in one CG if each volume type is associated with a
different pool (those pools under same backend), you can't
create the CG successfully.
According to the design of CG's, it should be scheduled on
backend level to support the case mentioned above.
Kendall Nelson [Mon, 9 Nov 2015 16:52:43 +0000 (10:52 -0600)]
Removal of deprecated NPIV option in Storwize
The storwize_svc_npiv_compatibility_mode option was deprecated and
set to be removed during the M release. This patch removes the
option, the associated code, and the test cases for the associated
code. This patch also removes the unused import versionutils.
Victor Stinner [Sun, 8 Nov 2015 21:04:45 +0000 (22:04 +0100)]
Port vzstorage to Python 3
* vzstorage: replace a/b with a//b to use integer division on
Python 3.
* fix os.path.exists mock: only override return for path /fake
(shares config)
* tests-py3.txt: add cinder.tests.unit.test_vzstorage
Note: remove also spaces in parameters in two functions calls to
respect the PEP 8.
Shay Halsband [Tue, 3 Nov 2015 14:33:03 +0000 (16:33 +0200)]
XtremIO fix create CG from src flow
Fix a bug during volume creation with CG,
that prevented the volume from being added to the CG on the array.
Query array snapshots names for CG snapshot before copying them
to a new volume.
Add unittest for create_cg_from_src.
Kurt Martin [Fri, 6 Nov 2015 16:42:50 +0000 (08:42 -0800)]
3PAR drivers volume size conversion is incorrect
The 3PAR drivers conversion of the volume size to gibibytes (GiBs) is
incorrect, resulting in slightly smaller volumes than expected. The
drivers were assuming the input was gigabytes (GBs) when in fact the
input was gibibytes (GiBs) as documented by the cinder API.
Michał Dulko [Fri, 6 Nov 2015 11:37:23 +0000 (12:37 +0100)]
Use Service object instead of DB API directly
In cmd.manage and volume.api we had code accessing DB API directly.
This should be done through Service versioned object instead and this
commit fixes that.
Victor Stinner [Thu, 5 Nov 2015 16:20:41 +0000 (17:20 +0100)]
Port test_tintri to Python 3
* Set configuration.nfs_oversub_ratio, otherwise tests
fail with TypeError on comparison between mock.Mock and int.
* tox.ini: add test_tintri to Python 3.4.
After introducing the commit 93d26e40098c966e7d791a9fb6152244a9f9409d
unit test TestCinderAllCmd fails if a test environment has
/etc/cinder/cinder.conf with proper backend configuration.
We should mock out some variables not to depend on test environment.
Tom Patzig [Mon, 26 Oct 2015 19:28:05 +0000 (20:28 +0100)]
Execute mount.nfs check with absolute path
Currently the existence of mount.nfs is checked by executing
the relative binary 'mount.nfs' with a non-root user,
in this case cinder. This results, for example on SUSE, in the error:
NfsException: mount.nfs is not installed
Because mount.nfs is located under /sbin, unprivileged users
do not have /sbin in their PATH to search for executables.
The change runs the mount.nfs check by using the absolute binary
path /sbin/mount.nfs. This seems to be common for most distributions
(SUSE, RedHat, CentOS, Ubuntu, Debian). The check can still be executed
as non privileged user, by not relying on correctly set PATH variable
and using the absolute path.
Sonia Ghanekar [Mon, 2 Nov 2015 21:58:42 +0000 (13:58 -0800)]
Using extra-specs in cloned vols for Nimble driver
This patch uses the set extra-specs while cloning a volume. All
existing extra-specs: 'nimble:encryption', 'nimble:perfpol-name'
and 'nimble:multi-initiator' are being reflected in the cloned
volume.
In the existing code, the extra-specs were not being considered
while cloning volumes; the parent volume attributes were used
directly in the cloned volume. This patch uses the extra-spec
values if they are set or if not then uses the default values
for the same.
This patch improves get_volume_stats method to invoke
dog command in SheepdogClient Class method instead of
in SheepdogDriver class method directly. Here are two
benefits we can realize as a result:
1.The current implementation can only get volume status
by local sheepdog node, but the SheepdogClient Class also
supports the method to run dog command with remote sheepdog
node.
2.SheepdogClient Class methods are implemented to run dog
command with fine grained Error handling. So it can improve
the robustness and is more readable to run dog command in
SheepdogClient Class method.
Cedric Zhuang [Wed, 17 Jun 2015 10:02:04 +0000 (18:02 +0800)]
Add retype logic in manage_existing for VNX
The manage existing API for VNX driver didn't check the volume type.
Add type check and retype the volume if it's not match.
Raise ManageExistingVolumeTypeMismatch if volume type cannot be
satisfied.
Details of the change:
* In order to compare the type of the LUN and the volume type, new
logic need to be introduced to convert LUN properties to
provisioning type and tiering type used in volume type. Following
changes are introduced as a side effect of this enhancement.
* _Enum class is extracted from VNXError as a base class for
enumerations.
* Provisioning type and tiering type are converted to enum.
* More properties need to be retrieved from array to check the
type.
Following changes are introduced by this change:
* Separate resource property descriptors to individual class
so that they are better organized.
* Remove common matchers from property descriptor to reduce
the possibility of error.
* Enhance the output parsing framework and assemble the logic
in VNXCliParser class.
* Create helper class Dict to allow access of properties with
dot.
* Reuse the logic in retype API when LUN type and volume type doesn't
match.
* Add API level unit tests for the retype logic.
* Add unit tests for all refactoring.
This patch adds the CORS support middleware to Cinder, allowing a
deployer to optionally configure rules under which a javascript client
may break the single-origin policy and access the API directly.
For cinder, the paste.ini method of deploying the middleware was
chosen, because it needs to be able to annotate responses created
by keystonemiddleware. If the middleware was explicitly included,
keystone would reject the request before the cross-domain headers
could be annotated, resulting in an error response that is
unreadable by the user agent.
Note that tests were explicitly not included. Cinder does not
possess a functional test suite, and thus constructing any
fake application with the CORS Middleware would not correctly
test the paste.ini initialization code path.
Fix calling delete_zones method with a wrong argument
Add a new zone with cisco zonemanager driver. If the added zone
name is the same as the existed name, the function delete_zones
will be called. But it fails because of passing a argument with
incorrect type. This patch fixes this error.
Co-Authored-By: Al Lau <alau2@cisco.com>
Closes-Bug: #1496283
Change-Id: Ib340b6828cfeb2bb318db23971268c7974ecc9f6
Nate Potter [Mon, 19 Oct 2015 16:24:29 +0000 (16:24 +0000)]
Return volume_type extra specs based on policy
Currently extra specs are only shown to the admin user
when showing volume types. This patch grants the flexibility
to grant other users privelages to see them based on policy.
It also hides the extra_specs entry in the dictionary from
users who can't see it rather than just showing "None" as
the value.
Michael Price [Fri, 2 Oct 2015 20:21:23 +0000 (15:21 -0500)]
NetApp: Fix issue with E-Series volume expand
The volume extend operation is using the wrong backend
API to expand the volume capacity. A volume copy is being
used to achieve the expansion for performance reasons,
but this results in snapshots defined on the original
volume being lost.
This patch updates the volume extend API to use the correct
method for expanding the volume capacity. For a thin-provisioned
volume or a volume defined on a DDP, this operation is very fast.
However, for a standard volume-group, this method will block
until the expansion has completed, because the expansion capacity
will not be available until completion.
Ryan McNair [Tue, 27 Oct 2015 22:46:46 +0000 (22:46 +0000)]
Update register_opts hacking check to allow tuples
Update the hacking check for register_opts to allow tuples to be
passed in directly as an argument. Previously tuples were getting
flagged as invalid due to a missing pair of parenthesis in the
hacking check.
zhangsong [Sat, 24 Oct 2015 16:47:47 +0000 (00:47 +0800)]
optimize the copy_image_to_volume method of sheepdogdriver
the current copy_image_to_volume method of sheepdogdriver can only
write the image file to local sheepdog, with this patch, it supports
write image file to remote sheepdog node.
The rule "limits_extension:used_limits" is used by
"UsedLimitsController" which is a controller extension and it extends
"limits" api. Most of controller extensions authorize user's context
by applying the function "extensions.soft_extension_authorizer()",
but "UsedLimitsController" applies "extensions.extension_authorizer"
and this may cause 403 Forbidden error.
In this patch, I changed UsedLimitsController's authorizer to
"soft_extension_authorizer".
Fergal Mc Carthy [Tue, 27 Oct 2015 18:25:45 +0000 (14:25 -0400)]
lvconvert missing from cinder volume.filters
The LVM lvconvert command is invoked by the revert method of the
cinder.brick.local_dev.lvm.LVM class but was missing a matching
volume.filters CommandFilter entry which has now been added.