This patch makes sure that no instances can be created which use disk templates which are not enabled on the cluster.
Signed-off-by: Helga Velroyen <hel...@google.com> --- lib/cmdlib.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index c098845..d5cc452 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -10154,6 +10154,14 @@ class LUInstanceCreate(LogicalUnit): for nic in self.op.nics: utils.ForceDictType(nic, constants.INIC_PARAMS_TYPES) + cluster = self.cfg.GetClusterInfo() + if not self.op.disk_template in cluster.enabled_disk_templates: + raise errors.OpPrereqError("Cannot create an instance with disk template" + " '%s', because it is not enabled in the" + " cluster. Enabled disk templates are: %s." % + (self.op.disk_template, + ",".join(cluster.enabled_disk_templates))) + # check disks. parameter names and consistent adopt/no-adopt strategy has_adopt = has_no_adopt = False for disk in self.op.disks: -- 1.8.1.3