Comment 8 for bug 1802322

OK, I can recreate.

The specific detail is that the bond macaddress matches one of the
physical interfaces and that the bond itself is down at the time of
the apply command.

# netplan apply --debug
WARK: matches: {'by-driver': {}, 'by-mac': {'00:16:3e:2c:4c:e5':
'eth0', '00:16:3e:c3:41:0a': 'eth1', '00:16:3e:b2:be:9a': 'eth2'}}
WARK: device lo operstate is unknown, not changing
WARK iface=bond1 link={'addr': '00:16:3e:c3:41:0a', 'broadcast':
'ff:ff:ff:ff:ff:ff'} mac=00:16:3e:c3:41:0a
driver=/sys/devices/virtual/net/bond1/device/driver
WARK: device eth0 operstate is up, not changing
WARK iface=eth1 link={'addr': '00:16:3e:c3:41:0a', 'broadcast':
'ff:ff:ff:ff:ff:ff'} mac=00:16:3e:c3:41:0a
driver=/sys/devices/virtual/net/eth1/device/driver
WARK interface=eth1 new_name=eth1
WARK iface=eth2 link={'addr': '00:16:3e:c3:41:0a', 'broadcast':
'ff:ff:ff:ff:ff:ff'} mac=00:16:3e:c3:41:0a
driver=/sys/devices/virtual/net/eth2/device/driver
WARK process changes: {'bond1': {'name': 'eth1'}, 'eth2': {'name': 'eth1'}}
WARK: devices: ['lo', 'bond1', 'eth0', 'eth1', 'eth2']
WARK: changes: {'bond1': {'name': 'eth1'}, 'eth2': {'name': 'eth1'}}
Traceback (most recent call last):
  File "/usr/sbin/netplan", line 23, in <module>
    netplan.main()
  File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 130, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 43, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 130, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 105,
in command_apply
    stderr=subprocess.DEVNULL)
  File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ip', 'link', 'set', 'dev',
'bond1', 'name', 'eth1']' returned non-zero exit status 2.

Two things here:

1) we shouldn't attempt to rename non-physical interfaces (lo and
bond1 can be skipped)
2) physical devices which are part of a bond should be skipped since
the mac changes

On Thu, Nov 8, 2018 at 10:35 AM Mihai Gheorghe
<email address hidden> wrote:
>
> # netplan --debug apply
>
> http://paste.ubuntu.com/p/bcv8cJQGvY/
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1802322
>
> Title:
> [regression] netplan apply is not idempotent and fails trying to
> rename a bond member interface
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/netplan/+bug/1802322/+subscriptions