, pTagsName
, pOutputFields
, pShutdownTimeout
+ , pShutdownTimeout'
, pShutdownInstance
, pForce
, pIgnoreOfflineNodes
, pFileDriver
, pFileStorageDir
, pGlobalFileStorageDir
+ , pGlobalSharedFileStorageDir
, pVgName
, pEnabledHypervisors
, pHypervisor
) where
import Control.Monad (liftM)
-import Data.Set (Set)
-import qualified Data.Set as Set
import Text.JSON (JSON, JSValue(..), JSObject (..), readJSON, showJSON,
fromJSString, toJSObject)
import qualified Text.JSON
import Ganeti.Types
import qualified Ganeti.Query.Language as Qlang
-
-- * Helper functions and types
-- | Build a boolean field.
showJSON (ExportTargetRemote l) = showJSON l
readJSON = readExportTarget
-
-- * Common opcode parameters
pDryRun :: Field
withDoc "Reason trail field" $
simpleField C.opcodeReason [t| ReasonTrail |]
-
-- * Parameters
pDebugSimulateErrors :: Field
pSkipChecks :: Field
pSkipChecks =
withDoc "Which checks to skip" .
- defaultField [| Set.empty |] $
- simpleField "skip_checks" [t| Set VerifyOptionalChecks |]
+ defaultField [| emptyListSet |] $
+ simpleField "skip_checks" [t| ListSet VerifyOptionalChecks |]
pIgnoreErrors :: Field
pIgnoreErrors =
withDoc "List of error codes that should be treated as warnings" .
- defaultField [| Set.empty |] $
- simpleField "ignore_errors" [t| Set CVErrorCode |]
+ defaultField [| emptyListSet |] $
+ simpleField "ignore_errors" [t| ListSet CVErrorCode |]
pVerbose :: Field
pVerbose =
pGlobalFileStorageDir :: Field
pGlobalFileStorageDir = optionalNEStringField "file_storage_dir"
+-- | Global directory for storing shared-file-backed disks.
+pGlobalSharedFileStorageDir :: Field
+pGlobalSharedFileStorageDir = optionalNEStringField "shared_file_storage_dir"
+
-- | Volume group name.
pVgName :: Field
pVgName =
pEnabledHypervisors =
withDoc "List of enabled hypervisors" .
optionalField $
- simpleField "enabled_hypervisors" [t| Hypervisor |]
+ simpleField "enabled_hypervisors" [t| [Hypervisor] |]
pClusterHvParams :: Field
pClusterHvParams =
pUidPool =
withDoc "Set UID pool, must be list of lists describing UID ranges\
\ (two items, start and end inclusive)" .
- optionalField $ simpleField "uid_pool" [t| [[(Int, Int)]] |]
+ optionalField $ simpleField "uid_pool" [t| [(Int, Int)] |]
pAddUids :: Field
pAddUids =
withDoc "Extend UID pool, must be list of lists describing UID\
\ ranges (two items, start and end inclusive)" .
- optionalField $ simpleField "add_uids" [t| [[(Int, Int)]] |]
+ optionalField $ simpleField "add_uids" [t| [(Int, Int)] |]
pRemoveUids :: Field
pRemoveUids =
withDoc "Shrink UID pool, must be list of lists describing UID\
\ ranges (two items, start and end inclusive) to be removed" .
- optionalField $ simpleField "remove_uids" [t| [[(Int, Int)]] |]
+ optionalField $ simpleField "remove_uids" [t| [(Int, Int)] |]
pMaintainNodeHealth :: Field
pMaintainNodeHealth =
pEnabledDiskTemplates =
withDoc "List of enabled disk templates" .
optionalField $
- simpleField "enabled_disk_templates" [t| DiskTemplate |]
+ simpleField "enabled_disk_templates" [t| [DiskTemplate] |]
pQueryWhat :: Field
pQueryWhat =
pPrimaryIp :: Field
pPrimaryIp =
- withDoc "Primary IP address" $
+ withDoc "Primary IP address" .
+ optionalField $
simpleField "primary_ip" [t| NonEmptyString |]
pSecondaryIp :: Field
pEvacMode :: Field
pEvacMode =
withDoc "Node evacuation mode" .
- renameField "EvacMode" $ simpleField "mode" [t| NodeEvacMode |]
+ renameField "EvacMode" $ simpleField "mode" [t| EvacMode |]
pInstanceName :: Field
pInstanceName =
pDiskTemplate :: Field
pDiskTemplate =
- withDoc "List of instance disks" $
+ withDoc "Disk template" $
simpleField "disk_template" [t| DiskTemplate |]
pFileDriver :: Field
defaultField [| forceNonNeg C.defaultShutdownTimeout |] $
simpleField "shutdown_timeout" [t| NonNegative Int |]
+-- | Another name for the shutdown timeout, because we like to be
+-- inconsistent.
+pShutdownTimeout' :: Field
+pShutdownTimeout' =
+ withDoc "How long to wait for instance to shut down" .
+ renameField "InstShutdownTimeout" .
+ defaultField [| forceNonNeg C.defaultShutdownTimeout |] $
+ simpleField "timeout" [t| NonNegative Int |]
+
pIgnoreFailures :: Field
pIgnoreFailures =
withDoc "Whether to ignore failures during removal" $
pTagsName =
withDoc "Name of object" .
renameField "TagsGetName" .
- optionalField $ simpleField "name" [t| NonEmptyString |]
+ optionalField $ simpleField "name" [t| String |]
pTagsList :: Field
pTagsList =
withDoc "IAllocator evac mode" .
renameField "IAllocatorEvacMode" .
optionalField $
- simpleField "evac_mode" [t| NodeEvacMode |]
+ simpleField "evac_mode" [t| EvacMode |]
pIAllocatorSpindleUse :: Field
pIAllocatorSpindleUse =