diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs index 0cf8a920d84373920c110c59c777b88c2e7e9da4..35a75bff05f6661f1a32de88c96f9d63c8272800 100644 --- a/htools/Ganeti/HTools/Cluster.hs +++ b/htools/Ganeti/HTools/Cluster.hs @@ -939,6 +939,12 @@ nodeEvacInstance nl il mode inst@(Instance.Instance 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}) _ _ = diff --git a/htools/Ganeti/HTools/Instance.hs b/htools/Ganeti/HTools/Instance.hs index b941df677b648e70dc642d3e49c8f238b5e19731..d1c67ee4517ad2839a7d7be0cfa7673e463df6e2 100644 --- a/htools/Ganeti/HTools/Instance.hs +++ b/htools/Ganeti/HTools/Instance.hs @@ -146,6 +146,7 @@ movableDiskTemplates = , T.DTBlock , T.DTSharedFile , T.DTRbd + , T.DTExt ] -- | A simple name for the int, instance association list. diff --git a/htools/Ganeti/HTools/Types.hs b/htools/Ganeti/HTools/Types.hs index 771407e68ecb80c7b25439972cc0592793bd9e23..160473b139635f04bd9bff46ce49d6b1903a64d7 100644 --- a/htools/Ganeti/HTools/Types.hs +++ b/htools/Ganeti/HTools/Types.hs @@ -121,6 +121,7 @@ templateMirrorType DTPlain = MirrorNone templateMirrorType DTBlock = MirrorExternal templateMirrorType DTDrbd8 = MirrorInternal templateMirrorType DTRbd = MirrorExternal +templateMirrorType DTExt = MirrorExternal -- | The resource spec type. data RSpec = RSpec diff --git a/htools/Ganeti/Objects.hs b/htools/Ganeti/Objects.hs index d4da6e41d87bba54bd0c58f87e70c3d501097300..22aac937cce7b00c9a58b41b157377b175fb880c 100644 --- a/htools/Ganeti/Objects.hs +++ b/htools/Ganeti/Objects.hs @@ -229,6 +229,7 @@ $(declareSADT "DiskType" , ("LD_FILE", 'C.ldFile) , ("LD_BLOCKDEV", 'C.ldBlockdev) , ("LD_RADOS", 'C.ldRbd) + , ("LD_EXT", 'C.ldExt) ]) $(makeJSONInstance ''DiskType) @@ -253,6 +254,7 @@ data DiskLogicalId | 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 (Show, Eq) -- | Mapping from a logical id to a disk type. @@ -262,6 +264,7 @@ lidDiskType (LIDDrbd8 {}) = LD_DRBD8 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)] @@ -276,6 +279,7 @@ encodeDLId (LIDDrbd8 nodeA nodeB port minorA minorB key) = 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. @@ -327,6 +331,13 @@ decodeDLId obj lid = do 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. -- diff --git a/htools/Ganeti/Types.hs b/htools/Ganeti/Types.hs index 208ae9d7f0011d4a78d1708e9291418662fae0d0..ae692f6b8a99650d06418dbd8672bcef238f2259 100644 --- a/htools/Ganeti/Types.hs +++ b/htools/Ganeti/Types.hs @@ -175,6 +175,7 @@ $(THH.declareSADT "DiskTemplate" , ("DTBlock", 'C.dtBlock) , ("DTDrbd8", 'C.dtDrbd8) , ("DTRbd", 'C.dtRbd) + , ("DTExt", 'C.dtExt) ]) $(THH.makeJSONInstance ''DiskTemplate)