From fc31fadd2abf3597f1b75f7041c21e50bf119848 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 16 Sep 2010 17:42:51 +0200
Subject: [PATCH] Restrict blacklisted OSes in instance installation

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

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index bcc72f2a7..f929cd324 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -6636,6 +6636,10 @@ class LUCreateInstance(LogicalUnit):
       if self.op.os_type is None:
         raise errors.OpPrereqError("No guest OS specified",
                                    errors.ECODE_INVAL)
+      if self.op.os_type in self.cfg.GetClusterInfo().blacklisted_oss:
+        raise errors.OpPrereqError("Guest OS '%s' is not allowed for"
+                                   " installation" % self.op.os_type,
+                                   errors.ECODE_STATE)
       if self.op.disk_template is None:
         raise errors.OpPrereqError("No disk template specified",
                                    errors.ECODE_INVAL)
-- 
GitLab