Restrict blacklisted OSes in instance installation
authorIustin Pop <iustin@google.com>
Thu, 16 Sep 2010 15:42:51 +0000 (17:42 +0200)
committerIustin Pop <iustin@google.com>
Thu, 30 Sep 2010 00:10:00 +0000 (20:10 -0400)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/cmdlib.py

index bcc72f2..f929cd3 100644 (file)
@@ -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)