Revision 91c17910 lib/rpc.py

b/lib/rpc.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
571 571
  return [(d.ToDict(), uid) for d, uid in value]
572 572

  
573 573

  
574
def MakeLegacyNodeInfo(data):
574
def MakeLegacyNodeInfo(data, require_vg_info=True):
575 575
  """Formats the data returned by L{rpc.RpcRunner.call_node_info}.
576 576

  
577 577
  Converts the data into a single dictionary. This is fine for most use cases,
578 578
  but some require information from more than one volume group or hypervisor.
579 579

  
580
  @param require_vg_info: raise an error if the returnd vg_info
581
      doesn't have any values
582

  
580 583
  """
581
  (bootid, (vg_info, ), (hv_info, )) = data
584
  (bootid, vgs_info, (hv_info, )) = data
585

  
586
  ret = utils.JoinDisjointDicts(hv_info, {"bootid": bootid})
587

  
588
  if require_vg_info or vgs_info:
589
    (vg0_info, ) = vgs_info
590
    ret = utils.JoinDisjointDicts(vg0_info, ret)
582 591

  
583
  return utils.JoinDisjointDicts(utils.JoinDisjointDicts(vg_info, hv_info), {
584
    "bootid": bootid,
585
    })
592
  return ret
586 593

  
587 594

  
588 595
def _AnnotateDParamsDRBD(disk, (drbd_params, data_params, meta_params)):

Also available in: Unified diff