From db915bd14bc278f36a3d29483883399e82609051 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 27 Jul 2007 10:00:50 +0000 Subject: [PATCH] =?UTF-8?q?Check=20for=20instances=20on=20=E2=80=9Cgnt-clu?= =?UTF-8?q?ster=20destroy=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: iustinp --- lib/cmdlib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index f5a26f386..56fe1de76 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -590,9 +590,13 @@ class LUDestroyCluster(NoHooksLU): master = self.sstore.GetMasterNode() 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 " "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): """Destroys the cluster. -- GitLab