incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Sorensen <shadow...@gmail.com>
Subject Re: VM router spawning multiple public nics
Date Tue, 28 Aug 2012 04:46:51 GMT
...
            Integer nicPos = 0;
            for (InterfaceDef nic : nics) {
                if (nic.getBrName().equalsIgnoreCase(_linkLocalBridgeName)) {
                    vlanAllocatedToVM.put("LinkLocal", nicPos);
                } else {
                    String vlanId = getVlanIdFromBridge(nic.getBrName());
                    if (vlanId != null) {
                        vlanAllocatedToVM.put(vlanId, nicPos);
                    } else {
                        vlanAllocatedToVM.put(Vlan.UNTAGGED, nicPos);
                    }
                }
                nicPos++;
            }
            IpAddressTO[] ips = cmd.getIpAddresses();
            int i = 0;
            String result = null;
            int nicNum = 0;
            for (IpAddressTO ip : ips) {
                if (!vlanAllocatedToVM.containsKey(ip.getVlanId())) {
                    /* plug a vif into router */
                    VifHotPlug(conn, routerName, ip.getVlanId(),
                            ip.getVifMacAddress());
                    vlanAllocatedToVM.put(ip.getVlanId(), nicPos++);
                }
...

Looks like the getVlanIdFromBridge might be a bit misleading. I am
running my guest public traffic on a 'cloudbr470', which is a bridge
to eth2.470, yet I configured this network as 'untagged' because I
have a vlan 470 available on eth3 for cloudstack to autoassign (eth3
is where all of my stuff will be autoassigned). So I'm not 100% sure
yet what's going on here but it seems as though the above is not
setting any 'Vlan.UNTAGGED', since it finds a vlan number for
eth2.470, but when it enumerates the IPs for the router, it then runs
ip.getVlanId() and doesn't find a nic for the untagged IP and creates
one.


I realize this is perhaps an uncommon case, but a bug nonetheless.
I'll play with the code a bit and see if I can come up with a
solution. I'm thinking I can look at the nic's broadcast URI and see
if it's supposed to be untagged, then add to vlanAllocatedToVM
appropriately, off the top of my head something like:

                    String vlanId = getVlanIdFromBridge(nic.getBrName());
                    if (vlanId != null &&
!nic.getBroadcastUri().toString().contains("untagged") {
                        vlanAllocatedToVM.put(vlanId, nicPos);
                    } else {
                        vlanAllocatedToVM.put(Vlan.UNTAGGED, nicPos);
                    }



On Mon, Aug 27, 2012 at 6:42 PM, Edison Su <Edison.su@citrix.com> wrote:
> Possible bug in in kvm code: LibvirtComputingResource->execute(IpAssocCommand cmd)->
VifHotPlug, which is only place adding nic into router vm.
> Turn on agent log, then take a look what happened.
>
>> -----Original Message-----
>> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
>> Sent: Monday, August 27, 2012 5:10 PM
>> To: cloudstack-dev@incubator.apache.org
>> Subject: VM router spawning multiple public nics
>>
>> I've got two zones running the same build of cloudstack (a recent copy
>> of master). One of them creates routers that turn into ugly
>> multi-headed beasts, and by that I mean that any time I create a port
>> forwarding or iptables rule for that router I get a new public NIC
>> with an identical IP address, I have an instance with a few tens of
>> NICs.  My guess is that some script isn't detecting that there's
>> already a NIC with the public IP on it.  It looks fine in the
>> database, there is only one public NIC defined in the nics table.
>> I'll troubleshoot it tomorrow, but if anyone knows where I should
>> begin the headstart would be appreciated.
>>
>> Thanks

Mime
View raw message