Signed-off-by: Guido Trotter <[email protected]>
---
lib/cmdlib.py | 4 ++--
lib/constants.py | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 9ee361f..759f01f 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -6158,7 +6158,7 @@ class LUInstanceRename(LogicalUnit):
old_name = inst.name
rename_file_storage = False
- if (inst.disk_template in (constants.DT_FILE, constants.DT_SHARED_FILE) and
+ if (inst.disk_template in constants.DTS_FILEBASED and
self.op.new_name != inst.name):
old_file_storage_dir = os.path.dirname(inst.disks[0].logical_id[1])
rename_file_storage = True
@@ -7591,7 +7591,7 @@ def _CreateDisks(lu, instance, to_skip=None,
target_node=None):
pnode = target_node
all_nodes = [pnode]
- if instance.disk_template in (constants.DT_FILE, constants.DT_SHARED_FILE):
+ if instance.disk_template in constants.DTS_FILEBASED:
file_storage_dir = os.path.dirname(instance.disks[0].logical_id[1])
result = lu.rpc.call_file_storage_dir_create(pnode, file_storage_dir)
diff --git a/lib/constants.py b/lib/constants.py
index bc048db..d2450c6 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -388,6 +388,8 @@ DTS_MUST_ADOPT = frozenset([DT_BLOCK])
# the set of disk templates that allow migrations
DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
+# the set of file based disk templates
+DTS_FILEBASED = frozenset([DT_FILE, DT_SHARED_FILE])
# logical disk types
LD_LV = "lvm"
--
1.7.5.4