Signed-off-by: Constantinos Venetsanopoulos <[email protected]>
---
htools/Ganeti/HTools/Cluster.hs | 6 ++++++
htools/Ganeti/HTools/Instance.hs | 1 +
htools/Ganeti/HTools/Types.hs | 2 ++
htools/Ganeti/Objects.hs | 12 ++++++++++++
4 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs
index deb56dd..ec3c00f 100644
--- a/htools/Ganeti/HTools/Cluster.hs
+++ b/htools/Ganeti/HTools/Cluster.hs
@@ -937,6 +937,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 9d13556..d211d5a 100644
--- a/htools/Ganeti/HTools/Instance.hs
+++ b/htools/Ganeti/HTools/Instance.hs
@@ -144,6 +144,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 31b3d70..4fc6b3f 100644
--- a/htools/Ganeti/HTools/Types.hs
+++ b/htools/Ganeti/HTools/Types.hs
@@ -123,6 +123,7 @@ $(THH.declareSADT "DiskTemplate"
, ("DTBlock", 'C.dtBlock)
, ("DTDrbd8", 'C.dtDrbd8)
, ("DTRbd", 'C.dtRbd)
+ , ("DTExt", 'C.dtExt)
])
$(THH.makeJSONInstance ''DiskTemplate)
@@ -141,6 +142,7 @@ templateMirrorType DTPlain = MirrorNone
templateMirrorType DTBlock = MirrorExternal
templateMirrorType DTDrbd8 = MirrorInternal
templateMirrorType DTRbd = MirrorExternal
+templateMirrorType DTExt = MirrorExternal
-- | The Group allocation policy type.
--
diff --git a/htools/Ganeti/Objects.hs b/htools/Ganeti/Objects.hs
index 2a3207d..ea7e177 100644
--- a/htools/Ganeti/Objects.hs
+++ b/htools/Ganeti/Objects.hs
@@ -200,6 +200,7 @@ $(declareSADT "DiskType"
, ("LD_FILE", 'C.ldFile)
, ("LD_BLOCKDEV", 'C.ldBlockdev)
, ("LD_RADOS", 'C.ldRbd)
+ , ("LD_EXT", 'C.ldExt)
])
$(makeJSONInstance ''DiskType)
@@ -231,6 +232,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 (Read, Show, Eq)
-- | Mapping from a logical id to a disk type.
@@ -240,6 +242,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)]
@@ -254,6 +257,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.
@@ -305,6 +309,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.
--
@@ -353,6 +364,7 @@ $(declareSADT "DiskTemplate"
, ("DTBlock", 'C.dtBlock)
, ("DTDrbd8", 'C.dtDrbd8)
, ("DTRados", 'C.dtRbd)
+ , ("DTExt", 'C.dtExt)
])
$(makeJSONInstance ''DiskTemplate)
--
1.7.2.5