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
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.
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.
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.
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 [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.
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:
Liu Xinguo [Wed, 15 Jul 2015 09:52:19 +0000 (17:52 +0800)]
Add hypermetro support for Huawei driver
Hypermetro is a key storage feature and a requirement for
features such as high-availability and disaster recovery of
applications running on OpenStack clouds. This patch will
add initial support for volume hypermetro in Huawei driver.
Eric Harney [Thu, 15 Oct 2015 14:25:49 +0000 (10:25 -0400)]
LIO: Let delete_initiator succeed if iqn not found
When performing delete_initiator, this should not
raise an error if it can't find the initiator in
an ACL. This likely indicates something has
gotten out of sync, but the teardown should be
allowed to succeed.
Alon Marx [Fri, 9 Oct 2015 21:00:49 +0000 (00:00 +0300)]
Updates in consistency_group in xiv/ds8k driver
The changes are:
1. ability to modify a consistecy group (update_consistencygroup)
2. ability to create a consistency group from a cgsnapshot or from
another consistency group (create_consistencygroup_from_src)
Change-Id: I8da0e86ec321bf67b59fef8426fdd637dfe83bbe
Implements: bp xiv-ds8k-cg-updates
yogeshprasad [Thu, 1 Oct 2015 10:24:10 +0000 (15:54 +0530)]
Retype support for CloudByte iSCSI cinder driver
This patch enables the volume retype function for CloudByte iSCSI cinder
driver. Admin can control the IOPS, graceallowed, compression and many
other QOS properties of a volume via OpenStack.
Patrick East [Fri, 9 Oct 2015 23:35:12 +0000 (16:35 -0700)]
Add retries for Cisco FCZM client CLI _cfg_save
Previously this config update would break if there were other changes
happening that were not completed yet. An easy work-around is to just
retry if it fails to apply the configuration update. There is already
code in place to handle this, but it doesn’t actually work correctly.
Instead of fixing it I’ve switched over to using the utils.retry
decorator to do the retries.
Jay S Bryant [Fri, 16 Oct 2015 20:21:27 +0000 (15:21 -0500)]
Remove unused gettextutils from oslo-incubator
Now that the old config generator code has been replaced/removed
we can now also remove gettextutils. The generator was the last
hold-out in our code still using that obsolete code.
This patch removes the unneeded file and also updates the i18n code
that was monkey patching in support for using the _() and _LX()
functions in gettextutils.
Ollie Leahy [Thu, 15 Oct 2015 15:20:28 +0000 (15:20 +0000)]
Use project id from volume when retyping volumes
Use the project_id from the volume being retyped to reserve quota in
get_volume_type_reservation(). Previously the project_id from the
context was used, which could cause reservations to be made and never
cleared.
This is a null-merge of the 7.0.0 release tag back into the master
branch so that the 7.0.0 tag will appear in the git commit history of
the master branch. It contains no actual changes to the master branch,
regardless of how our code review system's UI represents it. Please
ask in #openstack-infra if you have any questions, and otherwise try
to merge this as quickly as possible to avoid later conflicts on the
master branch.
Sean McGinnis [Mon, 12 Oct 2015 21:07:55 +0000 (16:07 -0500)]
Only use LOG.exception in exception handler
There were a few instances of the code calling LOG.exception
in places where there was not an exception in context. This
can cause errors and should just be LOG.error as it effectively
ends up being.
Some instances in vhdutils.py are being left as they are being
addressed in Ib3113f2c4752d37e890f97d259da5d51cbfcfb96 under a
different bug report.
Victor Stinner [Wed, 7 Oct 2015 21:44:46 +0000 (23:44 +0200)]
Port API admin action tests to Python 3
* Replace ast.literal_eval(response.body) with response.json
* Use oslo_serialization.jsonutils.dump_as_bytes() to encode the
response to JSON as bytes for the HTTP body.
* tests-py3.txt: add cinder.tests.unit.api.contrib.test_admin_actions
Victor Stinner [Wed, 7 Oct 2015 16:41:48 +0000 (18:41 +0200)]
Port API types extra specs to Python 3
* Replace dict.iteritems() with dict.items(). The iteritems() method
of dictionaries was removed in Python 3.
* Add cinder.tests.unit.api.contrib tests to tests-py3.txt:
Victor Stinner [Wed, 7 Oct 2015 16:12:48 +0000 (18:12 +0200)]
Port API to Python 3
* test_make_flat_dict(): only use one dictionary key. On Python 3,
the hash function is now randomized by default and so dictionary
keys are returned in a random order.
* Replace "not cmp(a, b) == 0" with "a != b"
* test_common: replace range(n) with list(range(n)) to get a list on
Python 3. On Python 3, range() now returns an iterator.
* Replace dict.items()[0] with list(dict.items()[0]). On Python 3,
dict.items() now returns a view which is not indexable.
* VolumeTypesController.index(): replace dict.values() with
list(dict.values()) to get a list on Python 3.
* test_xmlutil: use byte strings for XML
* test_extensions: use byte strings for HTTP body
* Add the following tests to tests-py3.txt:
Matt Riedemann [Mon, 12 Oct 2015 13:44:14 +0000 (06:44 -0700)]
windows: don't use LOG.exception if not logging an exception
There is a bug in python 3.4 such that if you call LOG.exception and
you're not in a logging handler context it fails. That bug is fixed
inadvertantly in python 3.5 under:
http://bugs.python.org/issue17911
This fixes the instance in the windows vhdutils module to use LOG.error
rather than LOG.exception to avoid that logging error.
Since LOG.exception was being used I'm assuming the original author wanted
traceback given this is a utility method, so we use the exc_info kwarg which
will log a traceback if there is one.
When large numbers of volumes are created from images in cloud,
and user uses pagination querying, there is no need to query all
volumes' volume_glance_metadata, just get those volumes which are in
response list.
Implement a new method "volume_api.get_list_volumes_image_metadata"
to query image metadata in list of volumes by using one sql querying.
When updating only volume type is_public, error will be raised: `ERROR:
Specify either volume type name and/or description`. Fixed this by
adding a check that is_public is None, the same way name and description
do.
Ollie Leahy [Thu, 1 Oct 2015 17:21:52 +0000 (18:21 +0100)]
encryption_api_url requires a version
If the value configured for encryption_api_url does not include the
barbican API version, then some calls from cinder will fail. This can
mean that encrypted volumes cannot be deleted. To prevent this happening
raise an exception if the configured value for encryption_api_url does not
include the barbican version.
Jacob Gregor [Thu, 1 Oct 2015 18:52:34 +0000 (13:52 -0500)]
Cleanup/move code in Storwize Driver
This patch updates the name of helper.py to storwize_svc_common.py.
In addition, ssh.py has been collapsed into storwize_svc_common.py
to reduce redundant code. Unit tests were also updated to reflect
these updates.
This patch is the first of a series of patches with the aim of
bringing the storwize_svc driver in line with other san based
Cinder drivers.
Co-Authored By: Kendall Nelson <kjnelson@us.ibm.com>
Co-Authored By: Slade Baumann <baumann@us.ibm.com>
Victor Stinner [Wed, 7 Oct 2015 15:38:12 +0000 (17:38 +0200)]
Port WSGI tests to Python 3
* Replace dict.keys()[0] with list(data.keys())[0]. On Python 3,
dict.keys() now returns a view which is not indexable.
* Skip SSL tests on Python 3. Tests hang for an unknown reason, they
must be fixed later.
* Fix unit tests: HTTP body type is bytes, not Unicode.
* Debug.print_generator(): on Python 3, write into sys.stdout.buffer
instead of sys.stdout, because HTTP body type is bytes not Unicode.
* ResponseObject: encode serializer output to UTF-8 if it's Unicode.
* tox.ini: add the following tests to Python 3.4
Note: Ignore pylint error E1101 on sys.stdout.buffer. pylint on
Python 2 complains that the buffer attribute doesn't exist, whereas
the code is only executed on Python 3 and the attribute exists on
Python 3.
Dmitry Guryanov [Tue, 13 Oct 2015 11:53:13 +0000 (14:53 +0300)]
Fix method VolumeTypeList.get_all
Function volume_types.get_all_types returns dict, then
VolumeTypeList.get_all passes it to base.obj_make_list, which, in turn,
passes it to oslo_versionedobjects.base.obj_make_list.
And this function iterates over 4th argument and calls
item_cls._from_db_object for each item. So if it will iterate over dict
from volume_types.get_all_types, it'll get strings instead of orm
objects.
By the way, VolumeTypeList.get_all is not used anywhere in cinder code.
I tried to use it in unit test for my new patch and found this problem.
Use lvm_conf_file directory for LVM_SYSTEM_DIR value.
Currently when LVM_SYSTEM_DIR is added to LVM.LVM_CMD_PREFIX it is
hardcoded as /etc/cinder.
However the configuration option lvm_conf_file could specify a file
located in an arbitrary directory, not just /etc/cinder, so we should
be using the path to the directory containing the specified lvm.conf
file as the value for LVM_SYSTEM_DIR.