From 728489a31609c62e5f65660cf2430dcd6a361b3c Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 22 Mar 2010 16:17:41 +0000
Subject: [PATCH] Fix burnin error when trying to grow a file volume

Abstract the growable disk types in a ganeti constants, and only run
disk grow, from burnin, on them.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/cmdlib.py    | 2 +-
 lib/constants.py | 3 +++
 tools/burnin     | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 9f604eed9..175c1fc77 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -7700,7 +7700,7 @@ class LUGrowDisk(LogicalUnit):
 
     self.instance = instance
 
-    if instance.disk_template not in (constants.DT_PLAIN, constants.DT_DRBD8):
+    if instance.disk_template not in constants.DTS_GROWABLE:
       raise errors.OpPrereqError("Instance's disk layout does not support"
                                  " growing.", errors.ECODE_INVAL)
 
diff --git a/lib/constants.py b/lib/constants.py
index 49fca781c..f84147110 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -265,6 +265,9 @@ DTS_NET_MIRROR = frozenset([DT_DRBD8])
 # the set of non-lvm-based disk templates
 DTS_NOT_LVM = frozenset([DT_DISKLESS, DT_FILE])
 
+# the set of disk templates which can be grown
+DTS_GROWABLE = frozenset([DT_PLAIN, DT_DRBD8])
+
 # logical disk types
 LD_LV = "lvm"
 LD_DRBD8 = "drbd8"
diff --git a/tools/burnin b/tools/burnin
index 91aae6b5c..a7ca79a8c 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -961,7 +961,7 @@ class Burner(object):
           opts.disk_template in constants.DTS_NET_MIRROR) :
         self.BurnReplaceDisks2()
 
-      if (opts.disk_template != constants.DT_DISKLESS and
+      if (opts.disk_template in constants.DTS_GROWABLE and
           utils.any(self.disk_growth, lambda n: n > 0)):
         self.BurnGrowDisks()
 
-- 
GitLab