NEC driver: fix a non-disruptive backup error

When attaching a snapshot to a node,
NEC driver automatically creates and attaches LUN-0
if the node does not have it yet.
The LUN-0 is reserved for storage functions control.

Currently, the driver does not update a LUN list after creating LUN-0
and selects the already used LUN to attach the snapshot.
That causes a non-disruptive backup error.

This patch adds the LUN list update.
The list is stored in `ldset' variable.

Change-Id: I6d5d34ac802ecf6239f2d7e1a2a13c58ce5db263
Closes-Bug: #1852201
(cherry picked from commit 04f8e46659)
This commit is contained in:
Naoki Saito 2019-11-12 20:23:51 +09:00
parent ef025a7935
commit 25cc53e43e
2 changed files with 25 additions and 0 deletions

View File

@ -1211,6 +1211,28 @@ class NonDisruptiveBackup_test(volume_helper.MStorageDSVDriver,
self.assertIsNotNone(ret)
self.assertEqual('fibre_channel', ret['driver_volume_type'])
ldset_lds0 = {'ldsetname': 'LX:OpenStack1', 'lds': {},
'protocol': 'FC',
'wwpn': ['1000-0090-FAA0-786A', '1000-0090-FAA0-786B'],
'port': []}
ldset_lds1 = {'ldsetname': 'LX:OpenStack1',
'lds': {16: {'ldn': 16, 'lun': 0}},
'protocol': 'FC',
'wwpn': ['1000-0090-FAA0-786A', '1000-0090-FAA0-786B'],
'port': []}
return_ldset = [ldset_lds0, ldset_lds1]
self.mock_object(self, '_validate_fcldset_exist',
side_effect=return_ldset)
mocker = self.mock_object(self._cli, 'addldsetld',
mock.Mock(wraps=self._cli.addldsetld))
connector = {'wwpns': ["10000090FAA0786A", "10000090FAA0786B"]}
ret = self.fc_initialize_connection_snapshot(snap, connector)
self.assertIsNotNone(ret)
self.assertEqual('fibre_channel', ret['driver_volume_type'])
mocker.assert_any_call('LX:OpenStack1', 'LX:__ControlVolume_10h', 0)
mocker.assert_any_call('LX:OpenStack1',
'LX:287RbQoP7VdwR1WsPC2fZT_l', 1)
def test_terminate_connection_snapshot(self):
ctx = context.RequestContext('admin', 'fake', True)
snap = fake_volume_obj(ctx, id="46045673-41e7-44a7-9333-02f07feab04b")

View File

@ -854,6 +854,8 @@ class MStorageDriver(volume_common.MStorageVolumeCommon):
LOG.debug('configure backend.')
lun0 = [ld for (ldn, ld) in ldset['lds'].items() if ld['lun'] == 0]
# NEC Storage cannot create an LV with LUN 0.
# Create a CV with LUN 0 to use the other LUN for an LV.
if not lun0:
LOG.debug('create and attach control volume.')
used_ldns.append(lvldn)
@ -867,6 +869,7 @@ class MStorageDriver(volume_common.MStorageVolumeCommon):
xml = self._cli.view_all(self._properties['ismview_path'])
pools, lds, ldsets, used_ldns, hostports, max_ld_count = (
self.configs(xml))
ldset = validate_ldset_exist(ldsets, connector)
self._cli.lvbind(bvname, lvname[3:], lvldn)
self._cli.lvlink(svname[3:], lvname[3:])