Revision 516a0e94

b/src/Ganeti/OpCodes.hs
626 626
  , pOpPriority
627 627
  , pDependencies
628 628
  , pComment
629
  , pReason
629 630
  ])
630 631

  
631 632
-- | Default common parameter values.
......
636 637
                 , opPriority   = OpPrioNormal
637 638
                 , opDepends    = Nothing
638 639
                 , opComment    = Nothing
640
                 , opReason     = []
639 641
                 }
640 642

  
641 643
-- | The top-level opcode type.
b/src/Ganeti/OpParams.hs
236 236
  , pOpPriority
237 237
  , pDependencies
238 238
  , pComment
239
  , pReason
239 240
  , pEnabledDiskTemplates
240 241
  , dOldQuery
241 242
  , dOldQueryNoLocking
......
1444 1445
pComment :: Field
1445 1446
pComment = optionalNullSerField $ stringField "comment"
1446 1447

  
1448
-- | Reason trail field.
1449
pReason :: Field
1450
pReason = simpleField C.opcodeReason [t| ReasonTrail |]
1451

  
1447 1452
-- * Entire opcode parameter list
1448 1453

  
1449 1454
-- | Old-style query opcode, with locking.
b/test/hs/Test/Ganeti/OpCodes.hs
342 342
          genNameNE
343 343
      _ -> fail $ "Undefined arbitrary for opcode " ++ op_id
344 344

  
345
-- | Generates one element of a reason trail
346
genReasonElem :: Gen ReasonElem
347
genReasonElem = (,,) <$> genFQDN <*> genFQDN <*> arbitrary
348

  
349
-- | Generates a reason trail
350
genReasonTrail :: Gen ReasonTrail
351
genReasonTrail = do
352
  size <- choose (0, 10)
353
  vectorOf size genReasonElem
354

  
345 355
instance Arbitrary OpCodes.CommonOpParams where
346 356
  arbitrary = OpCodes.CommonOpParams <$> arbitrary <*> arbitrary <*>
347
                arbitrary <*> resize 5 arbitrary <*> genMaybe genName
357
                arbitrary <*> resize 5 arbitrary <*> genMaybe genName <*>
358
                genReasonTrail
348 359

  
349 360
-- * Helper functions
350 361

  

Also available in: Unified diff