From 05325a35321781d67a53f757f7e736257f000dda Mon Sep 17 00:00:00 2001 From: Bernardo Dal Seno Date: Tue, 9 Oct 2012 01:43:17 +0200 Subject: [PATCH] Fixes and improvements to comments Some fixes, added more information in a few points, removed a stale (5+ year old) TODO comment. Signed-off-by: Bernardo Dal Seno Reviewed-by: Guido Trotter --- lib/cmdlib.py | 16 +++++++--------- lib/objects.py | 4 ++-- lib/rpc.py | 4 +++- qa/qa_utils.py | 2 ++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 1021912..aa3740f 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -6788,9 +6788,9 @@ def _ShutdownInstanceDisks(lu, instance, disks=None, ignore_primary=False): def _CheckNodeFreeMemory(lu, node, reason, requested, hypervisor_name): """Checks if a node has enough free memory. - This function check if a given node has the needed amount of free + This function checks if a given node has the needed amount of free memory. In case the node has less memory or we cannot get the - information from the node, this function raise an OpPrereqError + information from the node, this function raises an OpPrereqError exception. @type lu: C{LogicalUnit} @@ -6828,11 +6828,11 @@ def _CheckNodeFreeMemory(lu, node, reason, requested, hypervisor_name): def _CheckNodesFreeDiskPerVG(lu, nodenames, req_sizes): - """Checks if nodes have enough free disk space in the all VGs. + """Checks if nodes have enough free disk space in all the VGs. - This function check if all given nodes have the needed amount of + This function checks if all given nodes have the needed amount of free disk. In case any node has less disk or we cannot get the - information from the node, this function raise an OpPrereqError + information from the node, this function raises an OpPrereqError exception. @type lu: C{LogicalUnit} @@ -6853,9 +6853,9 @@ def _CheckNodesFreeDiskPerVG(lu, nodenames, req_sizes): def _CheckNodesFreeDiskOnVG(lu, nodenames, vg, requested): """Checks if nodes have enough free disk space in the specified VG. - This function check if all given nodes have the needed amount of + This function checks if all given nodes have the needed amount of free disk. In case any node has less disk or we cannot get the - information from the node, this function raise an OpPrereqError + information from the node, this function raises an OpPrereqError exception. @type lu: C{LogicalUnit} @@ -9137,8 +9137,6 @@ def _GenerateDiskTemplate( """Generate the entire disk layout for a given template type. """ - #TODO: compute space requirements - vgname = lu.cfg.GetVGName() disk_count = len(disk_info) disks = [] diff --git a/lib/objects.py b/lib/objects.py index dd83bd2..9835353 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -1023,7 +1023,7 @@ class Instance(TaggableObject): return tuple(all_nodes) secondary_nodes = property(_ComputeSecondaryNodes, None, None, - "List of secondary nodes") + "List of names of secondary nodes") def _ComputeAllNodes(self): """Compute the list of all nodes. @@ -1051,7 +1051,7 @@ class Instance(TaggableObject): return tuple(all_nodes) all_nodes = property(_ComputeAllNodes, None, None, - "List of all nodes of the instance") + "List of names of all the nodes of the instance") def MapLVsByNode(self, lvmap=None, devs=None, node=None): """Provide a mapping of nodes to LVs this instance owns. diff --git a/lib/rpc.py b/lib/rpc.py index 6f8326c..b72ac23 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -150,7 +150,7 @@ class RpcResult(object): """RPC Result class. This class holds an RPC result. It is needed since in multi-node - calls we can't raise an exception just because one one out of many + calls we can't raise an exception just because one out of many failed, and therefore we use this class to encapsulate the result. @ivar data: the data payload, for successful results, or None @@ -405,6 +405,8 @@ class _RpcProcessor: @param body: dictionary with request bodies per host @type read_timeout: int or None @param read_timeout: Read timeout for request + @rtype: dictionary + @return: a dictionary mapping host names to rpc.RpcResult objects """ assert read_timeout is not None, \ diff --git a/qa/qa_utils.py b/qa/qa_utils.py index f7d2698..873459d 100644 --- a/qa/qa_utils.py +++ b/qa/qa_utils.py @@ -166,6 +166,8 @@ def AssertCommand(cmd, fail=False, node=None): @param node: if passed, it should be the node on which the command should be executed, instead of the master node (can be either a dict or a string) + @return: the return code of the command + @raise qa_error.Error: if the command fails when it shouldn't or vice versa """ if node is None: -- 1.7.10.4