DaanHoogland commented on code in PR #7634:
URL: https://github.com/apache/cloudstack/pull/7634#discussion_r1262418129
##########
server/src/main/java/com/cloud/network/NetworkModelImpl.java:
##########
@@ -593,13 +590,24 @@ public List<? extends Nic> getNics(long vmId) {
@Override
public String getNextAvailableMacAddressInNetwork(long networkId) throws
InsufficientAddressCapacityException {
NetworkVO network = _networksDao.findById(networkId);
- String mac = _networksDao.getNextAvailableMacAddress(networkId,
MACIdentifier.value());
- if (mac == null) {
- throw new InsufficientAddressCapacityException("Unable to create
another mac address", Network.class, networkId);
+ Integer zoneIdentifier = MACIdentifier.value();
+ if (zoneIdentifier.intValue() == 0) {
+ zoneIdentifier =
Long.valueOf(network.getDataCenterId()).intValue();
}
+ String mac;
+ do {
+ mac = _networksDao.getNextAvailableMacAddress(networkId,
zoneIdentifier);
+ if (mac == null) {
+ throw new InsufficientAddressCapacityException("Unable to
create another mac address", Network.class, networkId);
+ }
+ } while(isMACUnique(mac));
Review Comment:
```suggestion
} while(! isMACUnique(mac));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]