From 5ce621ab2d83b8ac38d9a8fc3123fbd3feaa4b49 Mon Sep 17 00:00:00 2001 From: Helga Velroyen Date: Wed, 9 Oct 2013 14:16:40 +0200 Subject: [PATCH] Correct properties of the cluster's file storage dir This patch does: - Rename the haskell opcode parameter 'pGlobalFileStorageDir' and 'pGlobalSharedfileStorageDir' to 'pClusterFileStorageDir' and 'pClusterSharedfileStorageDir', respectively, because the old name was misleading. - The two parameters are made optional strings instead of non-empty strings. This actually used to be like this before, but was accidentally overriden by the switch to opcode generation from haskell to python. - The ClusterFileStorageDir parameter had to be renamed in Haskell to not clash with the FileStorageDir parameter of the OpInstanceCreate code. Signed-off-by: Helga Velroyen Reviewed-by: Michele Tartara --- src/Ganeti/OpCodes.hs | 4 ++-- src/Ganeti/OpParams.hs | 22 +++++++++++++--------- test/hs/Test/Ganeti/OpCodes.hs | 4 ++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs index 9a24646..aea41c0 100644 --- a/src/Ganeti/OpCodes.hs +++ b/src/Ganeti/OpCodes.hs @@ -232,8 +232,8 @@ $(genOpCode "OpCode" , pUseExternalMipScript , pEnabledDiskTemplates , pModifyEtcHosts - , pGlobalFileStorageDir - , pGlobalSharedFileStorageDir + , pClusterFileStorageDir + , pClusterSharedFileStorageDir ], []) , ("OpClusterRedistConf", diff --git a/src/Ganeti/OpParams.hs b/src/Ganeti/OpParams.hs index a9aae86..1b70794 100644 --- a/src/Ganeti/OpParams.hs +++ b/src/Ganeti/OpParams.hs @@ -100,8 +100,8 @@ module Ganeti.OpParams , pOptDiskTemplate , pFileDriver , pFileStorageDir - , pGlobalFileStorageDir - , pGlobalSharedFileStorageDir + , pClusterFileStorageDir + , pClusterSharedFileStorageDir , pVgName , pEnabledHypervisors , pHypervisor @@ -541,13 +541,17 @@ pDiskState = withDoc "Set disk states" . optionalField $ simpleField "disk_state" [t| JSObject JSValue |] --- | Global directory for storing file-backed disks. -pGlobalFileStorageDir :: Field -pGlobalFileStorageDir = optionalNEStringField "file_storage_dir" - --- | Global directory for storing shared-file-backed disks. -pGlobalSharedFileStorageDir :: Field -pGlobalSharedFileStorageDir = optionalNEStringField "shared_file_storage_dir" +-- | Cluster-wide default directory for storing file-backed disks. +pClusterFileStorageDir :: Field +pClusterFileStorageDir = + renameField "ClusterFileStorageDir" $ + optionalStringField "file_storage_dir" + +-- | Cluster-wide default directory for storing shared-file-backed disks. +pClusterSharedFileStorageDir :: Field +pClusterSharedFileStorageDir = + renameField "ClusterSharedFileStorageDir" $ + optionalStringField "shared_file_storage_dir" -- | Volume group name. pVgName :: Field diff --git a/test/hs/Test/Ganeti/OpCodes.hs b/test/hs/Test/Ganeti/OpCodes.hs index 66e982a..a036c2f 100644 --- a/test/hs/Test/Ganeti/OpCodes.hs +++ b/test/hs/Test/Ganeti/OpCodes.hs @@ -177,8 +177,8 @@ instance Arbitrary OpCodes.OpCode where emptyMUD <*> emptyMUD <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> - genMaybe (genName >>= mkNonEmpty) <*> - genMaybe (genName >>= mkNonEmpty) + genMaybe genName <*> + genMaybe genName "OP_CLUSTER_REDIST_CONF" -> pure OpCodes.OpClusterRedistConf "OP_CLUSTER_ACTIVATE_MASTER_IP" -> pure OpCodes.OpClusterActivateMasterIp -- 1.7.10.4