From df4272e57c2ad395f69bb66dc73965c0d1c6d811 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sun, 14 Mar 2010 01:55:16 +0100
Subject: [PATCH] LUCreateInstance: Move parameter init earlier

This way, the parameters are available in CheckArguments too.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/cmdlib.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 93d97cc5b..c22427def 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -5785,6 +5785,11 @@ class LUCreateInstance(LogicalUnit):
     """Check arguments.
 
     """
+    # set optional parameters to none if they don't exist
+    for attr in ["pnode", "snode", "iallocator", "hypervisor"]:
+      if not hasattr(self.op, attr):
+        setattr(self.op, attr, None)
+
     # do not require name_check to ease forward/backward compatibility
     # for tools
     if not hasattr(self.op, "name_check"):
@@ -5808,11 +5813,6 @@ class LUCreateInstance(LogicalUnit):
     """
     self.needed_locks = {}
 
-    # set optional parameters to none if they don't exist
-    for attr in ["pnode", "snode", "iallocator", "hypervisor"]:
-      if not hasattr(self.op, attr):
-        setattr(self.op, attr, None)
-
     # cheap checks, mostly valid constants given
 
     # verify creation mode
-- 
GitLab