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

Check for running instances when disabling templates



This patch introduces a function to be used in
'gnt-cluster modify' when disabling a couple of disk
templates. It checks whether there are still instances
running that use these templates.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent e8c86ab1
......@@ -916,6 +916,21 @@ class LUClusterSetParams(LogicalUnit):
raise errors.OpPrereqError("Cannot enable DRBD without a"
" DRBD usermode helper set.")
def _CheckInstancesOfDisabledDiskTemplates(
self, disabled_disk_templates):
"""Check whether we try to a disk template that is in use.
@type disabled_disk_templates: list of string
@param disabled_disk_templates: list of disk templates that are going to
be disabled by this operation
"""
for disk_template in disabled_disk_templates:
if self.cfg.HasAnyDiskOfType(disk_template):
raise errors.OpPrereqError(
"Cannot disable disk template '%s', because there is at least one"
" instance using it." % disk_template)
def CheckPrereq(self):
"""Check prerequisites.
......
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