[
https://issues.apache.org/jira/browse/CLOUDSTACK-9717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15907603#comment-15907603
]
ASF GitHub Bot commented on CLOUDSTACK-9717:
--------------------------------------------
Github user rafaelweingartner commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1878#discussion_r105678507
--- Diff:
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();
--- End diff --
This method is still quite big.
What about extracting lines 1966-1971 to a method? These lines are used to
generate/create the `sbNewMacSequence`. Then we could have a documentation
describing its workings and test cases.
> [VMware] RVRs have mismatching MAC addresses for extra public NICs
> ------------------------------------------------------------------
>
> Key: CLOUDSTACK-9717
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9717
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Network Controller, VMware
> Reporter: Suresh Kumar Anaparti
> Assignee: Suresh Kumar Anaparti
> Fix For: 4.10.0.0
>
>
> [CLOUDSTACK-985|https://issues.apache.org/jira/browse/CLOUDSTACK-985] doesn't
> seem to be completely fixed.
> ISSUE
> ==================
> If there are two public networks on two VLANs, and a pair redundant VRs
> acquire IPs from both, the associated NICs on the redundant VRs will have
> mismatching MAC addresses.
> The example below shows the eth2 NICs for the first public network
> (210.140.168.0/21) have matching MAC addresses (06:c4:b6:00:03:df) as
> expected, but the eth3 NICs for the second one (210.140.160.0/21) have
> mismatching MACs (02:00:50:e1:6c:cd versus 02:00:5a:e6:6c:d5).
> *r-43584-VM (Master)*
> 6: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UNKNOWN
> qlen 1000
> link/ether 06:c4:b6:00:03:df brd ff:ff:ff:ff:ff:ff
> inet 210.140.168.42/21 brd 210.140.175.255 scope global eth2
> inet 210.140.168.20/21 brd 210.140.175.255 scope global secondary eth2
> 8: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UNKNOWN
> qlen 1000
> link/ether 02:00:50:e1:6c:cd brd ff:ff:ff:ff:ff:ff
> inet 210.140.162.124/21 brd 210.140.167.255 scope global eth3
> inet 210.140.163.36/21 brd 210.140.167.255 scope global secondary eth3
> *r-43585-VM (Backup)*
> 6: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
> link/ether 06:c4:b6:00:03:df brd ff:ff:ff:ff:ff:ff
> inet 210.140.168.42/21 brd 210.140.175.255 scope global eth2
> inet 210.140.168.20/21 brd 210.140.175.255 scope global secondary eth2
> 8: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
> link/ether 02:00:5a:e6:6c:d5 brd ff:ff:ff:ff:ff:ff
> inet 210.140.162.124/21 brd 210.140.167.255 scope global eth3
> inet 210.140.163.36/21 brd 210.140.167.255 scope global secondary eth3
> CloudStack should ensure that the NICs for all public networks have matching
> MACs.
> REPRO STEPS
> ==================
> 1) Set up redundant VR.
> 2) Set up multiple public networks on different VLANs.
> 3) Acquire IPs in the RVR network until the VRs get IPs in the different
> public networks.
> 4) Confirm the mismatching MAC addresses.
> EXPECTED BEHAVIOR
> ==================
> Redundant VRs have matching MACs for all public networks.
> ACTUAL BEHAVIOR
> ==================
> Redundant VRs have matching MACs only for the first public network.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)