Comment 7 for bug 1776958

Revision history for this message
Paride Legovini (paride) wrote :

This is happening again with Focal and Groovy:

tox -e citest -- run --os-name=focal --platform=lxd --preserve-data --data-dir=results --verbose --deb=cloud-init_20.2-134-g747723a4-1\~bddeb_all.deb --test-config=tests/cloud_tests/testcases/modules/lxd_bridge.yaml

=============================================

2020-08-21 15:56:11,115 - subp.py[DEBUG]: Running command ['lxd', 'waitready', '--timeout=300'] with allowed return codes [0] (shell=False, capture=True)
2020-08-21 15:56:20,165 - subp.py[DEBUG]: Running command ['lxd', 'init', '--auto', '--storage-backend=dir'] with allowed return codes [0] (shell=False, capture=True)
2020-08-21 15:56:23,684 - subp.py[DEBUG]: Running command ['lxc', 'network', 'delete', 'lxdbr0', '--force-local'] with allowed return codes [0] (shell=False, capture=True)
2020-08-21 15:56:24,413 - cc_lxd.py[DEBUG]: Deletion of lxd network 'lxdbr0' failed. Assuming it did not exist.
2020-08-21 15:56:24,413 - subp.py[DEBUG]: Running command ['lxc', 'profile', 'device', 'remove', 'default', 'eth0', '--force-local'] with allowed return codes [0] (shell=False, capture=True)
2020-08-21 15:56:24,491 - cc_lxd.py[DEBUG]: Removal of device 'eth0' from profile 'default' succeeded.
2020-08-21 15:56:24,491 - cc_lxd.py[DEBUG]: Creating lxd bridge: network create lxdbr0 ipv4.address=10.100.100.1/24 ipv4.dhcp.ranges=10.100.100.100-10.100.100.200 ipv6.address=none dns.domain=lxd
2020-08-21 15:56:24,492 - subp.py[DEBUG]: Running command ['lxc', 'network', 'create', 'lxdbr0', 'ipv4.address=10.100.100.1/24', 'ipv4.dhcp.ranges=10.100.100.100-10.100.100.200', 'ipv6.address=none', 'dns.domain=lxd', '--force-local'] with allowed return codes [0] (shell=False, capture=True)
2020-08-21 15:56:24,569 - handlers.py[DEBUG]: finish: modules-final/config-lxd: FAIL: running config-lxd with frequency once-per-instance
2020-08-21 15:56:24,569 - util.py[WARNING]: Running module lxd (<module 'cloudinit.config.cc_lxd' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_lxd.py'>) failed
2020-08-21 15:56:24,569 - util.py[DEBUG]: Running module lxd (<module 'cloudinit.config.cc_lxd' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_lxd.py'>) failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 848, in _run_modules
    ran, _r = cc.run(run_name, mod.handle, func_args,
  File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 185, in run
    results = functor(*args)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_lxd.py", line 152, in handle
    _lxc(cmd_create)
  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_lxd.py", line 268, in _lxc
    subp.subp(['lxc'] + list(cmd) + ["--force-local"], update_env=env)
  File "/usr/lib/python3/dist-packages/cloudinit/subp.py", line 290, in subp
    raise ProcessExecutionError(stdout=out, stderr=err,
cloudinit.subp.ProcessExecutionError: Unexpected error while running command.
Command: ['lxc', 'network', 'create', 'lxdbr0', 'ipv4.address=10.100.100.1/24', 'ipv4.dhcp.ranges=10.100.100.100-10.100.100.200', 'ipv6.address=none', 'dns.domain=lxd', '--force-local']
Exit code: 1
Reason: -
Stdout:-
Stderr: Error: The network already exists

=============================================

So the cleanup code runs, but for some reason fails to delete the bridge. I tried running:

lxd init --auto --storage-backend=dir ; lxc network delete lxdbr0 --force-local

in a fresh Focal LXD container and it works (deletes lxdbr0), so I can't tell where the problem is yet.