<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<br>
<div class="moz-cite-prefix">On 13/09/2017 06:08, Luiz Angelo Daros
de Luca wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAJq09z4bXQMr+2mODYff_t99AV+HU9_7yogkWA1Q-FdoL=VUtA@mail.gmail.com"><span>Hello,</span>
<div><br>
</div>
<div>I'm facing a problem with Xen machines that depends on MD
devices.</div>
<div>As I'm new to systemd world, I might not be seeing the clean
solution.</div>
<div>That's why I'm asking for an advice.<br>
<br>
</div>
<div>MD devices are automatically detect by udev. If device state
is safe, /dev/md/myraid is started. However, if the state is not
safe (like a raid with a missing disk), udev
starts <a class="moz-txt-link-abbreviated" href="mailto:mdadm-last-resort@.timer">mdadm-last-resort@.timer</a> that tries to start the device
anyway after 30s. As mdadm-last-resort conflicts with the device
presence, it will not run if the required disk appears before
30s. Even with mdadm-last-resort running, MD device might still
be usable, although degraded.</div>
<div><br>
</div>
<div>Xen VM are started by xendomains.service, that simply calls a
shell script like in SysV times. It start a bunch of VM in
sequence. xendomains.service has only generic dependencies that
let it run at a very early stage.</div>
</blockquote>
I would cut that script in multiple services... but you mention
doing that below, so I'm just saying I think it's the right way to
go :)<br>
<blockquote type="cite"
cite="mid:CAJq09z4bXQMr+2mODYff_t99AV+HU9_7yogkWA1Q-FdoL=VUtA@mail.gmail.com">
<div><br>
</div>
<div>Now the problem: If for any reason, a MD device takes some
seconds to appear (or even 30s as the last resort), xendomains
will fail to start any machine that depends on that MD device.</div>
<div><br>
</div>
<div>I'm extending manually xendomains.service to depend on a
series of MD devices, that fixed the start order problem.
However, I created new problems. First I had to frequently
regenerate those "Requires" as machines are frequently
started/migrated between hosts (I also consider using systemd
generators). But worse, whenever a single MD device permanently
fails, xendomains is never started and all those VM that does
not use the failed MD never start.</div>
</blockquote>
<blockquote type="cite"
cite="mid:CAJq09z4bXQMr+2mODYff_t99AV+HU9_7yogkWA1Q-FdoL=VUtA@mail.gmail.com">
<div><br>
</div>
<div>I though that maybe I could use instances
(<a class="moz-txt-link-abbreviated" href="mailto:xendomains@vm1.service">xendomains@vm1.service</a>) to launch VM individually, each of them
depending on those devices it uses. However, these instances
would have to be dynamically generated based on its
configuration (systemd generators from /etc/xen/vm/xxx.cfg?),
either on boot, shutdown or simply periodically. The stop
procedure will still be the same, calling the SysV script as
systemd will not know about VM (re)started after boot.</div>
</blockquote>
you could create a template (<a class="moz-txt-link-abbreviated" href="mailto:xendomains@.service">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...<br>
<blockquote type="cite"
cite="mid:CAJq09z4bXQMr+2mODYff_t99AV+HU9_7yogkWA1Q-FdoL=VUtA@mail.gmail.com">
<div><br>
</div>
<div>I even though about simply create an alternative
xendomains.service that does not depend on any MD device and
launch it using a systemd timer if the xendomains that depends
on MD devices isn't started after 30s. It looks ugly but it
might work.</div>
<div><br>
</div>
<div>Regards,</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" moz-do-not-send="true">luizluca@gmail.com</a></p>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
systemd-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<div style="border-bottom: 1px solid #ccd4d7; margin:0 10px 10px
0; width:600px"> </div>
<div>
<table style="; padding: 15px 0 0 0" border="0">
<tbody>
<tr>
<td style="font-size:11px; color:#56707d; text-align:
center; "> <a href="http://www.smile.fr/"><img
src="http://ftp.smile.fr/client/Communication/signature/img/Logo.png"
alt="Logo" width="129" height="47"></a><br>
<br>
<font face="century gothic, arial, sans-serif">20 rue
des Jardins<br>
92600 Asnières-sur-Seine<br>
<a href="http://www.smile.fr/" style="font-size:14px;
color:#ec6608 ; text-decoration:none;">www.smile.fr</a></font>
</td>
<td style="padding-left:35px; font-size:12px;
color:#56707d">
<div style="color:#153358; font-size:12px;"><font
face="century gothic, arial, sans-serif"><b>Jérémy
ROSEN</b></font></div>
<div style="color:#117eb4; font-size:12px;"><font
face="century gothic, arial, sans-serif">Architecte
technique<br>
</font></div>
<div style="color:#56707d; font-size:12px;"><font
face="century gothic, arial, sans-serif">Email : <a
href="mailto:jeremy.rosen@smile.fr"
style="color:#56707d; font-size:12px;
text-decoration:none;">jeremy.rosen@smile.fr</a> <br>
Tel : +33141402967 </font></div>
<br>
<div> <span><a
href="https://www.facebook.com/smileopensource"><img
src="http://ftp.smile.fr/client/Communication/signature/img/Facebook.png"
alt="Facebook" width="25" height="24"></a></span>
<span><a
href="http://fr.slideshare.net/SmileOpenSource/presentations"><img
src="http://ftp.smile.fr/client/Communication/signature/img/Slideshare.png"
alt="Google%2B" width="25" height="24"></a></span>
<span><a href="https://www.linkedin.com/company/smile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/LinkedIn.png"
alt="LinkedIn" width="25" height="24"></a></span>
<span><a href="https://twitter.com/GroupeSmile"><img
src="http://ftp.smile.fr/client/Communication/signature/img/Twitter.png"
alt="Twitter" width="25" height="24"></a></span>
</div>
</td>
</tr>
</tbody>
</table>
<div style="border-bottom: 1px solid #ccd4d7; margin:0 10px 0 0;
width:600px"> </div>
<br>
<div> <a
href="http://www.smile.fr/Offres-services/Offres/Ingenierie?utm_source=signature&utm_medium=email&utm_campaign=signature"><img
src="http://signature.smile.eu/assets/img/OW_devient_Smile_ECS.png"
alt="bandeaux_mail" border="0"></a></div>
<br>
<div style="color:#a3acb5; font-size:10px;"> <img
src="http://ftp.smile.fr/client/Communication/signature/img/eco.png"
alt="eco" width="13" height="11"> <font face="century
gothic, arial, sans-serif"> Pour la planète, n'imprimez ce
mail que si c'est nécessaire </font> </div>
</div>
</div>
</body>
</html>