Merge "VNX driver needs to return snapshot objects"
This commit is contained in:
commit
e3ad323cb8
@ -21,6 +21,7 @@ import six
|
||||
|
||||
from cinder import exception
|
||||
from cinder import test
|
||||
from cinder.tests.unit import fake_snapshot
|
||||
from cinder.tests.unit import utils
|
||||
from cinder.volume import configuration as conf
|
||||
from cinder.volume.drivers.emc import emc_cli_fc
|
||||
@ -3583,15 +3584,18 @@ Time Remaining: 0 second(s)
|
||||
mock.call(*self.testData.LUN_DELETE_CMD('vol1'))]
|
||||
fake_cli.assert_has_calls(expect_cmd)
|
||||
|
||||
def test_create_cgsnapshot(self):
|
||||
@mock.patch(
|
||||
'cinder.objects.snapshot.SnapshotList.get_all_for_cgsnapshot')
|
||||
def test_create_cgsnapshot(self, get_all_for_cgsnapshot):
|
||||
cgsnapshot = self.testData.test_cgsnapshot['id']
|
||||
cg_name = self.testData.test_cgsnapshot['consistencygroup_id']
|
||||
commands = [self.testData.CREATE_CG_SNAPSHOT(cg_name, cgsnapshot)]
|
||||
results = [SUCCEED]
|
||||
fake_cli = self.driverSetup(commands, results)
|
||||
self.driver.db = mock.MagicMock()
|
||||
self.driver.db.volume_get_all_by_group.return_value =\
|
||||
self.testData.SNAPS_IN_SNAP_GROUP()
|
||||
snapshot_obj = fake_snapshot.fake_snapshot_obj(
|
||||
self.testData.SNAPS_IN_SNAP_GROUP())
|
||||
snapshot_obj.consistencygroup_id = cg_name
|
||||
get_all_for_cgsnapshot.return_value = [snapshot_obj]
|
||||
self.driver.create_cgsnapshot(None, self.testData.test_cgsnapshot)
|
||||
expect_cmd = [
|
||||
mock.call(
|
||||
@ -3599,14 +3603,18 @@ Time Remaining: 0 second(s)
|
||||
cg_name, cgsnapshot))]
|
||||
fake_cli.assert_has_calls(expect_cmd)
|
||||
|
||||
def test_delete_cgsnapshot(self):
|
||||
@mock.patch(
|
||||
'cinder.objects.snapshot.SnapshotList.get_all_for_cgsnapshot')
|
||||
def test_delete_cgsnapshot(self, get_all_for_cgsnapshot):
|
||||
snap_name = self.testData.test_cgsnapshot['id']
|
||||
commands = [self.testData.DELETE_CG_SNAPSHOT(snap_name)]
|
||||
results = [SUCCEED]
|
||||
fake_cli = self.driverSetup(commands, results)
|
||||
self.driver.db = mock.MagicMock()
|
||||
self.driver.db.snapshot_get_all_for_cgsnapshot.return_value =\
|
||||
self.testData.SNAPS_IN_SNAP_GROUP()
|
||||
snapshot_obj = fake_snapshot.fake_snapshot_obj(
|
||||
self.testData.SNAPS_IN_SNAP_GROUP())
|
||||
cg_name = self.testData.test_cgsnapshot['consistencygroup_id']
|
||||
snapshot_obj.consistencygroup_id = cg_name
|
||||
get_all_for_cgsnapshot.return_value = [snapshot_obj]
|
||||
self.driver.delete_cgsnapshot(None,
|
||||
self.testData.test_cgsnapshot)
|
||||
expect_cmd = [
|
||||
|
@ -40,6 +40,7 @@ from taskflow.types import failure
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LI, _LW
|
||||
from cinder import objects
|
||||
from cinder import utils
|
||||
from cinder.volume import configuration as config
|
||||
from cinder.volume.drivers.san import san
|
||||
@ -2748,7 +2749,7 @@ class EMCVnxCliBase(object):
|
||||
def create_cgsnapshot(self, driver, context, cgsnapshot):
|
||||
"""Creates a cgsnapshot (snap group)."""
|
||||
cgsnapshot_id = cgsnapshot['id']
|
||||
snapshots = driver.db.snapshot_get_all_for_cgsnapshot(
|
||||
snapshots = objects.SnapshotList().get_all_for_cgsnapshot(
|
||||
context, cgsnapshot_id)
|
||||
|
||||
model_update = {}
|
||||
@ -2772,7 +2773,7 @@ class EMCVnxCliBase(object):
|
||||
def delete_cgsnapshot(self, driver, context, cgsnapshot):
|
||||
"""Deletes a cgsnapshot (snap group)."""
|
||||
cgsnapshot_id = cgsnapshot['id']
|
||||
snapshots = driver.db.snapshot_get_all_for_cgsnapshot(
|
||||
snapshots = objects.SnapshotList().get_all_for_cgsnapshot(
|
||||
context, cgsnapshot_id)
|
||||
|
||||
model_update = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user