Skip to content

Instantly share code, notes, and snippets.

@ancorgs
Last active August 20, 2025 13:26
Show Gist options
  • Select an option

  • Save ancorgs/ba45ff78bd0ebdc0d957ec7033d0cbd5 to your computer and use it in GitHub Desktop.

Select an option

Save ancorgs/ba45ff78bd0ebdc0d957ec7033d0cbd5 to your computer and use it in GitHub Desktop.
iBFT initialization in Agama

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
end

But 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.iscsi with the value from iBFT
  • Then it stops iscsid.service using systemd.
  • Then it executes iscsiadm -m session until the daemon runs. No direct invocation to systemctl 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment