[VNX] Restore snapshot to volume
Add `revert_to_snapshot` API support for VNX Cinder driver. Implements: blueprint vnx-revert-to-snapshot Change-Id: Id6e3090d96a5bbf4879e8577fe3565c3032de228
This commit is contained in:
parent
afecba3b95
commit
2cd65abb71
cinder
tests/unit/volume/drivers/dell_emc/vnx
volume/drivers/dell_emc/vnx
doc/source/configuration/block-storage/drivers
driver-requirements.txtreleasenotes/notes
@ -207,6 +207,10 @@ test_create_snapshot_adapter:
|
|||||||
test_delete_snapshot_adapter:
|
test_delete_snapshot_adapter:
|
||||||
snapshot: *snapshot_base
|
snapshot: *snapshot_base
|
||||||
|
|
||||||
|
test_restore_snapshot_adapter:
|
||||||
|
volume: *volume_base
|
||||||
|
snapshot: *snapshot_base
|
||||||
|
|
||||||
test_do_create_cgsnap: &cg_snap_and_snaps
|
test_do_create_cgsnap: &cg_snap_and_snaps
|
||||||
cg_snap: *cg_snapshot_base
|
cg_snap: *cg_snapshot_base
|
||||||
snap1: *snapshot_base
|
snap1: *snapshot_base
|
||||||
|
@ -696,6 +696,15 @@ test_modify_snapshot:
|
|||||||
_methods:
|
_methods:
|
||||||
get_snap: *snap_modify
|
get_snap: *snap_modify
|
||||||
|
|
||||||
|
test_restore_snapshot: &test_restore_snapshot
|
||||||
|
lun: &lun_restore
|
||||||
|
_methods:
|
||||||
|
restore_snap:
|
||||||
|
|
||||||
|
vnx:
|
||||||
|
_methods:
|
||||||
|
get_lun: *lun_restore
|
||||||
|
|
||||||
test_create_cg_snapshot: &test_create_cg_snapshot
|
test_create_cg_snapshot: &test_create_cg_snapshot
|
||||||
cg_snap: &cg_snap_exist
|
cg_snap: &cg_snap_exist
|
||||||
_properties:
|
_properties:
|
||||||
@ -1614,6 +1623,8 @@ test_create_snapshot_adapter: *test_create_snapshot
|
|||||||
|
|
||||||
test_delete_snapshot_adapter: *test_delete_snapshot
|
test_delete_snapshot_adapter: *test_delete_snapshot
|
||||||
|
|
||||||
|
test_restore_snapshot_adapter: *test_restore_snapshot
|
||||||
|
|
||||||
test_create_cgsnapshot: *test_create_cg_snapshot
|
test_create_cgsnapshot: *test_create_cg_snapshot
|
||||||
|
|
||||||
test_do_create_cgsnap: *test_create_cg_snapshot
|
test_do_create_cgsnap: *test_create_cg_snapshot
|
||||||
|
@ -619,6 +619,13 @@ class TestCommonAdapter(test.TestCase):
|
|||||||
mocked_input):
|
mocked_input):
|
||||||
common_adapter.delete_snapshot(mocked_input['snapshot'])
|
common_adapter.delete_snapshot(mocked_input['snapshot'])
|
||||||
|
|
||||||
|
@res_mock.mock_driver_input
|
||||||
|
@res_mock.patch_common_adapter
|
||||||
|
def test_restore_snapshot_adapter(self, common_adapter, _ignore,
|
||||||
|
mocked_input):
|
||||||
|
common_adapter.restore_snapshot(mocked_input['volume'],
|
||||||
|
mocked_input['snapshot'])
|
||||||
|
|
||||||
@res_mock.patch_common_adapter
|
@res_mock.patch_common_adapter
|
||||||
def test_create_cgsnapshot(self, common_adapter, _):
|
def test_create_cgsnapshot(self, common_adapter, _):
|
||||||
common_adapter.do_create_cgsnap = mock.Mock(
|
common_adapter.do_create_cgsnap = mock.Mock(
|
||||||
|
@ -309,6 +309,10 @@ class TestClient(test.TestCase):
|
|||||||
def test_modify_snapshot(self, client, mocked):
|
def test_modify_snapshot(self, client, mocked):
|
||||||
client.modify_snapshot('snap_name', True, True)
|
client.modify_snapshot('snap_name', True, True)
|
||||||
|
|
||||||
|
@res_mock.patch_client
|
||||||
|
def test_restore_snapshot(self, client, mocked):
|
||||||
|
client.restore_snapshot('lun-id', 'snap_name')
|
||||||
|
|
||||||
@res_mock.patch_client
|
@res_mock.patch_client
|
||||||
def test_create_cg_snapshot(self, client, mocked):
|
def test_create_cg_snapshot(self, client, mocked):
|
||||||
snap = client.create_cg_snapshot('cg_snap_name', 'cg_name')
|
snap = client.create_cg_snapshot('cg_snap_name', 'cg_name')
|
||||||
|
@ -811,6 +811,11 @@ class CommonAdapter(replication.ReplicationAdapter):
|
|||||||
"""Deletes a snapshot."""
|
"""Deletes a snapshot."""
|
||||||
self.client.delete_snapshot(snapshot.name)
|
self.client.delete_snapshot(snapshot.name)
|
||||||
|
|
||||||
|
def restore_snapshot(self, volume, snapshot):
|
||||||
|
"""Restores a snapshot."""
|
||||||
|
lun_id = self.client.get_lun_id(volume)
|
||||||
|
self.client.restore_snapshot(lun_id, snapshot.name)
|
||||||
|
|
||||||
def _get_referenced_lun(self, existing_ref):
|
def _get_referenced_lun(self, existing_ref):
|
||||||
lun = None
|
lun = None
|
||||||
if 'source-id' in existing_ref:
|
if 'source-id' in existing_ref:
|
||||||
|
@ -337,6 +337,10 @@ class Client(object):
|
|||||||
snap.modify(allow_rw=allow_rw, auto_delete=auto_delete,
|
snap.modify(allow_rw=allow_rw, auto_delete=auto_delete,
|
||||||
keep_for=None)
|
keep_for=None)
|
||||||
|
|
||||||
|
def restore_snapshot(self, lun_id, snap_name):
|
||||||
|
lun = self.get_lun(lun_id=lun_id)
|
||||||
|
lun.restore_snap(snap_name)
|
||||||
|
|
||||||
def create_consistency_group(self, cg_name, lun_id_list=None):
|
def create_consistency_group(self, cg_name, lun_id_list=None):
|
||||||
try:
|
try:
|
||||||
cg = self.vnx.create_cg(name=cg_name, members=lun_id_list)
|
cg = self.vnx.create_cg(name=cg_name, members=lun_id_list)
|
||||||
|
@ -77,9 +77,10 @@ class VNXDriver(driver.ManageableVD,
|
|||||||
10.1.0 - Add QoS support
|
10.1.0 - Add QoS support
|
||||||
10.2.0 - Add replication group support
|
10.2.0 - Add replication group support
|
||||||
11.0.0 - Fix failure of migration during cloning
|
11.0.0 - Fix failure of migration during cloning
|
||||||
|
12.0.0 - Add `volume revert to snapshot` support
|
||||||
"""
|
"""
|
||||||
|
|
||||||
VERSION = '11.00.00'
|
VERSION = '12.00.00'
|
||||||
VENDOR = 'Dell EMC'
|
VENDOR = 'Dell EMC'
|
||||||
# ThirdPartySystems wiki page
|
# ThirdPartySystems wiki page
|
||||||
CI_WIKI_NAME = "EMC_VNX_CI"
|
CI_WIKI_NAME = "EMC_VNX_CI"
|
||||||
@ -141,6 +142,10 @@ class VNXDriver(driver.ManageableVD,
|
|||||||
"""Deletes a snapshot."""
|
"""Deletes a snapshot."""
|
||||||
self.adapter.delete_snapshot(snapshot)
|
self.adapter.delete_snapshot(snapshot)
|
||||||
|
|
||||||
|
def revert_to_snapshot(self, context, volume, snapshot):
|
||||||
|
"""Reverts a volume to a snapshot"""
|
||||||
|
self.adapter.restore_snapshot(volume, snapshot)
|
||||||
|
|
||||||
def ensure_export(self, context, volume):
|
def ensure_export(self, context, volume):
|
||||||
"""Driver entry point to get the export info for an existing volume."""
|
"""Driver entry point to get the export info for an existing volume."""
|
||||||
pass
|
pass
|
||||||
|
@ -39,6 +39,7 @@ Supported operations
|
|||||||
- Create a consistency group from consistency group snapshots.
|
- Create a consistency group from consistency group snapshots.
|
||||||
- Replication v2.1 support.
|
- Replication v2.1 support.
|
||||||
- Generic Group support.
|
- Generic Group support.
|
||||||
|
- Revert a volume to a snapshot.
|
||||||
|
|
||||||
Preparation
|
Preparation
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
@ -32,7 +32,7 @@ rados # LGPLv2.1
|
|||||||
rbd # LGPLv2.1
|
rbd # LGPLv2.1
|
||||||
|
|
||||||
# Dell EMC VNX
|
# Dell EMC VNX
|
||||||
storops>=0.4.8 # Apache-2.0
|
storops>=0.5.7 # Apache-2.0
|
||||||
|
|
||||||
# Violin
|
# Violin
|
||||||
vmemclient>=1.1.8 # Apache-2.0
|
vmemclient>=1.1.8 # Apache-2.0
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added support to revert a volume to a snapshot with the Dell EMC VNX
|
||||||
|
driver.
|
Loading…
x
Reference in New Issue
Block a user