From 5a9c7c348f889e68b046a7b28c7c3be370fe307d Mon Sep 17 00:00:00 2001 From: Bernardo Dal Seno <bdalseno@google.com> Date: Tue, 7 May 2013 15:01:50 +0200 Subject: [PATCH] Refactor check for exclusive_storage in LUInstanceCreate The order of evaluation of the conditions is changed, so it's easier to add more (foreseen) checks for exclusive_storage. Signed-off-by: Bernardo Dal Seno <bdalseno@google.com> Reviewed-by: Klaus Aehlig <aehlig@google.com> --- lib/cmdlib.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 935827ba6..6b1647db7 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -10983,12 +10983,12 @@ class LUInstanceCreate(LogicalUnit): " from the first disk's node group will be" " used") - if not self.op.disk_template in constants.DTS_EXCL_STORAGE: - nodes = [pnode] - if self.op.disk_template in constants.DTS_INT_MIRROR: - nodes.append(snode) - has_es = lambda n: _IsExclusiveStorageEnabledNode(self.cfg, n) - if compat.any(map(has_es, nodes)): + nodes = [pnode] + if self.op.disk_template in constants.DTS_INT_MIRROR: + nodes.append(snode) + has_es = lambda n: _IsExclusiveStorageEnabledNode(self.cfg, n) + if compat.any(map(has_es, nodes)): + if not self.op.disk_template in constants.DTS_EXCL_STORAGE: raise errors.OpPrereqError("Disk template %s not supported with" " exclusive storage" % self.op.disk_template, errors.ECODE_STATE) -- GitLab