VNX: ignore cg creation if group is not cg enabled

When adding volume to a non-consistent group, driver will try to
find/create the related CG on the VNX, this causes failure since the
group has no associated CG.

In this patch, driver will ignore the group id and only create volume
only.

Closes-bug: #1700892
Change-Id: I9668afa6c5553423464d3923728cffa5c7135f84
This commit is contained in:
Peter Wang 2017-07-17 14:26:50 +08:00
parent 5fb4f06d17
commit 9418c9444e
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,