Revision 06dfde19
b/lib/config.py | ||
---|---|---|
394 | 394 |
""" |
395 | 395 |
nobj = self._UnlockedGetNetwork(net_uuid) |
396 | 396 |
pool = network.AddressPool(nobj) |
397 |
if (address, net_uuid) in self._AllIPs(): |
|
398 |
raise errors.ConfigurationError("Address '%s' already exists in" |
|
399 |
" network '%s'" % (address, nobj.name)) |
|
397 | 400 |
if pool.IsReserved(address): |
398 | 401 |
raise errors.OpPrereqError("IP address '%s' already in use." % |
399 | 402 |
address, errors.ECODE_EXISTS) |
... | ... | |
521 | 524 |
|
522 | 525 |
return result |
523 | 526 |
|
527 |
def _AllIPs(self): |
|
528 |
"""Return all (IP, Network) present in the config. |
|
529 |
|
|
530 |
@rtype: list of tuples |
|
531 |
@return: the list of all IP, Network tuples |
|
532 |
|
|
533 |
""" |
|
534 |
result = [] |
|
535 |
for instance in self._config_data.instances.values(): |
|
536 |
for nic in instance.nics: |
|
537 |
result.append((nic.ip, nic.network)) |
|
538 |
|
|
539 |
return result |
|
540 |
|
|
524 | 541 |
def _AllDRBDSecrets(self): |
525 | 542 |
"""Return all DRBD secrets present in the config. |
526 | 543 |
|
Also available in: Unified diff