Extend OpClusterSetParams allowing to set the auto-balancing parameters for the maintenance daemon. In this way, the daemon can be controlled via normal cluster operations.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/OpCodes.hs | 2 ++ src/Ganeti/OpParams.hs | 14 ++++++++++++++ src/Ganeti/Query/Server.hs | 4 ++++ test/hs/Test/Ganeti/OpCodes.hs | 2 ++ 4 files changed, 22 insertions(+) diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs index f532d2b..c370a91 100644 --- a/src/Ganeti/OpCodes.hs +++ b/src/Ganeti/OpCodes.hs @@ -261,6 +261,8 @@ $(genOpCode "OpCode" , pEnabledDataCollectors , pDataCollectorInterval , pMaintdRoundDelay + , pMaintdEnableBalancing + , pMaintdBalancingThreshold ], []) , ("OpClusterRedistConf", diff --git a/src/Ganeti/OpParams.hs b/src/Ganeti/OpParams.hs index 4746430..2b266e6 100644 --- a/src/Ganeti/OpParams.hs +++ b/src/Ganeti/OpParams.hs @@ -298,6 +298,8 @@ module Ganeti.OpParams , pAdminStateSource , pEnabledDataCollectors , pMaintdRoundDelay + , pMaintdEnableBalancing + , pMaintdBalancingThreshold , pDataCollectorInterval , pNodeSslCerts , pSshKeys @@ -1896,6 +1898,18 @@ pMaintdRoundDelay = . optionalField $ simpleField "maint_round_delay" [t| Int |] +pMaintdEnableBalancing :: Field +pMaintdEnableBalancing = + withDoc "Whether the maintenance daemon should also keep the cluster balanced" + . optionalField + $ simpleField "maint_balance" [t| Bool |] + +pMaintdBalancingThreshold :: Field +pMaintdBalancingThreshold = + withDoc "Minimal gain per balancing step by the maintenance daemon" + . optionalField + $ simpleField "maint_balance_threshold" [t| Double |] + pNodeSslCerts :: Field pNodeSslCerts = withDoc "Whether to renew node SSL certificates" . diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs index 800cf51..e3789b3 100644 --- a/src/Ganeti/Query/Server.hs +++ b/src/Ganeti/Query/Server.hs @@ -272,6 +272,10 @@ handleCall _ _ cdata QueryClusterInfo = $ clusterDataCollectors cluster) , ("maint_round_delay", showJSON . maintRoundDelay $ configMaintenance cdata) + , ("maint_balance", + showJSON . maintBalance $ configMaintenance cdata) + , ("maint_balance_threshold", + showJSON . maintBalanceThreshold $ configMaintenance cdata) ] in case master of diff --git a/test/hs/Test/Ganeti/OpCodes.hs b/test/hs/Test/Ganeti/OpCodes.hs index 7b7fac5..62dc75d 100644 --- a/test/hs/Test/Ganeti/OpCodes.hs +++ b/test/hs/Test/Ganeti/OpCodes.hs @@ -252,6 +252,8 @@ instance Arbitrary OpCodes.OpCode where <*> genMaybe arbitraryDataCollector -- enabled_data_collectors <*> arbitraryDataCollectorInterval -- data_collector_interval <*> genMaybe (fromPositive <$> arbitrary) -- maintd round interval + <*> genMaybe arbitrary -- enable maintd balancing + <*> genMaybe arbitrary -- maintd balancing threshold "OP_CLUSTER_REDIST_CONF" -> pure OpCodes.OpClusterRedistConf "OP_CLUSTER_ACTIVATE_MASTER_IP" -> pure OpCodes.OpClusterActivateMasterIp -- 2.4.3.573.g4eafbef
