os-net-config mapping by MAC fails if trying to map in alternate order

Bug #1504263 reported by Dan Sneddon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Expired
Undecided
Unassigned

Bug Description

I am running into a stack trace when I try the following:

I want to override the natural ordering of the NICs. For instance:

On host A, I have the following NICs:

em1: 3c:97:0e:e9:27:ca
wlp4s0: 5c:51:4f:f5:79:bd

(note, this is just a test box, it has one wired and one wireless adapter, but that doesn't matter)

If I include a mapping file that matches this order, it works:

interface_mapping:
  nic1: 3c:97:0e:e9:27:ca
  nic2: 5c:51:4f:f5:79:bd

What I want to do is to map them like this:

interface_mapping:
  nic1: 5c:51:4f:f5:79:bd
  nic2: 3c:97:0e:e9:27:ca

Which should switch the order. Here is what happens when I try to run that mapping:

$ os-net-config --noop --debug -c /etc/os-net-config/config.yaml -m /etc/os-net-config/mapping2.yaml --persist-mapping
[2015/10/08 11:11:38 AM] [INFO] Using config file at: /etc/os-net-config/config.yaml
[2015/10/08 11:11:38 AM] [INFO] Using mapping file at: /etc/os-net-config/mapping2.yaml
[2015/10/08 11:11:38 AM] [INFO] Ifcfg net config provider created.
[2015/10/08 11:11:38 AM] [DEBUG] network_config JSON: [{'routes': [{'ip_netmask': '169.254.169.254/32', 'next_hop': '192.0.2.1'}], 'use_dhcp': True, 'type': 'interface', 'name': 'nic1'}, {'routes': [{'ip_netmask': '169.254.169.254/32', 'next_hop': '192.0.2.1'}], 'use_dhcp': False, 'type': 'interface', 'name': 'nic2'}]
[2015/10/08 11:11:38 AM] [DEBUG] interface_mapping JSON: {'nic2': '3c:97:0e:e9:27:ca', 'nic1': '5c:51:4f:f5:79:bd'}
[2015/10/08 11:11:38 AM] [DEBUG] persist_mapping: True
[2015/10/08 11:11:38 AM] [DEBUG] 5c:51:4f:f5:79:bd matches device wlp4s0
[2015/10/08 11:11:38 AM] [INFO] nic1 mapped to: wlp4s0
[2015/10/08 11:11:38 AM] [DEBUG] 3c:97:0e:e9:27:ca matches device em1
[2015/10/08 11:11:38 AM] [INFO] nic2 mapped to: em1
[2015/10/08 11:11:38 AM] [INFO] nic3 mapped to: vlan2
Traceback (most recent call last):
  File "/usr/bin/os-net-config", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/os_net_config/cli.py", line 184, in main
    obj = objects.object_from_json(iface_json)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 36, in object_from_json
    return Interface.from_json(json)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 247, in from_json
    return Interface(name, *opts)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 241, in __init__
    dhclient_args, dns_servers)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 139, in __init__
    numbered_nic_names = _numbered_nics(nic_mapping)
  File "/usr/lib/python2.7/site-packages/os_net_config/objects.py", line 93, in _numbered_nics
    raise InvalidConfigException(msg)
os_net_config.objects.InvalidConfigException: interface wlp4s0 already mapped, check mapping file for duplicates

-----

The problem occurs in the _numbered_nics method in objects.py.

Dan Sneddon (dsneddon)
Changed in tripleo:
status: New → Triaged
Revision history for this message
Steven Hardy (shardy) wrote :

Hmm, I'm pretty sure this worked when I originally implemented the mappings, if you're not already looking into it I can probably help out.

Ben Nemec (bnemec)
Changed in tripleo:
importance: Undecided → Medium
Revision history for this message
Emilien Macchi (emilienm) wrote : Cleanup EOL bug report

This is an automated cleanup. This bug report has been closed because it
is older than 18 months and there is no open code change to fix this.
After this time it is unlikely that the circumstances which lead to
the observed issue can be reproduced.

If you can reproduce the bug, please:
* reopen the bug report (set to status "New")
* AND add the detailed steps to reproduce the issue (if applicable)
* AND leave a comment "CONFIRMED FOR: <RELEASE_NAME>"
  Only still supported release names are valid (LIBERTY, MITAKA, NEWTON, OCATA, PIKE, PIKE).
  Valid example: CONFIRMED FOR: LIBERTY

Changed in tripleo:
importance: Medium → Undecided
status: Triaged → Expired
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.