Victor Stinner [Sun, 8 Nov 2015 21:13:14 +0000 (22:13 +0100)]
Port zfssa driver to Python 3
* Replace base64.encodestring() with
oslo_serialization.base64.encode_as_text() to accept Unicode as
input (encoded to UTF-8). On Python 3, the function decodes base64
from ASCII to get Unicode.
* tests-py3.txt: add cinder.tests.unit.test_zfssa
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.
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.
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.
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.
Wilson Liu [Tue, 13 Oct 2015 07:19:18 +0000 (15:19 +0800)]
Brocade driver add_zone optimization
Check whether the new zone we want to add/create
has the same zone name and members with the existing
zone on the switch. If they are same, no need to
delete and re-add it. This is significant if we
create volume from image or upload volume to image
in batch.
Michał Dulko [Fri, 23 Oct 2015 13:55:49 +0000 (15:55 +0200)]
Add missing cgsnapshot field to Snapshot object
SQLAlchemy model of snapshot specifies its relationship to cgsnapshot.
This wasn't reflected in Snapshot versioned object. The patch adds
cgsnapshot field to Snapshot object as well as required unit tests.
Michał Dulko [Fri, 23 Oct 2015 09:59:48 +0000 (11:59 +0200)]
Eager load snapshot_metadata in *snapshot_get_all
All methods returning snapshot lists in db.sqlalchemy.api are eager
loading snapshot_metadata - besides snapshot_get_all_by_project and
snapshot_get_active_by_window. In case of the latter that fact caused
unit tests to randomly fail because of SQLAlchemy Session sometimes
getting closed before the metadata got lazy loaded. This commit adds
missing options(joinedload('snapshot_metadata')) to these queries.
Yusuke Hayashi [Tue, 13 Oct 2015 23:53:49 +0000 (08:53 +0900)]
Case sensitivity problem in cinder scheduler
Volume creation fails when we use backend name which consists of
same characters as the name used before but different upper/lower case.
It happens in MySQL environment.
e.g.
1. configure 'lvm' as backend name and start cinder
2. reconfigure 'LVM' as backend name and restart cinder
It is caused by the difference of handling of case sensitivity
for backend name.
When checking the existence of cinder-volume/backend to judge
whether new cinder-volume service row in the DB should be created
or not, the search-logic is case insensitive for backend name.
On the other hand, when searching backend in create_volume processing,
the search-logic in cinder-scheduler is case sensitive for backend name.
That is why I change the former search-logic
from case insensitive one to case sensitive one.
Michał Dulko [Thu, 22 Oct 2015 19:49:13 +0000 (21:49 +0200)]
Add protocol to help of glance_api_servers option
Help for glance_api_servers option lacked information that it is
possible to specify protocol there (http or https) and suggested that
it isn't possible to use HTTPS in connection from Cinder to Glance.
This commit expands the message to include such information.
Lucian Petrut [Tue, 17 Feb 2015 16:28:07 +0000 (18:28 +0200)]
SMBFS: Fix retrieving total allocated size
Currently, the Windows SMBFS driver parses all the VHD/X images
present on the configured share in order to retrieve the allocated
size. Not only that this can be slow when having many volumes, but
it can also fail in certain environments when the images are in use.
The Linux SMBFS driver uses 'du', which gives incorrect values in
case of VHD/X images.
In order to avoid this, the driver can keep track of the allocated
size according to each share, the most basic solution being a JSON
stored in a file.
As the Windows SMBFS driver inherits the Linux SMBFS driver, only
overwriting the os specific methods, the fix is applied to the base
SMBFS driver.
Michał Dulko [Thu, 22 Oct 2015 12:54:35 +0000 (14:54 +0200)]
Make relationships in objects consistent
In Volume object 1:n relationship on volume_attachment was modeled
by ListOfObjectsField. Moreover _from_db_object and obj_load_attr
actually were setting VolumeAttachmentList as value of that field,
which is wrong behavior.
In CGSnapshot similar relationship on snapshots was done by ObjectField
with SnapshotList inside.
This commit unifies the approach to use the latter. Also unit test is
added to prevent mismatch of field type and value set on it.
Vincent Hou [Wed, 14 Oct 2015 02:35:13 +0000 (19:35 -0700)]
Remove the jointly loaded model in finish_volume_migration
After a successful volume migration, the source volume and the
destination volume need to swap the data in the models in
finish_volume_migration. It is sufficient to load the volume
model only and there is no need to load other models, like
volume type, metadata, consistency group, etc. If we load
these additional models, it will lead to NULL key error, when
either source or destination model has a NULL key pointer.
Sean McGinnis [Wed, 21 Oct 2015 21:23:56 +0000 (16:23 -0500)]
Update docs to generate Guru Meditation Report
Guru Meditation Reports (GMR) code in oslo.reports was recently updated
to expect SIGUSR2 as opposed to SIGUSR1, because it is reserved by
Apache 'mod_wsgi' for its own use.
Signal was changed and merged in change:
I9d3b6079ba2cca41fe4723723a6f80b2c3c0b9c0
Nate Potter [Tue, 13 Oct 2015 19:53:23 +0000 (19:53 +0000)]
Add qos_specs_id to volume type show
Adding qos_specs_id to the output of volume
type show to make getting the qos specs for
a volume type more convenient. However, this
variable will only be visible when type show
is called with the admin role.
Nate Potter [Wed, 21 Oct 2015 15:51:39 +0000 (15:51 +0000)]
Fix NoneType Attribute error
Currently when creating a volume without a specified
volume_type, the capabilities_filter fails saying that
NoneType object has no attribute 'get'. This patch
will make that issue instead throw an exception telling
the user that they need to specify a volume type.
Sachi King [Tue, 20 Oct 2015 22:43:07 +0000 (09:43 +1100)]
Add -constraints for CI jobs
This adds the constraints factor to the base section and duplicates
the sections required for CI with -constraints as tox does not
currently support factors in sections. Work towards enabling factor
support in sections is currently stalled, as such we will need to
duplicate sections adding -constraints to facilitate running sections
with the constrained install_command.
Erik Johannes [Mon, 5 Oct 2015 21:24:55 +0000 (14:24 -0700)]
NetApp: Cleanup if E-Series volume create fails
The creation of a volume may fail in such a manner
that a volume in a partial state has been created.
When Openstack comes back re-attempting the creation
operation it fails because the partial volume with
the name already exists.
Solution: When there is a failure creating a volume,
check if a partial volume was created and delete it
so any retry will be successful and the storage device
does not contain any dead volumes.
Some of the unit tests use mox instead of mock. Also, there are
cases where a single test tests multiple cases and methods. This
patch refactors the unit tests for the following methods in the
vmdk module to fix these issues: