From 8c9af2f03de610fe7fc55f79e005806078f4d720 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 19 Oct 2009 06:17:26 +0900 Subject: [PATCH] Simplify the cstats initializer Since all values are initialized to zero, the exact ordering is not important and thus we can use the positional mode for simpler code. The patch also adds docstrings to the cstats functions. --- Ganeti/HTools/Cluster.hs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/Ganeti/HTools/Cluster.hs b/Ganeti/HTools/Cluster.hs index 2560418ab..d8337ae2a 100644 --- a/Ganeti/HTools/Cluster.hs +++ b/Ganeti/HTools/Cluster.hs @@ -125,27 +125,11 @@ computeBadItems nl il = in (bad_nodes, bad_instances) +-- | Zero-initializer for the CStats type emptyCStats :: CStats -emptyCStats = CStats { csFmem = 0 - , csFdsk = 0 - , csAmem = 0 - , csAdsk = 0 - , csAcpu = 0 - , csMmem = 0 - , csMdsk = 0 - , csMcpu = 0 - , csImem = 0 - , csIdsk = 0 - , csIcpu = 0 - , csTmem = 0 - , csTdsk = 0 - , csTcpu = 0 - , csXmem = 0 - , csNmem = 0 - , csScore = 0 - , csNinst = 0 - } +emptyCStats = CStats 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +-- | Update stats with data from a new node updateCStats :: CStats -> Node.Node -> CStats updateCStats cs node = let CStats { csFmem = x_fmem, csFdsk = x_fdsk, -- GitLab