Revision f863d7aa

b/lib/rpc.py
391 391

  
392 392
    return results
393 393

  
394
  def __call__(self, hosts, procedure, body, read_timeout=None,
394
  def __call__(self, hosts, procedure, body, read_timeout,
395 395
               _req_process_fn=http.client.ProcessRequests):
396 396
    """Makes an RPC request to a number of nodes.
397 397

  
......
463 463
      pnbody = dict((n, serializer.DumpJson(prep_fn(n, enc_args)))
464 464
                    for n in node_list)
465 465

  
466
    result = self._proc(node_list, procedure, pnbody,
467
                        read_timeout=read_timeout)
466
    result = self._proc(node_list, procedure, pnbody, read_timeout)
468 467

  
469 468
    if postproc_fn:
470 469
      return dict(map(lambda (key, value): (key, postproc_fn(value)),
b/test/ganeti.rpc_unittest.py
73 73
    resolver = rpc._StaticResolver(["127.0.0.1"])
74 74
    http_proc = _FakeRequestProcessor(self._GetVersionResponse)
75 75
    proc = rpc._RpcProcessor(resolver, 24094)
76
    result = proc(["localhost"], "version", {"localhost": ""},
77
                  _req_process_fn=http_proc, read_timeout=60)
76
    result = proc(["localhost"], "version", {"localhost": ""}, 60,
77
                  _req_process_fn=http_proc)
78 78
    self.assertEqual(result.keys(), ["localhost"])
79 79
    lhresp = result["localhost"]
80 80
    self.assertFalse(lhresp.offline)
......
100 100
    proc = rpc._RpcProcessor(resolver, 19176)
101 101
    host = "node31856"
102 102
    body = {host: ""}
103
    result = proc([host], "version", body, _req_process_fn=http_proc,
104
                  read_timeout=12356)
103
    result = proc([host], "version", body, 12356, _req_process_fn=http_proc)
105 104
    self.assertEqual(result.keys(), [host])
106 105
    lhresp = result[host]
107 106
    self.assertFalse(lhresp.offline)
......
118 117
    proc = rpc._RpcProcessor(resolver, 30668)
119 118
    host = "n17296"
120 119
    body = {host: ""}
121
    result = proc([host], "version", body, _req_process_fn=http_proc,
122
                  read_timeout=60)
120
    result = proc([host], "version", body, 60, _req_process_fn=http_proc)
123 121
    self.assertEqual(result.keys(), [host])
124 122
    lhresp = result[host]
125 123
    self.assertTrue(lhresp.offline)
......
150 148
    resolver = rpc._StaticResolver(nodes)
151 149
    http_proc = _FakeRequestProcessor(self._GetMultiVersionResponse)
152 150
    proc = rpc._RpcProcessor(resolver, 23245)
153
    result = proc(nodes, "version", body, _req_process_fn=http_proc,
154
                  read_timeout=60)
151
    result = proc(nodes, "version", body, 60, _req_process_fn=http_proc,)
155 152
    self.assertEqual(sorted(result.keys()), sorted(nodes))
156 153

  
157 154
    for name in nodes:
......
180 177
                                             errinfo))
181 178
      host = "aef9ur4i.example.com"
182 179
      body = {host: ""}
183
      result = proc(body.keys(), "version", body,
184
                    _req_process_fn=http_proc, read_timeout=60)
180
      result = proc(body.keys(), "version", body, 60,
181
                    _req_process_fn=http_proc)
185 182
      self.assertEqual(result.keys(), [host])
186 183
      lhresp = result[host]
187 184
      self.assertFalse(lhresp.offline)
......
230 227
    http_proc = \
231 228
      _FakeRequestProcessor(compat.partial(self._GetHttpErrorResponse,
232 229
                                           httperrnodes, failnodes))
233
    result = proc(nodes, "vg_list", body, _req_process_fn=http_proc,
234
                  read_timeout=rpc._TMO_URGENT)
230
    result = proc(nodes, "vg_list", body, rpc._TMO_URGENT,
231
                  _req_process_fn=http_proc)
235 232
    self.assertEqual(sorted(result.keys()), sorted(nodes))
236 233

  
237 234
    for name in nodes:
......
275 272
      http_proc = _FakeRequestProcessor(fn)
276 273
      host = "oqo7lanhly.example.com"
277 274
      body = {host: ""}
278
      result = proc([host], "version", body,
279
                    _req_process_fn=http_proc, read_timeout=60)
275
      result = proc([host], "version", body, 60,
276
                    _req_process_fn=http_proc)
280 277
      self.assertEqual(result.keys(), [host])
281 278
      lhresp = result[host]
282 279
      self.assertFalse(lhresp.offline)
......
307 304
    proc = rpc._RpcProcessor(resolver, 18700)
308 305
    host = "node19759"
309 306
    body = {host: serializer.DumpJson(test_data)}
310
    result = proc([host], "upload_file", body, _req_process_fn=http_proc,
311
                  read_timeout=30)
307
    result = proc([host], "upload_file", body, 30, _req_process_fn=http_proc)
312 308
    self.assertEqual(result.keys(), [host])
313 309
    lhresp = result[host]
314 310
    self.assertFalse(lhresp.offline)

Also available in: Unified diff