Пример #1
0
    def _get_hosts(self, failure_tester):
        req = host_svc.QueryHostsRequest()

        resp = failure_tester.client.host_svc.QueryHosts(
            req,
            metadata=failure_tester.client.hostmgr_metadata,
            timeout=failure_tester.integ_config.rpc_timeout_sec)
        return resp.host_infos
Пример #2
0
    def _get_hosts(self, failure_tester):
        '''
        helper function for test_hostmgr_failover
        '''
        req = host_svc.QueryHostsRequest()

        resp = failure_tester.client.host_svc.QueryHosts(
            req,
            metadata=failure_tester.client.hostmgr_metadata,
            timeout=failure_tester.integ_config.rpc_timeout_sec,
        )
        return resp.host_infos
Пример #3
0
def query_hosts(states):
    """
    query hosts by state
    :param states: list of host_pb2.HostStates
    :return: host_svc_pb2.QueryHostsResponse
    """
    if not states:
        states = [
            host.HOST_STATE_UP,
            host.HOST_STATE_DRAINING,
            host.HOST_STATE_DOWN,
        ]
    client = Client()
    request = hostsvc.QueryHostsRequest(host_states=states)

    resp = client.host_svc.QueryHosts(request,
                                      metadata=client.hostmgr_metadata,
                                      timeout=10)
    return resp