Revision b705c7a6 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
2527 | 2527 |
"""Verify that the passed name is a valid one. |
2528 | 2528 |
|
2529 | 2529 |
""" |
2530 |
hostname = netutils.GetHostInfo(self.op.name)
|
|
2530 |
hostname = netutils.GetHostname(name=self.op.name)
|
|
2531 | 2531 |
|
2532 | 2532 |
new_name = hostname.name |
2533 | 2533 |
self.ip = new_ip = hostname.ip |
... | ... | |
3674 | 3674 |
|
3675 | 3675 |
def CheckArguments(self): |
3676 | 3676 |
# validate/normalize the node name |
3677 |
self.op.node_name = netutils.HostInfo.NormalizeName(self.op.node_name)
|
|
3677 |
self.op.node_name = netutils.Hostname.GetNormalizedName(self.op.node_name)
|
|
3678 | 3678 |
|
3679 | 3679 |
def BuildHooksEnv(self): |
3680 | 3680 |
"""Build hooks env. |
... | ... | |
3703 | 3703 |
Any errors are signaled by raising errors.OpPrereqError. |
3704 | 3704 |
|
3705 | 3705 |
""" |
3706 |
node_name = self.op.node_name |
|
3706 |
hostname = netutils.GetHostname(name=self.op.node_name) |
|
3707 |
node = hostname.name |
|
3707 | 3708 |
cfg = self.cfg |
3708 | 3709 |
|
3709 |
dns_data = netutils.GetHostInfo(node_name) |
|
3710 |
|
|
3711 |
node = dns_data.name |
|
3712 |
primary_ip = self.op.primary_ip = dns_data.ip |
|
3710 |
primary_ip = self.op.primary_ip = hostname.ip |
|
3713 | 3711 |
if self.op.secondary_ip is None: |
3714 | 3712 |
self.op.secondary_ip = primary_ip |
3715 | 3713 |
if not netutils.IP4Address.IsValid(self.op.secondary_ip): |
... | ... | |
4915 | 4913 |
|
4916 | 4914 |
new_name = self.op.new_name |
4917 | 4915 |
if self.op.name_check: |
4918 |
hostinfo = netutils.HostInfo(netutils.HostInfo.NormalizeName(new_name))
|
|
4919 |
new_name = hostinfo.name
|
|
4916 |
hostname = netutils.GetHostname(name=new_name)
|
|
4917 |
new_name = hostname.name
|
|
4920 | 4918 |
if (self.op.ip_check and |
4921 |
netutils.TcpPing(hostinfo.ip, constants.DEFAULT_NODED_PORT)):
|
|
4919 |
netutils.TcpPing(hostname.ip, constants.DEFAULT_NODED_PORT)):
|
|
4922 | 4920 |
raise errors.OpPrereqError("IP %s of instance %s already in use" % |
4923 |
(hostinfo.ip, new_name),
|
|
4921 |
(hostname.ip, new_name),
|
|
4924 | 4922 |
errors.ECODE_NOTUNIQUE) |
4925 | 4923 |
|
4926 | 4924 |
instance_list = self.cfg.GetInstanceList() |
... | ... | |
4928 | 4926 |
raise errors.OpPrereqError("Instance '%s' is already in the cluster" % |
4929 | 4927 |
new_name, errors.ECODE_EXISTS) |
4930 | 4928 |
|
4931 |
|
|
4932 | 4929 |
def Exec(self, feedback_fn): |
4933 | 4930 |
"""Reinstall the instance. |
4934 | 4931 |
|
... | ... | |
6551 | 6548 |
self.op.start = False |
6552 | 6549 |
# validate/normalize the instance name |
6553 | 6550 |
self.op.instance_name = \ |
6554 |
netutils.HostInfo.NormalizeName(self.op.instance_name)
|
|
6551 |
netutils.Hostname.GetNormalizedName(self.op.instance_name)
|
|
6555 | 6552 |
|
6556 | 6553 |
if self.op.ip_check and not self.op.name_check: |
6557 | 6554 |
# TODO: make the ip check more flexible and not depend on the name check |
... | ... | |
6590 | 6587 |
|
6591 | 6588 |
# instance name verification |
6592 | 6589 |
if self.op.name_check: |
6593 |
self.hostname1 = netutils.GetHostInfo(self.op.instance_name)
|
|
6590 |
self.hostname1 = netutils.GetHostname(name=self.op.instance_name)
|
|
6594 | 6591 |
self.op.instance_name = self.hostname1.name |
6595 | 6592 |
# used in CheckPrereq for ip ping check |
6596 | 6593 |
self.check_ip = self.hostname1.ip |
... | ... | |
6670 | 6667 |
raise errors.OpPrereqError("Missing source instance name", |
6671 | 6668 |
errors.ECODE_INVAL) |
6672 | 6669 |
|
6673 |
norm_name = netutils.HostInfo.NormalizeName(src_instance_name)
|
|
6674 |
self.source_instance_name = netutils.GetHostInfo(norm_name).name
|
|
6670 |
self.source_instance_name = \
|
|
6671 |
netutils.GetHostname(name=src_instance_name).name
|
|
6675 | 6672 |
|
6676 | 6673 |
else: |
6677 | 6674 |
raise errors.OpPrereqError("Invalid instance creation mode %r" % |
Also available in: Unified diff