Bug 1326164

Summary: [WALA][rhel6.8]waagent fails to set default gateway
Product: Red Hat Enterprise Linux 6 Reporter: Yuxin Sun <yuxisun>
Component: WALinuxAgentAssignee: Yue Zhang <yuezha>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8CC: anderson, huishao, jjarvis, leiwang, lic_interop, lizzha, mingzhan, wshi, yuezha, yuxisun
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-09 08:48:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1359574, 1366045, 1387784    

Description Yuxin Sun 2016-04-12 02:45:01 UTC
Description of problem:
The command in the setDefaultGatway function in waagent is incorrect.

Version-Release number of selected component (if applicable):
WALinuxAgent-2.0.16-1.el6

How reproducible:
Always

Steps to Reproduce:
1. Prepare a VM on Azure and login.
2. Enable the verbose log. Enable the error log of the "setDefaultGateway" function in class AbstractDistro
# vi /etc/waagent.conf, set Logs.Verbose=y
# vi /usr/sbin/waagent, find the "setDefaultGatway" function in class AbstractDistro, set "chk_err=True"
3. service waagent restart
4. Check the /var/log/waagent.log

Actual results:
The set default gateway command is "/sbin/route add default gw172.19.0.1" which is incorrect, so that it cannot be executed successfully.

Messages in /var/log/waagent.log:
2016/04/08 02:52:39 Set default gateway: 172.19.0.1
2016/04/08 02:52:39 /sbin/route add default gw172.19.0.1
2016/04/08 02:52:39 ERROR:CalledProcessError.  Error Code is 7
2016/04/08 02:52:39 ERROR:CalledProcessError.  Command string was /sbin/route add default gw172.19.0.1
2016/04/08 02:52:39 ERROR:CalledProcessError.  Command result was SIOCADDRT: No such device

Expected results:
The set default gateway command is correct.

Additional info:
The root cause is there's no space between "gw" and gateway address in the setDefaultGateway function in class AbstractDistro.

Comment 3 Yuxin Sun 2016-08-09 08:48:28 UTC
Fixed in WALinuxAgent-2.1.5. Verify and close it.

*** This bug has been marked as a duplicate of bug 1360493 ***