Allow modify_etc_hosts to be changed
[ganeti-local] / src / Ganeti / OpCodes.hs
index ec9a34f..c31465b 100644 (file)
@@ -6,7 +6,7 @@
 
 {-
 
-Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
+Copyright (C) 2009, 2010, 2011, 2012, 2013 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
@@ -44,10 +44,11 @@ module Ganeti.OpCodes
   , MetaOpCode(..)
   , wrapOpCode
   , setOpComment
+  , setOpPriority
   ) where
 
 import Data.Maybe (fromMaybe)
-import Text.JSON (readJSON, showJSON, JSON, JSValue, makeObj)
+import Text.JSON (readJSON, JSON, JSValue, makeObj)
 import qualified Text.JSON
 
 import Ganeti.THH
@@ -148,7 +149,8 @@ $(genOpCode "OpCode"
      [ pName
      ])
   , ("OpClusterSetParams",
-     [ pHvState
+     [ pForce
+     , pHvState
      , pDiskState
      , pVgName
      , pEnabledHypervisors
@@ -174,6 +176,8 @@ $(genOpCode "OpCode"
      , pHiddenOs
      , pBlacklistedOs
      , pUseExternalMipScript
+     , pEnabledDiskTemplates
+     , pModifyEtcHosts
      ])
   , ("OpClusterRedistConf", [])
   , ("OpClusterActivateMasterIp", [])
@@ -385,6 +389,7 @@ $(genOpCode "OpCode"
      , pRuntimeMem
      , pInstHvParams
      , pOptDiskTemplate
+     , pPrimaryNode
      , pRemoteNode
      , pOsNameChange
      , pInstOsParams
@@ -501,7 +506,6 @@ $(genOpCode "OpCode"
      ])
   , ("OpNetworkAdd",
      [ pNetworkName
-     , pNetworkType
      , pNetworkAddress4
      , pNetworkGateway4
      , pNetworkAddress6
@@ -517,7 +521,6 @@ $(genOpCode "OpCode"
      ])
   , ("OpNetworkSetParams",
      [ pNetworkName
-     , pNetworkType
      , pNetworkGateway4
      , pNetworkAddress6
      , pNetworkGateway6
@@ -535,7 +538,6 @@ $(genOpCode "OpCode"
   , ("OpNetworkDisconnect",
      [ pGroupName
      , pNetworkName
-     , pIpConflictsCheck
      ])
   , ("OpNetworkQuery", dOldQuery)
   , ("OpRestrictedCommand",
@@ -626,6 +628,7 @@ $(buildObject "CommonOpParams" "op"
   , pOpPriority
   , pDependencies
   , pComment
+  , pReason
   ])
 
 -- | Default common parameter values.
@@ -636,6 +639,7 @@ defOpParams =
                  , opPriority   = OpPrioNormal
                  , opDepends    = Nothing
                  , opComment    = Nothing
+                 , opReason     = []
                  }
 
 -- | The top-level opcode type.
@@ -670,3 +674,8 @@ wrapOpCode = MetaOpCode defOpParams
 setOpComment :: String -> MetaOpCode -> MetaOpCode
 setOpComment comment (MetaOpCode common op) =
   MetaOpCode (common { opComment = Just comment}) op
+
+-- | Sets the priority on a meta opcode.
+setOpPriority :: OpSubmitPriority -> MetaOpCode -> MetaOpCode
+setOpPriority prio (MetaOpCode common op) =
+  MetaOpCode (common { opPriority = prio }) op