Revision 27263c47 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
4437 | 4437 |
are still in use by some instances. |
4438 | 4438 |
|
4439 | 4439 |
""" |
4440 |
cluster = self.cfg.GetClusterInfo() |
|
4441 |
instances = self.cfg.GetAllInstancesInfo() |
|
4442 |
|
|
4443 |
storage_types_to_remove = set(cluster.enabled_storage_types) \ |
|
4444 |
- set(self.op.enabled_storage_types) |
|
4445 |
for instance in instances.itervalues(): |
|
4446 |
storage_type = constants.DISK_TEMPLATES_STORAGE_TYPE[ |
|
4447 |
instance.disk_template] |
|
4448 |
if storage_type in storage_types_to_remove: |
|
4449 |
raise errors.OpPrereqError("Cannot disable storage type '%s'," |
|
4450 |
" because instance '%s' is using disk" |
|
4451 |
" template '%s'." % |
|
4452 |
(storage_type, instance.name, |
|
4453 |
instance.disk_template)) |
|
4440 |
if self.op.enabled_storage_types: |
|
4441 |
cluster = self.cfg.GetClusterInfo() |
|
4442 |
instances = self.cfg.GetAllInstancesInfo() |
|
4443 |
|
|
4444 |
storage_types_to_remove = set(cluster.enabled_storage_types) \ |
|
4445 |
- set(self.op.enabled_storage_types) |
|
4446 |
for instance in instances.itervalues(): |
|
4447 |
storage_type = constants.DISK_TEMPLATES_STORAGE_TYPE[ |
|
4448 |
instance.disk_template] |
|
4449 |
if storage_type in storage_types_to_remove: |
|
4450 |
raise errors.OpPrereqError("Cannot disable storage type '%s'," |
|
4451 |
" because instance '%s' is using disk" |
|
4452 |
" template '%s'." % |
|
4453 |
(storage_type, instance.name, |
|
4454 |
instance.disk_template)) |
|
4454 | 4455 |
|
4455 | 4456 |
def Exec(self, feedback_fn): |
4456 | 4457 |
"""Change the parameters of the cluster. |
Also available in: Unified diff