try:
maskingViewInstanceName, storageGroupInstanceName, errorMessage = (
self._validate_masking_view(conn, maskingViewDict,
- defaultStorageGroupInstanceName))
+ defaultStorageGroupInstanceName,
+ extraSpecs))
LOG.debug(
"The masking view in the attach operation is "
"%(maskingViewInstanceName)s. The storage group "
return rollbackDict
def _validate_masking_view(self, conn, maskingViewDict,
- defaultStorageGroupInstanceName):
+ defaultStorageGroupInstanceName,
+ extraSpecs):
"""Validate all the individual pieces of the masking view.
:param conn: the ecom connection
:param maskingViewDict: the masking view dictionary
:param defaultStorageGroupInstanceName: the default SG
+ :param extraSpecs: extra specifications
:returns: maskingViewInstanceName
:returns: storageGroupInstanceName,
:returns: string -- errorMessage
if maskingViewInstanceName is None:
maskingViewInstanceName, storageGroupInstanceName, errorMessage = (
self._validate_new_masking_view(
- conn, maskingViewDict, defaultStorageGroupInstanceName))
+ conn, maskingViewDict, defaultStorageGroupInstanceName,
+ extraSpecs))
else:
storageGroupInstanceName, errorMessage = (
self._validate_existing_masking_view(
- conn, maskingViewDict, maskingViewInstanceName))
+ conn, maskingViewDict, maskingViewInstanceName,
+ extraSpecs))
return maskingViewInstanceName, storageGroupInstanceName, errorMessage
def _validate_new_masking_view(self, conn, maskingViewDict,
- defaultStorageGroupInstanceName):
+ defaultStorageGroupInstanceName,
+ extraSpecs):
"""Validate the creation of a new masking view.
:param conn: the ecom connection
:param maskingViewDict: the masking view dictionary
:param defaultStorageGroupInstanceName: the default SG
+ :param extraSpecs: extra specifications
:returns: maskingViewInstanceName
:returns: storageGroupInstanceName,
:returns: string -- errorMessage
initiatorGroupInstanceName, errorMessage = (
self._check_initiator_group(conn, controllerConfigService,
igGroupName, connector,
- storageSystemName))
+ storageSystemName, extraSpecs))
if errorMessage:
return None, storageGroupInstanceName, errorMessage
self._check_masking_view(
conn, controllerConfigService,
maskingViewName, storageGroupInstanceName,
- portGroupInstanceName, initiatorGroupInstanceName))
+ portGroupInstanceName, initiatorGroupInstanceName,
+ extraSpecs))
return maskingViewInstanceName, storageGroupInstanceName, errorMessage
def _validate_existing_masking_view(self,
conn, maskingViewDict,
- maskingViewInstanceName):
+ maskingViewInstanceName, extraSpecs):
"""Validate the components of an existing masking view.
:param conn: the ecom connection
:param maskingViewDict: the masking view dictionary
:param maskingViewInstanceName: the masking view instance name
+ :param extraSpecs: extra specification
:returns: storageGroupInstanceName
:returns: string -- errorMessage
"""
# First verify that the initiator group matches the initiators.
errorMessage = self._check_existing_initiator_group(
conn, controllerConfigService, maskingViewName,
- connector, storageSystemName, igGroupName)
+ connector, storageSystemName, igGroupName, extraSpecs)
if errorMessage:
return storageGroupInstanceName, errorMessage
def _check_initiator_group(
self, conn, controllerConfigService, igGroupName,
- connector, storageSystemName):
+ connector, storageSystemName, extraSpecs):
"""Check that initiator group can be either retrieved or created.
:param conn: the ecom connection
:param igGroupName: the initiator group Name
:param connector: the connector object
:param storageSystemName: the storage system name
+ :param extraSpecs: extra specifications
:returns: initiatorGroupInstanceName
:returns: string -- the error message
"""
initiatorGroupInstanceName = (
self._get_initiator_group_instance_name(
conn, controllerConfigService, igGroupName, connector,
- storageSystemName))
+ storageSystemName, extraSpecs))
if initiatorGroupInstanceName is None:
# This may be used in exception hence _ instead of _LE.
msg = (_(
def _check_existing_initiator_group(
self, conn, controllerConfigService, maskingViewName,
- connector, storageSystemName, igGroupName):
+ connector, storageSystemName, igGroupName, extraSpecs):
"""Check that existing initiator group in the masking view.
Check if the initiators in the initiator group match those in the
:param connector: the connector object
:param storageSystemName: the storage system name
:param igGroupName: the initiator group name
+ :param extraSpecs: extra specification
:returns: string -- msg, the error message
"""
msg = None
if not self._verify_initiator_group_from_masking_view(
conn, controllerConfigService, maskingViewName,
- connector, storageSystemName, igGroupName):
+ connector, storageSystemName, igGroupName,
+ extraSpecs):
# This may be used in exception hence _ instead of _LE.
msg = (_(
"Unable to verify initiator group: %(igGroupName)s "
def _check_masking_view(
self, conn, controllerConfigService,
maskingViewName, storageGroupInstanceName,
- portGroupInstanceName, initiatorGroupInstanceName):
+ portGroupInstanceName, initiatorGroupInstanceName, extraSpecs):
"""Check that masking view can be either got or created.
:param conn: the ecom connection
:param storageGroupInstanceName: storage group instance name
:param portGroupInstanceName: port group instance name
:param initiatorGroupInstanceName: the initiator group instance name
+ :param extraSpecs: extra specifications
:returns: maskingViewInstanceName
:returns: string -- msg, the error message
"""
self._get_masking_view_instance_name(
conn, controllerConfigService, maskingViewName,
storageGroupInstanceName, portGroupInstanceName,
- initiatorGroupInstanceName))
+ initiatorGroupInstanceName, extraSpecs))
if maskingViewInstanceName is None:
# This may be used in exception hence _ instead of _LE.
msg = (_(
def _create_or_get_initiator_group(
self, conn, controllerConfigService, igGroupName,
- connector, storageSystemName):
+ connector, storageSystemName, extraSpecs):
"""Attempt to create a initiatorGroup.
If one already exists with the same Initiator/wwns then get it.
:param igGroupName: the proposed name of the initiator group
:param connector: the connector information to the host
:param storageSystemName: the storage system name (String)
+ :param extraSpecs: extra specifications
:returns: foundInitiatorGroupInstanceName
"""
initiatorNames = self._find_initiator_names(conn, connector)
foundInitiatorGroupInstanceName = self._create_initiator_Group(
conn, controllerConfigService, igGroupName,
- storageHardwareIDInstanceNames)
+ storageHardwareIDInstanceNames, extraSpecs)
LOG.info(_LI(
"Created new initiator group name: %(igGroupName)s."),
def _create_masking_view(
self, conn, configService, maskingViewName, deviceMaskingGroup,
- targetMaskingGroup, initiatorMaskingGroup):
+ targetMaskingGroup, initiatorMaskingGroup, extraSpecs):
"""After creating an new initiator group find it and return it.
:param conn: the connection to the ecom server
:param deviceMaskingGroup: device(storage) masking group (instanceName)
:param targetMaskingGroup: target(port) masking group (instanceName)
:param initiatorMaskingGroup: initiator masking group (instanceName)
+ :param extraSpecs: extra specifications
:returns: int -- return code
:returns: dict -- job
:raises: VolumeBackendAPIException
TargetMaskingGroup=targetMaskingGroup)
if rc != 0L:
- rc, errordesc = self.utils.wait_for_job_complete(conn, job)
+ rc, errordesc = self.utils.wait_for_job_complete(conn, job,
+ extraSpecs)
if rc != 0L:
exceptionMessage = (_(
"Error Create Masking View: %(groupName)s. "
def _get_initiator_group_instance_name(
self, conn, controllerConfigService, igGroupName, connector,
- storageSystemName):
+ storageSystemName, extraSpecs):
"""Gets the initiator group instance name.
:param conn: the connection to the ecom server
:param igGroupName: the port group name
:param connector: the connector object
:param storageSystemName: the storage system name
+ :param extraSpecs: extra specifications
:returns: foundInitiatorGroupInstanceName
"""
foundInitiatorGroupInstanceName = (self._create_or_get_initiator_group(
conn, controllerConfigService, igGroupName, connector,
- storageSystemName))
+ storageSystemName, extraSpecs))
if foundInitiatorGroupInstanceName is None:
LOG.error(_LE(
"Cannot create or find an initiator group with "
def _get_masking_view_instance_name(
self, conn, controllerConfigService, maskingViewName,
storageGroupInstanceName, portGroupInstanceName,
- initiatorGroupInstanceName):
+ initiatorGroupInstanceName, extraSpecs):
"""Gets the masking view instance name.
:param conn: the connection to the ecom server
:param storageGroupInstanceName: the storage group instance name
:param portGroupInstanceName: the port group instance name
:param initiatorGroupInstanceName: the initiator group instance name
+ :param extraSpecs: extra specifications
:returns: instance name foundMaskingViewInstanceName
"""
_rc, job = (
self._create_masking_view(
conn, controllerConfigService, maskingViewName,
storageGroupInstanceName, portGroupInstanceName,
- initiatorGroupInstanceName))
+ initiatorGroupInstanceName, extraSpecs))
foundMaskingViewInstanceName = self.find_new_masking_view(conn, job)
if foundMaskingViewInstanceName is None:
LOG.error(_LE(
def _verify_initiator_group_from_masking_view(
self, conn, controllerConfigService, maskingViewName, connector,
- storageSystemName, igGroupName):
+ storageSystemName, igGroupName, extraSpecs):
"""Check that the initiator group contains the correct initiators.
If using an existing masking view check that the initiator group
:param connector: the connector dict
:param storageSystemName: the storage System Name (string)
:param igGroupName: the initiator group name (String)
+ :param extraSpecs: extra specifications
:returns: boolean
"""
initiatorNames = self._find_initiator_names(conn, connector)
foundInitiatorGroupFromConnector = (
self._create_initiator_Group(
conn, controllerConfigService, igGroupName,
- storageHardwareIDInstanceNames))
+ storageHardwareIDInstanceNames, extraSpecs))
storageGroupInstanceName = (
self._get_storage_group_from_masking_view(
conn, maskingViewName, storageSystemName))
portGroupInstanceName is not None):
self._delete_masking_view(
conn, controllerConfigService, maskingViewName,
- maskingViewInstanceName)
+ maskingViewInstanceName, extraSpecs)
newMaskingViewInstanceName = (
self._get_masking_view_instance_name(
conn, controllerConfigService, maskingViewName,
storageGroupInstanceName, portGroupInstanceName,
- foundInitiatorGroupFromConnector))
+ foundInitiatorGroupFromConnector, extraSpecs))
if newMaskingViewInstanceName is not None:
LOG.debug(
"The old masking view has been replaced: "
def _create_initiator_Group(
self, conn, controllerConfigService, igGroupName,
- hardwareIdinstanceNames):
+ hardwareIdinstanceNames, extraSpecs):
"""Create a new initiator group.
Given a list of hardwareId Instance name create a new
:param controllerConfigService: the controller configuration service
:param igGroupName: the initiator group name (String)
:param hardwareIdinstanceNames: one or more hardware id instance names
+ :param extraSpecs: extra specifications
:returns: foundInitiatorGroupInstanceName
:raises: VolumeBackendAPIException
"""
Members=[hardwareIdinstanceNames[0]])
if rc != 0L:
- rc, errordesc = self.utils.wait_for_job_complete(conn, job)
+ rc, errordesc = self.utils.wait_for_job_complete(conn, job,
+ extraSpecs)
if rc != 0L:
exceptionMessage = (_(
"Error Create Group: %(groupName)s. "
Members=[hardwareIdinstanceNames[j]])
if rc != 0L:
- rc, errordesc = self.utils.wait_for_job_complete(conn, job)
+ rc, errordesc = (
+ self.utils.wait_for_job_complete(conn, job,
+ extraSpecs))
if rc != 0L:
exceptionMessage = (_(
"Error adding initiator to group : %(groupName)s. "
def _delete_masking_view(
self, conn, controllerConfigService, maskingViewName,
- maskingViewInstanceName):
+ maskingViewInstanceName, extraSpecs):
"""Delete a masking view.
:param conn: connection the ecom server
:param controllerConfigService: the controller configuration service
:param maskingViewName: maskingview name (String)
:param maskingViewInstanceName: the masking view instance name
+ :param extraSpecs: extra specifications
:raises: VolumeBackendAPIException
"""
rc, job = conn.InvokeMethod('DeleteMaskingView',
ProtocolController=maskingViewInstanceName)
if rc != 0L:
- rc, errordesc = self.utils.wait_for_job_complete(conn, job)
+ rc, errordesc = self.utils.wait_for_job_complete(conn, job,
+ extraSpecs)
if rc != 0L:
exceptionMessage = (_(
"Error Modifying masking view : %(groupName)s. "
self._last_volume_delete_masking_view(
conn, controllerConfigService, mvInstanceName,
- maskingViewName)
+ maskingViewName, extraSpecs)
if not isV3:
isTieringPolicySupported, tierPolicyServiceInstanceName = (
self._get_tiering_info(conn, storageSystemInstanceName,
def _last_volume_delete_masking_view(
self, conn, controllerConfigService, mvInstanceName,
- maskingViewName):
+ maskingViewName, extraSpecs):
"""Delete the masking view.
Delete the masking view if the volume is the last one in the
:param controllerConfigService: controller config service
:param mvInstanceName: masking view instance name
:param maskingViewName: masking view name
+ :param extraSpecs: extra specifications
"""
LOG.debug(
"Last volume in the storage group, deleting masking view "
{'maskingViewName': maskingViewName})
self._delete_masking_view(
conn, controllerConfigService, maskingViewName,
- mvInstanceName)
+ mvInstanceName, extraSpecs)
mvInstance = self.utils.get_existing_instance(
conn, mvInstanceName)
# Delete storage group.
self._delete_storage_group(conn, controllerConfigService,
storageGroupInstanceName,
- storageGroupName)
+ storageGroupName, extraSpecs)
storageGroupInstance = self.utils.get_existing_instance(
conn, storageGroupInstanceName)
if storageGroupInstance:
{'storageGroupName': storageGroupName})
def _delete_storage_group(self, conn, controllerConfigService,
- storageGroupInstanceName, storageGroupName):
+ storageGroupInstanceName, storageGroupName,
+ extraSpecs):
"""Delete empty storage group
:param conn: the ecom connection
:param controllerConfigService: controller config service
:param storageGroupInstanceName: storage group instance name
:param storageGroupName: storage group name
+ :param extraSpecs: extra specifications
"""
rc, job = conn.InvokeMethod(
'DeleteGroup',
Force=True)
if rc != 0L:
- rc, errordesc = self.utils.wait_for_job_complete(conn, job)
+ rc, errordesc = self.utils.wait_for_job_complete(conn, job,
+ extraSpecs)
if rc != 0L:
exceptionMessage = (_(
"Error Deleting Group: %(storageGroupName)s. "