Redundant VRouter guest network on wrong interface
ISSUE TYPE
- Bug Report
COMPONENT NAME
redundant VPC Offering
CLOUDSTACK VERSION
master
CONFIGURATION
Standard cluster deployment regarding this issue. No changes made to sytemvm or the offerings involved.
OS / ENVIRONMENT
Seems to work only with OvS bridges. KVM with OvS Projects with VPCs
SUMMARY
Redundant vRouter Offering doesn't work because guest network is on wrong interface in vRouter
STEPS TO REPRODUCE
- Add VPC; choose Redundant VPC Offering
- Create a guest network/instance to allow for redundancy to build up
- some network is created on the wrong interface:

EXPECTED RESULTS
The guest network should be added on eth1 because this is the interface where both vRouters share the MAC address.
ACTUAL RESULTS
Redundancy state of the redundant routers changes from UNKNOWN to FAILED because conntrackd and keepalived cannot establish the VRRP redundancy between the two vRouters.
@DennisKonrad Does the issue happen occasionally ? Can it be reproduced by the steps you mentioned?
Everytime we try to deploy redundant offering for VPCs.
It only seems to happen with OvS bridges though. I tried to reproduce it with Linux Bridges but there it did work.
@DennisKonrad have you tried with offering with single router?
@ustcweizhou The single Router offering works like a charm in this setup. We use that for hundreds of VMs
@DennisKonrad now we can conclude the issue happens with ovs and redundant VPC offering. did you have this issue in old versions ? for example, 4.9.X or 4.11.X ?
@ustcweizhou It's very likely the issue is very old. My colleague mentioned it could be as old as 4.6 ...
We are currently trying to find out more about where the issue originates. It looks like the hint fmaximus gave is in parts true: In the json file the VPC-router receives, the dev_num and vif_mac address are wrong for the public ip. So whereever this gets matched the error happens.
@DennisKonrad can you reproduce the issue and upload some mgt logs ? you can grep the log by job id (job-XXXXX).
@weizhouapache The management logs are mostly uninteresting. But they also show that both VPC-router go into BACKUP state:

