Merge "VMAX driver - Retrieve volume from snapshot"
This commit is contained in:
commit
53678c5af2
cinder
@ -491,8 +491,17 @@ class EMCVMAXCommonData(object):
|
||||
test_snapshot = {'name': 'myCG1',
|
||||
'id': '12345abcde',
|
||||
'status': 'available',
|
||||
'host': fake_host
|
||||
'host': fake_host,
|
||||
'volume': test_source_volume,
|
||||
'provider_location': six.text_type(provider_location)
|
||||
}
|
||||
test_snapshot_v3 = {'name': 'myCG1',
|
||||
'id': '12345abcde',
|
||||
'status': 'available',
|
||||
'host': fake_host_v3,
|
||||
'volume': test_source_volume_v3,
|
||||
'provider_location': six.text_type(provider_location)
|
||||
}
|
||||
test_CG_snapshot = {'name': 'testSnap',
|
||||
'id': '12345abcde',
|
||||
'consistencygroup_id': '123456789',
|
||||
@ -3395,18 +3404,13 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase):
|
||||
emc_vmax_utils.EMCVMAXUtils,
|
||||
'get_volume_meta_head',
|
||||
return_value=[EMCVMAXCommonData.test_volume])
|
||||
@mock.patch.object(
|
||||
FakeDB,
|
||||
'volume_get',
|
||||
return_value=EMCVMAXCommonData.test_source_volume)
|
||||
@mock.patch.object(
|
||||
volume_types,
|
||||
'get_volume_type_extra_specs',
|
||||
return_value={'volume_backend_name': 'ISCSINoFAST'})
|
||||
def test_create_snapshot_different_sizes_meta_no_fast_success(
|
||||
self, mock_volume_type, mock_volume,
|
||||
self, mock_volume_type,
|
||||
mock_meta, mock_size, mock_pool):
|
||||
self.data.test_volume['volume_name'] = "vmax-1234567"
|
||||
common = self.driver.common
|
||||
volumeDict = {'classname': u'Symm_StorageVolume',
|
||||
'keybindings': EMCVMAXCommonData.keybindings}
|
||||
@ -3414,13 +3418,13 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase):
|
||||
mock.Mock(return_value=(volumeDict, 0)))
|
||||
common.provision.get_volume_dict_from_job = (
|
||||
mock.Mock(return_value=volumeDict))
|
||||
self.driver.create_snapshot(self.data.test_volume)
|
||||
self.driver.create_snapshot(self.data.test_snapshot)
|
||||
|
||||
def test_create_snapshot_no_fast_failed(self):
|
||||
self.data.test_volume['volume_name'] = "vmax-1234567"
|
||||
self.assertRaises(exception.VolumeBackendAPIException,
|
||||
self.driver.create_snapshot,
|
||||
self.data.test_volume)
|
||||
self.data.test_snapshot)
|
||||
|
||||
@unittest.skip("Skip until bug #1578986 is fixed")
|
||||
@mock.patch.object(
|
||||
@ -4310,16 +4314,12 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase):
|
||||
emc_vmax_utils.EMCVMAXUtils,
|
||||
'get_volume_meta_head',
|
||||
return_value=[EMCVMAXCommonData.test_volume])
|
||||
@mock.patch.object(
|
||||
FakeDB,
|
||||
'volume_get',
|
||||
return_value=EMCVMAXCommonData.test_source_volume)
|
||||
@mock.patch.object(
|
||||
volume_types,
|
||||
'get_volume_type_extra_specs',
|
||||
return_value={'volume_backend_name': 'ISCSIFAST'})
|
||||
def test_create_snapshot_different_sizes_meta_fast_success(
|
||||
self, mock_volume_type, mock_volume,
|
||||
self, mock_volume_type,
|
||||
mock_meta, mock_size, mock_pool, mock_policy):
|
||||
self.data.test_volume['volume_name'] = "vmax-1234567"
|
||||
common = self.driver.common
|
||||
@ -4332,13 +4332,13 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase):
|
||||
mock.Mock(return_value=volumeDict))
|
||||
common.fast.is_volume_in_default_SG = (
|
||||
mock.Mock(return_value=True))
|
||||
self.driver.create_snapshot(self.data.test_volume)
|
||||
self.driver.create_snapshot(self.data.test_snapshot)
|
||||
|
||||
def test_create_snapshot_fast_failed(self):
|
||||
self.data.test_volume['volume_name'] = "vmax-1234567"
|
||||
self.assertRaises(exception.VolumeBackendAPIException,
|
||||
self.driver.create_snapshot,
|
||||
self.data.test_volume)
|
||||
self.data.test_snapshot)
|
||||
|
||||
@unittest.skip("Skip until bug #1578986 is fixed")
|
||||
@mock.patch.object(
|
||||
@ -5536,18 +5536,13 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase):
|
||||
emc_vmax_utils.EMCVMAXUtils,
|
||||
'get_volume_meta_head',
|
||||
return_value=[EMCVMAXCommonData.test_volume])
|
||||
@mock.patch.object(
|
||||
FakeDB,
|
||||
'volume_get',
|
||||
return_value=EMCVMAXCommonData.test_source_volume)
|
||||
@mock.patch.object(
|
||||
volume_types,
|
||||
'get_volume_type_extra_specs',
|
||||
return_value={'volume_backend_name': 'FCFAST'})
|
||||
def test_create_snapshot_different_sizes_meta_fast_success(
|
||||
self, mock_volume_type, mock_volume,
|
||||
self, mock_volume_type,
|
||||
mock_meta, mock_size, mock_pool, mock_policy):
|
||||
self.data.test_volume['volume_name'] = "vmax-1234567"
|
||||
common = self.driver.common
|
||||
|
||||
volumeDict = {'classname': u'Symm_StorageVolume',
|
||||
@ -5558,7 +5553,7 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase):
|
||||
mock.Mock(return_value=volumeDict))
|
||||
common.fast.is_volume_in_default_SG = (
|
||||
mock.Mock(return_value=True))
|
||||
self.driver.create_snapshot(self.data.test_volume)
|
||||
self.driver.create_snapshot(self.data.test_snapshot)
|
||||
|
||||
@mock.patch.object(
|
||||
emc_vmax_common.EMCVMAXCommon,
|
||||
@ -5568,7 +5563,7 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase):
|
||||
self.data.test_volume['volume_name'] = "vmax-1234567"
|
||||
self.assertRaises(exception.VolumeBackendAPIException,
|
||||
self.driver.create_snapshot,
|
||||
self.data.test_volume)
|
||||
self.data.test_snapshot)
|
||||
|
||||
@unittest.skip("Skip until bug #1578986 is fixed")
|
||||
@mock.patch.object(
|
||||
@ -6204,13 +6199,8 @@ class EMCV3DriverTestCase(test.TestCase):
|
||||
volume_types,
|
||||
'get_volume_type_extra_specs',
|
||||
return_value={'volume_backend_name': 'V3_BE'})
|
||||
@mock.patch.object(
|
||||
FakeDB,
|
||||
'volume_get',
|
||||
return_value=EMCVMAXCommonData.test_source_volume_v3)
|
||||
def test_create_snapshot_v3_success(
|
||||
self, mock_volume_db, mock_type, moke_pool):
|
||||
self.data.test_volume_v3['volume_name'] = "vmax-1234567"
|
||||
self, mock_type, mock_pool):
|
||||
common = self.driver.common
|
||||
common.provisionv3.utils.get_v3_default_sg_instance_name = mock.Mock(
|
||||
return_value=(None, None, self.data.default_sg_instance_name))
|
||||
@ -6218,21 +6208,17 @@ class EMCV3DriverTestCase(test.TestCase):
|
||||
mock.Mock(return_value=True))
|
||||
common._initial_setup = mock.Mock(
|
||||
return_value=self.default_extraspec())
|
||||
self.driver.create_snapshot(self.data.test_volume_v3)
|
||||
self.driver.create_snapshot(self.data.test_snapshot_v3)
|
||||
|
||||
@mock.patch.object(
|
||||
FakeDB,
|
||||
'volume_get',
|
||||
return_value=EMCVMAXCommonData.test_source_volume_v3)
|
||||
@mock.patch.object(
|
||||
volume_types,
|
||||
'get_volume_type_extra_specs',
|
||||
return_value={'volume_backend_name': 'V3_BE'})
|
||||
def test_delete_snapshot_v3_success(self, mock_volume_type, mock_db):
|
||||
def test_delete_snapshot_v3_success(self, mock_volume_type):
|
||||
self.data.test_volume_v3['volume_name'] = "vmax-1234567"
|
||||
self.driver.common._initial_setup = mock.Mock(
|
||||
return_value=self.default_extraspec())
|
||||
self.driver.delete_snapshot(self.data.test_volume_v3)
|
||||
self.driver.delete_snapshot(self.data.test_snapshot_v3)
|
||||
|
||||
@unittest.skip("Skip until bug #1578986 is fixed")
|
||||
@mock.patch.object(
|
||||
|
@ -18,7 +18,6 @@ import ast
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from cinder import context
|
||||
from cinder.i18n import _LW
|
||||
from cinder import interface
|
||||
from cinder.volume import driver
|
||||
@ -123,13 +122,8 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver):
|
||||
|
||||
def create_snapshot(self, snapshot):
|
||||
"""Creates a snapshot."""
|
||||
ctxt = context.get_admin_context()
|
||||
volumename = snapshot['volume_name']
|
||||
index = volumename.index('-')
|
||||
volumeid = volumename[index + 1:]
|
||||
volume = self.db.volume_get(ctxt, volumeid)
|
||||
|
||||
volpath = self.common.create_snapshot(snapshot, volume)
|
||||
src_volume = snapshot['volume']
|
||||
volpath = self.common.create_snapshot(snapshot, src_volume)
|
||||
|
||||
model_update = {}
|
||||
snapshot['provider_location'] = six.text_type(volpath)
|
||||
@ -138,13 +132,9 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver):
|
||||
|
||||
def delete_snapshot(self, snapshot):
|
||||
"""Deletes a snapshot."""
|
||||
ctxt = context.get_admin_context()
|
||||
volumename = snapshot['volume_name']
|
||||
index = volumename.index('-')
|
||||
volumeid = volumename[index + 1:]
|
||||
volume = self.db.volume_get(ctxt, volumeid)
|
||||
src_volume = snapshot['volume']
|
||||
|
||||
self.common.delete_snapshot(snapshot, volume)
|
||||
self.common.delete_snapshot(snapshot, src_volume)
|
||||
|
||||
def ensure_export(self, context, volume):
|
||||
"""Driver entry point to get the export info for an existing volume."""
|
||||
|
@ -21,7 +21,6 @@ import os
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from cinder import context
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LE, _LI
|
||||
from cinder import interface
|
||||
@ -132,13 +131,8 @@ class EMCVMAXISCSIDriver(driver.ISCSIDriver):
|
||||
|
||||
def create_snapshot(self, snapshot):
|
||||
"""Creates a snapshot."""
|
||||
ctxt = context.get_admin_context()
|
||||
volumename = snapshot['volume_name']
|
||||
index = volumename.index('-')
|
||||
volumeid = volumename[index + 1:]
|
||||
volume = self.db.volume_get(ctxt, volumeid)
|
||||
|
||||
volpath = self.common.create_snapshot(snapshot, volume)
|
||||
src_volume = snapshot['volume']
|
||||
volpath = self.common.create_snapshot(snapshot, src_volume)
|
||||
|
||||
model_update = {}
|
||||
snapshot['provider_location'] = six.text_type(volpath)
|
||||
@ -147,13 +141,9 @@ class EMCVMAXISCSIDriver(driver.ISCSIDriver):
|
||||
|
||||
def delete_snapshot(self, snapshot):
|
||||
"""Deletes a snapshot."""
|
||||
ctxt = context.get_admin_context()
|
||||
volumename = snapshot['volume_name']
|
||||
index = volumename.index('-')
|
||||
volumeid = volumename[index + 1:]
|
||||
volume = self.db.volume_get(ctxt, volumeid)
|
||||
src_volume = snapshot['volume']
|
||||
|
||||
self.common.delete_snapshot(snapshot, volume)
|
||||
self.common.delete_snapshot(snapshot, src_volume)
|
||||
|
||||
def ensure_export(self, context, volume):
|
||||
"""Driver entry point to get the export info for an existing volume."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user