Revision 0e09422b

b/htools/Ganeti/HTools/Cluster.hs
1028 1028
                        in if sdx == Node.noSecondary
1029 1029
                           then  ""
1030 1030
                           else Container.nameOf nl sdx
1031
                      , if Instance.auto_balance inst then "Y" else "N"
1031
                      , if Instance.autoBalance inst then "Y" else "N"
1032 1032
                      , printf "%3d" $ Instance.vcpus inst
1033 1033
                      , printf "%5d" $ Instance.mem inst
1034 1034
                      , printf "%5d" $ Instance.dsk inst `div` 1024
b/htools/Ganeti/HTools/Instance.hs
63 63
    , idx          :: T.Idx     -- ^ Internal index
64 64
    , util         :: T.DynUtil -- ^ Dynamic resource usage
65 65
    , movable      :: Bool      -- ^ Can the instance be moved?
66
    , auto_balance :: Bool      -- ^ Is the instance auto-balanced?
66
    , autoBalance  :: Bool      -- ^ Is the instance auto-balanced?
67 67
    , tags         :: [String]  -- ^ List of instance tags
68 68
    } deriving (Show, Read)
69 69

  
......
107 107
             , util = T.baseUtil
108 108
             , tags = tags_init
109 109
             , movable = True
110
             , auto_balance = auto_balance_init
110
             , autoBalance = auto_balance_init
111 111
             }
112 112

  
113 113
-- | Changes the index.
b/htools/Ganeti/HTools/Node.hs
266 266
buildPeers t il =
267 267
    let mdata = map
268 268
                (\i_idx -> let inst = Container.find i_idx il
269
                               mem = if Instance.auto_balance inst
269
                               mem = if Instance.autoBalance inst
270 270
                                     then Instance.mem inst
271 271
                                     else 0
272 272
                           in (Instance.pNode inst, mem))
......
332 332
        new_dsk = fDsk t + Instance.dsk inst
333 333
        old_peers = peers t
334 334
        old_peem = P.find pnode old_peers
335
        new_peem =  if Instance.auto_balance inst
335
        new_peem =  if Instance.autoBalance inst
336 336
                    then old_peem - Instance.mem inst
337 337
                    else old_peem
338 338
        new_peers = if new_peem > 0
......
407 407
        old_peers = peers t
408 408
        old_mem = fMem t
409 409
        new_dsk = fDsk t - Instance.dsk inst
410
        secondary_needed_mem = if Instance.auto_balance inst
410
        secondary_needed_mem = if Instance.autoBalance inst
411 411
                               then Instance.mem inst
412 412
                               else 0
413 413
        new_peem = P.find pdx old_peers + secondary_needed_mem
b/htools/Ganeti/HTools/QC.hs
529 529
            Instance.sNode i == (if null snode
530 530
                                 then Node.noSecondary
531 531
                                 else sdx) &&
532
            Instance.auto_balance i == autobal &&
532
            Instance.autoBalance i == autobal &&
533 533
            isNothing fail1
534 534

  
535 535
prop_Text_Load_InstanceFail ktn fields =
......
652 652
    forAll (arbitrary `suchThat` ((> 0) . Node.fMem)) $ \node ->
653 653
    -- ab = auto_balance, nb = non-auto_balance
654 654
    -- we use -1 as the primary node of the instance
655
    let inst' = inst { Instance.pNode = -1, Instance.auto_balance = True }
655
    let inst' = inst { Instance.pNode = -1, Instance.autoBalance = True }
656 656
        inst_ab = setInstanceSmallerThanNode node inst'
657
        inst_nb = inst_ab { Instance.auto_balance = False }
657
        inst_nb = inst_ab { Instance.autoBalance = False }
658 658
        -- now we have the two instances, identical except the
659
        -- auto_balance attribute
659
        -- autoBalance attribute
660 660
        orig_rmem = Node.rMem node
661 661
        inst_idx = Instance.idx inst_ab
662 662
        node_add_ab = Node.addSec node inst_ab (-1)
b/htools/Ganeti/HTools/Text.hs
96 96
      printf "%s|%d|%d|%d|%s|%s|%s|%s|%s"
97 97
             iname (Instance.mem inst) (Instance.dsk inst)
98 98
             (Instance.vcpus inst) (Instance.runSt inst)
99
             (if Instance.auto_balance inst then "Y" else "N")
99
             (if Instance.autoBalance inst then "Y" else "N")
100 100
             pnode snode (intercalate "," (Instance.tags inst))
101 101

  
102 102
-- | Generate instance file data from instance objects.

Also available in: Unified diff