From c16915bd5904f1e3862c30d90ba40daeeae7238b Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Fri, 17 Jun 2011 12:19:44 +0300 Subject: [PATCH] Add DTS_FILEBASED constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- 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 9ee361fc4..759f01f16 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 bc048db70..d2450c630 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" -- GitLab