EduFrazao commented on code in PR #13603:
URL: https://github.com/apache/cloudstack/pull/13603#discussion_r4388971752
##########
core/src/main/java/com/cloud/resource/ServerResourceBase.java:
##########
@@ -106,8 +117,74 @@ protected void defineResourceNetworkInterfaces(Map<String,
Object> params) {
this.storageNic2 = NetUtils.getNetworkInterface(storageNic2);
}
+ private void checkForPrivateInterfaceDefinedByIp(Map<String, Object>
params) {
+ final String ifAddr = StringUtils.trimToNull((String)
params.get("private.network.address"));
+ if (ifAddr != null) {
+ logger.debug(String.format("Trying to use private address to
resolve interface: [%s]", ifAddr));
+ try {
+ InetAddress rawAddr =
InetAddress.getByAddress(InetAddress.getByName(ifAddr).getAddress());
+ final NetworkInterface nic =
NetworkInterface.getByInetAddress(rawAddr);
+ if (nic != null) {
+ logger.info("Using NIC [{}] as private NIC. Source:
InterfaceAddress [{}]", nic, ifAddr);
+ privateNic = nic;
+ } else {
+ logger.info("Unable to found private NIC with defined ip
[{}]", ifAddr);
+ }
+ } catch (Exception e) {
+ // Logging only, if this method was unable to find a valid
interface, iteration will be tested
+ logger.info("Unable to use private address to get the
management interface: [{}]", e.getMessage());
+ }
+ }
+ }
+
+ private String[] collectMgmtHostIp(Map<String, Object> params) {
+ final String hosts = (String) params.get("host");
+ if (hosts != null && hosts.trim().length() > 0) {
+ logger.info(String.format("Parsing host setting: [%s]", hosts));
+ final Set<String> hostCollection = new LinkedHashSet<String>();
+ if (hosts.contains(",")) {
+ for(final String ip : hosts.split(",")) {
+ final String h = ip.contains("@") ? ip.split("@")[0] : ip;
+ hostCollection.add(h.trim());
+ }
+ } else {
+ hostCollection.add(hosts.trim());
Review Comment:
You are right, this was an error. Fixed!
--
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]