Commit e04ec58e authored by Helga Velroyen's avatar Helga Velroyen
Browse files

gnt-instance: no instance creation with disabled templates

This patch makes sure that no instances can be created which use
disk templates which are not enabled on the cluster.
Signed-off-by: default avatarHelga Velroyen <>
Reviewed-by: default avatarMichele Tartara <>
parent f41dc024
......@@ -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." %
# check disks. parameter names and consistent adopt/no-adopt strategy
has_adopt = has_no_adopt = False
for disk in self.op.disks:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment