From d12f5c66169ffacc05a652422be8516b024ddcba Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 28 Jun 2010 15:14:43 +0200
Subject: [PATCH] Fix a type declaration error in LUTestAllocator

Also, improve logging of type errors, to ease debugging.

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

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index a991186a1..ff6603129 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -269,6 +269,8 @@ class LogicalUnit(object):
                                      " given type is not a proper type (%s)" %
                                      (attr_name, test))
       if not test(attr_val):
+        logging.error("OpCode %s, parameter %s, has invalid type %s/value %s",
+                      self.op.OP_ID, attr_name, type(attr_val), attr_val)
         raise errors.OpPrereqError("Parameter '%s' has invalid type" %
                                    attr_name, errors.ECODE_INVAL)
 
@@ -10053,7 +10055,8 @@ class LUTestAllocator(NoHooksLU):
     ("mode", _TElemOf(constants.VALID_IALLOCATOR_MODES)),
     ("name", _TNonEmptyString),
     ("nics", _TOr(_TNone, _TListOf(
-      _TDictOf(_TElemOf(["mac", "ip", "bridge"]), _TNonEmptyString)))),
+      _TDictOf(_TElemOf(["mac", "ip", "bridge"]),
+               _TOr(_TNone, _TNonEmptyString))))),
     ("disks", _TOr(_TNone, _TList)),
     ]
   _OP_DEFS = [
-- 
GitLab