In this way, OpClusterSetParams will be able to set those
values as well.
Signed-off-by: Klaus Aehlig <[email protected]>
---
src/Ganeti/WConfd/ConfigModifications.hs | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/Ganeti/WConfd/ConfigModifications.hs
b/src/Ganeti/WConfd/ConfigModifications.hs
index 30bd86d..68c6811 100644
--- a/src/Ganeti/WConfd/ConfigModifications.hs
+++ b/src/Ganeti/WConfd/ConfigModifications.hs
@@ -687,6 +687,27 @@ appendMaintdJobs jobs = do
(\_ cs -> return . addJobs $ cs)
(return ())
+-- | Set the autobalance flag.
+setMaintdBalance :: Bool -> WConfdMonad Bool
+setMaintdBalance value = do
+ now <- liftIO getClockTime
+ let setFlag = over (csConfigDataL . configMaintenanceL)
+ $ (serialL +~ 1) . (mTimeL .~ now) . (maintBalanceL .~ value)
+ liftM isJust $ modifyConfigWithLock
+ (\_ cs -> return . setFlag $ cs)
+ (return ())
+
+-- | Set the auto-balance threshold.
+setMaintdBalanceThreshold :: Double -> WConfdMonad Bool
+setMaintdBalanceThreshold value = do
+ now <- liftIO getClockTime
+ let setValue = over (csConfigDataL . configMaintenanceL)
+ $ (serialL +~ 1) . (mTimeL .~ now)
+ . (maintBalanceThresholdL .~ value)
+ liftM isJust $ modifyConfigWithLock
+ (\_ cs -> return . setValue $ cs)
+ (return ())
+
-- * The list of functions exported to RPC.
exportedFunctions :: [Name]
@@ -709,4 +730,6 @@ exportedFunctions = [ 'addInstance
, 'setMaintdRoundDelay
, 'clearMaintdJobs
, 'appendMaintdJobs
+ , 'setMaintdBalance
+ , 'setMaintdBalanceThreshold
]
--
2.4.3.573.g4eafbef