Revision 86ecce4a Ganeti/HTools/Cluster.hs

b/Ganeti/HTools/Cluster.hs
94 94
                     , csTmem :: Double -- ^ Cluster total mem
95 95
                     , csTdsk :: Double -- ^ Cluster total disk
96 96
                     , csTcpu :: Double -- ^ Cluster total cpus
97
                     , csVcpu :: Int    -- ^ Cluster virtual cpus (if
98
                                        -- node pCpu has been set,
99
                                        -- otherwise -1)
97 100
                     , csXmem :: Int    -- ^ Unnacounted for mem
98 101
                     , csNmem :: Int    -- ^ Node own memory
99 102
                     , csScore :: Score -- ^ The cluster score
......
125 128

  
126 129
-- | Zero-initializer for the CStats type
127 130
emptyCStats :: CStats
128
emptyCStats = CStats 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
131
emptyCStats = CStats 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
129 132

  
130 133
-- | Update stats with data from a new node
131 134
updateCStats :: CStats -> Node.Node -> CStats
......
135 138
                 csMmem = x_mmem, csMdsk = x_mdsk, csMcpu = x_mcpu,
136 139
                 csImem = x_imem, csIdsk = x_idsk, csIcpu = x_icpu,
137 140
                 csTmem = x_tmem, csTdsk = x_tdsk, csTcpu = x_tcpu,
141
                 csVcpu = x_vcpu,
138 142
                 csXmem = x_xmem, csNmem = x_nmem, csNinst = x_ninst
139 143
               }
140 144
            = cs
......
145 149
                   - Node.xMem node - Node.fMem node
146 150
        inc_icpu = Node.uCpu node
147 151
        inc_idsk = truncate (Node.tDsk node) - Node.fDsk node
152
        inc_vcpu = Node.hiCpu node
148 153

  
149 154
    in cs { csFmem = x_fmem + Node.fMem node
150 155
          , csFdsk = x_fdsk + Node.fDsk node
......
160 165
          , csTmem = x_tmem + Node.tMem node
161 166
          , csTdsk = x_tdsk + Node.tDsk node
162 167
          , csTcpu = x_tcpu + Node.tCpu node
168
          , csVcpu = if inc_vcpu == Node.noLimitInt
169
                     then Node.noLimitInt
170
                     else x_vcpu + inc_vcpu
163 171
          , csXmem = x_xmem + Node.xMem node
164 172
          , csNmem = x_nmem + Node.nMem node
165 173
          , csNinst = x_ninst + length (Node.pList node)

Also available in: Unified diff