You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@git.apache.org on 2017/05/02 13:06:42 UTC

[GitHub] sateesh-chodapuneedi commented on a change in pull request #1878: CLOUDSTACK-9717: [VMware] RVRs have mismatching MAC addresses for extra public NICs.

sateesh-chodapuneedi commented on a change in pull request #1878: CLOUDSTACK-9717: [VMware] RVRs have mismatching MAC addresses for extra public NICs.
URL: https://github.com/apache/cloudstack/pull/1878#discussion_r114313044
 
 

 ##########
 File path: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
 ##########
 @@ -1928,6 +1929,54 @@ protected StartAnswer execute(StartCommand cmd) {
             VirtualDevice nic;
             int nicMask = 0;
             int nicCount = 0;
+
+            if (vmSpec.getType() == VirtualMachine.Type.DomainRouter) {
+                int extraPublicNics = mgr.getRouterExtraPublicNics();
+                if (extraPublicNics > 0 && vmSpec.getDetails().containsKey("PeerRouterInstanceName")) {
+                    //Set identical MAC address for RvR on extra public interfaces
+                    String peerRouterInstanceName = vmSpec.getDetails().get("PeerRouterInstanceName");
+
+                    VirtualMachineMO peerVmMo = hyperHost.findVmOnHyperHost(peerRouterInstanceName);
+                    if (peerVmMo == null) {
+                        peerVmMo = hyperHost.findVmOnPeerHyperHost(peerRouterInstanceName);
+                    }
+
+                    if (peerVmMo != null) {
+                        StringBuffer sbOldMacSequence = new StringBuffer();
+                        for (NicTO oldNicTo : sortNicsByDeviceId(nics)) {
+                            sbOldMacSequence.append(oldNicTo.getMac()).append("|");
+                        }
+                        if (!sbOldMacSequence.toString().isEmpty()) {
+                            sbOldMacSequence.deleteCharAt(sbOldMacSequence.length() - 1); //Remove extra '|' char appended at the end
+                        }
+
+                        for (int nicIndex = nics.length - extraPublicNics; nicIndex < nics.length; nicIndex++) {
+                            VirtualDevice nicDevice = peerVmMo.getNicDeviceByIndex(nics[nicIndex].getDeviceId());
+                            if (nicDevice != null) {
+                                String mac = ((VirtualEthernetCard)nicDevice).getMacAddress();
+                                if (mac != null) {
+                                    s_logger.info("Use same MAC as previous RvR, the MAC is " + mac + " for extra NIC with device id: " + nics[nicIndex].getDeviceId());
+                                    nics[nicIndex].setMac(mac);
+                                }
+                            }
+                        }
+
+                        String bootArgs = vmSpec.getBootArgs();
+                        if (!StringUtils.isEmpty(bootArgs)) {
+                            StringBuffer sbNewMacSequence = new StringBuffer();
 
 Review comment:
   Yes, I'd second this.
 
----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services