On Wed, Jul 29, 2015 at 06:06:31PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
When collecting instance load on a per-instance basis (currently Xen only),
There is one case where we do not have load information at all for an
instance: an instance just evacuated from an offline node. On the other
hand, this is precisely the situation where we do not want to wait for
load data to come in---an offline node should be evacuated as soon as
possible. Therefore, we need keep track of the instances we recently
evacuated so that we can accept missing load data for them.
Signed-off-by: Klaus Aehlig <[email protected]>
---
lib/objects.py | 2 +-
src/Ganeti/Objects/Maintenance.hs | 1 +
src/Ganeti/WConfd/ConfigModifications.hs | 12 ++++++++++++
src/Ganeti/WConfd/Core.hs | 7 ++++++-
4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/lib/objects.py b/lib/objects.py
index 2bea940..0655443 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -557,7 +557,7 @@ class Filter(ConfigObject):
class Maintenance(ConfigObject):
"""Config object representing the state of the maintenance daemon"""
- __slots__ = ["roundDelay", "jobs", "balance", "balanceThreshold",
+ __slots__ = ["roundDelay", "jobs", "evacuated", "balance",
"balanceThreshold",
"serial_no"] + _TIMESTAMPS
def UpgradeConfig(self):
diff --git a/src/Ganeti/Objects/Maintenance.hs
b/src/Ganeti/Objects/Maintenance.hs
index fa05a01..6011e3d 100644
--- a/src/Ganeti/Objects/Maintenance.hs
+++ b/src/Ganeti/Objects/Maintenance.hs
@@ -50,6 +50,7 @@ $(buildObject "MaintenanceData" "maint" $
, defaultField [| False |] $ simpleField "balance" [t| Bool |]
, defaultField [| 0.1 :: Double |]
$ simpleField "balanceThreshold" [t| Double |]
+ , defaultField [| [] |] $ simpleField "evacuated" [t| [ String ] |]
]
++ timeStampFields
++ serialFields)
diff --git a/src/Ganeti/WConfd/ConfigModifications.hs
b/src/Ganeti/WConfd/ConfigModifications.hs
index 9f0a5b4..da4d9a4 100644
--- a/src/Ganeti/WConfd/ConfigModifications.hs
+++ b/src/Ganeti/WConfd/ConfigModifications.hs
@@ -701,6 +701,16 @@ setMaintdBalanceThreshold :: Double -> WConfdMonad Bool
setMaintdBalanceThreshold value = changeAndBumpMaint
$ maintBalanceThresholdL .~ value
+-- | Add a name to the list of recently evacuated instances.
+addMaintdEvacuated :: [String] -> WConfdMonad Bool
+addMaintdEvacuated names = changeAndBumpMaint . over maintEvacuatedL
+ $ ordNub . (++ names)
+
+-- | Remvoe a name from the list of recently evacuated instances.
s/Remvoe/Remove/
+rmMaintdEvacuated :: String -> WConfdMonad Bool
+rmMaintdEvacuated name = changeAndBumpMaint . over maintEvacuatedL
+ $ filter (/= name)
+
-- * The list of functions exported to RPC.
exportedFunctions :: [Name]
@@ -725,4 +735,6 @@ exportedFunctions = [ 'addInstance
, 'appendMaintdJobs
, 'setMaintdBalance
, 'setMaintdBalanceThreshold
+ , 'addMaintdEvacuated
+ , 'rmMaintdEvacuated
]
diff --git a/src/Ganeti/WConfd/Core.hs b/src/Ganeti/WConfd/Core.hs
index 0ec540e..3edccb6 100644
--- a/src/Ganeti/WConfd/Core.hs
+++ b/src/Ganeti/WConfd/Core.hs
@@ -63,7 +63,7 @@ import Ganeti.Locking.Locks ( GanetiLocks(ConfigLock, BGL)
import qualified Ganeti.Locking.Waiting as LW
import Ganeti.Objects ( ConfigData, DRBDSecret, LogicalVolume, Ip4Address
, configMaintenance, maintRoundDelay, maintJobs
- , maintBalance, maintBalanceThreshold
+ , maintBalance, maintBalanceThreshold, maintEvacuated
)
import Ganeti.Objects.Lens (configClusterL, clusterMasterNodeL)
import Ganeti.Types (JobId)
@@ -174,6 +174,10 @@ maintenanceBalancing :: WConfdMonad (Bool, Double)
maintenanceBalancing = liftM ((maintBalance &&& maintBalanceThreshold)
. configMaintenance) CW.readConfig
+-- | Get the list of recently evacuated instances.
+maintenanceEvacuated :: WConfdMonad [String]
+maintenanceEvacuated = liftM (maintEvacuated . configMaintenance) CW.readConfig
+
-- ** Temporary reservations related functions
dropAllReservations :: ClientId -> WConfdMonad ()
@@ -407,6 +411,7 @@ exportedFunctions = [ 'echo
, 'maintenanceRoundDelay
, 'maintenanceJobs
, 'maintenanceBalancing
+ , 'maintenanceEvacuated
-- temporary reservations (common)
, 'dropAllReservations
-- DRBD
--
2.5.0.rc2.392.g76e840b
LGTM