Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1559534

Summary: get_network_interfaces.yml erroneously relies on active field being present
Product: [oVirt] ovirt-hosted-engine-setup Reporter: Kyle Stapp <RabidCicada>
Component: ToolsAssignee: Simone Tiraboschi <stirabos>
Status: CLOSED CURRENTRELEASE QA Contact: Nikolai Sednev <nsednev>
Severity: low Docs Contact:
Priority: medium    
Version: 2.2.9CC: bugs, ylavi
Target Milestone: ovirt-4.2.3Keywords: Triaged
Target Release: 2.2.15Flags: rule-engine: ovirt-4.2+
ylavi: exception+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-hosted-engine-setup-2.2.15-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-10 06:29:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1458709    
Attachments:
Description Flags
Patch to fix problem none

Description Kyle Stapp 2018-03-22 17:43:45 UTC
Created attachment 1411810 [details]
Patch to fix problem

Description of problem:


Version-Release number of selected component (if applicable):
2.2.9 -> Master/Tip


How reproducible:
Always

Steps to Reproduce:
1.Have machine with secondary ip's assign to interfaces
E.G.

cat /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33
BOOTPROTO=none
DEFROUTE=yes
NAME=ens33
ONBOOT=yes
TYPE=Ethernet
IPADDR=10.10.10.4
PREFIX=28
GATEWAY=10.10.10.2
NM_CONTROLLED=no
[devel@tester ~]$ cat /etc/sysconfig/network-scripts/ifcfg-ens33:0

DEVICE=ens33:0
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.10.10.5
NETMASK=255.255.255.240
NM_CONTROLLED=no

2. Run `sudo hosted-engine --deploy`


Actual results:
[ INFO  ] TASK [Get all active network interfaces]
[ ERROR ] fatal: [localhost]: FAILED! => {"msg": "The conditional check '( ( item != 'lo' ) and ( hostvars[inventory_hostname]['ansible_' + item]['active'] ) and ( hostvars[inventory_hostname]['ansible_' + item]['type'] != 'bridge' ) and ( ( hostvars[inventory_hostname]['ansible_' + item]['ipv4'] is defined ) or ( hostvars[inventory_hostname]['ansible_' + item]['ipv6'] is defined ) or ( ( hostvars[inventory_hostname]['ansible_' + item]['type'] == 'bonding' ) and ( hostvars[inventory_hostname]['ansible_' + item]['slaves'][0] is defined ) and ( hostvars[inventory_hostname]['ansible_' + item]['mode'] in acceptable_bond_modes ) ) ) )' failed. The error was: error while evaluating conditional (( ( item != 'lo' ) and ( hostvars[inventory_hostname]['ansible_' + item]['active'] ) and ( hostvars[inventory_hostname]['ansible_' + item]['type'] != 'bridge' ) and ( ( hostvars[inventory_hostname]['ansible_' + item]['ipv4'] is defined ) or ( hostvars[inventory_hostname]['ansible_' + item]['ipv6'] is defined ) or ( ( hostvars[inventory_hostname]['ansible_' + item]['type'] == 'bonding' ) and ( hostvars[inventory_hostname]['ansible_' + item]['slaves'][0] is defined ) and ( hostvars[inventory_hostname]['ansible_' + item]['mode'] in acceptable_bond_modes ) ) ) )): 'dict object' has no attribute 'active'\n\nThe error appears to have been in '/usr/share/ovirt-hosted-engine-setup/ansible/get_network_interfaces.yml': line 6, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n  tasks:\n  - name: Get all active network interfaces\n    ^ here\n"}
[ ERROR ] Failed to execute stage 'Environment customization': Failed executing ansible-playbook


Expected results:
Installation presents nic options as per normal:
[ INFO  ] TASK [filter bonds with bad naming]
          Please indicate a nic to set ovirtmgmt bridge on: (dummy_0, ens33) [dummy_0]: 

Additional info:
The way ansible returns networks facts.  IT seems secondary interfaces can be populated as such:

"ansible_ens33_0": {
            "ipv4_secondaries": [
                {
                    "address": "10.10.10.5", 
                    "broadcast": "10.10.10.15", 
                    "netmask": "255.255.255.240", 
                    "network": "10.10.10.0"
                }
            ]
        }, 

which breaks the reference to "active"


PATCH to fix included inline:
diff --git a/src/ansible/get_network_interfaces.yml b/src/ansible/get_network_interfaces.yml
index 593a73b..1b1f12d 100644
--- a/src/ansible/get_network_interfaces.yml
+++ b/src/ansible/get_network_interfaces.yml
@@ -23,7 +23,7 @@
         ) and (
           'ansible_' + MGMT_NETWORK not in hostvars[inventory_hostname]
         ) and (
-          hostvars[inventory_hostname]['ansible_' + item]['active']
+          active in hostvars[inventory_hostname]['ansible_' + item] and hostvars[inventory_hostname]['ansible_' + item]['active']
         ) and (
           hostvars[inventory_hostname]['ansible_' + item]['type'] != 'bridge'
         ) and (

Comment 1 Kyle Stapp 2018-03-22 18:20:31 UTC
I've tried to use gerrit correctly:
https://gerrit.ovirt.org/#/c/89362/

I don't know how to leave messages in gerrit...so I'm linking here

Comment 2 Simone Tiraboschi 2018-03-22 20:55:04 UTC
a Bug-Url field in the commit message will do the magic, thanks!

Comment 3 Kyle Stapp 2018-03-22 21:29:27 UTC
What's the correct team in the future...I completely guessed at that.  Couldn't find a good reference on what ovirt Team to use.

Comment 4 Simone Tiraboschi 2018-03-22 21:53:54 UTC
(In reply to Kyle Stapp from comment #3)
> What's the correct team in the future...I completely guessed at that. 
> Couldn't find a good reference on what ovirt Team to use.

Integration is absolutely fine for all the setup and hosted-engine related tasks

Comment 5 Nikolai Sednev 2018-05-03 14:35:56 UTC
enp5s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.35.160.47  netmask 255.255.252.0  broadcast 10.35.163.255
        inet6 fe80::461e:a1ff:fe73:3961  prefixlen 64  scopeid 0x20<link>
        ether 44:1e:a1:73:39:61  txqueuelen 1000  (Ethernet)
        RX packets 11752  bytes 753725 (736.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 609  bytes 88666 (86.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfbee0000-fbefffff  

enp5s0f1:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.10.5  netmask 255.255.252.0  broadcast 10.10.11.255
        ether 44:1e:a1:73:39:61  txqueuelen 1000  (Ethernet)
        device memory 0xfbee0000-fbefffff  

[ INFO  ] TASK [Get all active network interfaces]
[ INFO  ] TASK [Filter bonds with bad naming]
[ INFO  ] TASK [Generate output list]
[ INFO  ] ok: [localhost]
          Please indicate a nic to set ovirtmgmt bridge on: (enp5s0f1, enp5s0f0) [enp5s0f1]: 
         
Works for me on these components:
ovirt-engine-4.2.3.3-0.1.el7.noarch
rhvm-appliance-4.2-20180427.0.el7.noarch
ovirt-hosted-engine-setup-2.2.19-1.el7ev.noarch
ovirt-hosted-engine-ha-2.2.11-1.el7ev.noarch
Linux 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux Server release 7.5 (Maipo)

Comment 6 Sandro Bonazzola 2018-05-10 06:29:32 UTC
This bugzilla is included in oVirt 4.2.3 release, published on May 4th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.3 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.