failOnSecondaryChange mode dt >>
evacOneNodeOnly nl il inst gdx avail_nodes
+nodeEvacInstance nl il mode inst@(Instance.Instance
+ {Instance.diskTemplate = dt@DTExt})
+ gdx avail_nodes =
+ failOnSecondaryChange mode dt >>
+ evacOneNodeOnly nl il inst gdx avail_nodes
+
nodeEvacInstance nl il ChangePrimary
inst@(Instance.Instance {Instance.diskTemplate = DTDrbd8})
_ _ =
, ("DTBlock", 'C.dtBlock)
, ("DTDrbd8", 'C.dtDrbd8)
, ("DTRbd", 'C.dtRbd)
+ , ("DTExt", 'C.dtExt)
])
$(THH.makeJSONInstance ''DiskTemplate)
templateMirrorType DTBlock = MirrorExternal
templateMirrorType DTDrbd8 = MirrorInternal
templateMirrorType DTRbd = MirrorExternal
+templateMirrorType DTExt = MirrorExternal
-- | The Group allocation policy type.
--
, ("LD_FILE", 'C.ldFile)
, ("LD_BLOCKDEV", 'C.ldBlockdev)
, ("LD_RADOS", 'C.ldRbd)
+ , ("LD_EXT", 'C.ldExt)
])
$(makeJSONInstance ''DiskType)
| LIDFile FileDriver String -- ^ Driver, path
| LIDBlockDev BlockDriver String -- ^ Driver, path (must be under /dev)
| LIDRados String String -- ^ Unused, path
+ | LIDExt String String -- ^ ExtProvider, unique name
deriving (Read, Show, Eq)
-- | Mapping from a logical id to a disk type.
lidDiskType (LIDFile {}) = LD_FILE
lidDiskType (LIDBlockDev {}) = LD_BLOCKDEV
lidDiskType (LIDRados {}) = LD_RADOS
+lidDiskType (LIDExt {}) = LD_EXT
-- | Builds the extra disk_type field for a given logical id.
lidEncodeType :: DiskLogicalId -> [(String, JSValue)]
encodeDLId (LIDRados pool name) = JSArray [showJSON pool, showJSON name]
encodeDLId (LIDFile driver name) = JSArray [showJSON driver, showJSON name]
encodeDLId (LIDBlockDev driver name) = JSArray [showJSON driver, showJSON name]
+encodeDLId (LIDExt extprovider name) = JSArray [showJSON extprovider, showJSON name]
-- | Custom encoder for DiskLogicalId, composing both the logical id
-- and the extra disk_type field.
path' <- readJSON path
return $ LIDRados driver' path'
_ -> fail $ "Can't read logical_id for rdb type"
+ LD_EXT ->
+ case lid of
+ JSArray [extprovider, name] -> do
+ extprovider' <- readJSON extprovider
+ name' <- readJSON name
+ return $ LIDExt extprovider' name'
+ _ -> fail $ "Can't read logical_id for extstorage type"
-- | Disk data structure.
--
, ("DTPlain", 'C.dtPlain)
, ("DTBlock", 'C.dtBlock)
, ("DTDrbd8", 'C.dtDrbd8)
+ , ("DTExt", 'C.dtExt)
])
$(makeJSONInstance ''DiskTemplate)