Revision 7dd14211 htools/Ganeti/HTools/QC.hs

b/htools/Ganeti/HTools/QC.hs
123 123

  
124 124
-- | Create an instance given its spec.
125 125
createInstance mem dsk vcpus =
126
    Instance.create "inst-unnamed" mem dsk vcpus "running" [] True (-1) (-1)
126
    Instance.create "inst-unnamed" mem dsk vcpus Types.Running [] True (-1) (-1)
127 127
                    Types.DTDrbd8
128 128

  
129 129
-- | Create a small cluster by repeating a node spec.
......
187 187
  let frest' = map (map dnsGetChar) frest
188 188
  return (felem ++ "." ++ intercalate "." frest')
189 189

  
190
instance Arbitrary Types.InstanceStatus where
191
    arbitrary = elements [ Types.AdminDown
192
                         , Types.AdminOffline
193
                         , Types.ErrorDown
194
                         , Types.ErrorUp
195
                         , Types.NodeDown
196
                         , Types.NodeOffline
197
                         , Types.Running
198
                         , Types.WrongNode]
199

  
190 200
-- let's generate a random instance
191 201
instance Arbitrary Instance.Instance where
192 202
    arbitrary = do
193 203
      name <- getFQDN
194 204
      mem <- choose (0, maxMem)
195 205
      dsk <- choose (0, maxDsk)
196
      run_st <- elements [ C.inststErrorup
197
                         , C.inststErrordown
198
                         , C.inststAdmindown
199
                         , C.inststNodedown
200
                         , C.inststNodeoffline
201
                         , C.inststRunning
202
                         , "no_such_status1"
203
                         , "no_such_status2"]
206
      run_st <- arbitrary
204 207
      pn <- arbitrary
205 208
      sn <- arbitrary
206 209
      vcpus <- choose (0, maxCpu)
......
591 594
    let vcpus_s = show vcpus
592 595
        dsk_s = show dsk
593 596
        mem_s = show mem
597
        status_s = Types.instanceStatusToRaw status
594 598
        ndx = if null snode
595 599
              then [(pnode, pdx)]
596 600
              else [(pnode, pdx), (snode, sdx)]
......
599 603
        sbal = if autobal then "Y" else "N"
600 604
        sdt = Types.diskTemplateToRaw dt
601 605
        inst = Text.loadInst nl
602
               [name, mem_s, dsk_s, vcpus_s, status,
606
               [name, mem_s, dsk_s, vcpus_s, status_s,
603 607
                sbal, pnode, snode, sdt, tags]
604 608
        fail1 = Text.loadInst nl
605
               [name, mem_s, dsk_s, vcpus_s, status,
609
               [name, mem_s, dsk_s, vcpus_s, status_s,
606 610
                sbal, pnode, pnode, tags]
607 611
        _types = ( name::String, mem::Int, dsk::Int
608
                 , vcpus::Int, status::String
612
                 , vcpus::Int, status::Types.InstanceStatus
609 613
                 , snode::String
610 614
                 , autobal::Bool)
611 615
    in

Also available in: Unified diff