From 130e907e95363e15cbc44197bacb530bf62bb52c Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 30 Aug 2007 14:30:38 +0000
Subject: [PATCH] Add one more check on cluster init.

This adds a check that the initial node's IP name doesn't resolve to a
loopback address (127.x.y.z).

Also remove an unused variable.

Reviewed-by: imsnah
---
 lib/cmdlib.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 1f858463c..b3d83eac5 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -546,6 +546,11 @@ class LUInitCluster(LogicalUnit):
                                  " for hostname." %
                                  (hostname_local, hostname["hostname_full"]))
 
+    if hostname["ip"].startswith("127."):
+      raise errors.OpPrereqError("This host's IP resolves to the private"
+                                 " range (%s). Please fix DNS or /etc/hosts." %
+                                 (hostname["ip"],))
+
     self.clustername = clustername = utils.LookupHostname(self.op.cluster_name)
     if not clustername:
       raise errors.OpPrereqError("Cannot resolve given cluster name ('%s')"
@@ -3085,7 +3090,6 @@ class LUReplaceDisks(LogicalUnit):
     # start of work
     remote_node = self.op.remote_node
     cfg = self.cfg
-    vgname = cfg.GetVGName()
     for dev in instance.disks:
       size = dev.size
       lv_names = [".%s_%s" % (dev.iv_name, suf) for suf in ["data", "meta"]]
-- 
GitLab