NAME
create_zone_config.sh - create the mirrored zpool and datasets of a zone
SYNOPSIS
/opt/omnicube/sbin/create_zone_config.sh zone
DESCRIPTION
create_zone_config.sh builds the storage layout of a single zone out of raw disk files that already exist on the local host and on every NFS-mounted peer, then creates the two ZFS datasets the zone needs.
The local pool name is derived from the short host name: the output of hostname truncated at the first hyphen. The peer list is not taken from config/nodes; instead the script lists the directories of / whose name starts with sr, drops the one matching the local pool, and keeps those whose name contains the site prefix (PROPPREFIX, the value of the SMF property config/site of svc:/omnicube/sysadm:default, or of the instance named by OC_SMF_INSTANCE). Those directories are the NFS mounts of the peers' raw LUN trees, as created by create_zone_pool.sh(8). Each candidate is validated as a name before it is used in a privileged command line.
The work performed, all through pfexec, is:
1. create the zone's zpool on the local raw file
/pool/raw/zone/zone-disk0.raw,
with
mountpoint=none
and
compression=lz4;
2. for every peer directory found, attach that peer's raw file
(/srv/raw/zone/*raw)
to the pool, turning it into an n-way mirror;
3. create
zone/zones
with
mountpoint=none;
4. create
zone/zones/zone
with
mountpoint=/zones/zone/
and
recordsize=4k.
The script stops at the first failure of any of these steps and exits with that command's status. It is meant to be run by hand, once, when provisioning a zone; the zone configuration itself is not created (the file ends with an empty Zone creation section).
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: build the storage of a new zone
create_zone_config.sh zbeio01
Example 2: inspect the result
zpool status zbeio01 zfs list -r zbeio01
EXIT STATUS
FILES
ENVIRONMENT
SECURITY
The zpool, zfs and truncate calls run under pfexec, using the root-equivalent OmniCube Administration profile. Both the zone name and every peer directory name obtained from the listing of / are validated before they are interpolated into those command lines.
SEE ALSO
omnicube_utils(3), oc_validate(3), vm_tpl.cfg(5), omnicube(7), create_iscsi_lun.sh(8), create_zone_pool.sh(8), manage_zone.sh(8), sync_pool.sh(8).
NOTES
This is the older, NFS-directory-driven provisioning path. create_zone_pool.sh(8) does the same job for both SYNC and ASYNC layouts, drives the peers from config/nodes over ssh, and creates the raw LUNs itself; prefer it for new deployments.
The raw files must already exist on every node before this command is run. Nothing is cleaned up if a mirror attach fails part way through: the pool exists with fewer members than intended and must be repaired or destroyed by hand.
The recordsize of the zone dataset is fixed at 4k here, whereas create_zone_pool.sh(8) takes it as an option.