Support flushing to a single group
authorKlaus Aehlig <aehlig@google.com>
Mon, 8 Feb 2016 15:28:25 +0000 (16:28 +0100)
committerKlaus Aehlig <aehlig@google.com>
Wed, 10 Feb 2016 09:59:06 +0000 (10:59 +0100)
When a group is verified, the configuration needs to be
fully flushed to that group. Support flushing by group,
so that we can get rid of the over-approximation of flushing
everything.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Brian Foley <bpfoley@google.com>

src/Ganeti/WConfd/Core.hs

index 6fc09c9..73dba45 100644 (file)
@@ -160,6 +160,11 @@ writeConfigAndUnlock cid cdata = do
 flushConfig :: WConfdMonad ()
 flushConfig = forceConfigStateDistribution Everywhere
 
+-- | Force the distribution of configuration to a given group without actually
+-- modifying it. It is not necessary to hold a lock for this operation.
+flushConfigGroup :: String -> WConfdMonad ()
+flushConfigGroup = forceConfigStateDistribution . ToGroups . S.singleton
+
 -- ** Temporary reservations related functions
 
 dropAllReservations :: ClientId -> WConfdMonad ()
@@ -390,6 +395,7 @@ exportedFunctions = [ 'echo
                     , 'unlockConfig
                     , 'writeConfigAndUnlock
                     , 'flushConfig
+                    , 'flushConfigGroup
                     -- temporary reservations (common)
                     , 'dropAllReservations
                     -- DRBD