From 02da9d07bef42907f9ea4d072d1e072a0fd05e38 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 25 Aug 2010 18:40:20 +0200
Subject: [PATCH] Add a new option --save-cluster

This option will in the future be used to serialize the cluster state in
hbal and hspace after the rebalance/allocation steps.
---
 Ganeti/HTools/CLI.hs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Ganeti/HTools/CLI.hs b/Ganeti/HTools/CLI.hs
index 37c158036..ff6904749 100644
--- a/Ganeti/HTools/CLI.hs
+++ b/Ganeti/HTools/CLI.hs
@@ -8,7 +8,7 @@ and this is more IO oriented.
 
 {-
 
-Copyright (C) 2009 Google Inc.
+Copyright (C) 2009, 2010 Google Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -60,6 +60,7 @@ module Ganeti.HTools.CLI
     , oPrintNodes
     , oQuiet
     , oRapiMaster
+    , oSaveCluster
     , oShowHelp
     , oShowVer
     , oTieredSpec
@@ -105,6 +106,7 @@ data Options = Options
     , optOffline     :: [String]       -- ^ Names of offline nodes
     , optOneline     :: Bool           -- ^ Switch output to a single line
     , optOutPath     :: FilePath       -- ^ Path to the output directory
+    , optSaveCluster :: Maybe FilePath -- ^ Save cluster state to this file
     , optShowCmds    :: Maybe FilePath -- ^ Whether to show the command list
     , optShowHelp    :: Bool           -- ^ Just show the help
     , optShowInsts   :: Bool           -- ^ Whether to show the instance map
@@ -137,6 +139,7 @@ defaultOptions  = Options
  , optOffline     = []
  , optOneline     = False
  , optOutPath     = "."
+ , optSaveCluster = Nothing
  , optShowCmds    = Nothing
  , optShowHelp    = False
  , optShowInsts   = False
@@ -304,6 +307,11 @@ oRapiMaster = Option "m" ["master"]
               (ReqArg (\ m opts -> Ok opts { optMaster = m }) "ADDRESS")
               "collect data via RAPI at the given ADDRESS"
 
+oSaveCluster :: OptType
+oSaveCluster = Option "S" ["save"]
+            (ReqArg (\ f opts -> Ok opts { optSaveCluster = Just f }) "FILE")
+            "Save cluster state at the end of the processing to FILE"
+
 oShowHelp :: OptType
 oShowHelp = Option "h" ["help"]
             (NoArg (\ opts -> Ok opts { optShowHelp = True}))
-- 
GitLab