Revision 044fff06 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
10384 | 10384 |
" or does not belong to network %s" % |
10385 | 10385 |
(nic.ip, net), |
10386 | 10386 |
errors.ECODE_NOTUNIQUE) |
10387 |
else: |
|
10388 |
# net is None, ip None or given
|
|
10389 |
if self.op.conflicts_check:
|
|
10390 |
_CheckForConflictingIp(self, nic.ip, self.pnode.name)
|
|
10387 |
|
|
10388 |
# net is None, ip None or given |
|
10389 |
elif self.op.conflicts_check:
|
|
10390 |
_CheckForConflictingIp(self, nic.ip, self.pnode.name) |
|
10391 | 10391 |
|
10392 | 10392 |
# mirror node verification |
10393 | 10393 |
if self.op.disk_template in constants.DTS_INT_MIRROR: |
... | ... | |
13115 | 13115 |
elif new_ip.lower() == constants.NIC_IP_POOL: |
13116 | 13116 |
raise errors.OpPrereqError("ip=pool, but no network found", |
13117 | 13117 |
errors.ECODE_INVAL) |
13118 |
else: |
|
13119 |
# new net is None
|
|
13120 |
if self.op.conflicts_check:
|
|
13121 |
_CheckForConflictingIp(self, new_ip, pnode)
|
|
13118 |
|
|
13119 |
# new net is None |
|
13120 |
elif self.op.conflicts_check:
|
|
13121 |
_CheckForConflictingIp(self, new_ip, pnode) |
|
13122 | 13122 |
|
13123 | 13123 |
if old_ip: |
13124 | 13124 |
if old_net: |
... | ... | |
15963 | 15963 |
else: |
15964 | 15964 |
self.gateway = self.op.gateway |
15965 | 15965 |
if self.pool.IsReserved(self.gateway): |
15966 |
raise errors.OpPrereqError("%s is already reserved" % |
|
15967 |
self.gateway, errors.ECODE_STATE) |
|
15966 |
raise errors.OpPrereqError("Gateway IP address '%s' is already" |
|
15967 |
" reserved" % self.gateway, |
|
15968 |
errors.ECODE_STATE) |
|
15968 | 15969 |
|
15969 | 15970 |
if self.op.network_type: |
15970 | 15971 |
if self.op.network_type == constants.VALUE_NONE: |
... | ... | |
16206 | 16207 |
|
16207 | 16208 |
self.network_uuid = self.cfg.LookupNetwork(self.network_name) |
16208 | 16209 |
if self.network_uuid is None: |
16209 |
raise errors.OpPrereqError("Network %s does not exist" %
|
|
16210 |
raise errors.OpPrereqError("Network '%s' does not exist" %
|
|
16210 | 16211 |
self.network_name, errors.ECODE_NOENT) |
16211 | 16212 |
|
16212 | 16213 |
self.group_uuid = self.cfg.LookupNodeGroup(self.group_name) |
16213 | 16214 |
if self.group_uuid is None: |
16214 |
raise errors.OpPrereqError("Group %s does not exist" %
|
|
16215 |
raise errors.OpPrereqError("Group '%s' does not exist" %
|
|
16215 | 16216 |
self.group_name, errors.ECODE_NOENT) |
16216 | 16217 |
|
16217 | 16218 |
self.needed_locks = { |
... | ... | |
16342 | 16343 |
|
16343 | 16344 |
self.network_uuid = self.cfg.LookupNetwork(self.network_name) |
16344 | 16345 |
if self.network_uuid is None: |
16345 |
raise errors.OpPrereqError("Network %s does not exist" %
|
|
16346 |
raise errors.OpPrereqError("Network '%s' does not exist" %
|
|
16346 | 16347 |
self.network_name, errors.ECODE_NOENT) |
16347 | 16348 |
|
16348 | 16349 |
self.group_uuid = self.cfg.LookupNodeGroup(self.group_name) |
16349 | 16350 |
if self.group_uuid is None: |
16350 |
raise errors.OpPrereqError("Group %s does not exist" %
|
|
16351 |
raise errors.OpPrereqError("Group '%s' does not exist" %
|
|
16351 | 16352 |
self.group_name, errors.ECODE_NOENT) |
16352 | 16353 |
|
16353 | 16354 |
self.needed_locks = { |
... | ... | |
16429 | 16430 |
|
16430 | 16431 |
|
16431 | 16432 |
def _CheckForConflictingIp(lu, ip, node): |
16432 |
"""In case of conflicting ip raise error.
|
|
16433 |
"""In case of conflicting IP address raise error.
|
|
16433 | 16434 |
|
16434 | 16435 |
@type ip: string |
16435 |
@param ip: ip address
|
|
16436 |
@param ip: IP address
|
|
16436 | 16437 |
@type node: string |
16437 | 16438 |
@param node: node name |
16438 | 16439 |
|
16439 | 16440 |
""" |
16440 | 16441 |
(conf_net, _) = lu.cfg.CheckIPInNodeGroup(ip, node) |
16441 | 16442 |
if conf_net is not None: |
16442 |
raise errors.OpPrereqError("Conflicting IP found:"
|
|
16443 |
" %s <> %s." % (ip, conf_net),
|
|
16443 |
raise errors.OpPrereqError(("Conflicting IP address found: '%s' != '%s'" %
|
|
16444 |
(ip, conf_net)),
|
|
16444 | 16445 |
errors.ECODE_STATE) |
16445 | 16446 |
|
16446 | 16447 |
return (None, None) |
Also available in: Unified diff