diff --git a/lib/bootstrap.py b/lib/bootstrap.py index b0fc18025d7e9a66a04dfa8d8ffd6da054efe4f2..7d9671244e47b8e2946ac1c20baebc61a191cb81 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -190,7 +190,7 @@ def InitCluster(cluster_name, mac_prefix, " belong to this host. Aborting." % hostname.ip, errors.ECODE_ENVIRON) - clustername = utils.GetHostInfo(cluster_name) + clustername = utils.GetHostInfo(utils.HostInfo.NormalizeName(cluster_name)) if utils.TcpPing(clustername.ip, constants.DEFAULT_NODED_PORT, timeout=5): diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 85555da3937b267e4fcee34ee1a719828d8d886f..99b11b407901eca96d9bc00d34175713daa63faf 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2907,6 +2907,10 @@ class LUAddNode(LogicalUnit): HTYPE = constants.HTYPE_NODE _OP_REQP = ["node_name"] + def CheckArguments(self): + # validate/normalize the node name + self.op.node_name = utils.HostInfo.NormalizeName(self.op.node_name) + def BuildHooksEnv(self): """Build hooks env. @@ -5654,6 +5658,8 @@ class LUCreateInstance(LogicalUnit): # for tools if not hasattr(self.op, "name_check"): self.op.name_check = True + # validate/normalize the instance name + self.op.instance_name = utils.HostInfo.NormalizeName(self.op.instance_name) if self.op.ip_check and not self.op.name_check: # TODO: make the ip check more flexible and not depend on the name check raise errors.OpPrereqError("Cannot do ip checks without a name check", diff --git a/scripts/gnt-node b/scripts/gnt-node index 55d36bcdf5bdb83bcf33fa0c089474b668a6f9bb..aaef9daa32499c7a33aec966002247b6c783ddf3 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -133,7 +133,7 @@ def AddNode(opts, args): """ cl = GetClient() - dns_data = utils.GetHostInfo(args[0]) + dns_data = utils.GetHostInfo(utils.HostInfo.NormalizeName(args[0])) node = dns_data.name readd = opts.readd