result = self._enum_repgroups()
elif ResultClass == 'Symm_FCSCSIProtocolEndpoint':
result = self._enum_fcscsiendpoint()
+ elif ResultClass == 'EMC_FCSCSIProtocolEndpoint':
+ result = self._enum_fcscsiendpoint()
elif ResultClass == 'Symm_SRPStoragePool':
result = self._enum_srpstoragepool()
elif ResultClass == 'Symm_StoragePoolCapabilities':
mvInstances = self.driver._get_common_masking_views(
portGroupInstanceName, initiatorGroupInstanceName)
self.assertTrue(len(mvInstances) == 0)
+
+
+class EMCVMAXUtilsTest(test.TestCase):
+ def setUp(self):
+
+ self.data = EMCVMAXCommonData()
+ super(EMCVMAXUtilsTest, self).setUp()
+
+ configuration = mock.Mock()
+ configuration.safe_get.return_value = 'UtilsTests'
+ configuration.config_group = 'UtilsTests'
+ emc_vmax_common.EMCVMAXCommon._gather_info = mock.Mock()
+ driver = emc_vmax_iscsi.EMCVMAXISCSIDriver(configuration=configuration)
+ driver.db = FakeDB()
+ self.driver = driver
+ self.driver.utils = emc_vmax_utils.EMCVMAXUtils(object)
+
+ def test_get_target_endpoints(self):
+ conn = FakeEcomConnection()
+ hardwareid = 123456789012345
+ result = self.driver.utils.get_target_endpoints(conn, hardwareid)
+ self.assertEqual(
+ ([{'Name': '5000090000000000'}]), result)
+
+ def test_get_protocol_controller(self):
+ conn = FakeEcomConnection()
+ hardwareid = 123456789012345
+ result = self.driver.utils.get_protocol_controller(conn, hardwareid)
+ self.assertEqual(
+ ({'CreationClassName': 'Symm_LunMaskingView',
+ 'ElementName': 'OS-fakehost-gold-I-MV'}), result)
+
+ def test_get_protocol_controller_exception(self):
+ conn = FakeEcomConnection()
+ conn.AssociatorNames = mock.Mock(return_value=[])
+ hardwareid = 123456789012345
+ self.assertRaises(
+ exception.VolumeBackendAPIException,
+ self.driver.utils.get_protocol_controller,
+ conn, hardwareid)
LOG.debug("HardwareID instance is: %(hardwareIdInstance)s.",
{'hardwareIdInstance': hardwareIdInstance})
try:
- _rc, targetEndpoints = (
- self.provision.get_target_endpoints(
- self.conn, storageHardwareService, hardwareIdInstance))
+ targetEndpoints = (
+ self.utils.get_target_endpoints(
+ self.conn, hardwareIdInstance))
except Exception:
errorMessage = (_(
"Unable to get target endpoints for hardwareId "
raise exception.VolumeBackendAPIException(data=errorMessage)
if targetEndpoints:
- endpoints = targetEndpoints['TargetEndpoints']
LOG.debug("There are %(len)lu endpoints.",
- {'len': len(endpoints)})
- for targetendpoint in endpoints:
+ {'len': len(targetEndpoints)})
+ for targetendpoint in targetEndpoints:
wwn = targetendpoint['Name']
# Add target wwn to the list if it is not already there.
if not any(d == wwn for d in targetWwns):
- necessary updates for CG changes (#1534616)
- Changing PercentSynced to CopyState (bug #1517103)
- Getting iscsi ip from port in existing masking view
+ - Replacement of EMCGetTargetEndpoints api (bug #1512791)
"""
VERSION = "2.3.0"
- necessary updates for CG changes (#1534616)
- Changing PercentSynced to CopyState (bug #1517103)
- Getting iscsi ip from port in existing masking view
+ - Replacement of EMCGetTargetEndpoints api (bug #1512791)
"""
VERSION = "2.3.0"
return rc, job
- def get_target_endpoints(self, conn, storageHardwareService, hardwareId):
- """Given the hardwareId get the target endpoints.
-
- :param conn: the connection to the ecom server
- :param storageHardwareService: the storage HardwareId Service
- :param hardwareId: the hardware Id
- :returns: int -- return code
- :returns: targetEndpoints
- :raises: VolumeBackendAPIException
- """
- startTime = time.time()
-
- rc, targetEndpoints = conn.InvokeMethod(
- 'EMCGetTargetEndpoints', storageHardwareService,
- HardwareId=hardwareId)
-
- if rc != 0:
- exceptionMessage = (_("Error finding Target WWNs."))
- LOG.error(exceptionMessage)
- raise exception.VolumeBackendAPIException(data=exceptionMessage)
-
- LOG.debug("InvokeMethod EMCGetTargetEndpoints "
- "took: %(delta)s H:MM:SS.",
- {'delta': self.utils.get_time_delta(startTime,
- time.time())})
-
- return rc, targetEndpoints
-
def create_consistency_group(
self, conn, replicationService, consistencyGroupName, extraSpecs):
"""Create a new consistency group.
cimProperties = properties[1]
foundIpAddress = cimProperties.value
return foundIpAddress
+
+ def get_target_endpoints(self, conn, hardwareId):
+ """Given the hardwareId get the target endpoints.
+
+ :param conn: the connection to the ecom server
+ :param hardwareId: the hardware Id
+ :returns: targetEndpoints
+ :raises: VolumeBackendAPIException
+ """
+ protocolControllerInstanceName = self.get_protocol_controller(
+ conn, hardwareId)
+
+ targetEndpoints = conn.AssociatorNames(
+ protocolControllerInstanceName,
+ ResultClass='EMC_FCSCSIProtocolEndpoint')
+
+ return targetEndpoints
+
+ def get_protocol_controller(self, conn, hardwareinstancename):
+ """Get the front end protocol endpoints of a hardware instance
+
+ :param conn: the ecom connection
+ :param hardwareinstancename: the hardware instance name
+ :returns: protocolControllerInstanceName
+ :raises: VolumeBackendAPIException
+ """
+ protocolControllerInstanceName = None
+ protocol_controllers = conn.AssociatorNames(
+ hardwareinstancename,
+ ResultClass='EMC_FrontEndSCSIProtocolController')
+ if len(protocol_controllers) > 0:
+ protocolControllerInstanceName = protocol_controllers[0]
+ if protocolControllerInstanceName is None:
+ exceptionMessage = (_(
+ "Unable to get target endpoints for hardwareId "
+ "%(hardwareIdInstance)s.")
+ % {'hardwareIdInstance': hardwareinstancename})
+ LOG.error(exceptionMessage)
+ raise exception.VolumeBackendAPIException(data=exceptionMessage)
+ return protocolControllerInstanceName