(2.10) Introduce --hotplug-if-possible option
[ganeti-local] / src / Ganeti / OpParams.hs
index a1e445c..278fb8f 100644 (file)
@@ -94,6 +94,8 @@ module Ganeti.OpParams
   , pHvState
   , pDiskState
   , pIgnoreIpolicy
+  , pHotplug
+  , pHotplugIfPossible
   , pAllowRuntimeChgs
   , pInstDisks
   , pDiskTemplate
@@ -311,6 +313,7 @@ $(declareSADT "TagType"
   , ("TagTypeNode",     'C.tagNode)
   , ("TagTypeGroup",    'C.tagNodegroup)
   , ("TagTypeCluster",  'C.tagCluster)
+  , ("TagTypeNetwork",  'C.tagNetwork)
   ])
 $(makeJSONInstance ''TagType)
 
@@ -318,6 +321,7 @@ $(makeJSONInstance ''TagType)
 data TagObject = TagInstance String
                | TagNode     String
                | TagGroup    String
+               | TagNetwork  String
                | TagCluster
                deriving (Show, Eq)
 
@@ -327,12 +331,14 @@ tagTypeOf (TagInstance {}) = TagTypeInstance
 tagTypeOf (TagNode     {}) = TagTypeNode
 tagTypeOf (TagGroup    {}) = TagTypeGroup
 tagTypeOf (TagCluster  {}) = TagTypeCluster
+tagTypeOf (TagNetwork  {}) = TagTypeNetwork
 
 -- | Gets the potential tag object name.
 tagNameOf :: TagObject -> Maybe String
 tagNameOf (TagInstance s) = Just s
 tagNameOf (TagNode     s) = Just s
 tagNameOf (TagGroup    s) = Just s
+tagNameOf (TagNetwork  s) = Just s
 tagNameOf  TagCluster     = Nothing
 
 -- | Builds a 'TagObject' from a tag type and name.
@@ -341,6 +347,8 @@ tagObjectFrom TagTypeInstance (JSString s) =
   return . TagInstance $ fromJSString s
 tagObjectFrom TagTypeNode     (JSString s) = return . TagNode $ fromJSString s
 tagObjectFrom TagTypeGroup    (JSString s) = return . TagGroup $ fromJSString s
+tagObjectFrom TagTypeNetwork  (JSString s) =
+  return . TagNetwork $ fromJSString s
 tagObjectFrom TagTypeCluster   JSNull      = return TagCluster
 tagObjectFrom t v =
   fail $ "Invalid tag type/name combination: " ++ show t ++ "/" ++
@@ -702,6 +710,13 @@ pDiskParams = optionalField $
               simpleField "diskparams" [t| GenericContainer DiskTemplate
                                            UncheckedDict |]
 
+-- | Whether to hotplug device.
+pHotplug :: Field
+pHotplug = defaultFalse "hotplug"
+
+pHotplugIfPossible :: Field
+pHotplugIfPossible = defaultFalse "hotplug_if_possible"
+
 -- * Parameters for node resource model
 
 -- | Set hypervisor states.