Revision 402df383 lib/cmdlib/instance.py
b/lib/cmdlib/instance.py | ||
---|---|---|
993 | 993 |
errors.ECODE_STATE) |
994 | 994 |
self.LogInfo("Chose IP %s from network %s", nic.ip, nobj.name) |
995 | 995 |
else: |
996 |
try: |
|
997 |
self.cfg.ReserveIp(net_uuid, nic.ip, ec_id) |
|
998 |
except errors.ReservationError: |
|
999 |
raise errors.OpPrereqError("IP address %s already in use" |
|
1000 |
" or does not belong to network %s" % |
|
1001 |
(nic.ip, nobj.name), |
|
1002 |
errors.ECODE_NOTUNIQUE) |
|
996 |
self.cfg.ReserveIp(net_uuid, nic.ip, ec_id) |
|
1003 | 997 |
|
1004 | 998 |
# net is None, ip None or given |
1005 | 999 |
elif self.op.conflicts_check: |
... | ... | |
2520 | 2514 |
errors.ECODE_INVAL) |
2521 | 2515 |
# Reserve new IP if in the new network if any |
2522 | 2516 |
elif new_net_uuid: |
2523 |
try: |
|
2524 |
self.cfg.ReserveIp(new_net_uuid, new_ip, ec_id) |
|
2525 |
self.LogInfo("Reserving IP %s in network %s", |
|
2526 |
new_ip, new_net_obj.name) |
|
2527 |
except errors.ReservationError: |
|
2528 |
raise errors.OpPrereqError("IP %s not available in network %s" % |
|
2529 |
(new_ip, new_net_obj.name), |
|
2530 |
errors.ECODE_NOTUNIQUE) |
|
2517 |
self.cfg.ReserveIp(new_net_uuid, new_ip, ec_id) |
|
2531 | 2518 |
# new network is None so check if new IP is a conflicting IP |
2532 | 2519 |
elif self.op.conflicts_check: |
2533 | 2520 |
_CheckForConflictingIp(self, new_ip, pnode) |
2534 | 2521 |
|
2535 | 2522 |
# release old IP if old network is not None |
2536 | 2523 |
if old_ip and old_net_uuid: |
2537 |
try: |
|
2538 |
self.cfg.ReleaseIp(old_net_uuid, old_ip, False, ec_id) |
|
2539 |
except errors.AddressPoolError: |
|
2540 |
logging.warning("Release IP %s not contained in network %s", |
|
2541 |
old_ip, old_net_obj.name) |
|
2524 |
self.cfg.ReleaseIp(old_net_uuid, old_ip, False, ec_id) |
|
2542 | 2525 |
|
2543 | 2526 |
# there are no changes in (ip, network) tuple and old network is not None |
2544 | 2527 |
elif (old_net_uuid is not None and |
Also available in: Unified diff