[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simon Godard updated CLOUDSTACK-9431:
-------------------------------------
    Description: 
After upgrading to ACS 4.7.1 and our Virtual routers to 4.6.0, we noticed that 
the Network usage (bytes sent and received) were not good anymore. Bytes sent 
are now 0 and bytes received appear to be what used to be bytes sent before the 
update.

We are using Advanced networking with VPC on Xen Server 6.5.

I have checked the CloudStack Java code that is handling retrieving the network 
stats and nothing changed for a long time. What changed is the way the Virtual 
router is configured (now using Python scripts). After comparing the previous 
_iptables_ rules, I noticed something weird with the NETWORK_STATS_eth1 chain:
{noformat}
iptables -L NETWORK_STATS_eth1 -n -v -x

Chain NETWORK_STATS_eth1 (1 references)
    pkts      bytes    target      prot opt in     out     source               
destination         
       0        0        all            --  *      eth1    0.0.0.0/0            
10.188.216.0/24     
   47170  7755561        all            --  *      eth1    10.188.216.0/24      
0.0.0.0/0           
       0        0        all            --  *      eth1    0.0.0.0/0            
10.188.218.0/24     
   71957 689541123       all            --  *      eth1    10.188.218.0/24      
0.0.0.0/0  
{noformat}

The rules are out of order and the _in_ and _out_ too. Now, if we compare those 
rules against the previous ones (version 4.4.4 of the VR):
{noformat}
iptables -L NETWORK_STATS_eth1 -n -v -x

Chain NETWORK_STATS_eth1 (1 references)
 pkts bytes target     prot opt in     out     source               destination 
        
35167 2673K            all  --  any    eth1    10.158.216.0/22      anywhere    
        
33036 2511K            all  --  eth1   any     anywhere             
10.158.216.0/22     
{noformat}

Once I noticed the differences, I tried to find the root cause in CsAddress.py
The following lines appear to be problematic.
{noformat}
self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
                            ("eth1", "eth1", self.address['network'])])
self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -d %s" %
                            ("eth1", "eth1", self.address['network'])])
{noformat}

After updating them to be the following (note the -i instead of -o on the 
second line), the network stats are back to normal:
{noformat}
self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
                            ("eth1", "eth1", self.address['network'])])
self.fw.append(["", "front", "-A NETWORK_STATS_%s -i %s -d %s" %
                            ("eth1", "eth1", self.address['network'])])
{noformat}

  was:
After upgrading to ACS 4.7.1 and our Virtual routers to 4.6.0, we noticed that 
the Network usage (bytes sent and received) were not good anymore. Bytes sent 
are now 0 and bytes received appear to be what used to be bytes sent before the 
update.

We are using Advanced networking with VPC on Xen Server 6.5.

I have checked the CloudStack Java code that is handling retrieving the network 
stats and nothing changed for a long time. What changed is the way the Virtual 
router is configured (now using Python scripts). After comparing the previous 
_iptables_ rules, I noticed something weird with the NETWORK_STATS_eth1 chain:
{noformat}
iptables -L NETWORK_STATS_eth1 -n -v -x

Chain NETWORK_STATS_eth1 (1 references)
    pkts      bytes    target      prot opt in     out     source               
destination         
       0        0        all            --  *      eth1    0.0.0.0/0            
10.188.216.0/24     
   47170  7755561        all            --  *      eth1    10.188.216.0/24      
0.0.0.0/0           
       0        0        all            --  *      eth1    0.0.0.0/0            
10.188.218.0/24     
   71957 689541123       all            --  *      eth1    10.188.218.0/24      
0.0.0.0/0  
{noformat}

The rules are out of order and the _in_ and _out_ too. Now, if we compare those 
rules against the previous ones (version 4.4.4 of the VR):
{noformat}
iptables -L NETWORK_STATS_eth1 -n -v -x

Chain NETWORK_STATS_eth1 (1 references)
 pkts bytes target     prot opt in     out     source               destination 
        
35167 2673K            all  --  any    eth1    10.158.216.0/22      anywhere    
        
33036 2511K            all  --  eth1   any     anywhere             
10.158.216.0/22     
{noformat}

Once I noticed the differences, I tried to find the root cause in CsAddress.py
The following lines appear to be problematic.
{noformat}
self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
                            ("eth1", "eth1", self.address['network'])])
            self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -d %s" %
                            ("eth1", "eth1", self.address['network'])])
{noformat}

After updating them to be the following (note the -i instead of -o on the 
second line), the network stats are back to normal:
{noformat}
self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
                            ("eth1", "eth1", self.address['network'])])
            self.fw.append(["", "front", "-A NETWORK_STATS_%s -i %s -d %s" %
                            ("eth1", "eth1", self.address['network'])])
{noformat}


> Network usage stats from VR in VPC are wring after upgrading to ACS 4.7
> -----------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9431
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9431
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: Usage, Virtual Router
>    Affects Versions: 4.7.1
>            Reporter: Simon Godard
>
> After upgrading to ACS 4.7.1 and our Virtual routers to 4.6.0, we noticed 
> that the Network usage (bytes sent and received) were not good anymore. Bytes 
> sent are now 0 and bytes received appear to be what used to be bytes sent 
> before the update.
> We are using Advanced networking with VPC on Xen Server 6.5.
> I have checked the CloudStack Java code that is handling retrieving the 
> network stats and nothing changed for a long time. What changed is the way 
> the Virtual router is configured (now using Python scripts). After comparing 
> the previous _iptables_ rules, I noticed something weird with the 
> NETWORK_STATS_eth1 chain:
> {noformat}
> iptables -L NETWORK_STATS_eth1 -n -v -x
> Chain NETWORK_STATS_eth1 (1 references)
>     pkts      bytes    target      prot opt in     out     source             
>   destination         
>        0        0        all            --  *      eth1    0.0.0.0/0          
>   10.188.216.0/24     
>    47170  7755561        all            --  *      eth1    10.188.216.0/24    
>   0.0.0.0/0           
>        0        0        all            --  *      eth1    0.0.0.0/0          
>   10.188.218.0/24     
>    71957 689541123       all            --  *      eth1    10.188.218.0/24    
>   0.0.0.0/0  
> {noformat}
> The rules are out of order and the _in_ and _out_ too. Now, if we compare 
> those rules against the previous ones (version 4.4.4 of the VR):
> {noformat}
> iptables -L NETWORK_STATS_eth1 -n -v -x
> Chain NETWORK_STATS_eth1 (1 references)
>  pkts bytes target     prot opt in     out     source               
> destination         
> 35167 2673K            all  --  any    eth1    10.158.216.0/22      anywhere  
>           
> 33036 2511K            all  --  eth1   any     anywhere             
> 10.158.216.0/22     
> {noformat}
> Once I noticed the differences, I tried to find the root cause in CsAddress.py
> The following lines appear to be problematic.
> {noformat}
> self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
>                             ("eth1", "eth1", self.address['network'])])
> self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -d %s" %
>                             ("eth1", "eth1", self.address['network'])])
> {noformat}
> After updating them to be the following (note the -i instead of -o on the 
> second line), the network stats are back to normal:
> {noformat}
> self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
>                             ("eth1", "eth1", self.address['network'])])
> self.fw.append(["", "front", "-A NETWORK_STATS_%s -i %s -d %s" %
>                             ("eth1", "eth1", self.address['network'])])
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to