Revision 1b68f268 lib/config.py
b/lib/config.py | ||
---|---|---|
277 | 277 |
prefix = None |
278 | 278 |
if net: |
279 | 279 |
net_uuid = self._UnlockedLookupNetwork(net) |
280 |
if net_uuid: |
|
281 |
nobj = self._UnlockedGetNetwork(net_uuid) |
|
282 |
if nobj.mac_prefix: |
|
283 |
prefix = nobj.mac_prefix |
|
280 |
nobj = self._UnlockedGetNetwork(net_uuid) |
|
281 |
if nobj.mac_prefix: |
|
282 |
prefix = nobj.mac_prefix |
|
284 | 283 |
|
285 | 284 |
return prefix |
286 | 285 |
|
... | ... | |
366 | 365 |
|
367 | 366 |
""" |
368 | 367 |
net_uuid = self._UnlockedLookupNetwork(net) |
369 |
if net_uuid: |
|
370 |
self._UnlockedReleaseIp(net_uuid, address, ec_id) |
|
368 |
self._UnlockedReleaseIp(net_uuid, address, ec_id) |
|
371 | 369 |
|
372 | 370 |
@locking.ssynchronized(_config_lock, shared=1) |
373 | 371 |
def GenerateIp(self, net, ec_id): |
... | ... | |
411 | 409 |
|
412 | 410 |
""" |
413 | 411 |
net_uuid = self._UnlockedLookupNetwork(net) |
414 |
if net_uuid: |
|
415 |
return self._UnlockedReserveIp(net_uuid, address, ec_id) |
|
412 |
return self._UnlockedReserveIp(net_uuid, address, ec_id) |
|
416 | 413 |
|
417 | 414 |
@locking.ssynchronized(_config_lock, shared=1) |
418 | 415 |
def ReserveLV(self, lv_name, ec_id): |
... | ... | |
1457 | 1454 |
for nic in instance.nics: |
1458 | 1455 |
if nic.network is not None and nic.ip is not None: |
1459 | 1456 |
net_uuid = self._UnlockedLookupNetwork(nic.network) |
1460 |
if net_uuid: |
|
1461 |
# Return all IP addresses to the respective address pools |
|
1462 |
self._UnlockedCommitIp(constants.RELEASE_ACTION, net_uuid, nic.ip) |
|
1457 |
# Return all IP addresses to the respective address pools |
|
1458 |
self._UnlockedCommitIp(constants.RELEASE_ACTION, net_uuid, nic.ip) |
|
1463 | 1459 |
|
1464 | 1460 |
del self._config_data.instances[instance_name] |
1465 | 1461 |
self._config_data.cluster.serial_no += 1 |
... | ... | |
2477 | 2473 |
if check_uuid: |
2478 | 2474 |
self._EnsureUUID(net, ec_id) |
2479 | 2475 |
|
2480 |
existing_uuid = self._UnlockedLookupNetwork(net.name) |
|
2481 |
if existing_uuid: |
|
2482 |
raise errors.OpPrereqError("Desired network name '%s' already" |
|
2483 |
" exists as a network (UUID: %s)" % |
|
2484 |
(net.name, existing_uuid), |
|
2485 |
errors.ECODE_EXISTS) |
|
2486 | 2476 |
net.serial_no = 1 |
2487 | 2477 |
self._config_data.networks[net.uuid] = net |
2488 | 2478 |
self._config_data.cluster.serial_no += 1 |
... | ... | |
2502 | 2492 |
for net in self._config_data.networks.values(): |
2503 | 2493 |
if net.name == target: |
2504 | 2494 |
return net.uuid |
2505 |
return None |
|
2495 |
raise errors.OpPrereqError("Network '%s' not found" % target, |
|
2496 |
errors.ECODE_NOENT) |
|
2506 | 2497 |
|
2507 | 2498 |
@locking.ssynchronized(_config_lock, shared=1) |
2508 | 2499 |
def LookupNetwork(self, target): |
... | ... | |
2549 | 2540 |
|
2550 | 2541 |
""" |
2551 | 2542 |
net_uuid = self._UnlockedLookupNetwork(net) |
2552 |
if net_uuid is None: |
|
2553 |
return None |
|
2554 |
|
|
2555 | 2543 |
node_info = self._UnlockedGetNodeInfo(node) |
2556 | 2544 |
nodegroup_info = self._UnlockedGetNodeGroup(node_info.group) |
2557 | 2545 |
netparams = nodegroup_info.networks.get(net_uuid, None) |
Also available in: Unified diff