Agama uses this code to initialize iSCSI and iBFT. It looks quite reasonable.
def activate
start_services
Yast::IscsiClientLib.getiBFT
# Check initiator name, creating one if missing.
return false unless Yast::IscsiClientLib.checkInitiatorName(silent: true)
# Why we need to sleep here? This was copied from yast2-iscsi-client.
sleep(0.5)
Yast::IscsiClientLib.getConfig
Yast::IscsiClientLib.autoLogOn
endBut since it relies on YaST libraries, some not-so-obvious things happen.
The first line (start_services) starts iscsi.service, iscsid.service and iscsiuio.service. All using systemd.
The second line (getIBFT) reads the iBFT configuration, so its values are then known to the YaST libraries.
So far, so good. :-)
The next line (checkInitiatorName) does not-so-nice things:
- First it replaces the content from
/etc/iscsi/initiatorname.iscsiwith the value from iBFT - Then it stops
iscsid.serviceusing systemd. - Then it executes
iscsiadm -m sessionuntil the daemon runs. No direct invocation tosystemctl start.
The next line (getConfig) reads the configuration if it's not already read. I see no trace of its execution in the logs.
So I guess nothing special to mention here.
The last line (autoLogOn) tries to login via iscsiadm -m fw -l but it fails. I guess it is fair to assume that's caused by how checkInitiatorName messed with the services.