def terminate_connection(self, volume, connector, **kwargs): LOG.info( 'Terminate FC connection for volume %(id)s, ' 'connector info %(conn)s.', { 'id': volume.id, 'conn': connector }) if self._is_volume_multi_attach_to_same_host(volume, connector): return metadata = huawei_utils.get_volume_private_data(volume) if metadata.get('hypermetro'): hypermetro = huawei_utils.get_hypermetro(self.local_cli, volume) if hypermetro: rmt_ini_tgt_map = huawei_flow.terminate_remote_fc_connection( hypermetro['ID'], connector, self.fc_san, self.hypermetro_rmt_cli) loc_ini_tgt_map = huawei_flow.terminate_fc_connection( volume, constants.LUN_TYPE, connector, self.fc_san, self.local_cli) if metadata.get('hypermetro'): self._merge_ini_tgt_map(loc_ini_tgt_map, rmt_ini_tgt_map) conn = { 'driver_volume_type': 'fibre_channel', 'data': { 'initiator_target_map': loc_ini_tgt_map }, } LOG.info('Terminate FC connection successfully: %s.', conn) zm_utils.remove_fc_zone(conn) return conn
def _terminate_connection_snapshot_locked(self, host, snapshot, connector): LOG.info('Terminate FC connection for snapshot %(id)s, ' 'connector info %(conn)s.', {'id': snapshot.id, 'conn': connector}) ini_tgt_map = huawei_flow.terminate_fc_connection( snapshot, constants.SNAPSHOT_TYPE, connector, self.fc_san, self.local_cli, self.configuration) conn = {'driver_volume_type': 'fibre_channel', 'data': {'initiator_target_map': ini_tgt_map}, } LOG.info('Terminate FC connection successfully: %s.', conn) zm_utils.remove_fc_zone(conn) return conn