Revision 4c1275f9

b/lib/constants.py
392 392
  DT_SHARED_FILE: ST_FILE,
393 393
  }
394 394

  
395
# the set of network-mirrored disk templates
396
DTS_INT_MIRROR = compat.UniqueFrozenset([DT_DRBD8])
397

  
398
# the set of externally-mirrored disk templates (e.g. SAN, NAS)
399
DTS_EXT_MIRROR = compat.UniqueFrozenset([
400
  DT_DISKLESS, # 'trivially' externally mirrored
401
  DT_SHARED_FILE,
402
  DT_BLOCK,
403
  DT_RBD,
404
  DT_EXT,
405
  ])
406

  
407
# the set of non-lvm-based disk templates
408
DTS_NOT_LVM = compat.UniqueFrozenset([
409
  DT_DISKLESS,
410
  DT_FILE,
411
  DT_SHARED_FILE,
412
  DT_BLOCK,
413
  DT_RBD,
414
  DT_EXT,
415
  ])
416

  
417
# the set of disk templates which can be grown
418
DTS_GROWABLE = compat.UniqueFrozenset([
419
  DT_PLAIN,
420
  DT_DRBD8,
421
  DT_FILE,
422
  DT_SHARED_FILE,
423
  DT_RBD,
424
  DT_EXT,
425
  ])
426

  
427
# the set of disk templates that allow adoption
428
DTS_MAY_ADOPT = compat.UniqueFrozenset([
429
  DT_PLAIN,
430
  DT_BLOCK,
431
  ])
432

  
433
# the set of disk templates that *must* use adoption
434
DTS_MUST_ADOPT = compat.UniqueFrozenset([DT_BLOCK])
435

  
436
# the set of disk templates that allow migrations
437
DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
438

  
439
# the set of file based disk templates
440
DTS_FILEBASED = compat.UniqueFrozenset([
441
  DT_FILE,
442
  DT_SHARED_FILE,
443
  ])
444

  
445
# the set of disk templates that can be moved by copying
446
# Note: a requirement is that they're not accessed externally or shared between
447
# nodes; in particular, sharedfile is not suitable.
448
DTS_COPYABLE = compat.UniqueFrozenset([
449
  DT_FILE,
450
  DT_PLAIN,
451
  ])
452

  
453
# the set of disk templates that are supported by exclusive_storage
454
DTS_EXCL_STORAGE = compat.UniqueFrozenset([DT_PLAIN])
455

  
456
# templates for which we don't perform checks on free space
457
DTS_NO_FREE_SPACE_CHECK = compat.UniqueFrozenset([
458
  DT_FILE,
459
  DT_SHARED_FILE,
460
  DT_RBD,
461
  DT_EXT,
462
  ])
463

  
464
DTS_BLOCK = compat.UniqueFrozenset([
465
  DT_PLAIN,
466
  DT_DRBD8,
467
  DT_BLOCK,
468
  DT_RBD,
469
  DT_EXT,
470
  ])
471 395

  
472 396
# drbd constants
473 397
DRBD_HMAC_ALG = "md5"
......
478 402
#: Size of DRBD meta block device
479 403
DRBD_META_SIZE = 128
480 404

  
405
DTS_INT_MIRROR = _constants.DTS_INT_MIRROR
406
DTS_EXT_MIRROR = _constants.DTS_EXT_MIRROR
407
DTS_NOT_LVM = _constants.DTS_NOT_LVM
408
DTS_GROWABLE = _constants.DTS_GROWABLE
409
DTS_MAY_ADOPT = _constants.DTS_MAY_ADOPT
410
DTS_MUST_ADOPT = _constants.DTS_MUST_ADOPT
411
DTS_MIRRORED = _constants.DTS_MIRRORED
412
DTS_FILEBASED = _constants.DTS_FILEBASED
413
DTS_COPYABLE = _constants.DTS_COPYABLE
414
DTS_EXCL_STORAGE = _constants.DTS_EXCL_STORAGE
415
DTS_NO_FREE_SPACE_CHECK = _constants.DTS_NO_FREE_SPACE_CHECK
416
DTS_BLOCK = _constants.DTS_BLOCK
481 417
# drbd barrier types
482 418
DRBD_B_NONE = "n"
483 419
DRBD_B_DISK_BARRIERS = "b"
b/src/Ganeti/ConstantUtils.hs
30 30

  
31 31
import Data.Char (ord)
32 32
import Data.Set (Set)
33
import qualified Data.Set as Set (fromList, toList)
33
import qualified Data.Set as Set (fromList, toList, union)
34 34

  
35 35
import Ganeti.THH (PyValue(..))
36 36
import Ganeti.PyValueInstances ()
......
61 61
mkSet :: Ord a => [a] -> FrozenSet a
62 62
mkSet = FrozenSet . Set.fromList
63 63

  
64
union :: Ord a => FrozenSet a -> FrozenSet a -> FrozenSet a
65
union x y = FrozenSet (unFrozenSet x `Set.union` unFrozenSet y)
66

  
64 67
-- | 'Protocol' represents the protocols used by the daemons
65 68
data Protocol = Tcp | Udp
66 69
  deriving (Show)
b/src/Ganeti/HsConstants.hs
530 530
defaultEnabledDiskTemplates :: [String]
531 531
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
532 532

  
533
-- | The set of network-mirrored disk templates
534
dtsIntMirror :: FrozenSet String
535
dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
536

  
537
-- | 'DTDiskless' is 'trivially' externally mirrored
538
dtsExtMirror :: FrozenSet String
539
dtsExtMirror =
540
  ConstantUtils.mkSet $
541
  map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
542

  
543
-- | The set of non-lvm-based disk templates
544
dtsNotLvm :: FrozenSet String
545
dtsNotLvm =
546
  ConstantUtils.mkSet $
547
  map Types.diskTemplateToRaw
548
  [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
549

  
550
-- | The set of disk templates which can be grown
551
dtsGrowable :: FrozenSet String
552
dtsGrowable =
553
  ConstantUtils.mkSet $
554
  map Types.diskTemplateToRaw
555
  [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
556

  
557
-- | The set of disk templates that allow adoption
558
dtsMayAdopt :: FrozenSet String
559
dtsMayAdopt =
560
  ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
561

  
562
-- | The set of disk templates that *must* use adoption
563
dtsMustAdopt :: FrozenSet String
564
dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
565

  
566
-- | The set of disk templates that allow migrations
567
dtsMirrored :: FrozenSet String
568
dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
569

  
570
-- | The set of file based disk templates
571
dtsFilebased :: FrozenSet String
572
dtsFilebased =
573
  ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
574

  
575
-- | The set of disk templates that can be moved by copying
576
--
577
-- Note: a requirement is that they're not accessed externally or
578
-- shared between nodes; in particular, sharedfile is not suitable.
579
dtsCopyable :: FrozenSet String
580
dtsCopyable =
581
  ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
582

  
583
-- | The set of disk templates that are supported by exclusive_storage
584
dtsExclStorage :: FrozenSet String
585
dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
586

  
587
-- | Templates for which we don't perform checks on free space
588
dtsNoFreeSpaceCheck :: FrozenSet String
589
dtsNoFreeSpaceCheck =
590
  ConstantUtils.mkSet $
591
  map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
592

  
593
dtsBlock :: FrozenSet String
594
dtsBlock =
595
  ConstantUtils.mkSet $
596
  map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
597

  
533 598
-- * File backend driver
534 599

  
535 600
fdBlktap :: String

Also available in: Unified diff