Fix instance failover in case of DTS_EXT_MIRROR
authorDimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
Thu, 30 Jul 2015 19:56:47 +0000 (22:56 +0300)
committerHrvoje Ribicic <riba@google.com>
Mon, 17 Aug 2015 15:11:41 +0000 (15:11 +0000)
Since 2.14 L{objects.Instance} no longer has a disk_template
slot, thus we must obtain it indirectly via cfg.GetInstanceDiskTemplate().

Commit ff74b60 uses the _CloseInstanceDisks() helper during instance
failover in case the instance's disk template is DTS_EXT_MIRROR,
but uses the instance.disk_template value directly, which is a bug.
Fix this.

Signed-off-by: Dimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>

lib/cmdlib/instance_migration.py

index 75f9a83..ca64afb 100644 (file)
@@ -980,7 +980,8 @@ class TLMigrateInstance(Tasklet):
                                  (self.instance.name,
                                   self.cfg.GetNodeName(source_node_uuid), msg))
 
-    if self.instance.disk_template in constants.DTS_EXT_MIRROR:
+    disk_template = self.cfg.GetInstanceDiskTemplate(self.instance.uuid)
+    if disk_template in constants.DTS_EXT_MIRROR:
       self._CloseInstanceDisks(source_node_uuid)
 
     self.feedback_fn("* deactivating the instance's disks on source node")