Skip to content
Snippets Groups Projects
Commit 5cd95d46 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a type for the log type in job/opcode logs


Also fixes indentation for OP_STATUS.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 60f20a41
No related branches found
No related tags found
No related merge requests found
......@@ -132,6 +132,8 @@ $(genArbitrary ''OpSubmitPriority)
$(genArbitrary ''OpStatus)
$(genArbitrary ''ELogType)
-- * Properties
prop_AllocPolicy_serialisation :: AllocPolicy -> Property
......@@ -352,6 +354,10 @@ prop_JobDependency_serialisation = testSerialisation
prop_OpSubmitPriority_serialisation :: OpSubmitPriority -> Property
prop_OpSubmitPriority_serialisation = testSerialisation
-- | Test 'ELogType' serialisation.
prop_ELogType_serialisation :: ELogType -> Property
prop_ELogType_serialisation = testSerialisation
testSuite "Types"
[ 'prop_AllocPolicy_serialisation
, 'case_AllocPolicy_order
......@@ -394,4 +400,5 @@ testSuite "Types"
, 'prop_JobId_serialisation
, 'prop_JobDependency_serialisation
, 'prop_OpSubmitPriority_serialisation
, 'prop_ELogType_serialisation
]
......@@ -89,6 +89,7 @@ module Ganeti.Types
, OpStatus(..)
, opStatusToRaw
, opStatusFromRaw
, ELogType(..)
) where
import Control.Monad (liftM)
......@@ -453,12 +454,20 @@ $(THH.makeJSONInstance ''OpSubmitPriority)
-- | Our ADT for the OpCode status at runtime (while in a job).
$(THH.declareSADT "OpStatus"
[ ("OP_STATUS_QUEUED", 'C.opStatusQueued)
, ("OP_STATUS_WAITING", 'C.opStatusWaiting)
, ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
, ("OP_STATUS_RUNNING", 'C.opStatusRunning)
, ("OP_STATUS_CANCELED", 'C.opStatusCanceled)
, ("OP_STATUS_SUCCESS", 'C.opStatusSuccess)
, ("OP_STATUS_ERROR", 'C.opStatusError)
])
[ ("OP_STATUS_QUEUED", 'C.opStatusQueued)
, ("OP_STATUS_WAITING", 'C.opStatusWaiting)
, ("OP_STATUS_CANCELING", 'C.opStatusCanceling)
, ("OP_STATUS_RUNNING", 'C.opStatusRunning)
, ("OP_STATUS_CANCELED", 'C.opStatusCanceled)
, ("OP_STATUS_SUCCESS", 'C.opStatusSuccess)
, ("OP_STATUS_ERROR", 'C.opStatusError)
])
$(THH.makeJSONInstance ''OpStatus)
-- | Type for the job message type.
$(THH.declareSADT "ELogType"
[ ("ELogMessage", 'C.elogMessage)
, ("ELogRemoteImport", 'C.elogRemoteImport)
, ("ELogJqueueTest", 'C.elogJqueueTest)
])
$(THH.makeJSONInstance ''ELogType)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment