CLEANUP_OPT = cli_option("--cleanup", dest="cleanup",
default=False, action="store_true",
- help="Instead of performing the migration, try to"
- " recover from a failed cleanup. This is safe"
+ help="Instead of performing the migration/failover,"
+ " try to recover from a failed cleanup. This is safe"
" to run even if the instance is healthy, but it"
" will create extra replication traffic and "
" disrupt briefly the replication (like during the"
- " migration")
+ " migration/failover")
STATIC_OPT = cli_option("-s", "--static", dest="static",
action="store_true", default=False,
FailoverInstance, ARGS_ONE_INSTANCE,
[FORCE_OPT, IGNORE_CONSIST_OPT, SUBMIT_OPT, SHUTDOWN_TIMEOUT_OPT,
DRY_RUN_OPT, PRIORITY_OPT, DST_NODE_OPT, IALLOCATOR_OPT,
- IGNORE_IPOLICY_OPT],
+ IGNORE_IPOLICY_OPT, CLEANUP_OPT],
"[-f] <instance>", "Stops the instance, changes its primary node and"
" (if it was originally running) starts it on the new node"
" (the secondary for mirrored instances or any node"
_ExpandNamesForMigration(self)
self._migrater = \
- TLMigrateInstance(self, self.op.instance_name, False, True, False,
- self.op.ignore_consistency, True,
+ TLMigrateInstance(self, self.op.instance_name, self.op.cleanup, True,
+ False, self.op.ignore_consistency, True,
self.op.shutdown_timeout, self.op.ignore_ipolicy)
self.tasklets = [self._migrater]
"SHUTDOWN_TIMEOUT": self.op.shutdown_timeout,
"OLD_PRIMARY": source_node,
"NEW_PRIMARY": target_node,
+ "FAILOVER_CLEANUP": self.op.cleanup,
}
if instance.disk_template in constants.DTS_INT_MIRROR:
_PIgnoreIpolicy,
_PIAllocFromDesc("Iallocator for deciding the target node for"
" shared-storage instances"),
+ ("cleanup", False, ht.TBool,
+ "Whether a previously failed failover should be cleaned up"),
]
OP_RESULT = ht.TNone
, opTargetNode = Nothing
, opIgnoreIpolicy = False
, opIallocator = Nothing
+ , opMigrationCleanup = False
}
])
| offSec ->
, pMigrationTargetNode
, pIgnoreIpolicy
, pIallocator
+ , pMigrationCleanup
])
, ("OpInstanceMigrate",
[ pInstanceName
genMaybe genNodeNameNE <*> genMaybe genNameNE
"OP_INSTANCE_FAILOVER" ->
OpCodes.OpInstanceFailover <$> genFQDN <*> arbitrary <*> arbitrary <*>
- genMaybe genNodeNameNE <*> arbitrary <*> genMaybe genNameNE
+ genMaybe genNodeNameNE <*> arbitrary <*> genMaybe genNameNE <*>
+ arbitrary
"OP_INSTANCE_MIGRATE" ->
OpCodes.OpInstanceMigrate <$> genFQDN <*> arbitrary <*> arbitrary <*>
genMaybe genNodeNameNE <*> arbitrary <*>