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

def terminate_connection(self, volume, hostname, wwn=None, iqn=None):

    hosts = None
    if wwn:
        hosts = self.client.queryHost(wwns=wwn)
    elif iqn:
        hosts = self.client.queryHost(iqns=[iqn])
    if (hosts and hosts['members'] and ('name' in hosts['members'][0])):
        hostname = hosts['members'][0]['name']
    try:
        self.delete_vlun(volume, hostname)
        return
    except hpeexceptions.HTTPNotFound as e:
        if ('host    does    not    exist' in e.get_description()):
            if self._active_backend_id:
                LOG.warning('Because    the    host    is    currently    in    a    failed-over    state,    the    volume    will    not    be    properly    detached    from    the    primary    array.    The    detach    will    be    considered    a    success    as    far    as    Cinder    is    concerned.    The    volume    can    now    be    attached    to    the    secondary    target.')
                return
            else:
                hostname = self._get_3par_hostname_from_wwn_iqn(wwn, iqn)
                if (hostname is None):
                    LOG.error('Exception:    %s', e)
                    raise
        else:
            LOG.error('Exception:    %s', e)
            raise
    self.delete_vlun(volume, hostname)
