<div dir="ltr"><div><div><div>I don't understand why some keys in my config aren't accessible through python while they are in the config file.<br>So I wrote this little snippet that shows the lines present in my config that aren't accessible through python.<br>See the lines with the >>> in the output:<br></div>I discovered that because I wanted to get the value of lxc.id_map mostly, and the MAC address too.<br></div>Is this accessible differently ?<br></div>thanks<br><div><div><div><br>import re<br>import lxc<br><br>container = lxc.Container('lxcws')<br>with open(container.config_file_name) as conf_file:<br>    options = conf_file.readlines()<br><br>f_config = {}<br>for op in options:<br>    m = re.match('^(.*) = (.*)$', op)<br>    if m is not None:<br>        f_key = m.group(1)<br>        f_value = m.group(2)<br>        f_config[f_key] = f_value<br><br>for k in container.get_keys():<br>    try:<br>        print(k in f_config.keys(), k , container.get_config_item(k))<br>    except Exception as e:<br>        if k in f_config.keys():<br>            print('>>>', k in f_config.keys(), k, e)<br>        else:<br>            print(k in f_config.keys(), k, e)<br><br>True lxc.arch x86_64<br>False lxc.pts 1024<br>False lxc.tty 4<br>False lxc.devttydir <br>False lxc.kmsg 'Invalid configuration key'<br>False lxc.aa_profile <br>False lxc.aa_allow_incomplete 0<br>False lxc.se_context <br>False lxc.cgroup <br>>>> True lxc.id_map 'Invalid configuration key'<br>False lxc.loglevel NOTSET<br>False lxc.logfile <br>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']<br>True lxc.mount.auto proc:mixed sys:ro cgroup:mixed<br>False lxc.mount <br>False lxc.rootfs.mount /usr/lib/x86_64-linux-gnu/lxc/rootfs<br>False lxc.rootfs.options <br>True lxc.rootfs.backend dir<br>True lxc.rootfs /home/lotso/.local/share/lxc/lxcws/rootfs<br>False lxc.pivotdir 'Invalid configuration key'<br>True lxc.utsname lxcws<br>False lxc.hook.pre-start <br>False lxc.hook.pre-mount <br>False lxc.hook.mount ['/usr/share/lxcfs/lxc.mount.hook']<br>False lxc.hook.autodev <br>False lxc.hook.start <br>False lxc.hook.stop <br>False lxc.hook.post-stop ['/usr/share/lxcfs/lxc.reboot.hook']<br>False lxc.hook.clone ['/usr/share/lxc/hooks/clonehostname']<br>False lxc.hook.destroy <br>False lxc.hook 'Invalid configuration key'<br>>>> True lxc.network.type 'Invalid configuration key'<br>>>> True lxc.network.flags 'Invalid configuration key'<br>>>> True lxc.network.link 'Invalid configuration key'<br>False <a href="http://lxc.network.name">lxc.network.name</a> 'Invalid configuration key'<br>False lxc.network.macvlan.mode 'Invalid configuration key'<br>False lxc.network.veth.pair 'Invalid configuration key'<br>False lxc.network.script.up 'Invalid configuration key'<br>False lxc.network.script.down 'Invalid configuration key'<br>>>> True lxc.network.hwaddr 'Invalid configuration key'<br>False lxc.network.mtu 'Invalid configuration key'<br>False <a href="http://lxc.network.vlan.id">lxc.network.vlan.id</a> 'Invalid configuration key'<br>False lxc.network.ipv4.gateway 'Invalid configuration key'<br>False lxc.network.ipv4 'Invalid configuration key'<br>False lxc.network.ipv6.gateway 'Invalid configuration key'<br>False lxc.network.ipv6 'Invalid configuration key'<br>False lxc.network ['empty', 'veth']<br>False lxc.cap.drop ['mac_admin', 'mac_override', 'sys_time', 'sys_module', 'sys_rawio']<br>False lxc.cap.keep <br>False lxc.console.logfile <br>False lxc.console <br>False lxc.seccomp /usr/share/lxc/config/common.seccomp<br>>>> True lxc.include 'Invalid configuration key'<br>False lxc.autodev 'Invalid configuration key'<br>False lxc.haltsignal 'Invalid configuration key'<br>False lxc.rebootsignal 'Invalid configuration key'<br>False lxc.stopsignal 'Invalid configuration key'<br>False lxc.start.auto 0<br>False lxc.start.delay 0<br>False lxc.start.order 0<br>False lxc.monitor.unshare 0<br>False lxc.group <br>False lxc.environment <br>False lxc.init_cmd <br>False lxc.init_uid 0<br>False lxc.init_gid 0<br>False lxc.ephemeral 0<br><div><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">benoit barthelet<br><a href="http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE" target="_blank">http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE</a><br></div></div></div></div>
</div></div></div></div></div>