Commit 3d7e87b8 authored by Iustin Pop's avatar Iustin Pop
Browse files

Rework/enhance original htools opcodes



The original htools opcodes were minimalistic and not 1:1 equivalent
with the Python ones. Let's add all missing fields and, since we
changed the order, switch to more readable record syntax for building
the opcodes.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 3929e782
......@@ -110,15 +110,16 @@ instance Arbitrary OpCodes.OpCode where
OpCodes.OpTestDelay <$> arbitrary <*> arbitrary <*>
genNodeNamesNE <*> arbitrary
"OP_INSTANCE_REPLACE_DISKS" ->
OpCodes.OpInstanceReplaceDisks <$> genFQDN <*>
genMaybe genNodeNameNE <*> arbitrary <*> genDiskIndices <*>
genMaybe genNameNE
OpCodes.OpInstanceReplaceDisks <$> genFQDN <*> arbitrary <*>
arbitrary <*> arbitrary <*> genDiskIndices <*>
genMaybe genNodeNameNE <*> genMaybe genNameNE
"OP_INSTANCE_FAILOVER" ->
OpCodes.OpInstanceFailover <$> genFQDN <*> arbitrary <*>
genMaybe genNodeNameNE
OpCodes.OpInstanceFailover <$> genFQDN <*> arbitrary <*> arbitrary <*>
genMaybe genNodeNameNE <*> arbitrary <*> genMaybe genNameNE
"OP_INSTANCE_MIGRATE" ->
OpCodes.OpInstanceMigrate <$> genFQDN <*> arbitrary <*>
arbitrary <*> arbitrary <*> genMaybe genNodeNameNE
OpCodes.OpInstanceMigrate <$> genFQDN <*> arbitrary <*> arbitrary <*>
genMaybe genNodeNameNE <*> arbitrary <*>
arbitrary <*> arbitrary <*> genMaybe genNameNE <*> arbitrary
"OP_TAGS_GET" ->
OpCodes.OpTagsGet <$> arbitrary <*> arbitrary
"OP_TAGS_SEARCH" ->
......
......@@ -1453,11 +1453,26 @@ iMoveToJob nl il idx move =
Bad msg -> error $ "Empty node name for idx " ++
show n ++ ": " ++ msg ++ "??"
Ok ne -> Just ne
live = Just True
opF = OpCodes.OpInstanceMigrate iname live False True Nothing
opFA n = OpCodes.OpInstanceMigrate iname live False True (lookNode n)
opR n = OpCodes.OpInstanceReplaceDisks iname (lookNode n)
OpCodes.ReplaceNewSecondary [] Nothing
opF = OpCodes.OpInstanceMigrate
{ OpCodes.opInstanceName = iname
, OpCodes.opMigrationMode = Nothing -- default
, OpCodes.opOldLiveMode = Nothing -- default as well
, OpCodes.opTargetNode = Nothing -- this is drbd
, OpCodes.opAllowRuntimeChanges = False
, OpCodes.opIgnoreIpolicy = False
, OpCodes.opMigrationCleanup = False
, OpCodes.opIallocator = Nothing
, OpCodes.opAllowFailover = True }
opFA n = opF { OpCodes.opTargetNode = lookNode n } -- not drbd
opR n = OpCodes.OpInstanceReplaceDisks
{ OpCodes.opInstanceName = iname
, OpCodes.opEarlyRelease = False
, OpCodes.opIgnoreIpolicy = False
, OpCodes.opReplaceDisksMode = OpCodes.ReplaceNewSecondary
, OpCodes.opReplaceDisksList = []
, OpCodes.opRemoteNode = lookNode n
, OpCodes.opIallocator = Nothing
}
in case move of
Failover -> [ opF ]
FailoverToAny np -> [ opFA np ]
......
......@@ -59,22 +59,31 @@ $(genOpCode "OpCode"
])
, ("OpInstanceReplaceDisks",
[ pInstanceName
, pRemoteNode
, pEarlyRelease
, pIgnoreIpolicy
, pReplaceDisksMode
, pReplaceDisksList
, pRemoteNode
, pIallocator
])
, ("OpInstanceFailover",
[ pInstanceName
, pShutdownTimeout
, pIgnoreConsistency
, pMigrationTargetNode
, pIgnoreIpolicy
, pIallocator
])
, ("OpInstanceMigrate",
[ pInstanceName
, pMigrationMode
, pMigrationLive
, pMigrationTargetNode
, pAllowRuntimeChgs
, pIgnoreIpolicy
, pMigrationCleanup
, pIallocator
, pAllowFailover
, pMigrationTargetNode
])
, ("OpTagsGet",
[ pTagsObject
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment