Bug 1256312

Summary: The facts option picks a wrong network interface
Product: Red Hat Enterprise Linux 7 Reporter: xingge <gxing>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED NOTABUG QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: alikins, fnguyen, gxing, ldai, liliu, qianzhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-11 08:43:07 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:
Embargoed:

Description xingge 2015-08-24 10:59:40 UTC
Description of problem:
The facts option picks a wrong network interface

Version-Release number of selected component (if applicable):
subscription-manager-gui-1.15.9-6.el7.x86_64
subscription-manager-1.15.9-6.el7.x86_64
subscription-manager-initial-setup-addon-1.15.9-6.el7.x86_64
python-rhsm-1.15.4-2.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1.list the system's network inter face
[root@dhcp-128-252 ~]# ifconfig
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500 <------should be picked by the facts option 
        inet 10.66.129.236  netmask 255.255.254.0  broadcast 10.66.129.255
        inet6 fe80::5054:ff:fe5d:abd  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:5d:0a:bd  txqueuelen 1000  (Ethernet)
        RX packets 56631  bytes 4316546 (4.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2206  bytes 723292 (706.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 72  bytes 6720 (6.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 72  bytes 6720 (6.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:65:1f:26  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2.use facts option to list the system's network
[root@dhcp-128-252 ~]# subscription-manager facts | grep network
network.hostname: dhcp-128-252.nay.redhat.com
network.ipv4_address: 127.0.0.1       <--------------wrong interface picked
network.ipv6_address: ::1       <------------------also wrong interface

Actual results:
As the step2 shows 

Expected results:
The facts option should pick ens3's ip address not the lo's.

Additional info:
I think the facts option netwok may kind of unnecessary now cause we have the net option like below:
[root@dhcp-128-252 ~]# subscription-manager facts | grep "net.interface"
net.interface.ens3.ipv4_address: 10.66.129.236
net.interface.ens3.ipv4_broadcast: 10.66.129.255
net.interface.ens3.ipv4_netmask: 23
net.interface.ens3.ipv6_address.link: fe80::5054:ff:fe5d:abd
net.interface.ens3.ipv6_netmask.link: 64
net.interface.ens3.mac_address: 52:54:00:5D:0A:BD
net.interface.lo.ipv4_address: 127.0.0.1
net.interface.lo.ipv4_broadcast: Unknown
net.interface.lo.ipv4_netmask: 8
net.interface.lo.ipv6_address.host: ::1
net.interface.lo.ipv6_netmask.host: 128
net.interface.virbr0-nic.mac_address: 52:54:00:65:1F:26
net.interface.virbr0.ipv4_address: 192.168.122.1
net.interface.virbr0.ipv4_broadcast: 192.168.122.255
net.interface.virbr0.ipv4_netmask: 24
net.interface.virbr0.mac_address: 52:54:00:65:1F:26

Comment 1 Filip Nguyen 2015-09-03 11:16:02 UTC
network.ipv4_address is a result of IP resolution for your hostname, not 'a pick' from the list of interfaces. What is your output for commands:
 sudo cat /etc/hostname
 sudo cat /etc/resolv.conf
 sudo cat /etc/hosts
 sudo cat /etc/sysconfig/network
 hostname
 arp -n $(hostname)
 ping -c 1 $(hostname)

Comment 2 Filip Nguyen 2015-09-11 08:43:07 UTC
Closing this as not a bug.