LisaLi [Thu, 24 Dec 2015 03:16:26 +0000 (11:16 +0800)]
Add restore_volume_id in backup
This patch is to add restore_volume_id in backup object.
When restoring a volume from a backup, it saves the
volume in backup object.
Currently volume service and backup service are in same host.
When backup service starts, it does cleanup tasks on both
backups and volumes on current host.
But with bp scalable-backup-service, backup service and
volume services can run on different hosts. When doing cleanup
tasks, we need to find out backing-up and restoring volumes
related to the backups on current host. Backing-up volumes can
be found with field backup.volume_id. Restoring volumes are found
by new field backup.restore_volume_id.
Change-Id: I757be7a5e47fc366c181400587b5a61fe3709a0b
Partial-Implements: bp scalable-backup-service Co-Authored-By: Tom Barron <tpb@dyncloud.net>
Cory Stone [Mon, 8 Feb 2016 17:22:59 +0000 (11:22 -0600)]
Fix dynamic import of CONF.volume_api_class
Modifies the import to actually happen when API() is called instead of
when the module is loaded.
This is necessary because CONF.volume_api_class is always evaluated as
the default value since the config file hadn't been parsed yet when the
module is loaded.
Nova fixed this problem a while ago for the compute driver in
https://review.openstack.org/#/c/14353/.
Clinton Knight [Mon, 11 Jan 2016 21:13:03 +0000 (16:13 -0500)]
Add variable QoS to NetApp cDOT drivers
Most QoS implementations involve fixed limits, such as maxIOPS
or maxBPS. But there are clouds that offer QoS limits that are
partly based on capacity of the underlying resource. This commit
adds two new QoS flags to the NetApp cDOT drivers, maxIOPSperGiB
and maxBPSperGiB, which implement this capability. A light
refactor of the snapshot delete paths was required to separate
those from the volume delete paths, since only the latter should
involve the QoS logic.
Victor Stinner [Tue, 9 Feb 2016 10:47:31 +0000 (11:47 +0100)]
Port backup drivers to Python 3
* PosixBackupDriver: open file in binary mode (to read/write).
Update test_backup_posix.py for that.
* test_backup_nfs: buffer() doesn't exist and is no more needed on
Python 3, only use buffer() on Python 2.
* tests-py3.txt: add cinder.tests.unit.backup
Vincent Hou [Tue, 2 Feb 2016 19:20:02 +0000 (14:20 -0500)]
Storwize: Implement v2 replication
Storwize supports three major types for volume replications:
split IO, global mirror and metro mirror.
This patch is dedicated to implement the replication for
the modes of global mirror and metro mirror. Mirror
establishes a Global/Metro Mirror relationship between
two volumes of equal size. The volumes in a Mirror
relationship are referred to as the primary volume and
the replica volume. The replication_mode in
replication_device must be set to global or metro.
The volume type needs to associate with the extra spec
with 'replication_enabled' equaling to "<is> True", and
'replication_type' equaling to '<in> global' or '<in>
metro'.
What is supported with replication:
* create volume
* create volume from snapshot
* clone a volume
When a volume is created and replication is enabled, the
replica volume is also created on the back-end enabled
for replicas.
What is not supported with replication yet:
* volume migration
* volume retype
The replica volume will not be created or moved after migration
or retype of a replicated volume. Admins should be aware,
when migrating or retyping a volume to a type with replication
enabled, that the replica will not be automatically created.
The replication can be configured via either multi-backend
on one cinder volume node, or on separate cinder volume
nodes.
Options to be put in cinder.conf, where the primary back-end
is located:
scottda [Mon, 8 Feb 2016 23:59:34 +0000 (16:59 -0700)]
Volume create fails with FakeISCSIDriver
Volume create fails when the FakeISCSIDriver is used, because the
scheduler capacity filter detects that capacity on the fake backend
is zero. Change the total_capacity and free_capacity_gb for the
FakeISCSIDriver from 0 to infinite.
Alex O'Rourke [Mon, 1 Feb 2016 21:58:33 +0000 (13:58 -0800)]
3PAR: Create consistency group from source CG
Supports creating a consistency group from a source consistency group
in the HPE 3PAR driver.
This makes use of temporary snapshots, which are not managed by Cinder.
Upon volume/CG deleteion, these temp snapshots will automatically be
cleaned up.
Alex O'Rourke [Thu, 14 Jan 2016 18:50:16 +0000 (10:50 -0800)]
Remove old client version checks from 3PAR driver
The minimum required 3PAR client version has been bumped from 4.0.0 to
4.1.0. There are a few checks that look for a version between these
that can be removed.
Victor Stinner [Tue, 26 Jan 2016 14:48:34 +0000 (15:48 +0100)]
Port objects unit tests to Python 3
* BaseObjectsTestCase._compare(): replace hasattr() with getattr()
and a white list of expected exceptions. On Python 2, hasattr()
ignores *all* exceptions and so may hide real bugs.
* Mocks: except a call to obj.__bool__() rather than
obj.__nonzero__() on Python 3. bool(obj) now calls obj.__bool__()
on Python 3.
* Replace dict.keys() with list(dict.keys()) to get a list on Python
3. On Python 3, dict.keys() now returns a view.
* JSON/base64:
* Replace jsonutils.dumps() with jsonutils.dump_as_bytes() to get
JSON as bytes
* Replace base64.encodestring() with oslo_serialization.base64.encode_as_text() to get
base64 as bytes
* Replace base64.decodestring() with
oslo_serialization.base64.decode_as_text() to accept Unicode and
return Unicode
Anthony Lee [Wed, 9 Dec 2015 00:15:42 +0000 (16:15 -0800)]
LeftHand: Implement un/manage snapshot support
Implements support for managing and unmanaging snapshots to
the HPE LeftHand driver.
This patch now allows snapshots to be removed from OpenStack
management but still left on the LeftHand backend. Snapshots
on the LeftHand backend can also be managed by OpenStack.
Helen Walsh [Tue, 1 Dec 2015 21:10:36 +0000 (21:10 +0000)]
EMC VMAX - Method not being called for V3
The method _remove_last_vol_and_delete_sg to remove
the last volume and delete the storage group was not
being called for the VMAX3, due to an indentation error.
Patrick East [Tue, 2 Feb 2016 19:08:39 +0000 (11:08 -0800)]
Allow for eradicating Pure volumes on Cinder delete
This change adds in a config option which, when enabled, will cause
the Pure Storage volume drivers to eradicate volumes, snapshots, and
protection groups on delete for their Cinder counterpart.
With this config enabled an admin will NOT be able to recover data once
objects are deleted. By default the new config option is disabled and
volumes, snapshots, and protection group snapshots will be retained
pending eradication where they can be recovered for a period of time.
Adriano Rosso [Thu, 4 Feb 2016 16:18:17 +0000 (14:18 -0200)]
HNAS driver: retry on Connection reset fix
When HNAS driver is not using the SSH option and there are lots of exports in
the backend, a exception of "Connection reset" is eventually raised in the
driver initialization.
This patch makes the HNAS driver retries when this exception is raised.
Philipp Marek [Thu, 4 Feb 2016 13:47:39 +0000 (14:47 +0100)]
DRBD: Compat for current DRBDmanage versions.
The to-be-1.0 versions may provide additional data via a DM_INFO
tag; but as older versions don't have that (yet), we need to be
careful when asking for its value.
Accela Zhao [Thu, 4 Feb 2016 02:11:09 +0000 (18:11 -0800)]
Fix variable scope issue in try-except
Below piece of code in cinder.backup.api.API.create does not handle
the scope of variable 'backup' properly. In general variable used in
except clause has larger scope than what is in try clause.
The first problem: if object.Backup.__init__ raises exception,
variable 'backup' won't be assigned. However the cleanup code invokes
backup.destroy(), which results in an UnboundLocalError. The original
exception of __init__ is dropped, instead UnboundLocalError is raised
up-level. I know that for now objects.Backup.__init__ doesn't have
chance to raise exception, but when writing code we should not rely
on such assumption.
The second problem: backup.create() invokes DB. If an DB exception is
raised, backup.id won't be assigned. Any access to backup.id will
result in an "NotImplementedError: Cannot load 'id' in the base
class". However, when cleaning up, the backup.destroy() does access
backup.id. So we have the similar problem as the first one, and the
original exception is overrode by NotImplementedError.
This patch fixes it by adding a first-assignment outside try clause,
and add a safe check in except clause. The added test cases, if run
on the original code, it will show how the above problem occurs.
Sheel Rana [Wed, 3 Feb 2016 18:30:11 +0000 (00:00 +0530)]
Bootable filter for listening volumes from CLI
Currently cinder treats all values passed to it as True
for bootable filter in volume GET call.
For ex, if bootable=invalid, it converts it into True being
bootable as boolean value in db table 'volume'.
Need to update filtering functionality in cinder to address
'True' and 'False' values seperately.
Existing behavior will be kept same.
Only True/False/true/false input handling is done to treat
true/false seperately
(In current behavior, whatever input is passed for boolean
parameter, cinder convetrs it to True)
Tom Barron [Wed, 3 Feb 2016 22:14:23 +0000 (17:14 -0500)]
mock time.sleep in Broadcom unit test
TestBrcdHttpFCZoneClient.test_post_zone_data() invokes
BrcdHTTPFCZoneClient.post_zone_data(), which in turn
has a loop around its connect() method inside which there
is a sleep(). Without time.sleep() mocked out, the test
runs 7s on my laptop.
This change mocks out time.sleep() in the test so that
it now runs in .6s.
Accela Zhao [Wed, 3 Feb 2016 07:19:45 +0000 (23:19 -0800)]
Don't create cgsnapshot if cg is empty
If we create cgsnapshot from an empty consistencygroup, it fails
with "Consistency group is empty. No cgsnapshot will be created".
However, a cgsnapshot object is still created in DB.
This is because in cinder/consistencygroup/api.py::_create_cgsnapshot,
we create cgsnapshot object before we test whether the corresponding
consistencygroup is empy.
This patch fixes this problem by moving the creation of cgsnapshot
object to after the test of whether consistencygroup is empty.
This patch fixes the problem with the 3PAR not
working with the generic image cache.
In order to do the image cache, the 3PAR has to create a
temporary snapshot of the volume being cloned. Then the
background cloning is against the temporary snapshot.
The problem is, the temporary snapshot stays around.
We try to account for this temporary snapshot in
the delete volume action.
We also bump the minimum required python-3parclient
version to 4.1.0, which has the new getVolumeSnapshots
API call required to make this all work.
Currently the volume manager doesn't log the instance ID during
volume detach. This is missing in cinder-api log as well. This
patch adds a log statement to print a message with volume ID and
instance ID before calling driver detach.
Wilson Liu [Sat, 23 Jan 2016 02:21:41 +0000 (10:21 +0800)]
Remove useless unit tests mock in Huawei driver
There are some useless ut mocks in Huawei driver,
we'd better to cleanup them.
Also we did some other code cleanup:
1. Cleanup the return value when delete_volume and extend_volume.
2. Check whether the LUN exists in a LUN group firstly besause
this case is more likely to happen than other cases.
LisaLi [Thu, 28 Jan 2016 02:47:36 +0000 (10:47 +0800)]
Return updated volume type after updating
When updating volume type in db, it queries the object and
would like to return the updated object.
The problem is that the update session hasn't committed and
the update has not been implemented in db. And then the query is
executed in another session. As a result, the update function returns
an non-updated object.
Helen Walsh [Wed, 11 Nov 2015 22:09:59 +0000 (22:09 +0000)]
EMC VMAX - Fix for last volume in VMAX3 storage group
This patch fixes bug in the deletion the last volume in a
storage group for the VMAX3. If a masking view did not exist
we tried to get an instance of it which threw an exception.
Now we handle both scenarios correctly.