Revision 25361b9a lib/backend.py

b/lib/backend.py
350 350
  """
351 351
  result = {}
352 352

  
353
  if 'hypervisor' in what:
354
    result['hypervisor'] = my_dict = {}
355
    for hv_name in what['hypervisor']:
356
      my_dict[hv_name] = hypervisor.GetHypervisor(hv_name).Verify()
357

  
358
  if 'filelist' in what:
359
    result['filelist'] = utils.FingerprintFiles(what['filelist'])
360

  
361
  if 'nodelist' in what:
362
    result['nodelist'] = {}
363
    random.shuffle(what['nodelist'])
364
    for node in what['nodelist']:
353
  if constants.NV_HYPERVISOR in what:
354
    result[constants.NV_HYPERVISOR] = tmp = {}
355
    for hv_name in what[constants.NV_HYPERVISOR]:
356
      tmp[hv_name] = hypervisor.GetHypervisor(hv_name).Verify()
357

  
358
  if constants.NV_FILELIST in what:
359
    result[constants.NV_FILELIST] = utils.FingerprintFiles(
360
      what[constants.NV_FILELIST])
361

  
362
  if constants.NV_NODELIST in what:
363
    result[constants.NV_NODELIST] = tmp = {}
364
    random.shuffle(what[constants.NV_NODELIST])
365
    for node in what[constants.NV_NODELIST]:
365 366
      success, message = _GetSshRunner(cluster_name).VerifyNodeHostname(node)
366 367
      if not success:
367
        result['nodelist'][node] = message
368
  if 'node-net-test' in what:
369
    result['node-net-test'] = {}
368
        tmp[node] = message
369

  
370
  if constants.NV_NODENETTEST in what:
371
    result[constants.NV_NODENETTEST] = tmp = {}
370 372
    my_name = utils.HostInfo().name
371 373
    my_pip = my_sip = None
372
    for name, pip, sip in what['node-net-test']:
374
    for name, pip, sip in what[constants.NV_NODENETTEST]:
373 375
      if name == my_name:
374 376
        my_pip = pip
375 377
        my_sip = sip
376 378
        break
377 379
    if not my_pip:
378
      result['node-net-test'][my_name] = ("Can't find my own"
379
                                          " primary/secondary IP"
380
                                          " in the node list")
380
      tmp[my_name] = ("Can't find my own primary/secondary IP"
381
                      " in the node list")
381 382
    else:
382 383
      port = utils.GetNodeDaemonPort()
383
      for name, pip, sip in what['node-net-test']:
384
      for name, pip, sip in what[constants.NV_NODENETTEST]:
384 385
        fail = []
385 386
        if not utils.TcpPing(pip, port, source=my_pip):
386 387
          fail.append("primary")
......
388 389
          if not utils.TcpPing(sip, port, source=my_sip):
389 390
            fail.append("secondary")
390 391
        if fail:
391
          result['node-net-test'][name] = ("failure using the %s"
392
                                           " interface(s)" %
393
                                           " and ".join(fail))
392
          tmp[name] = ("failure using the %s interface(s)" %
393
                       " and ".join(fail))
394

  
395
  if constants.NV_LVLIST in what:
396
    result[constants.NV_LVLIST] = GetVolumeList(what[constants.NV_LVLIST])
397

  
398
  if constants.NV_INSTANCELIST in what:
399
    result[constants.NV_INSTANCELIST] = GetInstanceList(
400
      what[constants.NV_INSTANCELIST])
401

  
402
  if constants.NV_VGLIST in what:
403
    result[constants.NV_VGLIST] = ListVolumeGroups()
404

  
405
  if constants.NV_VERSION in what:
406
    result[constants.NV_VERSION] = constants.PROTOCOL_VERSION
407

  
408
  if constants.NV_HVINFO in what:
409
    hyper = hypervisor.GetHypervisor(what[constants.NV_HVINFO])
410
    result[constants.NV_HVINFO] = hyper.GetNodeInfo()
394 411

  
395 412
  return result
396 413

  

Also available in: Unified diff