'Unmap the volume and delete the host if it has no more mappings.'

def unmap_vol_from_host(self, volume_name, host_name):

    LOG.debug('Enter:    unmap_vol_from_host:    volume    %(volume_name)s    from    host    %(host_name)s.', {'volume_name': volume_name, 'host_name': host_name})
    resp = self.ssh.lsvdiskhostmap(volume_name)
    if (not len(resp)):
        LOG.warning('unmap_vol_from_host:    No    mapping    of    volume    %(vol_name)s    to    any    host    found.', {'vol_name': volume_name})
        return host_name
    if (host_name is None):
        if (len(resp) > 1):
            LOG.warning('unmap_vol_from_host:    Multiple    mappings    of    volume    %(vol_name)s    found,    no    host    specified.', {'vol_name': volume_name})
            return
        else:
            host_name = resp[0]['host_name']
    else:
        found = False
        for h in resp.select('host_name'):
            if (h == host_name):
                found = True
        if (not found):
            LOG.warning('unmap_vol_from_host:    No    mapping    of    volume    %(vol_name)s    to    host    %(host)s    found.', {'vol_name': volume_name, 'host': host_name})
            return host_name
    self.ssh.rmvdiskhostmap(host_name, volume_name)
    LOG.debug('Leave:    unmap_vol_from_host:    volume    %(volume_name)s    from    host    %(host_name)s.', {'volume_name': volume_name, 'host_name': host_name})
    return host_name
