Bug 1452243

Summary: Interface matching regular expression ignores interfaces with a '-' in the name
Product: [oVirt] ovirt-setup-lib Reporter: Simone Tiraboschi <stirabos>
Component: CoreAssignee: Simone Tiraboschi <stirabos>
Status: CLOSED CURRENTRELEASE QA Contact: Artyom <alukiano>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.1.0CC: alukiano, bugs, danken, lveyde, mavital, sbonazzo, stirabos, ylavi
Target Milestone: ovirt-4.1.3Keywords: EasyFix, Triaged
Target Release: 1.1.3Flags: rule-engine: ovirt-4.1+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
ovirt-setup-lib now correctly handles interfaces with a '-' in the name like 'nm-bond1.122' which are allowed by NetworkManager/Cockpit UI.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-06 13:11:27 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: 1459229    
Bug Blocks: 1455431    

Description Simone Tiraboschi 2017-05-18 16:12:33 UTC
Description of problem:
Interface matching regular expression ignores interfaces with a '-' in the name so a bond named 'nm-bond1.122' will be ignored due to the '-' in its name.
The user instead could configure a device with that name from NetworkManager/Cockpit UI.

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. create a bond with a dash in the name
2. configure an IP address over the bond and ensure that the hostname resolves there
3. try deploying hosted-engine

Actual results:

The address got resolving the hostname could not be identified on any interface (since ovirt-setup-lib ignores the bond due to the dash) ans so hosted-engine-setup aborts.

2017-05-17 15:53:53 DEBUG otopi.context context._executeMethod:142 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 132, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-hosted-engine-setup/scripts/../plugins/gr-he-common/network/bridge.py", line 345, in _validate_hostname_first_host
    allow_empty=False,
  File "/usr/lib/python2.7/site-packages/ovirt_setup_lib/hostname.py", line 452, in getHostname
    store=(True if envkey else False),
  File "/usr/lib/python2.7/site-packages/ovirt_setup_lib/dialog.py", line 144, in queryEnvKey
    raise RuntimeError(msg)
RuntimeError: Host name is not valid: host.domain.name resolves to 192.168.45.65 and not all of them can be mapped to non loopback devices on this host


Expected results:
The user can successfully deploy

Additional info:

Comment 2 Artyom 2017-06-05 08:52:36 UTC
Checked on
ovirt-hosted-engine-setup-2.1.2-2.el7ev.noarch
ovirt-setup-lib-1.1.1-1.el7ev.noarch

Deployment fails with the traceback:
017-06-05 09:49:20 DEBUG otopi.plugins.gr_he_common.vm.cloud_init plugin.execute:921 execute-output: ('/sbin/ip', 'addr', 'show', 'my-bond') stdout:
5: my-bond: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 00:14:5e:dd:05:55 brd ff:ff:ff:ff:ff:ff
    inet 10.35.72.13/24 brd 10.35.72.255 scope global dynamic my-bond
       valid_lft 42000sec preferred_lft 42000sec
    inet6 2620:52:0:2348:6248:5124:671d:1146/64 scope global noprefixroute dynamic
       valid_lft 2591821sec preferred_lft 604621sec
    inet6 fe80::b925:96f4:3a25:af8/64 scope link
       valid_lft forever preferred_lft forever

2017-06-05 09:49:20 DEBUG otopi.plugins.gr_he_common.vm.cloud_init plugin.execute:926 execute-output: ('/sbin/ip', 'addr', 'show', 'my-bond') stderr:


2017-06-05 09:49:20 DEBUG otopi.plugins.gr_he_common.vm.cloud_init cloud_init._getMyIPAddress:132 address: None
2017-06-05 09:49:20 DEBUG otopi.context context._executeMethod:142 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 132, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-hosted-engine-setup/scripts/../plugins/gr-he-common/vm/cloud_init.py", line 781, in _customize_vm_networking
    self._customize_vm_addressing()
  File "/usr/share/ovirt-hosted-engine-setup/scripts/../plugins/gr-he-common/vm/cloud_init.py", line 215, in _customize_vm_addressing
    my_ip = self._getMyIPAddress()
  File "/usr/share/ovirt-hosted-engine-setup/scripts/../plugins/gr-he-common/vm/cloud_init.py", line 136, in _getMyIPAddress
    _('Cannot acquire nic/bridge address')
RuntimeError: Cannot acquire nic/bridge address
2017-06-05 09:49:20 ERROR otopi.context context._executeMethod:151 Failed to execute stage 'Environment customization': Cannot acquire nic/bridge address


Problem in our regular expression
_INET_ADDRESS_RE = re.compile(
        flags=re.VERBOSE,
        pattern=r"""
            \s+
            inet
            \s
            (?P<address>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2})
            .+
            \s+
            (?P<interface>[a-zA-Z0-9_.]+)
            $
    """
    )

Comment 3 Red Hat Bugzilla Rules Engine 2017-06-05 08:52:42 UTC
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.

Comment 4 Sandro Bonazzola 2017-06-06 11:42:40 UTC
Please open a separate bug on ovirt-hosted-engine-setup since the failing regexp is there, not in ovirt-setup-lib. Moving this back to ON_QA.

Comment 7 Artyom 2017-06-11 12:35:00 UTC
Verified on ovirt-hosted-engine-setup-2.1.3-1.el7ev.noarch

It is looking fine from hosted-engine perspective now, but guys from network team said that bond name with '-' not supported by VDSM and engine.
See the error:
  File "/usr/share/ovirt-hosted-engine-setup/scripts/../plugins/gr-he-common/network/bridge.py", line 388, in _setupNetworks
    'message: "%s"' % (networks, code, message))
RuntimeError: Failed to setup networks {'ovirtmgmt': {'bonding': 'my-bond', 'bootproto': 'dhcp', 'blockingdhcp': True, 'defaultRoute': True}}. Error code: "25" message: "u'my-bond' is not a valid bonding device name"