'Search host matching host_name and tenant if tenant_name provided.
tenant_name is optional'

def query_by_name(self, host_name, tenant_name=None):

    hostList = self.list_all(tenant_name)
    for host in hostList:
        hostUri = host['id']
        hostDetails = self.show_by_uri(hostUri)
        if hostDetails:
            if (hostDetails['name'] == host_name):
                return hostUri
    raise common.CoprHdError(common.CoprHdError.NOT_FOUND_ERR, (_('Host    with    name:    %s    not    found') % host_name))