Also we checked and found out, that the redundant VPC ist not using the https://github.com/apache/cloudstack/blob/9e6ee7c63e8b3073f9855511fe7cb004414b2dd4/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java#L1756
We think that this is very likely the root of this issue.
@DennisKonrad we have a fix for another issue with VPC, maybe it solves this bug.
diff --git a/server/src/main/java/com/cloud/network/router/CommandSetupHelper.java b/server/src/main/java/com/cloud/network/router/CommandSetupHelper.java
index f9ffeb9..e2da241 100644
--- a/server/src/main/java/com/cloud/network/router/CommandSetupHelper.java
+++ b/server/src/main/java/com/cloud/network/router/CommandSetupHelper.java
@@ -866,7 +866,12 @@ public class CommandSetupHelper {
}
}
- final IpAssocCommand cmd = new IpAssocCommand(ipsToSend);
+ final IpAssocCommand cmd;
+ if (router.getVpcId() != null) {
+ cmd = new IpAssocVpcCommand(ipsToSend);
+ } else {
+ cmd = new IpAssocCommand(ipsToSend);
+ }
cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(associatedWithNetworkId, router.getId()));
cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
can you try with it ?
@weizhouapache Thanks! Looks very promising. I will compile/test and come back to report if that fixes it.
@weizhouapache I tested now and hit a related error. In https://github.com/apache/cloudstack/blob/96d98de85cdce3ab9e33c6dda6ffa131d825cd85/systemvm/debian/opt/cloud/bin/cs/CsAddress.py#L261 it fails with: self.dnum = hex(100 + int(dev[3:]))ValueError: invalid literal for int() with base 10: 'None'
After that the deployment of the redundant vpc fails and the router is deleted (The second one does not even start to deploy). I'll try to step through code tomorrow and see why there is no device number. Also I will try to get my hands on to the generated json file.
Do you see anything suspicious?
@DennisKonrad I will test it as well
@weizhouapache I found that the json the router receives really does not have the "nic_dev_id" set at all. Therefor the script fails because the value has "null" asigned then.
redundant VPC `{"ip_address":[ {"public_ip":"172.20.20.12","source_nat":true,"add":true,"one_to_one_nat":false,"first_i_p":true,"gateway":"172.20.0.1","netmask":"255.255.0.0","vif_mac_address":"1e:00:d5:00:00:c2","new_nic":false,"nw_type":"Public"}],"type":"ips"}
non redundant VPC {"ip_address":[ {"public_ip":"172.20.20.13","source_nat":true,"add":true,"one_to_one_nat":false,"first_i_p":true,"gateway":"172.20.0.1","netmask":"255.255.0.0","vif_mac_address":"1e:00:f4:00:00:c3","nic_dev_id":1,"new_nic":false,"nw_type":"Public"}],"type":"ips"}`
@DennisKonrad I reverted #2304, and it works
@DennisKonrad I believe this is a regress issue caused by #2304 I think we should revert #2304, and look for another solution for the issue mentioned in in the title of #2304 However, I did not find more information about the issue.
@weizhouapache Hi Weizhou, sorry that I rummage in between. i think #2304 was introduced from @fmaximus because we had some problem with the interface order on "OVS", "OpenvSwitch". There was no possibility to add a nat or something like that. Now linux bridges and OVS will work. From my side a better way would be to change the redundant VR component like the non redundant.
Can you support on this side? Can you give us some hints how and where we change the redundant part of VR?
@svenvogel @DennisKonrad
there are two methods to handle ip association in LibvirtComputingResource.java
public ExecutionResult prepareNetworkElementCommand(final IpAssocCommand cmd) {
protected ExecutionResult prepareNetworkElementCommand(final IpAssocVpcCommand cmd) {
In the past they have almost same processing. @fmaximus has changed the second method in #2304 for openvswitch setup. the first method is not changed which might be the root cause of this issue #3679 @DennisKonrad .
For now all ip association in normal setup(vpc with rvr, linux bridge) are handled by the first method, which work fine. I did not see any IpAssocVpcCommand (all are IpAssocCommand ) so I am confused how issue mentioned in #2304 is fixed. @svenvogel can you give me more details ?
I found the mac address of nic and ip addresses are different, which might be why nic device id is determined by broadcast uri instead of mac address, and also the reason device id is null reported by @DennisKonrad in https://github.com/apache/cloudstack/issues/3179#issuecomment-553940664
in my opinion, we should (1) apply the change in https://github.com/apache/cloudstack/issues/3179#issuecomment-552463825 (2) different process for ovs and linux bridge in the two method above. to be clear, nic device id is determined by mac address map (if ovs) or broadcast url (if linux bridge).
@weizhouapache The second function
prepareNetworkElementCommand(final IpAssocVpcCommand cmd)
does work for linux bridge and ovs at the moment I think. But it doen't work for the redundant vpc offering with ovs.
Can you explain why you want to
(1) apply the change in #3179 (comment)
Do you think it would be possible to write a mac address map based function for both (ovs and linux bridge)?
@DennisKonrad I did not see any IpAssocVpcCommand in management server log, so I think all are IpAssocCommand , even when ip is associated to a VPC. Please correct me if I am wrong
We have seen and fixed many issues with VPC & RvRs in cloudstack 4.7.1, especially when there are multiple public ip ranges. For example, network element should not be cleaned up when de-associate a public ip. https://github.com/apache/cloudstack/blob/master/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java#L377-L382 If IP is associated/de-associated to an isolated network, the command should be IpAssocCommand If IP is associated/de-associated to a VPC, the command should be IpAssocVpcCommand
the second function
prepareNetworkElementCommand(final IpAssocVpcCommand cmd)
does NOT work for normal setup (linux bridge), if we apply the change in https://github.com/apache/cloudstack/issues/3179#issuecomment-552463825
as you said in https://github.com/apache/cloudstack/issues/3179#issuecomment-553641686
I have changed the first function to similar behavior as the second function. I got the same issue as the description (source nat ip on eth2, but no ip on eth1). Now I can conclude that the issue is a regression issue after #2304, but the root cause should be wrong mac address of public ip addresses. https://github.com/apache/cloudstack/blob/master/server/src/main/java/com/cloud/network/router/CommandSetupHelper.java#L812-L814