and secondary before failover.
:directory: instance-failover
-:env. vars: IGNORE_CONSISTENCY
+:env. vars: IGNORE_CONSISTENCY, OLD_SECONDARY, OLD_PRIMARY, NEW_SECONDARY, NEW_PRIMARY
:pre-execution: master node, secondary node
:post-execution: master node, secondary node
and secondary before migration.
:directory: instance-migrate
-:env. vars: MIGRATE_LIVE, MIGRATE_CLEANUP
+:env. vars: MIGRATE_LIVE, MIGRATE_CLEANUP, OLD_SECONDARY, OLD_PRIMARY, NEW_SECONDARY, NEW_PRIMARY
:pre-execution: master node, secondary node
:post-execution: master node, secondary node
The name of the instance OS.
INSTANCE_PRIMARY
- The name of the node which is the primary for the instance.
+ The name of the node which is the primary for the instance. Note that
+ for migrations/failovers, you shouldn't rely on this variable since
+ the nodes change during the exectution, but on the
+ OLD_PRIMARY/NEW_PRIMARY values.
INSTANCE_SECONDARIES
- Space-separated list of secondary nodes for the instance.
+ Space-separated list of secondary nodes for the instance. Note that
+ for migrations/failovers, you shouldn't rely on this variable since
+ the nodes change during the exectution, but on the
+ OLD_SECONDARY/NEW_SECONDARY values.
INSTANCE_MEMORY
The memory size (in MiBs) of the instance.
NEW_SECONDARY
The name of the node on which the new mirror component is being
- added. This can be the name of the current secondary, if the new
- mirror is on the same secondary.
+ added (for replace disk). This can be the name of the current
+ secondary, if the new mirror is on the same secondary. For
+ migrations/failovers, this is the old primary node.
OLD_SECONDARY
- The name of the old secondary in the replace-disks command Note that
+ The name of the old secondary in the replace-disks command. Note that
this can be equal to the new secondary if the secondary node hasn't
- actually changed.
+ actually changed. For migrations/failovers, this is the new primary
+ node.
+
+OLD_PRIMARY, NEW_PRIMARY
+ For migrations/failovers, the old and respectively new primary
+ nodes. These two mirror the NEW_SECONDARY/OLD_SECONDARY variables
EXPORT_NODE
The node on which the exported image of the instance was done.
GANETI_OP_TARGET=instance2.example.com
.. vim: set textwidth=72 :
+.. Local Variables:
+.. mode: rst
+.. fill-column: 72
+.. End:
This runs on master, primary and secondary nodes of the instance.
"""
+ instance = self.instance
+ source_node = instance.primary_node
+ target_node = instance.secondary_nodes[0]
env = {
"IGNORE_CONSISTENCY": self.op.ignore_consistency,
"SHUTDOWN_TIMEOUT": self.shutdown_timeout,
+ "OLD_PRIMARY": source_node,
+ "OLD_SECONDARY": target_node,
+ "NEW_PRIMARY": target_node,
+ "NEW_SECONDARY": source_node,
}
- env.update(_BuildInstanceHookEnvByObject(self, self.instance))
- nl = [self.cfg.GetMasterNode()] + list(self.instance.secondary_nodes)
+ env.update(_BuildInstanceHookEnvByObject(self, instance))
+ nl = [self.cfg.GetMasterNode()] + list(instance.secondary_nodes)
return env, nl, nl
def CheckPrereq(self):
"""
instance = self._migrater.instance
+ source_node = instance.primary_node
+ target_node = instance.secondary_nodes[0]
env = _BuildInstanceHookEnvByObject(self, instance)
env["MIGRATE_LIVE"] = self.op.live
env["MIGRATE_CLEANUP"] = self.op.cleanup
+ env.update({
+ "OLD_PRIMARY": source_node,
+ "OLD_SECONDARY": target_node,
+ "NEW_PRIMARY": target_node,
+ "NEW_SECONDARY": source_node,
+ })
nl = [self.cfg.GetMasterNode()] + list(instance.secondary_nodes)
return env, nl, nl