Revision 06fb92cf lib/rpc.py
b/lib/rpc.py | ||
---|---|---|
584 | 584 |
return [(d.ToDict(), uid) for d, uid in value] |
585 | 585 |
|
586 | 586 |
|
587 |
def BuildVgInfoQuery(cfg): |
|
588 |
"""Build a query about the default VG for C{node_info}. |
|
589 |
|
|
590 |
The result of the RPC can be parsed with L{MakeLegacyNodeInfo}. |
|
591 |
|
|
592 |
@type cfg: L{config.ConfigWriter} |
|
593 |
@param cfg: Cluster configuration |
|
594 |
@rtype: list |
|
595 |
@return: argument suitable for L{rpc.RpcRunner.call_node_info} |
|
596 |
|
|
597 |
""" |
|
598 |
vg_name = cfg.GetVGName() |
|
599 |
if vg_name: |
|
600 |
ret = [ |
|
601 |
(constants.ST_LVM_VG, vg_name), |
|
602 |
(constants.ST_LVM_PV, vg_name), |
|
603 |
] |
|
604 |
else: |
|
605 |
ret = [] |
|
606 |
return ret |
|
607 |
|
|
608 |
|
|
587 | 609 |
def MakeLegacyNodeInfo(data, require_vg_info=True): |
588 | 610 |
"""Formats the data returned by L{rpc.RpcRunner.call_node_info}. |
589 | 611 |
|
... | ... | |
599 | 621 |
ret = utils.JoinDisjointDicts(hv_info, {"bootid": bootid}) |
600 | 622 |
|
601 | 623 |
if require_vg_info or vgs_info: |
602 |
(vg0_info, ) = vgs_info |
|
624 |
(vg0_info, vg0_spindles) = vgs_info
|
|
603 | 625 |
ret = utils.JoinDisjointDicts(vg0_info, ret) |
626 |
ret["spindles_free"] = vg0_spindles["vg_free"] |
|
627 |
ret["spindles_total"] = vg0_spindles["vg_size"] |
|
604 | 628 |
|
605 | 629 |
return ret |
606 | 630 |
|
Also available in: Unified diff