'Driver entry point to unattach a volume from an instance.'

def terminate_connection(self, volume, connector, **kwargs):

    start_time = time.time()
    LOG.debug('in    terminate_connection')
    LOG.debug('volume:    %s', volume.__dict__)
    LOG.debug('connector:    %s', connector)
    lun_naa = self._get_lun_naa_from_volume_metadata(volume)
    LOG.debug('lun_naa:    %s', lun_naa)
    selected_lun = self.api_executor.get_lun_info(LUNNAA=lun_naa)
    lun_index = selected_lun.find('LUNIndex').text
    LOG.debug('LUNIndex:    %s', lun_index)
    lun_status = self.enum('createing', 'unmapped', 'mapped')
    LOG.debug('LUNStatus:    %s', selected_lun.find('LUNStatus').text)
    LOG.debug('lun_status.mapped:    %s', six.text_type(lun_status.mapped))
    if (selected_lun.find('LUNStatus').text != six.text_type(lun_status.mapped)):
        return
    target_index = selected_lun.find('LUNTargetList').find('row').find('targetIndex').text
    LOG.debug('target_index:    %s', target_index)
    self.api_executor.disable_lun(lun_index, target_index)
    self.api_executor.unmap_lun(lun_index, target_index)
    elapsed_time = (time.time() - start_time)
    LOG.debug('terminate_connection    elapsed_time    :    %s', elapsed_time)
