Merge "VNX: ignore cg creation if group is not cg enabled"

This commit is contained in:
Jenkins 2017-07-20 03:13:55 +00:00 committed by Gerrit Code Review
commit f407b4eac1
2 changed files with 10 additions and 2 deletions

View File

@ -100,6 +100,8 @@ class DriverResourceMock(dict):
def _fake_volume_wrapper(*args, **kwargs):
expected_attrs_key = {'volume_attachment': 'volume_attachment',
'volume_metadata': 'metadata'}
if 'group' in kwargs:
expected_attrs_key['group'] = kwargs['group']
return fake_volume.fake_volume_obj(
context.get_admin_context(),
expected_attrs=[
@ -108,7 +110,8 @@ def _fake_volume_wrapper(*args, **kwargs):
def _fake_cg_wrapper(*args, **kwargs):
return fake_consistencygroup.fake_consistencyobject_obj(None, **kwargs)
return fake_consistencygroup.fake_consistencyobject_obj(
'fake_context', **kwargs)
def _fake_snapshot_wrapper(*args, **kwargs):

View File

@ -35,6 +35,7 @@ from cinder.volume.drivers.dell_emc.vnx import client
from cinder.volume.drivers.dell_emc.vnx import common
from cinder.volume.drivers.dell_emc.vnx import taskflows as emc_taskflow
from cinder.volume.drivers.dell_emc.vnx import utils
from cinder.volume import utils as vol_utils
from cinder.zonemanager import utils as zm_utils
@ -238,7 +239,11 @@ class CommonAdapter(object):
'tier': tier})
qos_specs = utils.get_backend_qos_specs(volume)
cg_id = volume.group_id
if (volume.group and
vol_utils.is_group_a_cg_snapshot_type(volume.group)):
cg_id = volume.group_id
else:
cg_id = None
lun = self.client.create_lun(
pool, volume_name, volume_size,
provision, tier, cg_id,