Merge "Fix failure for failing back the primary."

This commit is contained in:
Jenkins 2017-07-31 16:22:58 +00:00 committed by Gerrit Code Review
commit 9008a62337
3 changed files with 20 additions and 10 deletions

View File

@ -1260,6 +1260,9 @@ class TestCommonAdapter(test.TestCase):
name=vol1.name)
self.assertEqual(fake_mirror.secondary_client,
common_adapter.client)
self.assertIsNone(common_adapter.active_backend_id)
self.assertFalse(fake_mirror.primary_client ==
fake_mirror.secondary_client)
self.assertEqual('default', backend_id)
for update in updates:
self.assertEqual(fields.ReplicationStatus.ENABLED,

View File

@ -67,16 +67,20 @@ class CommonAdapter(replication.ReplicationAdapter):
self.itor_auto_dereg = None
self.queue_path = None
def _build_client_from_config(self, config, queue_path=None):
return client.Client(
config.san_ip,
config.san_login,
config.san_password,
config.storage_vnx_authentication_type,
config.naviseccli_path,
config.storage_vnx_security_file_dir,
queue_path)
def do_setup(self):
self._normalize_config()
self.client = client.Client(
self.config.san_ip,
self.config.san_login,
self.config.san_password,
self.config.storage_vnx_authentication_type,
self.config.naviseccli_path,
self.config.storage_vnx_security_file_dir,
self.queue_path)
self.client = self._build_client_from_config(
self.config, self.queue_path)
# Replication related
if (self.active_backend_id in
common.ReplicationDeviceList.get_backend_ids(self.config)):

View File

@ -159,6 +159,9 @@ class ReplicationAdapter(object):
raise exception.InvalidInput(reason=error_msg)
rep_list = common.ReplicationDeviceList(configuration)
device = rep_list[0]
# primary_client always points to the configed VNX.
primary_client = self._build_client_from_config(self.config)
# secondary_client always points to the VNX in replication_device.
secondary_client = client.Client(
ip=device.san_ip,
username=device.san_login,
@ -168,11 +171,11 @@ class ReplicationAdapter(object):
sec_file=device.storage_vnx_security_file_dir)
if failover:
mirror_view = common.VNXMirrorView(
self.client, secondary_client)
primary_client, secondary_client)
else:
# For fail-back, we need to take care of reversed ownership.
mirror_view = common.VNXMirrorView(
secondary_client, self.client)
secondary_client, primary_client)
return mirror_view
else:
error_msg = _('VNX Cinder driver does not support '