From: Dimitris Bliablias <[email protected]> Currently, the 'gluster' and 'sharedfile' disk templates are both mapped to the Shared File storage type. This compromise causes the Gluster block devices to be interpreted in the config as 'sharedfile' devices, instead of 'gluster', and subsequently to be wrongly handled as Shared File disks. This behavior, currently makes the 'gluster' disk template not functional.
This patch, fixes this issue by introducing the Gluster storage type, which will be exclusively used by the 'gluster' disk template. Signed-off-by: Dimitris Bliablias <[email protected]> Signed-off-by: Petr Pudlak <[email protected]> Reviewed-by: Petr Pudlak <[email protected]> Signed-off-by: Lisa Velden <[email protected]> --- lib/backend.py | 1 + src/Ganeti/Constants.hs | 5 ++++- src/Ganeti/Objects.hs | 5 ++++- src/Ganeti/Types.hs | 7 ++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index d843ae7..402aae1 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -786,6 +786,7 @@ _STORAGE_TYPE_INFO_FN = { constants.ST_LVM_PV: _GetLvmPvSpaceInfo, constants.ST_LVM_VG: _GetLvmVgSpaceInfo, constants.ST_SHARED_FILE: None, + constants.ST_GLUSTER: None, constants.ST_RADOS: None, } diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs index 01fa70a..d0ae44b 100644 --- a/src/Ganeti/Constants.hs +++ b/src/Ganeti/Constants.hs @@ -721,6 +721,9 @@ stFile = Types.storageTypeToRaw StorageFile stSharedFile :: String stSharedFile = Types.storageTypeToRaw StorageSharedFile +stGluster :: String +stGluster = Types.storageTypeToRaw StorageGluster + stLvmPv :: String stLvmPv = Types.storageTypeToRaw StorageLvmPv @@ -888,7 +891,7 @@ mapDiskTemplateStorageType = (DTDiskless, StorageDiskless), (DTPlain, StorageLvmVg), (DTRbd, StorageRados), - (DTGluster, StorageSharedFile)] + (DTGluster, StorageGluster)] -- | The set of network-mirrored disk templates dtsIntMirror :: FrozenSet String diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs index e73690f..1b25933 100644 --- a/src/Ganeti/Objects.hs +++ b/src/Ganeti/Objects.hs @@ -401,6 +401,7 @@ data DiskLogicalId -- ^ NodeA, NodeB, Port, MinorA, MinorB, Secret | LIDFile FileDriver String -- ^ Driver, path | LIDSharedFile FileDriver String -- ^ Driver, path + | LIDGluster FileDriver String -- ^ Driver, path | LIDBlockDev BlockDriver String -- ^ Driver, path (must be under /dev) | LIDRados String String -- ^ Unused, path | LIDExt String String -- ^ ExtProvider, unique name @@ -412,6 +413,7 @@ lidDiskType (LIDPlain {}) = DTPlain lidDiskType (LIDDrbd8 {}) = DTDrbd8 lidDiskType (LIDFile {}) = DTFile lidDiskType (LIDSharedFile {}) = DTSharedFile +lidDiskType (LIDGluster {}) = DTGluster lidDiskType (LIDBlockDev {}) = DTBlock lidDiskType (LIDRados {}) = DTRbd lidDiskType (LIDExt {}) = DTExt @@ -431,6 +433,7 @@ encodeDLId (LIDRados pool name) = JSArray [showJSON pool, showJSON name] encodeDLId (LIDFile driver name) = JSArray [showJSON driver, showJSON name] encodeDLId (LIDSharedFile driver name) = JSArray [showJSON driver, showJSON name] +encodeDLId (LIDGluster 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] @@ -483,7 +486,7 @@ decodeDLId obj lid = do JSArray [driver, path] -> do driver' <- readJSON driver path' <- readJSON path - return $ LIDSharedFile driver' path' + return $ LIDGluster driver' path' _ -> fail "Can't read logical_id for shared file type" DTBlock -> case lid of diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs index 5eb51c4..aedef7e 100644 --- a/src/Ganeti/Types.hs +++ b/src/Ganeti/Types.hs @@ -475,6 +475,7 @@ $(THH.makeJSONInstance ''OobStatus) $(THH.declareLADT ''String "StorageType" [ ("StorageFile", "file") , ("StorageSharedFile", "sharedfile") + , ("StorageGluster", "gluster") , ("StorageLvmPv", "lvm-pv") , ("StorageLvmVg", "lvm-vg") , ("StorageDiskless", "diskless") @@ -498,6 +499,7 @@ data StorageUnitRaw = SURaw StorageType StorageKey -- | Full storage unit with storage-type-specific parameters data StorageUnit = SUFile StorageKey | SUSharedFile StorageKey + | SUGluster StorageKey | SULvmPv StorageKey SPExclusiveStorage | SULvmVg StorageKey SPExclusiveStorage | SUDiskless StorageKey @@ -509,6 +511,7 @@ data StorageUnit = SUFile StorageKey instance Show StorageUnit where show (SUFile key) = showSUSimple StorageFile key show (SUSharedFile key) = showSUSimple StorageSharedFile key + show (SUGluster key) = showSUSimple StorageGluster key show (SULvmPv key es) = showSULvm StorageLvmPv key es show (SULvmVg key es) = showSULvm StorageLvmVg key es show (SUDiskless key) = showSUSimple StorageDiskless key @@ -519,6 +522,7 @@ instance Show StorageUnit where instance JSON StorageUnit where showJSON (SUFile key) = showJSON (StorageFile, key, []::[String]) showJSON (SUSharedFile key) = showJSON (StorageSharedFile, key, []::[String]) + showJSON (SUGluster key) = showJSON (StorageGluster, key, []::[String]) showJSON (SULvmPv key es) = showJSON (StorageLvmPv, key, [es]) showJSON (SULvmVg key es) = showJSON (StorageLvmVg, key, [es]) showJSON (SUDiskless key) = showJSON (StorageDiskless, key, []::[String]) @@ -550,7 +554,7 @@ diskTemplateToStorageType DTPlain = StorageLvmVg diskTemplateToStorageType DTRbd = StorageRados diskTemplateToStorageType DTDiskless = StorageDiskless diskTemplateToStorageType DTBlock = StorageBlock -diskTemplateToStorageType DTGluster = StorageSharedFile +diskTemplateToStorageType DTGluster = StorageGluster -- | Equips a raw storage unit with its parameters addParamsToStorageUnit :: SPExclusiveStorage -> StorageUnitRaw -> StorageUnit @@ -559,6 +563,7 @@ addParamsToStorageUnit _ (SURaw StorageDiskless key) = SUDiskless key addParamsToStorageUnit _ (SURaw StorageExt key) = SUExt key addParamsToStorageUnit _ (SURaw StorageFile key) = SUFile key addParamsToStorageUnit _ (SURaw StorageSharedFile key) = SUSharedFile key +addParamsToStorageUnit _ (SURaw StorageGluster key) = SUGluster key addParamsToStorageUnit es (SURaw StorageLvmPv key) = SULvmPv key es addParamsToStorageUnit es (SURaw StorageLvmVg key) = SULvmVg key es addParamsToStorageUnit _ (SURaw StorageRados key) = SURados key -- 2.2.0.rc0.207.ga3a616c
