BryanMLima commented on code in PR #7634:
URL: https://github.com/apache/cloudstack/pull/7634#discussion_r1235809160
##########
api/src/main/java/com/cloud/network/NetworkModel.java:
##########
@@ -114,6 +114,13 @@ public interface NetworkModel {
List<? extends Nic> getNics(long vmId);
+ /**
+ * gets the next available MAC and checks it for global uniqueness in the
nics table. It will keep looking till it fins a nic to use.
Review Comment:
```suggestion
* Gets the next available MAC and checks it for global uniqueness in
the nics table. It will keep looking until it finds a MAC address that it is
unique.
```
##########
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 zoneIdentifyer = MACIdentifier.value();
+ if (zoneIdentifyer.intValue() == 0) {
+ zoneIdentifyer =
Long.valueOf(network.getDataCenterId()).intValue();
}
+ String mac;
+ do {
+ mac = _networksDao.getNextAvailableMacAddress(networkId,
zoneIdentifyer);
Review Comment:
```suggestion
Integer zoneIdentifier = MACIdentifier.value();
if (zoneIdentifier.intValue() == 0) {
zoneIdentifier =
Long.valueOf(network.getDataCenterId()).intValue();
}
String mac;
do {
mac = _networksDao.getNextAvailableMacAddress(networkId,
zoneIdentifier);
```
--
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]