salt: salt doesn't support LXC 3.0+

Description of Issue/Question

Creation of LXC with network_profile with LXC 3.0+ results to unusable containers.

The problem is that salt doesn’t support the new config keys supporting nic settings:

lxc.net.[i].type
lxc.net.[i].flags 
lxc.net.[i].link 
lxc.net.[i].mtu 
lxc.net.[i].name 
lxc.net.[i].hwaddr 
lxc.net.[i].ipv4.address 
lxc.net.[i].ipv4.gateway 
lxc.net.[i].ipv6.address 
lxc.net.[i].ipv6.gateway 
lxc.net.[i].script.up 
lxc.net.[i].script.down 

Setup

salt/lxc.sls

create-lxc-foo:
  lxc.present:
    - name:  foo
    - profile: ubuntu1804
    - network_profile: foo_network

pillar/profile.sls

lxc.container_profile:
  ubuntu1804:
    template: download
    options:
      dist: ubuntu
      release: bionic
      arch: amd64

pillar/network.sls

lxc.network_profile:
  foo_network:
    eth1:
      link: lxcbr0
      type: veth
      flags: up

Versions Report

Salt Version:
           Salt: 2017.7.8
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 12 2018, 14:36:49)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-139-generic
         system: Linux
        version: Ubuntu 16.04 xenial

After reading lxc module in 2018.3.3 and develop branches, I see that module only supports old keys.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 1
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Still there in 2019.2.1.

@adam-codeberg: since you are working on the modules/lxc.py, here is a “quick fix” I personnaly had to do: https://github.com/saltstack/salt/issues/52219#issuecomment-535421741

as temporary workaround you can set empty network profile:

lxc.network_profile:
  default:
    eth0:
      disable: true

and use /etc/lxc/default.conf as network configurator