On Thu, Jul 23, 2015 at 07:33:51PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
One of the tasks the maintenance daemon does is keeping
the cluster balanced, taking load into account. As this
is not wanted for all use cases of Ganeti, there is a
flag to control it. Also, to avoid flapping behavior,
a threshold for balancing operations can be specified;
a balancing move will only be carried out if the gain
in the cluster metrics is bigger than the given threshold.
We also provide safe default values: balancing is
disabled by default, and the threshold is 10 times higher
than the one for manual balancing.
Signed-off-by: Klaus Aehlig <[email protected]>
---
lib/objects.py | 3 ++-
src/Ganeti/Objects/Maintenance.hs | 3 +++
test/hs/Test/Ganeti/Objects.hs | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/objects.py b/lib/objects.py
index 806fe75..2bea940 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -557,7 +557,8 @@ class Filter(ConfigObject):
class Maintenance(ConfigObject):
"""Config object representing the state of the maintenance daemon"""
- __slots__ = ["roundDelay", "jobs", "serial_no"] + _TIMESTAMPS
+ __slots__ = ["roundDelay", "jobs", "balance", "balanceThreshold",
+ "serial_no"] + _TIMESTAMPS
def UpgradeConfig(self):
if self.serial_no is None:
diff --git a/src/Ganeti/Objects/Maintenance.hs
b/src/Ganeti/Objects/Maintenance.hs
index 8587f81..fa05a01 100644
--- a/src/Ganeti/Objects/Maintenance.hs
+++ b/src/Ganeti/Objects/Maintenance.hs
@@ -47,6 +47,9 @@ $(buildObject "MaintenanceData" "maint" $
[ defaultField [| C.maintdDefaultRoundDelay |]
$ simpleField "roundDelay" [t| Int |]
, defaultField [| [] |] $ simpleField "jobs" [t| [ JobId ] |]
+ , defaultField [| False |] $ simpleField "balance" [t| Bool |]
+ , defaultField [| 0.1 :: Double |]
+ $ simpleField "balanceThreshold" [t| Double |]
]
++ timeStampFields
++ serialFields)
diff --git a/test/hs/Test/Ganeti/Objects.hs b/test/hs/Test/Ganeti/Objects.hs
index 4b116e1..b97944d 100644
--- a/test/hs/Test/Ganeti/Objects.hs
+++ b/test/hs/Test/Ganeti/Objects.hs
@@ -381,6 +381,8 @@ instance Arbitrary MaintenanceData where
<*> arbitrary
<*> arbitrary
<*> arbitrary
+ <*> arbitrary
+ <*> arbitrary
-- | Generates a network instance with minimum netmasks of /24. Generating
-- bigger networks slows down the tests, because long bit strings are generated
--
2.4.3.573.g4eafbef
LGTM