[systemd-devel] [iGVT-g] Proper way for systemd service to wait mdev gvt device initialization
gnidorah at ya.ru
gnidorah at ya.ru
Sun May 26 18:49:50 UTC 2019
Cool, that did the trick! Thank you Jordan!
20.05.2019, 23:35, "Jordan Glover" <golden_miller83 at protonmail.ch>:
> On Sunday, May 19, 2019 6:45 PM, Alex Ivanov <gnidorah at ya.ru> wrote:
>
>> Hello.
>> What is the proper way to do that? I have a unit that creates gvt device in the system
>>
>> ExecStart = "sh -c 'echo a297db4a-f4c2-11e6-90f6-d3b88d6c9525 > /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/i915-GVTg_V5_8/create'";
>> ExecStop = "sh -c 'echo 1 > /sys/bus/pci/devices/0000:00:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525/remove'";
>>
>> Ideally I would to like to start this service when 0000:00:02.0 device appears in the system, but the problem is that /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/ tree is populated later, so my service will fail.
>>
>> So the question what is the proper way to fix that.
>
> Use systemd.path helper:
> https://www.freedesktop.org/software/systemd/man/systemd.path.html
>
> Examples:
> https://blog.andrewkeech.com/posts/170809_path.html
>
> Create gvt.path and gvt.service
>
> gvt.path:
> ...
> [Unit]
> Description=gvt path
>
> [Path]
> PathExist=/sys/bus/pci/devices/0000:00:02.0/mdev_supported_types
>
> [Install]
> WantedBy=multi-user.target
>
> gvt.service:
> ...
> [Unit]
> Description=gvt service
>
> [Service]
> ExecStart = "sh -c 'echo a297db4a-f4c2-11e6-90f6-d3b88d6c9525 > /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types/i915-GVTg_V5_8/create'"
> ExecStop = "sh -c 'echo 1 > /sys/bus/pci/devices/0000:00:02.0/a297db4a-f4c2-11e6-90f6-d3b88d6c9525/remove'"
More information about the systemd-devel
mailing list