On Mon, Mar 02, 2015 at 12:20:55PM +0100, 'Klaus Aehlig' via ganeti-devel wrote:
If this option is given, make loadExternalData evaluate the bit indicating
if all data was available. If this is not the case, exit.
Signed-off-by: Klaus Aehlig <[email protected]>
---
src/Ganeti/HTools/ExtLoader.hs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/Ganeti/HTools/ExtLoader.hs b/src/Ganeti/HTools/ExtLoader.hs
index aebaeb3..56e2e80 100644
--- a/src/Ganeti/HTools/ExtLoader.hs
+++ b/src/Ganeti/HTools/ExtLoader.hs
@@ -46,6 +46,7 @@ import Control.Monad
import Control.Monad.Writer (runWriterT)
import Control.Exception
import Data.Maybe (isJust, fromJust)
+import Data.Monoid (getAll)
import System.FilePath
import System.IO
import System.Time (getClockTime)
@@ -125,9 +126,11 @@ loadExternalData opts = do
ldresult = input_data >>= (if ignoreDynU then clearDynU else return)
>>= mergeData eff_u exTags selInsts exInsts now
cdata <- exitIfBad "failed to load data, aborting" ldresult
- (cdata', _) <- runWriterT $ if optMonD opts
- then MonD.queryAllMonDDCs cdata opts
- else return cdata
+ (cdata', ok) <- runWriterT $ if optMonD opts
+ then MonD.queryAllMonDDCs cdata opts
+ else return cdata
+ exitWhen (optMonDExitMissing opts && not (getAll ok))
+ "Not all required data available"
let (fix_msgs, nl) = checkData (cdNodes cdata') (cdInstances cdata')
unless (optVerbose opts == 0) $ maybeShowWarnings fix_msgs
--
2.2.0.rc0.207.ga3a616c
LGTM