NAME
create_iscsi_lun.sh - create and export the main and SLOG iSCSI LUNs of a zone
SYNOPSIS
/opt/omnicube/sbin/create_iscsi_lun.sh zone size
DESCRIPTION
create_iscsi_lun.sh creates the two COMSTAR logical units that back one zone over iSCSI: a main LUN of the requested size on the host's main pool, and a fixed 10 GB SLOG LUN on the host's NVMe pool. Both are backed by sparse raw files inside their own ZFS dataset, and both are exported to every initiator by adding a view with no host group and no target group. It is an operator command, run once per zone.
Pool names are derived from the short host name, that is the output of hostname truncated at the first hyphen:
Both halves are idempotent in two ways. The dataset and the raw file are only created when the raw file does not already exist, and the logical unit is only created when stmfadm list-lu -v does not already mention that raw file, in which case the command returns without touching the existing LU or its view. Otherwise stmfadm create-lu is run, its GUID is taken from the created line of the output, and stmfadm add-view publishes it; the GUID and the backing file are printed on success.
This command runs entirely on the local host. It does not talk to the other cluster nodes and does not read config/nodes. The shared run-level guard applies: the command exits 0 without doing anything when the host is at run level 0, 1, 5, 6, S or s, or when /etc/nologin exists, unless OC_IGNORE_RUNLEVEL is set.
OPERANDS
This command takes no options.
EXAMPLES
Example 1: create a 200 GB main LUN and its SLOG for a zone
create_iscsi_lun.sh zbeio01 200
Example 2: verify what was exported
pfexec stmfadm list-lu -v pfexec stmfadm list-view -l <guid>
Example 3: re-run after a partial failure
create_iscsi_lun.sh zbeio01 200
Existing raw files and existing logical units are left alone, so a re-run only completes what is missing.
EXIT STATUS
FILES
ENVIRONMENT
SECURITY
The zfs, truncate and stmfadm calls run under pfexec, using the root-equivalent OmniCube Administration profile. Both operands are validated before they reach a dataset name, a file path or an stmfadm command line: the zone name against the standard name pattern, the size as a strictly positive integer, which also rules out the silent creation of a zero-length logical unit.
SEE ALSO
omnicube_utils(3), oc_validate(3), omnicube(7), create_zone_config.sh(8), create_zone_pool.sh(8), get_vm_disk_info.sh(8), manage_zone.sh(8), pool_monitor.sh(8).
NOTES
stmfadm add-view is called without a host group or target group, so each logical unit is visible to every initiator that can reach the target. Restrict access with target and host groups, or at the network level, if that is not what you want.
The parent datasets main_pool/iscsi and slog_pool/iscsi-slog are expected to exist already; zfs create is only called for the per-zone child.
The SLOG pool name is derived, not verified. On a host without a <short_host>-nvme pool the SLOG half fails, after the main LUN has already been created and exported.