Masaki Kanno [Sun, 4 Oct 2015 06:57:22 +0000 (15:57 +0900)]
Delete a temporary volume in DB with admin context
Non-disruptive backup creates a temporary volume. Information
of the volume will be deleted from DB if the volume cannot be
created by drivers. volume_destroy method is used in order to
delete the information. We must elevate the context to admin
context because the method requests admin context.
Xing Yang [Fri, 2 Oct 2015 14:17:40 +0000 (10:17 -0400)]
VMAX Truncate Storage Group Name
In the VMAX driver, it generates a storage group name using
the short host name, pool name, etc. However the storage
group name has an upper limit of 64 characters. So it fails
if the length of the name exceeds the limit. This patch
fixes it by truncating the name to fix within the limit.
Victor Stinner [Fri, 2 Oct 2015 07:43:44 +0000 (09:43 +0200)]
Fix various Python 3 issues
* Drop exceptions import. Replace exceptions.OSError with OSError.
The exceptions module was removed in Python 3.
* Replace 8l with 8
* Replace generator.next() with next(generator)
* convert_uuid_to_es_fmt(): use bytes
* Replace function.func_name with function.__name__
This change helps to run tests using "testr run" instead of
testtools.run.
Victor Stinner [Thu, 1 Oct 2015 16:04:30 +0000 (18:04 +0200)]
Fix volume throttling to Python 3
BlkioCgroup._set_limits(): sort devices before iterating on them to
have a reliable behaviour.
The devs variable is a dictionary. On Python 3, the hash function is
now randomized, so iterating on a dictionary gives items in a random
order. Use sorted() to iterate on the list of sorted devices instead.
tox.ini: add cinder.tests.unit.test_volume_throttling to Python 3.
In both enable_replication and disable_replication,
it tests to see the replication_state is in the correct
state. When it's not it was raising InvalidVolume()
InvalidVolume requires a reason text message.
This patch adds the missing reason=msg when creating
the InvalidVolume exception
Sean McGinnis [Thu, 1 Oct 2015 14:18:43 +0000 (09:18 -0500)]
Cleanup orphaned code from cinder root directory
There were several methods in the root directory source files
that were no longer being used anywhere. While some of these
have potential for being useful, they are not in use and should
not be sitting around the codebase waiting for someone to need them.
This patch removes unused methods from utils as well as their
associated unit tests.
Method _devices_sizes() in Block Device driver invokes N times
_get_device_size(device) to get devices sizes. It can be done by
executing one command: blockdev --getsize64 /dev/loop1 /dev/loop2.
In such a way we take the devices' sizes in bytes and convert them
to Megabytes.
Obtain target authentication from database same as LIO target
Currently, tgt, iet and cxt obtain user and password for iSCSI
target by analyzing configuration file.
However this information is already stored in DB and LIO obtains
these authentication from provider_auth in DB.
This way is simple and robust instead of analyzing configuration
file directly.
This patch proposes these two changes:
- Change the way to obtain authentication from configuration
file to DB at _get_target_chap_auth().
- Move _get_target_chap_auth() into iscsi.py and inherit
the method at tgt, iet and cxt target because they can use
same implementation to get authentication from DB.
dell_storagecenter_api.py was looking for the cgsnapshot for
cgsnapshot-delete via the wrong REST API call. It was also only
looking for the first volume's snapshot rather than all snapshots
associated with a cgsnapshot. It now locates the snapshots properly
and expires the associated replays on cgsnapshot-delete.
Victor Stinner [Fri, 21 Aug 2015 16:47:50 +0000 (09:47 -0700)]
Port test_volume to Python 3
* don't use hasttr() to check if a lazy SQLAlchemy is loaded or not: use
the obj_attr_is_set() method instead. On Python 3, hasattr() pass
through SQLAlchemy exceptions which is unexpected.
* Replace a/b with a//b to use integer division, not float division.
* Replace filter() with list-comprehension using an if.
* Replace file() with open() and open /dev/null in binary mode (not text
mode, so Unicode on Python 3).
* test_volume require "import cinder.volume.targets.tgt" on Python 3
* Use a key function to sort a list of dictionaries. Dictionaries are no
more comparable on Python 3.
* tox.ini: add the following tests to Python 3.4.
Wilson Liu [Thu, 24 Sep 2015 10:05:11 +0000 (18:05 +0800)]
Fix update Huawei driver issue
If a volume is created with old version of Huawei driver,
there is no pool info related to the volume, but the new
version of Huawei driver assumes that the volume have the
pool info and will read the pool info from the volume,
and then the read fails. This will happen when we call
create_volume_from_snapshot() in new version of Huawei
driver when the volume is created by old version of Huawei
driver.
Victor Stinner [Tue, 18 Aug 2015 23:03:51 +0000 (16:03 -0700)]
Fix Python 3 issues in wsgi
Fix unicode versus bytes issues in wsgi code, a HTTP body is a bytes
string. Changes:
* On Python 3, encode JSON to UTF-8.
* Replace file() with open(); file() was removed in Python 3.
* Use literal byte strings (b'...') for HTTP body.
* Use binary instead of text mode for HTTP body when getting a file from
a socket (sock.makefile).
Victor Stinner [Wed, 26 Aug 2015 22:13:51 +0000 (00:13 +0200)]
py3: Port pure driver test to Python 3
* Replace func.func_name with func.__name__: the func_name attribute
was removed in Python 3, whereas the __name__ attribute exists on
Python 2 and Python 3
* Create INITIATOR_TARGET_MAP using list(set()) to get the same order
than the tested code. The exact order is not reliable, it depends
on the hash function which is now randomized by default on
Python 3. The hash function is also different between Python 2.7
and 3.4.
* tox.ini: add test_pure to Python 3.4
Wilson Liu [Thu, 24 Sep 2015 08:52:31 +0000 (16:52 +0800)]
Report *real* free capacity in Huawei driver
When we query capacity of a storage pool on Huawei storage,
there are two items in the result: one is "USERFREECAPACITY"
and the another one is "DATASPACE". In fact the "DATASPACE"
is the *real* space we can use to create LUN, the
"USERFREECAPACITY" contains some metadata that we can not use
to store user data.
Dave Chen [Mon, 3 Aug 2015 09:01:22 +0000 (17:01 +0800)]
Show image metadata
This patch implements the API to show the glance image metadata
for a specific volume.
DocImpact: May need to document this API.
APIImpact: Provided the API to show image metadata.
Partially implements: bp support-modify-volume-image-metadata
Currently the volume related operation in CloudByte driver does not:
* Update the ISCSI Initiator Group during volume deletion operation,
and
* During retry of any volume operation it does not catches the exact
cause of the failure happened.
So to deal with the following issues two changes has been done in
CloudByte Driver:
* Added a new method "_update_initiator_group"
ISCSI Initiator Group is one of the parameter added to the volumes
at the time of creation in CloudByte Storage. Using this the external
source can access the volumes easily. By default, Initiator Group
value is set to 'ALL', but it should be changed to 'None' before
deletion. Since the following is not happening, thus volume delete
operation fails from OpenStack. In order to avoid this the
"delete_volume" method now uses the "_update_initiator_group" which
update the volume ISCSI Initiatior Groupof the volumes to 'None'
before deletion, and thus volume delete operation will have no issues
while running from OpenStack.
* Added a check to "_retry_volume_operation"
The _retry_volume_operation method was not able to check the exact
cause of the failure happened during volume operation in CloudByte
Storage, which arises if some invalid parameters are provided in
"cinder.conf" against "cloudbyte backend" or if some anomaly happens
at CloudByte Storage during any volume operation from OpenStack. Due
to this, tracking the ERROR becomes a very difficult task to do. Thus
to resolve this issue a "check" has been added to the method which
will raise the exact cause of the error and thus making it easier to
solve.
This patch cleanly reverts the changes made via the
commit: e681ba2a99995dcd999e6539bb1222f8a1ac8adc
cleanly and mitigates the conflicts that would
occur with git-revert on the said commit.
The revert is solely for changes pertaining to the use
of the external library, netapp_lib. Minor code refactors
from the prior change are retained.
Unit test coverage has been increased for ZAPI and REST
interface code in netapp/dataontap/client/api.py and
netapp/eseries/client.py.
Vincent Hou [Tue, 1 Sep 2015 03:17:04 +0000 (11:17 +0800)]
Remove the destination volume check in delete_volume
* If the volume migration fails in the middle of the progress,
the destination volume will be cleaned up via
rpcapi.delete_volume. The method delete_volume in manager
should allow us to clean up the database record for the
destination volume.
* The variable update in migrate_volume_completion has been
assigned twice. Remove the second one.
Wilson Liu [Wed, 23 Sep 2015 07:04:33 +0000 (15:04 +0800)]
Huawei driver add check before use a QoS
One QoS in Huawei storage array can contain at most 64 LUNs.
Do a check before adding LUN to QoS, if the number of the
LUNs in the QoS is already equal or larger than 64, then
this QoS should not be used.
Xing Yang [Wed, 23 Sep 2015 15:22:43 +0000 (11:22 -0400)]
Fix VMAX live migration problem
Live migration fails for VMAX because the host is not taken into
account when determining whether a volume is masked or not. For
live migration it is necessary to know which host a volume is masked
to. This patch fixes the problem by checking which host the volume
is masked to.
Kendall Nelson [Mon, 21 Sep 2015 18:11:19 +0000 (13:11 -0500)]
Missing configuration opts from cinder.sample.conf
The logic for writing opts registered with register_opt() to the
auto-generated opts.py file was flawed in that the directories where
there were opts being registered with this method would be imported,
but the actual opt would be missed when looking through the file for
the name of the opt being registered. Now the singular opts are being
caught and written to opts.py for the oslo-config-generator to process.
The 'backend' section was added to generate_cinder_opts.py
due to some of the missing opts being a part of that section.
Also the way some of the opts that were being registered with groups
were incorrect and so this addresses those in both how they were
processed in generate_cinder_opts.py and the files in which they are being
registered.
There is also one change to the name of an opt in cinder/volume/api.py.
Instances such as this one will be caught by the in-progress hacking
check patch: https://review.openstack.org/#/c/223375/
Tina [Thu, 17 Sep 2015 04:04:42 +0000 (00:04 -0400)]
Create volume in cg enhancement in VNX driver
VNX driver queries whether a LUN is in CG after adding it into
CG. However, as long as the LUN is added successfully, the LUN
will be in CG. The additional query is useless. This patch removes
the additional query.
When using a Cinder specific lvm.conf file, we need to setup the
LVM_SYSTEM_DIR setting in the LVM.LVM_CMD_PREFIX before issuing
any LVM commands to ensure that the correct lvm.conf is used.
The issue was uncovered when testing on a Cinder Volume host setup
as follows:
* Cinder is configured to use an LVM backend, backed by the
cinder-volumes VG, which already exists.
* /etc/lvm/lvm.conf rejects all devices other than those on which
the operating system is installed.
* /etc/cinder/lvm.conf accepts only the devices backing the
cinder-volumes LVM VG
The cinder-volume service would fail to initialise the specified LVM
backend because the cinder.brick.local_dev.lvm.LVM.__init__() call
checks for the existence of the specified VG before
LVM_SYSTEM_DIR=/etc/cinder
has been added to the LVM.LVM_CMD_PREFIX, and thus fails to find the
VG, and raises an exception.
By moving the setup of the LVM_SYSTEM_DIR environment variable in
LVM.LVM_CMD_PREFIX to happen before any LVM commands are issued we
ensure that all subsequent LVM commands are run against the correct
lvm.conf file.
Eric Harney [Mon, 21 Sep 2015 18:29:19 +0000 (14:29 -0400)]
Allow c-vol backends to start when some backends fail to load
Currently, if a c-vol backend fails to load due to an error in
the module startup process (like a volume driver's __init__ or
dependency import failure), the c-vol process halts completely.
Instead, catch that backend failure, log it, and allow other
backends in enabled_backends to still start up and run.
Note that this is not applicable for failures that allow
drivers to load and remain "uninitialized" -- this is for
failures that occur prior to that point.
When using NetApp drivers, all available flexvols on
a datastore are being reported to the Cinder Scheduler
as available storage pools. This allows Cinder volumes
to be created on flexvols not designated for OpenStack.
This commit fixes the problem by delimiting which pools are
eligible for provisioning via a configuration parameter
'netapp_pool_name_search_pattern'. This allows
the Cinder drivers to operate against a restricted
set of storage containers.
The VMDK driver for ESX server was deprecated during
Icehouse release. Configuring Cinder to use this driver
prints a warning that the driver is deprecated and
will be removed in the Juno release.
This patch removes the deprecated VMDK driver for
ESX server.