Hi,

It seems that this is needed so that DRBD instances can migrate..

(Interdiff)

diff --git a/lib/cmdlib/instance_migration.py b/lib/cmdlib/instance_migration.py
index fc4cb5a..fff1cd7 100644
--- a/lib/cmdlib/instance_migration.py
+++ b/lib/cmdlib/instance_migration.py
@@ -354,7 +354,7 @@ class TLMigrateInstance(Tasklet):
         raise errors.ConfigurationError("No secondary node but using"
                                         " %s disk template" %
                                         self.instance.disk_template)
-      target_node_uuid = secondary_node_uuids[0]
+      self.target_node_uuid = target_node_uuid = secondary_node_uuids[0]
       if self.lu.op.iallocator or \
         (self.lu.op.target_node_uuid and
          self.lu.op.target_node_uuid != target_node_uuid):



* Dimitris Aragiorgis <[email protected]> [2014-01-10 22:29:24 +0200]:

> * Dimitris Aragiorgis <[email protected]> [2014-01-10 15:00:08 +0200]:
> 
> > In case of DRBD, hooks run on both primary (source) and secondary
> > (target) nodes. To get the same behavior for DTS_EXT_MIRROR, where we
> > do not have secondary node, we should explicitly add target node to
> > hooks nodes during instance migration/failover.
> > 
> > CheckPrereq() of TLMigrateInstance runs before BuildHooksManager(),
> > thus target_node calculated by Iallocator is available under
> > self._migrater.target_node. Use this value instead of
> > self.op.target_node which can be None.
> > 
> > Update NEWS and related doc entries.
> > 
> > Signed-off-by: Dimitris Aragiorgis <[email protected]>
> > ---
> >  NEWS                             |    2 ++
> >  doc/hooks.rst                    |    8 ++++----
> >  lib/cmdlib/instance_migration.py |   10 +++++++---
> >  3 files changed, 13 insertions(+), 7 deletions(-)
> > 
> > diff --git a/NEWS b/NEWS
> > index 26c2616..c383d48 100644
> > --- a/NEWS
> > +++ b/NEWS
> > @@ -21,6 +21,8 @@ Incompatible/important changes
> >    checks whether there are instances still using those templates.
> >  - 'gnt-node list-storage' now also reports storage information about
> >    file-based storage types.
> > +- In case of non drbd instances, export *_SECONDARY environment variables
> 
> Here apparently I forgot to escape * ...
> If the rest looks OK could you please fix it before pushing it?
> 
> Thanks,
> dimara
> 
> > +  as empty strings (and not "None") during 'instance-migrate' related 
> > hooks.
> >  
> >  New features
> >  ~~~~~~~~~~~~
> > diff --git a/doc/hooks.rst b/doc/hooks.rst
> > index 3a2846a..fc37e73 100644
> > --- a/doc/hooks.rst
> > +++ b/doc/hooks.rst
> > @@ -379,8 +379,8 @@ and secondary before failover.
> >  
> >  :directory: instance-failover
> >  :env. vars: IGNORE_CONSISTENCY, SHUTDOWN_TIMEOUT, OLD_PRIMARY, 
> > OLD_SECONDARY, NEW_PRIMARY, NEW_SECONDARY
> > -:pre-execution: master node, secondary node
> > -:post-execution: master node, primary and secondary nodes
> > +:pre-execution: master node, secondary (target) node
> > +:post-execution: master node, primary (source) and secondary (target) nodes
> >  
> >  OP_INSTANCE_MIGRATE
> >  ++++++++++++++++++++
> > @@ -391,8 +391,8 @@ and secondary before migration.
> >  
> >  :directory: instance-migrate
> >  :env. vars: MIGRATE_LIVE, MIGRATE_CLEANUP, OLD_PRIMARY, OLD_SECONDARY, 
> > NEW_PRIMARY, NEW_SECONDARY
> > -:pre-execution: master node, primary and secondary nodes
> > -:post-execution: master node, primary and secondary nodes
> > +:pre-execution: master node, primary (source) and secondary (target) nodes
> > +:post-execution: master node, primary (source) and secondary (target) nodes
> >  
> >  
> >  OP_INSTANCE_REMOVE
> > diff --git a/lib/cmdlib/instance_migration.py 
> > b/lib/cmdlib/instance_migration.py
> > index 32eaf25..fc4cb5a 100644
> > --- a/lib/cmdlib/instance_migration.py
> > +++ b/lib/cmdlib/instance_migration.py
> > @@ -136,11 +136,12 @@ class LUInstanceFailover(LogicalUnit):
> >      """
> >      instance = self._migrater.instance
> >      source_node_uuid = instance.primary_node
> > +    target_node_uuid = self._migrater.target_node_uuid
> >      env = {
> >        "IGNORE_CONSISTENCY": self.op.ignore_consistency,
> >        "SHUTDOWN_TIMEOUT": self.op.shutdown_timeout,
> >        "OLD_PRIMARY": self.cfg.GetNodeName(source_node_uuid),
> > -      "NEW_PRIMARY": self.op.target_node,
> > +      "NEW_PRIMARY": self.cfg.GetNodeName(target_node_uuid),
> >        "FAILOVER_CLEANUP": self.op.cleanup,
> >        }
> >  
> > @@ -160,6 +161,7 @@ class LUInstanceFailover(LogicalUnit):
> >      """
> >      instance = self._migrater.instance
> >      nl = [self.cfg.GetMasterNode()] + list(instance.secondary_nodes)
> > +    nl.append(self._migrater.target_node_uuid)
> >      return (nl, nl + [instance.primary_node])
> >  
> >  
> > @@ -198,12 +200,13 @@ class LUInstanceMigrate(LogicalUnit):
> >      """
> >      instance = self._migrater.instance
> >      source_node_uuid = instance.primary_node
> > +    target_node_uuid = self._migrater.target_node_uuid
> >      env = BuildInstanceHookEnvByObject(self, instance)
> >      env.update({
> >        "MIGRATE_LIVE": self._migrater.live,
> >        "MIGRATE_CLEANUP": self.op.cleanup,
> >        "OLD_PRIMARY": self.cfg.GetNodeName(source_node_uuid),
> > -      "NEW_PRIMARY": self.op.target_node,
> > +      "NEW_PRIMARY": self.cfg.GetNodeName(target_node_uuid),
> >        "ALLOW_RUNTIME_CHANGES": self.op.allow_runtime_changes,
> >        })
> >  
> > @@ -211,7 +214,7 @@ class LUInstanceMigrate(LogicalUnit):
> >        env["OLD_SECONDARY"] = 
> > self.cfg.GetNodeName(instance.secondary_nodes[0])
> >        env["NEW_SECONDARY"] = self.cfg.GetNodeName(source_node_uuid)
> >      else:
> > -      env["OLD_SECONDARY"] = env["NEW_SECONDARY"] = None
> > +      env["OLD_SECONDARY"] = env["NEW_SECONDARY"] = ""
> >  
> >      return env
> >  
> > @@ -222,6 +225,7 @@ class LUInstanceMigrate(LogicalUnit):
> >      instance = self._migrater.instance
> >      snode_uuids = list(instance.secondary_nodes)
> >      nl = [self.cfg.GetMasterNode(), instance.primary_node] + snode_uuids
> > +    nl.append(self._migrater.target_node_uuid)
> >      return (nl, nl)
> >  
> >  
> > -- 
> > 1.7.10.4


Attachment: signature.asc
Description: Digital signature

Reply via email to