Revision 9be1ff8c
b/lib/constants.py | ||
---|---|---|
263 | 263 |
ST_LVM_VG = _constants.ST_LVM_VG |
264 | 264 |
ST_RADOS = _constants.ST_RADOS |
265 | 265 |
STORAGE_TYPES = _constants.STORAGE_TYPES |
266 |
|
|
267 |
# the set of storage types for which storage reporting is available |
|
268 |
# FIXME: Remove this, once storage reporting is available for all types. |
|
269 |
STS_REPORT = compat.UniqueFrozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG]) |
|
266 |
STS_REPORT = _constants.STS_REPORT |
|
270 | 267 |
|
271 | 268 |
# Storage fields |
272 | 269 |
# first two are valid in LU context only, not passed to backend |
... | ... | |
278 | 275 |
SF_FREE = _constants.SF_FREE |
279 | 276 |
SF_USED = _constants.SF_USED |
280 | 277 |
SF_ALLOCATABLE = _constants.SF_ALLOCATABLE |
278 |
VALID_STORAGE_FIELDS = _constants.VALID_STORAGE_FIELDS |
|
279 |
MODIFIABLE_STORAGE_FIELDS = _constants.MODIFIABLE_STORAGE_FIELDS |
|
281 | 280 |
|
282 |
# Storage operations |
|
283 |
SO_FIX_CONSISTENCY = "fix-consistency" |
|
284 |
|
|
285 |
# Available fields per storage type |
|
286 |
VALID_STORAGE_FIELDS = compat.UniqueFrozenset([ |
|
287 |
SF_NODE, |
|
288 |
SF_NAME, |
|
289 |
SF_TYPE, |
|
290 |
SF_SIZE, |
|
291 |
SF_USED, |
|
292 |
SF_FREE, |
|
293 |
SF_ALLOCATABLE, |
|
294 |
]) |
|
281 |
SO_FIX_CONSISTENCY = _constants.SO_FIX_CONSISTENCY |
|
282 |
VALID_STORAGE_OPERATIONS = _constants.VALID_STORAGE_OPERATIONS |
|
295 | 283 |
|
296 |
MODIFIABLE_STORAGE_FIELDS = { |
|
297 |
ST_LVM_PV: frozenset([SF_ALLOCATABLE]), |
|
298 |
} |
|
284 |
VF_DEV = _constants.VF_DEV |
|
285 |
VF_INSTANCE = _constants.VF_INSTANCE |
|
286 |
VF_NAME = _constants.VF_NAME |
|
287 |
VF_NODE = _constants.VF_NODE |
|
288 |
VF_PHYS = _constants.VF_PHYS |
|
289 |
VF_SIZE = _constants.VF_SIZE |
|
290 |
VF_VG = _constants.VF_VG |
|
299 | 291 |
|
300 | 292 |
LDS_OKAY = _constants.LDS_OKAY |
301 | 293 |
LDS_UNKNOWN = _constants.LDS_UNKNOWN |
302 | 294 |
LDS_FAULTY = _constants.LDS_FAULTY |
303 | 295 |
LDS_NAMES = _constants.LDS_NAMES |
304 |
VALID_STORAGE_OPERATIONS = { |
|
305 |
ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]), |
|
306 |
} |
|
307 |
|
|
308 |
# Volume fields |
|
309 |
VF_DEV = "dev" |
|
310 |
VF_INSTANCE = "instance" |
|
311 |
VF_NAME = "name" |
|
312 |
VF_NODE = "node" |
|
313 |
VF_PHYS = "phys" |
|
314 |
VF_SIZE = "size" |
|
315 |
VF_VG = "vg" |
|
316 | 296 |
|
317 | 297 |
# disk template types |
318 | 298 |
DT_BLOCK = _constants.DT_BLOCK |
... | ... | |
327 | 307 |
DISK_TEMPLATES = _constants.DISK_TEMPLATES |
328 | 308 |
DEFAULT_ENABLED_DISK_TEMPLATES = _constants.DEFAULT_ENABLED_DISK_TEMPLATES |
329 | 309 |
|
330 |
# mapping of disk templates to storage types |
|
331 |
MAP_DISK_TEMPLATE_STORAGE_TYPE = { |
|
332 |
DT_BLOCK: ST_BLOCK, |
|
333 |
DT_DISKLESS: ST_DISKLESS, |
|
334 |
DT_DRBD8: ST_LVM_VG, |
|
335 |
DT_EXT: ST_EXT, |
|
336 |
DT_FILE: ST_FILE, |
|
337 |
DT_PLAIN: ST_LVM_VG, |
|
338 |
DT_RBD: ST_RADOS, |
|
339 |
DT_SHARED_FILE: ST_FILE, |
|
340 |
} |
|
341 |
|
|
342 |
|
|
310 |
MAP_DISK_TEMPLATE_STORAGE_TYPE = _constants.MAP_DISK_TEMPLATE_STORAGE_TYPE |
|
343 | 311 |
# drbd constants |
344 | 312 |
DRBD_HMAC_ALG = "md5" |
345 | 313 |
DRBD_DEFAULT_NET_PROTOCOL = "C" |
b/src/Ganeti/HsConstants.hs | ||
---|---|---|
36 | 36 |
-} |
37 | 37 |
module Ganeti.HsConstants where |
38 | 38 |
|
39 |
import Control.Arrow ((***)) |
|
39 | 40 |
import Data.List ((\\)) |
40 | 41 |
import Data.Map (Map) |
41 | 42 |
import qualified Data.Map as Map (fromList, keys, insert) |
... | ... | |
639 | 640 |
storageTypes :: FrozenSet String |
640 | 641 |
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..] |
641 | 642 |
|
643 |
-- | The set of storage types for which storage reporting is available |
|
644 |
-- |
|
645 |
-- FIXME: Remove this, once storage reporting is available for all |
|
646 |
-- types. |
|
647 |
stsReport :: FrozenSet String |
|
648 |
stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg] |
|
649 |
|
|
642 | 650 |
-- * Storage fields |
643 | 651 |
-- ** First two are valid in LU context only, not passed to backend |
644 | 652 |
|
... | ... | |
665 | 673 |
sfUsed :: String |
666 | 674 |
sfUsed = Types.storageFieldToRaw SFUsed |
667 | 675 |
|
676 |
validStorageFields :: FrozenSet String |
|
677 |
validStorageFields = |
|
678 |
ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++ |
|
679 |
[sfNode, sfType] |
|
680 |
|
|
681 |
modifiableStorageFields :: Map String (FrozenSet String) |
|
682 |
modifiableStorageFields = |
|
683 |
Map.fromList [(Types.storageTypeToRaw StorageLvmPv, |
|
684 |
ConstantUtils.mkSet [sfAllocatable])] |
|
685 |
|
|
686 |
-- * Storage operations |
|
687 |
|
|
688 |
soFixConsistency :: String |
|
689 |
soFixConsistency = "fix-consistency" |
|
690 |
|
|
691 |
validStorageOperations :: Map String (FrozenSet String) |
|
692 |
validStorageOperations = |
|
693 |
Map.fromList [(Types.storageTypeToRaw StorageLvmVg, |
|
694 |
ConstantUtils.mkSet [soFixConsistency])] |
|
695 |
|
|
696 |
-- * Volume fields |
|
697 |
|
|
698 |
vfDev :: String |
|
699 |
vfDev = "dev" |
|
700 |
|
|
701 |
vfInstance :: String |
|
702 |
vfInstance = "instance" |
|
703 |
|
|
704 |
vfName :: String |
|
705 |
vfName = "name" |
|
706 |
|
|
707 |
vfNode :: String |
|
708 |
vfNode = "node" |
|
709 |
|
|
710 |
vfPhys :: String |
|
711 |
vfPhys = "phys" |
|
712 |
|
|
713 |
vfSize :: String |
|
714 |
vfSize = "size" |
|
715 |
|
|
716 |
vfVg :: String |
|
717 |
vfVg = "vg" |
|
718 |
|
|
668 | 719 |
-- * Local disk status |
669 | 720 |
|
670 | 721 |
ldsFaulty :: Int |
... | ... | |
724 | 775 |
defaultEnabledDiskTemplates :: [String] |
725 | 776 |
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain] |
726 | 777 |
|
778 |
-- | Mapping of disk templates to storage types |
|
779 |
mapDiskTemplateStorageType :: Map String String |
|
780 |
mapDiskTemplateStorageType = |
|
781 |
Map.fromList $ |
|
782 |
map (Types.diskTemplateToRaw *** Types.storageTypeToRaw) |
|
783 |
[(DTBlock, StorageBlock), |
|
784 |
(DTDrbd8, StorageLvmVg), |
|
785 |
(DTExt, StorageExt), |
|
786 |
(DTSharedFile, StorageFile), |
|
787 |
(DTFile, StorageFile), |
|
788 |
(DTDiskless, StorageDiskless), |
|
789 |
(DTPlain, StorageLvmVg), |
|
790 |
(DTRbd, StorageRados)] |
|
791 |
|
|
727 | 792 |
-- | The set of network-mirrored disk templates |
728 | 793 |
dtsIntMirror :: FrozenSet String |
729 | 794 |
dtsIntMirror = ConstantUtils.mkSet [dtDrbd8] |
Also available in: Unified diff