From 6dfad215f98c8ff12a5530296f4edf6e94f863cf Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 17 Jun 2009 13:01:46 +0200 Subject: [PATCH] Fix checking for valid OS in instance create The current check in LUCreateInstance.CheckPrereq() is wrong - it only checks if we got an OS, but not if we got a valid OS. This patch fixes it. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/cmdlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index dab9ef728..1c2ffbbec 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -4730,7 +4730,7 @@ class LUCreateInstance(LogicalUnit): # os verification result = self.rpc.call_os_get(pnode.name, self.op.os_type) result.Raise() - if not isinstance(result.data, objects.OS): + if not isinstance(result.data, objects.OS) or not result.data: raise errors.OpPrereqError("OS '%s' not in supported os list for" " primary node" % self.op.os_type) -- GitLab