<span>Thanks Jérémy,</span><div><br></div><div>That was what I needed. I was afraid to be headed to the wrong way. Now that I know what to do, I need to know where and when.</div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" id="gmail_block_quote0"><div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite">
    </blockquote></div><div text="#000000" bgcolor="#FFFFFF">
    you could create a template (<a class="m_-987163146845524182moz-txt-link-abbreviated" href="mailto:xendomains@.service" target="_blank">xendomains@.service</a>) and use drop-ins
    to do per-instance overrides
    (/etc/systemd/system/xendomains@vm1.service.d/append.conf) that
    would allow you to individualize each domain while keeping the
    common parts<br>
    <br>
    I would find a way to prevent a domain with no corresponding to
    start (maybe by not defining a mandatory key in the template) to
    make sure no rogue domains are created...</div></blockquote></div></div><div><br></div><div>I would use a template like xendomains@.service in order to specify common stuff. However, the config of which vm are enabled (autostart) is only available at boot time. Is a systemd generator the way to go? Is is there another way to define it?</div><div><br></div><div>Also, should I use a service patch (like append.conf you mentioned) or simply directly create /run/.../xendomains@vm1.service?<br></div><div><br></div><div>It would be trivial to define a template xendomains@.service and start services like "systemctl start xendomains@vm1.service", that would read /etc/xen/vm/vm1 and launch it. I just don't know how I could define dynamic dependency for that instance depending on the content of /etc/xen/vm/vm1. Execstartpre can check requirements and prevent a service to run but not wait for a resource to be available. It would be something like ExecRequires=.</div><div><br></div><div>Instances seems to be created only when asked directly (systemctl start xendomains@vm1.service), which might be triggered by something like udev event. Is there anything like ExecListStartInstances=, ExecListRunningInstances=?</div><div>Generators can create something like that but they are triggered only at boot and daemon-reload. It would be interesting to somehow run "something like generators" when start/stop/status is called.</div><div><br></div><div>From what I know about systemd, I'm thinking of something like a generator that will create services for all autostart and saved vm. The current script-based xendomains.service will run after all xendomains@.service instances. This way, a new enabled-after-boot vm would be started with "systemctl restart xendomains". I could use the existence of /etc/xen/auto/vm or /var/lib/xen/save/vm as requirement for xendomains@vm.service, in order to avoid to start a disabled-after-boot vm. However, this does not look like an elegant solution.</div><div><br></div><div>Regards,</div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" id="gmail_block_quote0">
</blockquote></div></div><div dir="ltr">-- <br></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p dir="ltr">Luiz Angelo Daros de Luca<br>
<a href="mailto:luizluca@gmail.com">luizluca@gmail.com</a></p>
</div></div>