Skip to content
Snippets Groups Projects
Commit db915bd1 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Check for instances on “gnt-cluster destroy”.

Reviewed-by: iustinp
parent 739ecd56
No related branches found
No related tags found
No related merge requests found
...@@ -590,9 +590,13 @@ class LUDestroyCluster(NoHooksLU): ...@@ -590,9 +590,13 @@ class LUDestroyCluster(NoHooksLU):
master = self.sstore.GetMasterNode() master = self.sstore.GetMasterNode()
nodelist = self.cfg.GetNodeList() nodelist = self.cfg.GetNodeList()
if len(nodelist) > 0 and nodelist != [master]: if len(nodelist) != 1 or nodelist[0] != master:
raise errors.OpPrereqError, ("There are still %d node(s) in " raise errors.OpPrereqError, ("There are still %d node(s) in "
"this cluster." % (len(nodelist) - 1)) "this cluster." % (len(nodelist) - 1))
instancelist = self.cfg.GetInstanceList()
if instancelist:
raise errors.OpPrereqError, ("There are still %d instance(s) in "
"this cluster." % len(instancelist))
def Exec(self, feedback_fn): def Exec(self, feedback_fn):
"""Destroys the cluster. """Destroys the cluster.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment