[lxc-users] why some keys in my config are said to be invalid ?

Benoit Barthelet benoit.barthelet at gmail.com
Thu Mar 16 09:16:12 UTC 2017


I don't understand why some keys in my config aren't accessible through
python while they are in the config file.
So I wrote this little snippet that shows the lines present in my config
that aren't accessible through python.
See the lines with the >>> in the output:
I discovered that because I wanted to get the value of lxc.id_map mostly,
and the MAC address too.
Is this accessible differently ?
thanks

import re
import lxc

container = lxc.Container('lxcws')
with open(container.config_file_name) as conf_file:
    options = conf_file.readlines()

f_config = {}
for op in options:
    m = re.match('^(.*) = (.*)$', op)
    if m is not None:
        f_key = m.group(1)
        f_value = m.group(2)
        f_config[f_key] = f_value

for k in container.get_keys():
    try:
        print(k in f_config.keys(), k , container.get_config_item(k))
    except Exception as e:
        if k in f_config.keys():
            print('>>>', k in f_config.keys(), k, e)
        else:
            print(k in f_config.keys(), k, e)

True lxc.arch x86_64
False lxc.pts 1024
False lxc.tty 4
False lxc.devttydir
False lxc.kmsg 'Invalid configuration key'
False lxc.aa_profile
False lxc.aa_allow_incomplete 0
False lxc.se_context
False lxc.cgroup
>>> True lxc.id_map 'Invalid configuration key'
False lxc.loglevel NOTSET
False lxc.logfile
False lxc.mount.entry ['/sys/fs/fuse/connections sys/fs/fuse/connections
none bind,optional 0 0', '/sys/kernel/debug sys/kernel/debug none
bind,optional 0 0', '/sys/kernel/security sys/kernel/security none
bind,optional 0 0', '/sys/fs/pstore sys/fs/pstore none bind,optional 0 0',
'mqueue dev/mqueue mqueue rw,relatime,create=dir,optional 0 0',
'/dev/console dev/console none bind,create=file 0 0', '/dev/full dev/full
none bind,create=file 0 0', '/dev/null dev/null none bind,create=file 0 0',
'/dev/random dev/random none bind,create=file 0 0', '/dev/tty dev/tty none
bind,create=file 0 0', '/dev/urandom dev/urandom none bind,create=file 0
0', '/dev/zero dev/zero none bind,create=file 0 0',
'/sys/firmware/efi/efivars sys/firmware/efi/efivars none bind,optional 0
0', '/proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc none bind,optional 0
0']
True lxc.mount.auto proc:mixed sys:ro cgroup:mixed
False lxc.mount
False lxc.rootfs.mount /usr/lib/x86_64-linux-gnu/lxc/rootfs
False lxc.rootfs.options
True lxc.rootfs.backend dir
True lxc.rootfs /home/lotso/.local/share/lxc/lxcws/rootfs
False lxc.pivotdir 'Invalid configuration key'
True lxc.utsname lxcws
False lxc.hook.pre-start
False lxc.hook.pre-mount
False lxc.hook.mount ['/usr/share/lxcfs/lxc.mount.hook']
False lxc.hook.autodev
False lxc.hook.start
False lxc.hook.stop
False lxc.hook.post-stop ['/usr/share/lxcfs/lxc.reboot.hook']
False lxc.hook.clone ['/usr/share/lxc/hooks/clonehostname']
False lxc.hook.destroy
False lxc.hook 'Invalid configuration key'
>>> True lxc.network.type 'Invalid configuration key'
>>> True lxc.network.flags 'Invalid configuration key'
>>> True lxc.network.link 'Invalid configuration key'
False lxc.network.name 'Invalid configuration key'
False lxc.network.macvlan.mode 'Invalid configuration key'
False lxc.network.veth.pair 'Invalid configuration key'
False lxc.network.script.up 'Invalid configuration key'
False lxc.network.script.down 'Invalid configuration key'
>>> True lxc.network.hwaddr 'Invalid configuration key'
False lxc.network.mtu 'Invalid configuration key'
False lxc.network.vlan.id 'Invalid configuration key'
False lxc.network.ipv4.gateway 'Invalid configuration key'
False lxc.network.ipv4 'Invalid configuration key'
False lxc.network.ipv6.gateway 'Invalid configuration key'
False lxc.network.ipv6 'Invalid configuration key'
False lxc.network ['empty', 'veth']
False lxc.cap.drop ['mac_admin', 'mac_override', 'sys_time', 'sys_module',
'sys_rawio']
False lxc.cap.keep
False lxc.console.logfile
False lxc.console
False lxc.seccomp /usr/share/lxc/config/common.seccomp
>>> True lxc.include 'Invalid configuration key'
False lxc.autodev 'Invalid configuration key'
False lxc.haltsignal 'Invalid configuration key'
False lxc.rebootsignal 'Invalid configuration key'
False lxc.stopsignal 'Invalid configuration key'
False lxc.start.auto 0
False lxc.start.delay 0
False lxc.start.order 0
False lxc.monitor.unshare 0
False lxc.group
False lxc.environment
False lxc.init_cmd
False lxc.init_uid 0
False lxc.init_gid 0
False lxc.ephemeral 0


-- 
benoit barthelet
http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170316/857df0f3/attachment.html>


More information about the lxc-users mailing list