NAME
isolate_node.sh - place an OmniCube node in isolation mode, or take it back out
SYNOPSIS
/opt/omnicube/sbin/isolate_node.sh [ auto | manual | reconcile | release | status ]
isolate_node.sh [verb]
DESCRIPTION
isolate_node.sh puts the local node into isolation mode by taking every remote pool and LUN offline, and takes it back out again. A node is isolated when it can no longer reach its peer's iSCSI targets: continuing to drive half-visible remote devices is worse than standing down until the peer returns.
Exactly one verb is accepted, and it defaults to auto when no argument is given, which preserves the bare invocation used by pool_monitor.sh(8). Both isolation modes share the same on-disk marker, the directory /var/run/omnicube/isolate_node.lock, so any consumer that only tests for that directory's presence keeps working regardless of the mode. The mode itself is recorded as a single word in the file /var/run/omnicube/isolate_node.lock/mode.
The script sets an explicit, exported PATH of /usr/sbin:/sbin:/opt/ooce/sbin:/usr/bin:/usr/gnu/bin:/opt/ooce/bin because pfexec matches /etc/security/exec_attr.d/omnicube on the resolved path of the binary, so sqlite3 and gsed must resolve to the paths listed there. It sources /opt/omnicube/lib/common/utils.sh for logging, the node identity and the marker path.
Isolation modes
A marker directory whose mode file is missing or unreadable, for instance one left behind by an older version, is treated as manual. The safe default is to require a human to clear it rather than to remove something that may have been intentional.
Entering isolation
For both auto and manual, the marker directory is created with mkdir (atomic; an existing directory is not an error), the effective mode is written to the mode file, and one of Entering <mode> isolation mode, Isolation mode changed from <old> to <new> or Already in <mode> isolation mode is logged at info level. The isolation action itself then runs: for every pool except rpool and except pools whose name contains the local host's short name (the hostname truncated at the first hyphen), Isolate pool <name> is printed and every device of that pool whose LUN id is not in the local pfexec stmfadm list-lu output is taken offline with pfexec zpool offline. Locally-served LUNs are therefore left online; only the peer's are dropped. The pool candidate list is filtered with shell pattern matching, and the local-LUN comparison uses fixed-string whole-word matching, so neither a metacharacter in the hostname nor a short WWN that is a substring of a longer one can select the wrong devices.
Leaving isolation
reconcile and release both remove the mode file and the marker directory. Neither re-onlines anything: clearing the marker is what allows pool_monitor.sh(8) and the zone-management service to resume and bring the pools back through their existing repair paths.
reconcile first decides whether the peer is really back. It reuses the probe that caused the isolation: for every non-local target in the iscsi_sessions table of /opt/efitsrv/sysinfo.db it reads discover_addr and runs nc -vz addr 3260. The node counts as reachable only when at least one remote target was probed and every one of them answered, which is symmetric with the condition that triggered the isolation. Target names and addresses are validated against ^[a-zA-Z0-9.:_-]+$ and skipped otherwise, since they are external input flowing into an SQL string literal and into a command line.
Run-level guard
auto, manual and reconcile call abort_if_shutting_down and exit 0 silently when the host is at run level 0, 1, 5, 6, S or s, or when /etc/nologin exists; a node on its way down must not start isolating itself or churning isolation state. OC_IGNORE_RUNLEVEL set to a non-empty value overrides this. release is a deliberate operator action and is allowed even mid-shutdown, and status only reads state, so neither is gated.
Locking
This command takes no single-instance lock of its own. The marker directory is the shared state, and it is created with a single atomic mkdir, so two concurrent invocations converge instead of colliding. The parent directory /var/run/omnicube is created by utils.sh on every source with mode 1775 and group config/lock_group, so both root and RBAC operators can create the marker.
Alerting
All progress messages go through info() from utils.sh: stdout plus syslog user.info under the tag <site>isolate_node, which /etc/rsyslog.d/omnicube.conf routes to /var/log/misc.log. A failure to create the marker is reported with error(), which additionally mails oc-alert; warning()-level events would mail oc-warn. Both are throttled per (severity, message) pair to at most one mail per config/mail_throttle_window seconds, default 3600.
OPERANDS
Any other argument prints usage: isolate_node.sh [auto|manual|reconcile|release|status] on stderr and exits 2.
EXAMPLES
Example 1: take a node out of service before maintenance
pfexec /opt/omnicube/sbin/isolate_node.sh manual /opt/omnicube/sbin/isolate_node.sh status isolated (manual)
Example 2: put the node back into service afterwards
Nothing is re-onlined by the release itself; the next pool_monitor.sh pass does that.
pfexec /opt/omnicube/sbin/isolate_node.sh release /opt/omnicube/sbin/isolate_node.sh status not isolated
Example 3: ask whether a temporary isolation can heal now
/opt/omnicube/sbin/isolate_node.sh reconcile tail /var/log/misc.log
Example 4: check isolation state from a script
if [ "$(/opt/omnicube/sbin/isolate_node.sh status)" != "not isolated" ]; then
echo "node is isolated, skipping"
fi
EXIT STATUS
FILES
ENVIRONMENT
SECURITY
zpool, stmfadm and sqlite3 are invoked through pfexec, which requires the OmniCube Administration profile from /etc/security/prof_attr.d/omnicube. That profile is root-equivalent as a whole. Target names and discovery addresses read out of /opt/efitsrv/sysinfo.db are validated before being interpolated into SQL literals or privileged command lines.
SEE ALSO
manage_zone.sh(8), pool_monitor.sh(8), sync_pool.sh(8), sys_monitor(8), oc_lock(3), oc_log(3), oc_runlevel(3), omnicube_utils(3), omnicube(7).
NOTES
Isolation is a node-wide, cluster-visible state. While the marker exists every remote pool is offline, so zones backed by the peer's LUNs cannot run, and pool_monitor.sh(8) stops performing repairs.
The asymmetry between the two modes is intentional and is the main thing to remember: automation may create and clear an auto lock at will, but a manual lock is a promise to a human. Nothing in the suite removes it, and an automatic auto trigger arriving while a manual lock is held leaves the lock manual. After maintenance, the node stays isolated until someone runs release.
Neither reconcile nor release re-onlines the devices that auto or manual offlined. Recovery is left to the next monitor pass; if the monitors are disabled, the pools must be re-onlined by hand with zpool online.