Getting link attributes via IPDevice fails for interfaces with long names on xenial

Bug #1637993 reported by Omer Anson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Omer Anson

Bug Description

Getting link attributes via IPDevice fails for interfaces with long names on xenial. This can be seen in the functional test test_get_device_mac_too_long_name, which fails on xenial. Reproducible on the gate with 'check experimental'.

The output from the failed test is:
ft1.1: neutron.tests.functional.agent.linux.test_ip_lib.IpLibTestCase.test_get_device_mac_too_long_name_StringException: Empty attachments:
  stderr
  stdout

pythonlogging:'': {{{
DEBUG [stevedore.extension] found extension EntryPoint.parse('pika = oslo_messaging._drivers.impl_pika:PikaDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kombu = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('fake = oslo_messaging._drivers.impl_fake:FakeDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('zmq = oslo_messaging._drivers.impl_zmq:ZmqDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('amqp = oslo_messaging._drivers.impl_amqp1:ProtonDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('rabbit = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kafka = oslo_messaging._drivers.impl_kafka:KafkaDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('pika = oslo_messaging._drivers.impl_pika:PikaDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kombu = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('fake = oslo_messaging._drivers.impl_fake:FakeDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('zmq = oslo_messaging._drivers.impl_zmq:ZmqDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('amqp = oslo_messaging._drivers.impl_amqp1:ProtonDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('rabbit = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kafka = oslo_messaging._drivers.impl_kafka:KafkaDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('pika = oslo_messaging._drivers.impl_pika:PikaDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kombu = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('fake = oslo_messaging._drivers.impl_fake:FakeDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('zmq = oslo_messaging._drivers.impl_zmq:ZmqDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('amqp = oslo_messaging._drivers.impl_amqp1:ProtonDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('rabbit = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kafka = oslo_messaging._drivers.impl_kafka:KafkaDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('pika = oslo_messaging._drivers.impl_pika:PikaDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kombu = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('fake = oslo_messaging._drivers.impl_fake:FakeDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('zmq = oslo_messaging._drivers.impl_zmq:ZmqDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('amqp = oslo_messaging._drivers.impl_amqp1:ProtonDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('rabbit = oslo_messaging._drivers.impl_rabbit:RabbitDriver')
   DEBUG [stevedore.extension] found extension EntryPoint.parse('kafka = oslo_messaging._drivers.impl_kafka:KafkaDriver')
   DEBUG [oslo_policy._cache_handler] Reloading cached file /opt/stack/new/neutron/neutron/tests/etc/policy.json
   DEBUG [oslo_policy.policy] Reloaded policy file: /opt/stack/new/neutron/neutron/tests/etc/policy.json
 WARNING [oslo_policy.policy] Policies ['update_rbac_policy:target_tenant'] are part of a cyclical reference.
}}}

Traceback (most recent call last):
  File "neutron/tests/base.py", line 125, in func
    return f(self, *args, **kwargs)
  File "neutron/tests/functional/agent/linux/test_ip_lib.py", line 177, in test_get_device_mac_too_long_name
    device = self.manage_device(attr)
  File "neutron/tests/functional/agent/linux/test_ip_lib.py", line 83, in manage_device
    namespace=attr.namespace)
  File "neutron/agent/linux/interface.py", line 113, in init_l3
    default_ipv6_lla = ip_lib.get_ipv6_lladdr(device.link.address)
  File "neutron/agent/linux/ip_lib.py", line 531, in address
    return self.attributes.get('link/ether')
  File "neutron/agent/linux/ip_lib.py", line 555, in attributes
    return self._parse_line(self._run(['o'], ('show', self.name)))
  File "neutron/agent/linux/ip_lib.py", line 361, in _run
    return self._parent._run(options, self.COMMAND, args)
  File "neutron/agent/linux/ip_lib.py", line 81, in _run
    return self._as_root(options, command, args)
  File "neutron/agent/linux/ip_lib.py", line 96, in _as_root
    log_fail_as_error=self.log_fail_as_error)
  File "neutron/agent/linux/ip_lib.py", line 105, in _execute
    log_fail_as_error=log_fail_as_error)
  File "neutron/agent/linux/utils.py", line 139, in execute
    raise RuntimeError(msg)
RuntimeError: Exit code: 255; Stdin: ; Stdout: ; Stderr: Error: argument "teste330f1130ac45f8d" is wrong: "name" too long

Omer Anson (omer-anson)
affects: dragonflow → neutron
Changed in neutron:
status: New → In Progress
Changed in neutron:
importance: Undecided → Low
tags: added: functional-tests
tags: added: xenial
removed: functional-tests
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

I believe all those xenial bugs should be High to reflect the deadline set by infra.

Changed in neutron:
importance: Low → Medium
importance: Medium → Low
importance: Low → High
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

I believe the following patch in iproute2 made the difference:

-bash-4.2$ git show --stat 50b9950d
commit 50b9950dd90114609e10298c0fa32a9371250687
Author: Roopa Prabhu <email address hidden>
Date: Wed Jul 16 07:13:25 2014 -0700

    link dump filter

    This patch avoids a full link wildump request when the user has specified
    a single link. Uses RTM_GETLINK without the NLM_F_DUMP flag.

    This helps on a system with large number of interfaces.

    This patch currently only uses the link ifindex in the filter.
    Hoping to provide a subsequent kernel patch to do link dump filtering on
    other attributes in the kernel.

    In iplink_get, to be safe, this patch currently sets the answer buffer
    size to the max size that libnetlink rtnl_talk can copy. The current api
    does not seem to provide a way to indicate the answer buf size.

    changelog from RFC to v1:
        - incorporated comments from stephen (fixed comment and fixed if/else block)

    changelog from v1 to v2:
        - fix whitespaces error

    Signed-off-by: Roopa Prabhu <email address hidden>

 ip/ip_common.h | 1 +
 ip/ipaddress.c | 13 +++++++++++++
 ip/iplink.c | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)

-bash-4.2$ git tag --contains 50b9950d
v3.16.0
v3.17.0
v3.18.0
v3.19.0
v4.0.0
v4.1.0
v4.1.1
v4.2.0
v4.3.0
v4.4.0
v4.5.0
v4.6.0
v4.7.0
v4.8.0

Trusty was 3.12, so it was first dumping all devices; then filter what's requested.

The reason why it worked before is that the device was accessed thru a hash table index that was calculated as strncmp(im->name, name, IFNAMSIZ) where IFNAMSIZ is 16, so effectively everything after 15th char was truncated.

tags: added: functional-tests
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/391808
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=0140a183dc0d5610f51badae82a16c4c44ff9885
Submitter: Jenkins
Branch: master

commit 0140a183dc0d5610f51badae82a16c4c44ff9885
Author: Omer Anson <email address hidden>
Date: Mon Oct 31 08:52:43 2016 +0200

    Truncate IPDevice's name to interface max size

    An interface's name is limited to INTERFACE_MAX_SIZE. In some cases, IP
    utils truncate this name automatically. In Ubuntu Xenial, ip link
    returns an error instead of this behaviour.

    This change truncates the device's name upon read (The full name is
    still stored on the object). This way, the code does not rely on IP
    utils to do the truncation. This solves the error in the test.

    Change-Id: I41b226e4b52239b861e2b6e806296025502b9b60
    Closes-Bug: 1637993

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/398346

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 10.0.0.0b1

This issue was fixed in the openstack/neutron 10.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/newton)

Reviewed: https://review.openstack.org/398346
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=7295beec362d4754d1eb6c353efdf14a8edde8cb
Submitter: Jenkins
Branch: stable/newton

commit 7295beec362d4754d1eb6c353efdf14a8edde8cb
Author: Omer Anson <email address hidden>
Date: Mon Oct 31 08:52:43 2016 +0200

    Truncate IPDevice's name to interface max size

    An interface's name is limited to INTERFACE_MAX_SIZE. In some cases, IP
    utils truncate this name automatically. In Ubuntu Xenial, ip link
    returns an error instead of this behaviour.

    This change truncates the device's name upon read (The full name is
    still stored on the object). This way, the code does not rely on IP
    utils to do the truncation. This solves the error in the test.

    Closes-Bug: 1637993

    Conflicts:
     neutron/agent/linux/ip_lib.py

    Change-Id: I41b226e4b52239b861e2b6e806296025502b9b60
    (cherry picked from commit 0140a183dc0d5610f51badae82a16c4c44ff9885)

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 9.1.1

This issue was fixed in the openstack/neutron 9.1.1 release.

tags: added: neutron-proactive-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/421992

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/mitaka)

Reviewed: https://review.openstack.org/421992
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3a7c9d0e4d1ef2d3cf44305f7c885f1ad9267946
Submitter: Jenkins
Branch: stable/mitaka

commit 3a7c9d0e4d1ef2d3cf44305f7c885f1ad9267946
Author: Omer Anson <email address hidden>
Date: Mon Oct 31 08:52:43 2016 +0200

    Truncate IPDevice's name to interface max size

    An interface's name is limited to INTERFACE_MAX_SIZE. In some cases, IP
    utils truncate this name automatically. In Ubuntu Xenial, ip link
    returns an error instead of this behaviour.

    This change truncates the device's name upon read (The full name is
    still stored on the object). This way, the code does not rely on IP
    utils to do the truncation. This solves the error in the test.

    Closes-Bug: 1637993

    Conflicts:
     neutron/agent/linux/ip_lib.py

    Change-Id: I41b226e4b52239b861e2b6e806296025502b9b60
    (cherry picked from commit 0140a183dc0d5610f51badae82a16c4c44ff9885)
    (cherry picked from commit 7295beec362d4754d1eb6c353efdf14a8edde8cb)

tags: added: in-stable-mitaka
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 8.4.0

This issue was fixed in the openstack/neutron 8.4.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.