Commit 27263c47 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

gnt-cluster modify: limit storage type consistency check



This fixes the currently broken Q&A. The consistency check
for storage types is now only run when the 'enabled_storage_types'
are actually changed by 'gnt-cluster modify'.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 9c6f0b51
......@@ -4437,20 +4437,21 @@ class LUClusterSetParams(LogicalUnit):
are still in use by some instances.
 
"""
cluster = self.cfg.GetClusterInfo()
instances = self.cfg.GetAllInstancesInfo()
storage_types_to_remove = set(cluster.enabled_storage_types) \
- set(self.op.enabled_storage_types)
for instance in instances.itervalues():
storage_type = constants.DISK_TEMPLATES_STORAGE_TYPE[
instance.disk_template]
if storage_type in storage_types_to_remove:
raise errors.OpPrereqError("Cannot disable storage type '%s',"
" because instance '%s' is using disk"
" template '%s'." %
(storage_type, instance.name,
instance.disk_template))
if self.op.enabled_storage_types:
cluster = self.cfg.GetClusterInfo()
instances = self.cfg.GetAllInstancesInfo()
storage_types_to_remove = set(cluster.enabled_storage_types) \
- set(self.op.enabled_storage_types)
for instance in instances.itervalues():
storage_type = constants.DISK_TEMPLATES_STORAGE_TYPE[
instance.disk_template]
if storage_type in storage_types_to_remove:
raise errors.OpPrereqError("Cannot disable storage type '%s',"
" because instance '%s' is using disk"
" template '%s'." %
(storage_type, instance.name,
instance.disk_template))
 
def Exec(self, feedback_fn):
"""Change the parameters of the cluster.
......
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