• James Smart's avatar
    nvme-fc: add uevent for auto-connect · eaefd5ab
    James Smart authored
    To support auto-connecting to FC-NVME devices upon their dynamic
    appearance, add a uevent that can kick off connection scripts.
    uevent is posted against the fc_udev device.
    
    patch set tested with the following rule to kick an nvme-cli connect-all
    for the FC initiator and FC target ports. This is just an example for
    testing and not intended for real life use.
    
    ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \
            ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \
    	RUN+="/bin/sh -c '/usr/local/sbin/nvme connect-all --transport=fc --host-traddr=$env{NVMEFC_HOST_TRADDR} --traddr=$env{NVMEFC_TRADDR} >> /tmp/nvme_fc.log'"
    
    I will post proposed udev/systemd scripts for possible kernel support.
    Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    eaefd5ab
fc.c 80.9 KB