-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Thu, Dec 27, 2018 at 01:49:14PM +0100, Zrubi wrote:
> I need to "play" with custom xml configs, in order to get hardware
> info via dmidecode inside a VM.
(...)
> Am I missed something?

That's not how jinja template inheritance works. After {% extends %} clause
nothing is generated unless it is part of {% block %} that references
preexisting block in parent template.

http://jinja.pocoo.org/docs/2.10/templates/#template-inheritance

Only this has any effect:

> {% extends 'libvirt/xen.xml' %}
> {% block os %}
>       {{ super() }}
>       <smbios mode='sysinfo'/>
> {% endblock %}

The following goes to /dev/null:

> <sysinfo type='smbios'>
> {% block sysinfo %}
>       <bios>
>               <entry name='Vendor'>Lenovo</entry>
>       </bios>
>   <system>
>     <entry name='manufacturer'>Fedora</entry>
>     <entry name='product'>Virt-Manager</entry>
>     <entry name='version'>0.9.4</entry>
>   </system>
>   <baseBoard>
>     <entry name='manufacturer'>LENOVO</entry>
>     <entry name='product'>20BE0061MC</entry>
>     <entry name='version'>0B98401 Pro</entry>
>     <entry name='serial'>W1KS427111E</entry>
>   </baseBoard>
>   <chassis>
>     <entry name='manufacturer'>Dell Inc.</entry>
>     <entry name='version'>2.12</entry>
>     <entry name='serial'>65X0XF2</entry>
>     <entry name='asset'>40000101</entry>
>     <entry name='sku'>Type3Sku1</entry>
>   </chassis>
>   <oemStrings>
>     <entry>myappname:some arbitrary data</entry>
>     <entry>otherappname:more arbitrary data</entry>
>   </oemStrings>
> {% endblock %}
> </sysinfo>

1) <sysinfo> and </sysinfo> lines are not inside any {% block %}
2) there is no "sysinfo" block in parent template

For a quick-and-dirty hack, if you intend this <sysinfo> node to be a child of
<domain>, just append it to some preexisting block using super():

  {% block basic %}
    {{ super() }}
    <sysinfo type='smbios'>
    {# ... #}
    </sysinfo>
  {% endblock %}

Alternatively, we'd accept a patch against libvirt/xen.xml to add something
like this:

  <sysinfo>
    {% block sysinfo %}{% endblock %}
  </sysinfo>

After that patch being merged, you could write in your config:

  {% extends 'libvirt/xen.ml' %}
  {% block sysinfo %}
    <bios/>
    <system/>
    <baseBoard/>
    {# ... #}
  {% endblock %}

- -- 
pozdrawiam / best regards       _.-._
Wojtek Porczyk               .-^'   '^-.
Invisible Things Lab         |'-.-^-.-'|
                             |  |   |  |
 I do not fear computers,    |  '-.-'  |
 I fear lack of them.        '-._ :  ,-'
    -- Isaac Asimov             `^-^-_>
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEaO0VFfpr0tEF6hYkv2vZMhA6I1EFAlwk1FsACgkQv2vZMhA6
I1H9mhAAl4nBKfOiTx9EewX3PH0yisxWCfG+WRJADeaSS107HCl73g3BObqF52t2
De6zbCRqh0hAovFBxSz7OY00py9RpboO3/nduoScQkOxMoEIfRNkzxX6yHT6HsSU
KtY9FKzhaxAGZSqeni2te+CYc0UobZkvwS/Sm3v7o6E52sctBvNkg/Sr4bzmulxo
OvvShRU//DizPi9wXjNTBwykWIgx62CsSDa9fO9SO49S/EAtULxM3X1dGp7mVfeW
8Di0dDMLZNhzm0NczVVNnJUdG3ar1C8GuZzrNwRU7/ylWSj+PEE2zHT/asTZlSdp
16KDx6bXicwIfcNwH56LUxvMy5TQ/qm26DtKmd7+TGq0V5pjtdvjxPse5D8nA/83
BKwGyKmt8KtKeXXDv7UtcMXL8CKmt2C0+ijXR1mLGxmxmLnfTAvZT1KNCA0jnqvO
aewUAHZ7YD7Zx1jBQmEJj9PjXUf+3GzadhtYygnRG755YodPrSxzpOOPbQ5zFgta
I5Mi3pq+sJY99YgIjfMSwKlvB1Ii8Dd+V1TKSdUnjnmKlEIB9GhqjH64kF7sk00P
yHleLnETvkUh/Tk38LgP5Rk6DOGZQsiZZmF3BZEI9werKpf7aSWDKeqzohPvy6do
tKnNV084Yq+XGhf7ecSRQJZv4Wi2er2Xgm0KiY5jFP+HXPaqAuk=
=6KEz
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-devel+unsubscr...@googlegroups.com.
To post to this group, send email to qubes-devel@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-devel/20181227133211.sohk7senmnepfxb3%40invisiblethingslab.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to