Mailing List Archive

Network script is invoked twice - in parallel!
Hi all,

I observe that my networking script is invoked twice - in parallel! -
when I execute "xl create ..." or reboot a domU.
I added the following the beginning/end of my script:

> echo "$$ ${command} ${dev} ${ip} | $@" >>/tmp/xen.log
> ...
> echo "$$ done" >>/tmp/xen.log


The output is:

> 1575914 online vif34.0 195.x.x.x 2a01:x:x:x:x::2/66 | online type_if=vif
> 1575916 online vif34.0 195.x.x.x 2a01:x:x:x:x::2/66 | online type_if=vif
> 1575914 done
> 1575916 done


I am using Xen 4.17.1.

How can I prevent that from happening? The script fails randomly since
it is executed in parallel twice!

I would expect that the script is executed once only.


Kind Regards,
Sven
Re: Network script is invoked twice - in parallel! [ In reply to ]
On Sat, May 06, 2023 at 03:42:15PM +0200, Sven K?hler wrote:
> Hi all,
>
> I observe that my networking script is invoked twice - in parallel! - when I
> execute "xl create ..." or reboot a domU.
> I added the following the beginning/end of my script:
>
> > echo "$$ ${command} ${dev} ${ip} | $@" >>/tmp/xen.log
> > ...
> > echo "$$ done" >>/tmp/xen.log
>
>
> The output is:
>
> > 1575914 online vif34.0 195.x.x.x 2a01:x:x:x:x::2/66 | online type_if=vif
> > 1575916 online vif34.0 195.x.x.x 2a01:x:x:x:x::2/66 | online type_if=vif
> > 1575914 done
> > 1575916 done
>
>
> I am using Xen 4.17.1.
>
> How can I prevent that from happening? The script fails randomly since it is
> executed in parallel twice!
>
> I would expect that the script is executed once only.

I don't think that is expected... I think there are three ways that the
hotplug event can be handled:

- udev rules (deprecated?)
- `xl devd` (required in a domU driver domain)
- directly from `xl create`

If you've done an upgrade are there some old udev rules hanging around? If
not do you have an `xl devd` process running? systemd unit
xendriverdomain.service or /etc/init.d/xendriverdomain, the init.d script
looks to have a check to not run in dom0 but the systemd unit doesn't have
the same.

If these don't help how about recording more information in the debug log
so you can see the full process tree of each invocation of the network
script.

James
Re: Network script is invoked twice - in parallel! [ In reply to ]
Hi James,

Am 09.05.23 um 09:28 schrieb James Dingwall:
> On Sat, May 06, 2023 at 03:42:15PM +0200, Sven Köhler wrote:
>> Hi all,
>>
>> I observe that my networking script is invoked twice - in parallel! - when I
>> execute "xl create ..." or reboot a domU.
>> I added the following the beginning/end of my script:
>>
>>> echo "$$ ${command} ${dev} ${ip} | $@" >>/tmp/xen.log
>>> ...
>>> echo "$$ done" >>/tmp/xen.log
>>
>>
>> The output is:
>>
>>> 1575914 online vif34.0 195.x.x.x 2a01:x:x:x:x::2/66 | online type_if=vif
>>> 1575916 online vif34.0 195.x.x.x 2a01:x:x:x:x::2/66 | online type_if=vif
>>> 1575914 done
>>> 1575916 done
>>
>>
>> I am using Xen 4.17.1.
>>
>> How can I prevent that from happening? The script fails randomly since it is
>> executed in parallel twice!
>>
>> I would expect that the script is executed once only.
>
> I don't think that is expected... I think there are three ways that the
> hotplug event can be handled:
>
> - udev rules (deprecated?)
> - `xl devd` (required in a domU driver domain)
> - directly from `xl create`
>
> If you've done an upgrade are there some old udev rules hanging around? If
> not do you have an `xl devd` process running? systemd unit
> xendriverdomain.service or /etc/init.d/xendriverdomain, the init.d script
> looks to have a check to not run in dom0 but the systemd unit doesn't have
> the same.

xendriverdomain was enabled and was indeed invoking the script in
addition to xl create. I would have seen that, I guess, if I had looked
into the parent process.

Thanks for the hint!


Kind Regards,
Sven