NVMf initiator persistent across boots

Max Gurtovoy maxg at mellanox.com
Wed Mar 7 08:36:16 PST 2018



On 3/7/2018 5:48 PM, Hannes Reinecke wrote:
> On 03/05/2018 08:45 PM, Sagi Grimberg wrote:
>>
>>> Hi all,
>>>
>>> Sorry for the delay, but I wanted to know if we had a progress for
>>> this topic. I want to add functionality that gives persistency for
>>> fabric devices not only across boots but also across adapter/device
>>> removals.
>>> My idea is to add a flag --persist to "nvme connect" command. This
>>> command will add the created ctrls to a file
>>> (/etc/nvme-fabrics/persistent_ctrls for example).
>>> And I want to add a udev rule that in case of ctrl removal, we'll run
>>> a script that try to periodicly connect to the target.
>> Why not just add a periodic task to run nvme connect-all?
>> -- 
>> [Unit]
>> Description=NVMf auto discovery service
>> After=systemd-modules-load.service network-online.target
>>
>> [Service]
>> Type=oneshot
>> ExecStart=/usr/bin/nvme connect-all
>> StandardOutput=journal
>>
>> [Timer]
>> OnUnitActiveSec=1min
>>
>> [Install]
>> WantedBy=multi-user.target timers.target
>> -- 
>>
>> That would simply run nvme connect-all once every say minute.
>> The only problem is that it relies on the kernel to fail
>> duplicate subsystems. We could enforce that in nvme-cli for that
>> matter though (we can compare against sysfs address and subsysnqn).
>>
>> Johannes is probably one to know better than me if this is the
>> correct way to go...
>>
> In principle we could; but we should first decide what the correct
> strategy here is.
> FC has the same issue, and tries to overcome this by adding custom
> uevents.
> 
> Wasn't there a session proposed at LSF/MM?
> I guess that's the right forum to discuss it, as it'll involve all fabrics.

Yes, I'll catch up since I probably wouldn't make it to LSF this year.
Meanwhile I created the following timer/service for systemd:

timer:
------------
[Unit]
Description=NVMf auto discovery timer

[Timer]
OnUnitActiveSec=60
Unit=nvme_fabrics_persistant.service

[Install]
WantedBy=multi-user.target timers.target

service:
----------
[Unit]
Description=NVMf auto discovery service
Requires=network.target
After=systemd-modules-load.service network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/nvme connect-all
StandardOutput=journal

[Install]
WantedBy=multi-user.target timers.target


I works for me but the problem is that we trigger nvme discover every 60 
seconds...
But I guess until we'll have final definition for discovery for the 
fabrics we can live with that.

> 
> Cheers,
> 
> Hannes
> 



More information about the Linux-nvme mailing list