rafaelweingartner commented on a change in pull request #2653: Generate MAC
address if the MAC in command addNicToVirtualMachine is invalid
URL: https://github.com/apache/cloudstack/pull/2653#discussion_r189051475
##########
File path: server/src/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -1228,12 +1230,22 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd
cmd) throws InvalidParameterV
return _vmDao.findById(vmInstance.getId());
}
+ /**
+ * It checks if the given mac is null, in case of a null mac it calls
method {@link com.cloud.network.NetworkModel
#getNextAvailableMacAddressInNetwork(long)} and returns the generated mac
address
+ */
+ protected String getNextAvailableMacAddressInNetworkIfMacIsNull(String
macAddress, long networkId) {
Review comment:
You are not getting the "next available" if the provided MAC is null. You
are looking for the next possible MAC address if the provided one is
**invalid**. Therefore, you address not only the `null`, empty, and blank
cases, but also cases where the provided String is an invalid MAC address.
Having said that, I think the method name and its documentation can benefit
from improvements.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services