NAME
create_zone_pool.sh - create the zpool and datasets of a SYNC or ASYNC zone
SYNOPSIS
/opt/omnicube/sbin/create_zone_pool.sh -z zone [-s pool_size] [-k record_size] [-e]
DESCRIPTION
create_zone_pool.sh provisions the storage of one zone across every node of the cluster and then creates the two ZFS datasets the zone needs. It is an operator command, run once per zone at provisioning time.
The node list comes from the SMF property config/nodes of svc:/omnicube/sysadm:default, or of the instance named by OC_SMF_INSTANCE, read by the shared library into the nodes array. Each entry is the full host name and is used as the ssh target; pool, dataset and mount point paths use the short name, that is the entry truncated at the first hyphen. Remote privileged commands are run as pfexec on the peer. Every peer other than the local host must answer an ssh pre-flight probe before anything is created, because pool creation is an all-or-nothing operation spanning several nodes and a peer that turns out to be unreachable half way through leaves orphaned datasets, raw files and mounts behind with no automatic cleanup.
On every node, including the local one, the script first creates the dataset short_node/raw/zone mounted at /short_node/raw/zone and a sparse raw file /short_node/raw/zone/zone-disk0.raw of pool_size GB. What happens next depends on the mode.
SYNC mode (default)
One single zpool named after the zone is created on the local host as an n-way mirror of all the nodes' raw files. To make the peers' files visible locally, each peer's raw directory is NFS-mounted on the same path with
vers=4,rsize=131072,wsize=131072,actimeo=0,retry=36000,nocto, timeo=60,noforcedirectio
and the local raw directory is created on each peer so the mount is symmetric. The pool is created with primarycache=metadata, mountpoint=none, compression=lz4, atime=off and autoexpand=on. Only the datasets zone/zones and zone/zones/zone are created afterwards, on the local host only, since the pool itself is shared.
ASYNC mode (-e)
No NFS mount and no mirror. An independent zpool named after the zone is created on each node from that node's own raw file, with the same pool properties. The zone/zones and zone/zones/zone datasets are created locally, and zone/zones is additionally created on every peer, so that replication with autosync(8) or manage_zone.sh -S has a place to land.
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.
OPTIONS
Any other option prints the usage summary and exits.
EXAMPLES
Example 1: a mirrored SYNC pool of the default size
create_zone_pool.sh -z zbeio01
Example 2: a 500 GB SYNC pool with a 4K record size for a database VM
create_zone_pool.sh -z zbeio01 -s 500 -k 4
Example 3: an ASYNC zone replicated between nodes
create_zone_pool.sh -z zfoo -s 200 -e
EXIT STATUS
The NFS mount phase of SYNC mode returns 2 from its own function, which the caller reports as exit status 3.
FILES
ENVIRONMENT
SECURITY
All zfs, zpool, truncate, mkdir and mount calls run under pfexec, locally and on the peers, using the root-equivalent OmniCube Administration profile. The zone name, every node name read from config/nodes, and both numeric options are validated before they reach a privileged command line or an ssh command string. ssh runs with BatchMode=yes and StrictHostKeyChecking=yes, so each peer's host key must already be known.
SEE ALSO
omnicube_utils(3), oc_ssh(3), oc_validate(3), vm_tpl.cfg(5), omnicube(7), autosync(8), create_iscsi_lun.sh(8), create_zone_config.sh(8), manage_zone.sh(8), pool_monitor.sh(8), sync_pool.sh(8).
NOTES
The command is not idempotent and has no rollback. A failure after the raw files have been created leaves them, and any NFS mounts already made, in place on several nodes; clean up by hand before retrying. The status of the final dataset creation step is not checked either, so the command can exit 0 after the pool was built but zone/zones or zone/zones/zone failed; verify with zfs list -r afterwards.
In SYNC mode the pool exists on one node at a time only. It is the pool that manage_zone.sh -l hands over between nodes, and the NFS mounts are what make the mirror members of the other nodes reachable, so an actimeo=0 NFS path is on the write path of the zone: peer or network problems show up as pool latency. In ASYNC mode each node has its own pool and the zone data is moved by replication instead.
The record_size option only affects the leaf dataset zone/zones/zone and nothing else. The pool-wide properties, including compression=lz4, are fixed in the script.