<chapter id="gcwwm"><title>Planning the <literal>lx</literal> Branded
Zone Configuration (Overview)</title><highlights><para>This chapter describes what you need to do before you can configure
an <literal>lx</literal> branded zone on your x64 or x86 based system. This
chapter also describes how to use the <command>zonecfg</command> command.</para>
</highlights><sect1 id="gcxax"><title>System and Space Requirements</title><para>The following primary machine considerations are associated with the
use of <literal>lx</literal> branded zones.</para><itemizedlist><listitem><para>The machine must be either x64 or x86 based.</para>
</listitem><listitem><para>Sufficient disk space to hold the files that are unique within
each <literal>lx</literal> zone must be available. The disk space requirements
for an <literal>lx</literal> zone are determined by the size and number of
RPMs, or Linux packages, that are installed.</para>
</listitem><listitem><para>The <literal>lx</literal> brand supports only the whole root
model, so each installed zone will have its own copy of every file.</para>
</listitem>
</itemizedlist><para>There are no limits on how much disk space can be consumed by a zone.
The global administrator is responsible for space restriction. The global
administrator must ensure that local storage is sufficient to hold a non-global
zone's root file system. Given sufficient storage, even a small uniprocessor
system can support a number of zones running simultaneously.</para>
</sect1><sect1 id="gdbhe"><title>Restricting the Size of the Branded Zone</title><para>The following options can be used to restrict zone size:</para><itemizedlist><listitem><para>You can place the zone on a <command>lofi</command>-mounted
partition. This action will limit the amount of space consumed by the zone
to that of the file used by <command>lofi</command>. For more information,
see the <olink targetdoc="group-refman" targetptr="lofiadm-1m" remap="external"><citerefentry><refentrytitle>lofiadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="lofi-7d" remap="external"><citerefentry><refentrytitle>lofi</refentrytitle><manvolnum>7D</manvolnum></citerefentry></olink> man pages.</para>
</listitem><listitem><para>You can use soft partitions to divide disk slices or logical
volumes into partitions. You can use these partitions as zone roots, and thus
limit per-zone disk consumption. The soft partition limit is 8192 partitions.
For more information, see <olink targetdoc="logvolmgradmin" targetptr="about-softpart-1" remap="external">Chapter 12, <citetitle remap="chapter">Soft Partitions (Overview),</citetitle> in <citetitle remap="book">Solaris Volume Manager Administration Guide</citetitle></olink>.</para>
</listitem><listitem><para>You can use the standard partitions of a disk for zone roots,
and thus limit per-zone disk consumption.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="gdbgz"><title>Branded Zone Network Address</title><para>Each zone that requires network connectivity has one or more unique
IP addresses. IPv4 addresses are supported. You must assign an IPv4 address
for the zone. For more information, see <olink targetptr="gdbgz" remap="internal">Branded Zone
Network Address</olink>.</para>
</sect1><sect1 id="gcxau"><title><literal>lx</literal> Branded Zone Configuration
Process</title><para>The <command>zonecfg</command> command is used to:</para><itemizedlist><listitem><para>Set the brand for the zone</para>
</listitem><listitem><para>Create the configuration for the <literal>lx</literal> zone</para>
</listitem><listitem><para>Verify the configuration to determine whether the specified
resources and properties are legal and internally consistent on a hypothetical
x86 or x64 based system</para>
</listitem><listitem><para>Perform a brand-specific verification. The verification ensures
the following:</para><itemizedlist><listitem><para>The zone cannot have any inherited package directories, ZFS
datasets, or added devices.</para>
</listitem><listitem><para>If the zone is configured to use audio, the specified devices
(if any) must be <literal>none</literal>, <literal>default</literal>, or a
single digit.</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist><para>The check performed by the <command>zonecfg</command> <literal>verify</literal> command
for a given configuration verifies the following:</para><itemizedlist><listitem><para>Ensures that a zone path is specified</para>
</listitem><listitem><para>Ensures that all of the required properties for each resource
are specified</para>
</listitem><listitem><para>Ensures that brand requirements are met</para>
</listitem>
</itemizedlist><para>For more information about the <command>zonecfg</command> command, see
the <olink targetdoc="group-refman" targetptr="zonecfg-1m" remap="external"><citerefentry><refentrytitle>zonecfg</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</sect1><sect1 id="gekrh"><title><literal>lx</literal> Branded Zone Configuration
Components</title><para>This section covers the following components:</para><itemizedlist><listitem><para>Zone resources and properties that can be configured using
the <command>zonecfg</command> command</para>
</listitem><listitem><para>Resources included in the configuration by default</para>
</listitem>
</itemizedlist><sect2 id="gcxbn"><title>Zone Name and Zone Path in an <literal>lx</literal> Branded
Zone</title><para>You must choose a name and a path for your zone.</para>
</sect2><sect2 id="gdkcr"><title>Zone Autoboot in an <literal>lx</literal> Branded
Zone</title><para>The <literal>autoboot</literal> property setting determines whether
the zone is automatically booted when the global zone is booted.</para>
</sect2><sect2 id="gdafy"><title>Resource Pool Association in an <literal>lx</literal> Branded
Zone</title><para>If you have configured resource pools on your system as described in <olink targetptr="rmpool.task-1" remap="internal">Chapter&nbsp;13, Creating and Administering Resource
Pools (Tasks)</olink>, you can use the <literal>pool</literal> property to
associate the zone with one of the resource pools when  you configure the
zone.</para><para>If you do not have resource pools configured, you can still specify
that a subset of the system's processors be dedicated to a non-global zone
while it is running by using the <literal>dedicated-cpu</literal> resource.
The system will dynamically create a temporary pool for use while the zone
is running.</para><note><para>A zone configuration using a persistent pool set through the <literal>pool</literal> property is incompatible with a temporary pool configured through
the <literal>dedicated-cpu</literal> resource. You can set only one of these
two properties.</para>
</note>
</sect2><sect2 id="gekgp"><title>Specifying the <literal>dedicated-cpu</literal> Resource</title><para>The <literal>dedicated-cpu</literal> resource specifies that a subset
of the system's processors should be dedicated to a non-global zone while
it is running. When the zone boots, the system will dynamically create a temporary
pool for use while the zone is running.</para><para>Note that with specification in <command>zonecfg</command>, pool settings
propagate during migrations.</para><para>The <literal>dedicated-cpu</literal> resource sets limits for <literal>ncpus</literal>, and optionally, <literal>importance</literal>. </para><variablelist><varlistentry><term><literal>ncpus</literal></term><listitem><para>Specify the number of CPUs or specify a range, such as 2&ndash;4
CPUs. If you specify a range because you want dynamic resource pool behavior,
also do the following:</para><itemizedlist><listitem><para>Set the <literal>importance</literal> property.</para>
</listitem><listitem><para>Enable the dynamic resource pool service as described in <olink targetptr="rmpool.task-57" remap="internal">Enabling and Disabling the Pools Facility</olink></para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry><varlistentry><term><literal>importance</literal></term><listitem><para>If you are using a CPU range to achieve dynamic behavior,
also set the <literal>importance</literal> property, The <literal>importance</literal> property,
which is <emphasis>optional</emphasis>, defines the relative importance of
the pool. This property is only needed when you specify a range for <literal>ncpus</literal> and are using dynamic resource pools managed by <command>poold</command>.
If <command>poold</command> is not running, then <literal>importance</literal> is
ignored. If <command>poold</command> is running and <literal>importance</literal> is
not set, <literal>importance</literal> defaults to <literal>1</literal>. For
more information, see <olink targetptr="gbvhv" remap="internal">pool.importance Property Constraint</olink>.</para>
</listitem>
</varlistentry>
</variablelist><caution><para>The <literal>cpu-shares</literal> rctl and the <literal>dedicated-cpu</literal> resource are incompatible.</para>
</caution>
</sect2><sect2 id="gepzg"><title>Specifying the <literal>capped-cpu</literal> Resource</title><para>The <literal>capped-cpu</literal> resource provides an absolute
limit on the amount of CPU resources that can be consumed by a project or
a zone. The <literal>capped-cpu</literal> resource has a single <literal>ncpus</literal> property
that is a positive decimal with two digits to the right of the decimal. This
property corresponds to units of CPUs. The resource does not accept a range.
The resource does accept a decimal number. When specifying <literal>ncpus</literal>,
a value of <literal>1</literal> means 100 percent of a CPU. A value of <literal>1.25</literal> means 125 percent, because 100 percent corresponds to one full
CPU on the system.</para><note><para>The <literal>capped-cpu</literal> resource and the <literal>dedicated-cpu</literal> resource are incompatible.</para>
</note>
</sect2><sect2 id="gekhp"><title>Scheduling Class in a Zone</title><para>You
can use the <emphasis>fair share scheduler</emphasis> (FSS) to control the
allocation of available CPU resources among zones, based on the importance
of the workloads in the zone. This importance is expressed by the number of <emphasis>shares</emphasis> of CPU resources that you assign to each zone. Even if you
are not using FSS to manage CPU resource allocation between zones, you can
set the zone's scheduling-class to use FSS so that you can set shares on projects
within the zone.</para><para>When you explicitly set the <literal>cpu-shares</literal> property,
the fair share scheduler (FSS) will be used as the scheduling class for that
zone. However, the preferred way to use FSS in this case is to set FSS to
be the system default scheduling class with the <command>dispadmin</command> command.
That way, all zones will benefit from getting a fair share of the system CPU
resources. If <literal>cpu-shares</literal> is not set for a zone, the zone
will use the system default scheduling class. The following actions set the
scheduling class for a zone:</para><itemizedlist><listitem><para>You can use the <literal>scheduling-class</literal> property
in <command>zonecfg</command> to set the scheduling class for the zone.</para>
</listitem><listitem><para>You can set the scheduling class for a zone through the resource
pools facility. If the zone is associated with a pool that has its <literal>pool.scheduler</literal> property set to a valid scheduling class, then processes running
in the zone run in that scheduling class by default. See <olink targetptr="rmpool-2" remap="internal">Introduction to Resource Pools</olink> and <olink targetptr="rmpool.task-22" remap="internal">How to Associate a Pool With a Scheduling Class</olink>.</para>
</listitem><listitem><para>If the <literal>cpu-shares</literal> rctl is set and FSS has
not been set as the scheduling class for the zone through another action, <literal>zoneadmd</literal> sets the scheduling class to FSS when the zone boots.</para>
</listitem><listitem><para>If the scheduling class is not set through any other action,
the zone inherits the system default scheduling class.</para>
</listitem>
</itemizedlist><para>Note that you can use the <command>priocntl</command> described in the <olink targetdoc="group-refman" targetptr="priocntl-1" remap="external"><citerefentry><refentrytitle>priocntl</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page to
move running processes into a different scheduling class without changing
the default scheduling class and rebooting.</para>
</sect2><sect2 id="gekgx"><title><literal>capped-memory</literal> Resource</title><para>The <literal>capped-memory</literal> resource sets limits for <literal>physical</literal>, <literal>swap</literal>,
and <literal>locked</literal> memory. Each limit is optional, but at least
one must be set.</para><itemizedlist><listitem><para>Determine values for this resource if you plan to cap memory
for the zone by using <literal>rcapd</literal> from the global zone. The <literal>physical</literal> property of the <literal>capped-memory</literal> resource
is used by <literal>rcapd</literal> as the <literal>max-rss</literal> value
for the zone.</para>
</listitem><listitem><para>The <literal>swap</literal> property of the <literal>capped-memory</literal> resource is the preferred way to set the <literal>zone.max-swap</literal> resource
control.</para>
</listitem><listitem><para>The <literal>locked</literal> property of the <literal>capped-memory</literal> resource is the preferred way to set the <literal>zone.max-locked-memory</literal> resource control.</para>
</listitem>
</itemizedlist><para>For more information, see <olink targetptr="rm.rcapd-1" remap="internal">Chapter&nbsp;10,
Physical Memory Control Using the Resource Capping Daemon (Overview)</olink>, <olink targetptr="rm.rcapd.task-1" remap="internal">Chapter&nbsp;11, Administering the Resource Capping
Daemon (Tasks)</olink>, and <olink targetptr="gcziw" remap="internal">How to Configure the
lx Branded Zone</olink>.</para>
</sect2><sect2 id="gcxbe"><title>Zone Network Interfaces in an <literal>lx</literal> Branded
Zone</title><para>Only the shared-IP network configuration is supported in an <literal>lx</literal> branded
zone.</para><para>Each zone that requires network connectivity must have one or more dedicated
IP addresses. These addresses are associated with logical network interfaces.
Network interfaces configured by the <command>zonecfg</command> command will
automatically be set up and placed in the zone when it is booted.</para>
</sect2><sect2 id="gdaft"><title>Mounted File Systems in an <literal>lx</literal> Branded
Zone</title><para>Generally, the file systems mounted in a zone include the following:</para><itemizedlist><listitem><para>The set of file systems mounted when the virtual platform
is initialized</para>
</listitem><listitem><para>The set of file systems mounted from within the zone itself</para>
</listitem>
</itemizedlist><para>This can include, for example, the following file systems:</para><itemizedlist><listitem><para><filename>automount</filename>-triggered mounts</para>
</listitem><listitem><para>Mounts explicitly performed by a zone administrator</para>
</listitem>
</itemizedlist><para>Certain restrictions are placed on mounts performed from within the
application environment. These restrictions prevent the zone administrator
from denying service to the rest of the system, or otherwise negatively impacting
other zones.</para><para>There are security restrictions associated with mounting certain file
systems from within a zone. Other file systems exhibit special behavior when
mounted in a zone. See <olink targetptr="z.admin.ov-2" remap="internal">File Systems and Non-Global
Zones</olink> for more information.</para>
</sect2><sect2 id="gcxaj"><title>Zone-Wide Resource Controls in an <literal>lx</literal> Branded
Zone</title><para>The preferred, simpler method for setting a zone-wide resource control
is to use the property name instead of the <literal>rctl</literal> resource.
These limits are specified for both the global and non-global zones.</para><para>The global administrator can also set privileged zone-wide resource
controls for a zone by using the <literal>rctl</literal> resource.</para><para>Zone-wide resource controls limit the total resource usage of all process
entities within a zone. These limits are specified for both the global and
non-global zones by using the <command>zonecfg</command> command. For instructions,
see <olink targetptr="gcziw" remap="internal">How to Configure the lx Branded Zone</olink>.</para><para>The following resource controls are currently available:</para><table frame="all" id="gejuq"><title>Zone-Wide Resource Controls</title><tgroup cols="5" colsep="1" rowsep="1"><colspec colwidth="39*"/><colspec colwidth="30*"/><colspec colwidth="33*"/><colspec colwidth="20*"/><colspec colwidth="22*"/><thead><row><entry><para>Control Name</para>
</entry><entry><para>Global Property Name</para>
</entry><entry><para>Description</para>
</entry><entry><para>Default Unit</para>
</entry><entry><para>Value Used For</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>zone.cpu-cap</literal></para>
</entry><entry>
</entry><entry><para>Absolute limit on the amount of CPU resources for this zone. A value
of <literal>100</literal> means 100 percent of one CPU as the <literal>project.cpu-cap</literal> setting. A value of <literal>125</literal> is 125 percent, because
100 percent corresponds to one full CPU on the system when using CPU caps.</para>
</entry><entry><para>Quantity (number of CPUs)</para>
</entry><entry>
</entry>
</row><row><entry><para><literal>zone.cpu-shares</literal></para>
</entry><entry><para><literal>cpu-shares</literal></para>
</entry><entry><para>Number of fair share scheduler (FSS) CPU shares for this zone.</para>
</entry><entry><para>Quantity (shares)</para>
</entry><entry>
</entry>
</row><row><entry><para><literal>zone.max-locked-memory.</literal></para>
</entry><entry><para><literal></literal></para>
</entry><entry><para>Total amount of physical locked memory available to a zone.</para><para>If the privilege <literal>priv_proc_lock_memory</literal> is assigned
to a zone, consider setting this resource control as well, to prevent that
zone from locking all memory.</para>
</entry><entry><para>Size (bytes)</para>
</entry><entry><para><literal>locked</literal> property of <literal>capped-memory</literal></para>
</entry>
</row><row><entry><para><literal>zone.max-lwps</literal></para>
</entry><entry><para><literal>max-lwps</literal></para>
</entry><entry><para>Maximum number of LWPs simultaneously available to this zone.</para>
</entry><entry><para>Quantity (LWPs)</para>
</entry><entry>
</entry>
</row><row><entry><para><literal>zone.max-msg-ids</literal></para>
</entry><entry><para><literal>max-msg-ids</literal></para>
</entry><entry><para>Maximum number of message queue IDs allowed for this zone.</para>
</entry><entry><para>Quantity (message queue IDs)</para>
</entry><entry>
</entry>
</row><row><entry><para><literal>zone.max-sem-ids</literal></para>
</entry><entry><para><literal>max-sem-ids</literal></para>
</entry><entry><para>Maximum number of semaphore IDs allowed for this zone.</para>
</entry><entry><para>Quantity (semaphore IDs)</para>
</entry><entry>
</entry>
</row><row><entry><para><literal>zone.max-shm-ids</literal></para>
</entry><entry><para><literal>max-shm-ids</literal></para>
</entry><entry><para>Maximum number of shared memory IDs allowed for this zone.</para>
</entry><entry><para>Quantity (shared memory IDs)</para>
</entry><entry>
</entry>
</row><row><entry><para><literal>zone.max-shm-memory</literal></para>
</entry><entry><para><literal>max-shm-memory</literal></para>
</entry><entry><para>Total amount of System V shared memory allowed for this zone.</para>
</entry><entry><para>Size (bytes)</para>
</entry><entry>
</entry>
</row><row><entry><para><literal>zone.max-swap</literal></para>
</entry><entry><para><literal></literal></para>
</entry><entry><para>Total amount of swap that can be consumed by user process address space
mappings and <literal>tmpfs</literal> mounts for this zone.</para>
</entry><entry><para>Size (bytes)</para>
</entry><entry><para><literal>swap</literal> property of <literal>capped-memory</literal></para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2><sect2 id="gcxai"><title>Configurable Privileges in an <literal>lx</literal> Branded
Zone</title><para>The <literal>limitpriv</literal> property is used to specify a privilege mask other than
the predefined default set. When a zone is booted, a default set of privileges
is included in the brand configuration. These privileges are considered safe
because they prevent a privileged process in the zone from affecting processes
in other non-global zones on the system or in the global zone. You can use
the <literal>limitpriv</literal> property to do the following: </para><itemizedlist><listitem><para>Add to the default set of privileges, understanding that such
changes might allow processes in one zone to affect processes in other zones
 by being able to control a global resource.</para>
</listitem><listitem><para>Remove from the default set of privileges, understanding that
such changes might prevent some processes from operating correctly if they
require those privileges to run.</para>
</listitem>
</itemizedlist><note><para>There are a few privileges that cannot be removed from the zone's
default privilege set, and there are also a few privileges that cannot be
added to the set at this time.</para>
</note><para>For more information, see <olink targetptr="gcytx" remap="internal">Privileges Defined
in lx Branded Zones</olink>, <olink targetptr="z.admin.ov-18" remap="internal">Privileges in
a Non-Global Zone</olink> and <olink targetdoc="group-refman" targetptr="privileges-5" remap="external"><citerefentry><refentrytitle>privileges</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink>.</para>
</sect2><sect2 id="gcxbi"><title><literal>attr</literal> Resource in an <literal>lx</literal> Branded
Zone</title><para>You can use the <literal>attr</literal> resource type to enable access
to an audio device present in the global zone. For instructions, see Step
12 of <olink targetptr="gdbji" remap="internal">How to Configure, Verify, and Commit the lx
Branded Zone</olink>.</para><para>You can also add a comment for a zone by using the <literal>attr</literal> resource
type.</para>
</sect2>
</sect1><sect1 id="gcxbd"><title>Resources Included in the Configuration by Default</title><sect2 id="gcxbb"><title>Configured Devices in <literal>lx</literal> Branded
Zones</title><para>The devices supported by each zone
are documented in the man pages and other documentation for that brand. The <literal>lx</literal> zone does not allow the addition of any unsupported or unrecognized
devices. The framework detects any attempt to add an unsupported device. An
error message is issued that indicates the zone configuration cannot be verified.</para><para>Note that access to an audio device running in the global zone can be
added through the <literal>attr</literal> resource property as shown in Step
12 of <olink targetptr="gdbji" remap="internal">How to Configure, Verify, and Commit the lx
Branded Zone</olink>.</para>
</sect2><sect2 id="gcxru"><title>File Systems Defined in <literal>lx</literal> Branded
Zones</title><para>The file systems that are required
for a branded zone are defined in the brand. You can add additional Solaris
file systems to an <literal>lx</literal> branded zone by using the <literal>fs</literal> resource
property as shown in Step 9 of <olink targetptr="gdbji" remap="internal">How to Configure,
Verify, and Commit the lx Branded Zone</olink>.</para><note><para>Adding local Linux file systems is not supported. You can NFS
mount file systems from a Linux server.</para>
</note>
</sect2><sect2 id="gcytx"><title>Privileges Defined in <literal>lx</literal> Branded
Zones</title><para>Processes are
restricted to a subset of privileges. Privilege restriction prevents a zone
from performing operations that might affect other zones. The set of privileges
limits the capabilities of privileged users within the zone.</para><para>Default, required default, optional, and prohibited privileges are defined
by each brand. You can also add or remove certain privileges by using the <literal>limitpriv</literal> property as shown in Step 8 of <olink targetptr="gdbji" remap="internal">How
to Configure, Verify, and Commit the lx Branded Zone</olink>. The table <olink targetptr="gcogn" remap="internal">Table&nbsp;26&ndash;1</olink> lists all of the Solaris privileges
and the status of each privilege with respect to zones.</para><para>For more information about privileges, see the <olink targetdoc="group-refman" targetptr="ppriv-1" remap="external"><citerefentry><refentrytitle>ppriv</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page and <citetitle>System
Administration Guide: Security Services</citetitle>.</para>
</sect2>
</sect1><sect1 id="gdafu"><title>Using the <command>zonecfg</command> Command to Create
an <literal>lx</literal> Branded Zone</title><para>The <command>zonecfg</command> command,
which is described in the <olink targetdoc="group-refman" targetptr="zonecfg-1m" remap="external"><citerefentry><refentrytitle>zonecfg</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page, is used to configure a zone. </para><para>The <command>zonecfg</command> command can also be used to persistently
specify the resource management settings for the global zone. For example,
you can use the command to configure the global zone to use a dedicated CPU
by using the <literal>dedicated-cpu</literal> resource.</para><para>The <command>zonecfg</command> command can be used in interactive mode,
in command-line mode, or in command-file mode. The following operations can
be performed using this command:</para><itemizedlist><listitem><para>Create or delete (destroy) a zone configuration</para>
</listitem><listitem><para>Add resources to a particular configuration</para>
</listitem><listitem><para>Set properties for resources added to a configuration</para>
</listitem><listitem><para>Remove resources from a particular configuration</para>
</listitem><listitem><para>Query or verify a configuration</para>
</listitem><listitem><para>Commit to a configuration</para>
</listitem><listitem><para>Revert to a previous configuration</para>
</listitem><listitem><para>Rename a zone</para>
</listitem><listitem><para>Exit from a <command>zonecfg</command> session</para>
</listitem>
</itemizedlist><para>The <command>zonecfg</command> prompt is of the following form:</para><screen>zonecfg:<replaceable>zonename</replaceable>></screen><para>When you are configuring a specific resource type, such as a file system,
that resource type is also included in the prompt:</para><screen>zonecfg:<replaceable>zonename</replaceable>:fs></screen><para>For more information, including procedures that show how to use the
various <command>zonecfg</command> components described in this chapter, see <olink targetptr="gcziw" remap="internal">How to Configure the lx Branded Zone</olink>.</para>
</sect1><sect1 id="gdajh"><title><command>zonecfg</command> Modes</title><para>The concept of  a <emphasis>scope</emphasis> is used
for the user interface. The scope can be either <emphasis>global</emphasis> or <emphasis>resource specific</emphasis>. The default scope is global.</para><para>In the global scope,
the <command>add</command> subcommand and the <command>select</command> subcommand
are used to select a specific resource. The scope then changes to that resource
type.</para><itemizedlist><listitem><para>For the <command>add</command> subcommand, the <command>end</command> or <command>cancel</command> subcommands are used to complete the resource specification.</para>
</listitem><listitem><para>For the <command>select</command> subcommand, the <command>end</command> or <command>cancel</command> subcommands are used to complete the resource modification.</para>
</listitem>
</itemizedlist><para>The scope then reverts back to global.</para><para>Certain subcommands, such as <command>add</command>, <command>remove</command>,
and <command>set</command>,  have different semantics in each scope.</para><sect2 id="gdakg"><title><command>zonecfg</command> Interactive Mode</title><para>In interactive mode, the following subcommands are
supported. For detailed information about semantics and options used with
the subcommands, see the <citerefentry><refentrytitle>zonecfg</refentrytitle><manvolnum>1M</manvolnum></citerefentry> man page for options. For any subcommand
that could result in destructive actions or  loss of work, the system requests
user confirmation before proceeding. You can use the <option>F</option> (force)
option to bypass this confirmation.</para><variablelist><varlistentry><term><command>help</command></term><listitem><para>Print general help, or display help about a given resource.</para><screen>zonecfg:lx-zone:net> <userinput>help</userinput></screen>
</listitem>
</varlistentry><varlistentry><term><command>create</command></term><listitem><para>Begin configuring an in-memory configuration for the specified
new branded zone.</para><itemizedlist><listitem><para>With the <option>t</option> <replaceable>template</replaceable> option,
to create a configuration that is identical to the specified template. The
zone name is changed from the template name to the new zone name. To create
a Linux branded zone, use:</para><screen>zonecfg:lx-zone> <userinput>create -t SUNWlx</userinput></screen>
</listitem><listitem><para>With the <option>b</option> option, to create a blank configuration
for which you can set the brand.</para><screen>zonecfg:lx-zone> <userinput>create -b</userinput>
zonecfg:lx-zone> <userinput>set brand=lx</userinput></screen>
</listitem><listitem><para>With the <option>F</option> option, to overwrite an existing
configuration.</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry><varlistentry><term><command>export</command></term><listitem><para>Print the configuration to standard output, or to the output
file specified, in a form that can be used in a command file.</para>
</listitem>
</varlistentry><varlistentry><term><command>add</command></term><listitem><para>In the global scope, add the specified resource type to the
configuration.</para><para>In the resource scope, add a property of the given name with the given
value.</para><para>See How to Configure the <literal>lx</literal> Branded Zone and the <citerefentry><refentrytitle>zonecfg</refentrytitle><manvolnum>1M</manvolnum></citerefentry> man
page for more information.</para>
</listitem>
</varlistentry><varlistentry><term><command>set</command></term><listitem><para>Set a given property name to the given property value. Note
that some properties, such as <literal>zonepath</literal>, are global, while
others are resource specific. Thus, this command is applicable in both the
global and resource scopes.</para>
</listitem>
</varlistentry><varlistentry><term><command>select</command></term><listitem><para>Applicable only in the global scope. Select the resource of
the given type that matches the given property name-property value pair criteria
for modification. The scope is changed to that resource type. You must specify
a sufficient number of property name-value pairs for the resource to be uniquely
identified.</para>
</listitem>
</varlistentry><varlistentry><term><command>clear</command></term><listitem><para>Clear the value for optional settings. Required settings cannot
be cleared. However, some required settings can be changed by assigning a
new value.</para>
</listitem>
</varlistentry><varlistentry><term><command>remove</command></term><listitem><para>In the global scope, remove the specified resource type. You
must specify a sufficient number of property name-value pairs for the resource
type to be uniquely identified. If no property name-value pairs are specified,
all instances will be removed.  If more than one exists, a confirmation is
required unless the <option>F</option> option is used.</para><para>In the resource scope, remove the specified property name-property value
from the current resource.</para>
</listitem>
</varlistentry><varlistentry><term><command>end</command></term><listitem><para>Applicable only in the resource scope. End the resource specification.</para><para>The <command>zonecfg</command> command then verifies that the current
resource is fully specified.</para><itemizedlist><listitem><para>If the resource is fully specified, it is added to the in-memory
configuration and the scope will revert back to global. </para>
</listitem><listitem><para>If the specification is incomplete, the system displays an
error message that describes what needs to be done.</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry><varlistentry><term><command>cancel</command></term><listitem><para>Applicable only in the resource scope. End the resource specification
and reset the scope to global. Any partially specified resources are not retained.</para>
</listitem>
</varlistentry><varlistentry><term><command>delete</command></term><listitem><para>Destroy the specified configuration. Delete the configuration
both from memory and from stable storage. You must use the <option>F</option> (force)
option with <command>delete</command>.</para><caution><para>This action is instantaneous. No commit is required, and a
deleted zone cannot be reverted.</para>
</caution>
</listitem>
</varlistentry><varlistentry><term><command>info</command></term><listitem><para>Display information about the current configuration or the
global resource properties <literal>zonepath</literal>, <literal>autoboot</literal>,
and <literal>pool</literal>. If a resource type is specified, display information
only about resources of that type. In the resource scope, this subcommand
applies only to the resource being added or modified.</para>
</listitem>
</varlistentry><varlistentry><term><command>verify</command></term><listitem><para>Verify current configuration for correctness. Ensure that
all resources have all of their required properties specified.</para>
</listitem>
</varlistentry><varlistentry><term><command>commit</command></term><listitem><para>Commit current configuration from memory to stable storage.
Until the in-memory configuration is committed, changes can be removed with
the <command>revert</command> subcommand. A configuration must be committed
to be used by <command>zoneadm</command>. This operation is attempted automatically
when you complete a <command>zonecfg</command> session. Because only a correct
configuration can be committed, the commit operation automatically does a
verify.</para>
</listitem>
</varlistentry><varlistentry><term><command>revert</command></term><listitem><para>Revert configuration back to the last committed state.</para>
</listitem>
</varlistentry><varlistentry><term><command>exit</command></term><listitem><para>Exit the <command>zonecfg</command> session.   You can use
the <option>F</option> (force) option with <command>exit</command>.</para><para>A <command>commit</command> is automatically attempted if  needed. Note
that an EOF character can also be used to exit the session.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2><sect2 id="gdakk"><title><command>zonecfg</command> Command-File Mode</title><para>In command-file mode, input is taken from a file. The <command>export</command> subcommand
described in <command>zonecfg</command> Interactive Mode is used to produce
this file. The configuration can be printed to standard output, or the <option>f</option> option
can be used to specify an output file.</para>
</sect2>
</sect1><sect1 id="gdahn"><title>Branded Zone Configuration Data</title><para>Zone configuration data consists of two kinds of entities: resources
and properties. Each resource has a type, and each resource can also have
a set of one or more properties. The properties have names and values. The
set of properties is dependent on the resource type.</para><sect2 id="gdahx"><title>Resource and Property Types</title><para>The resource and property
types are described as follows:</para><variablelist><varlistentry><term>Zone name</term><listitem><para>The zone name identifies the zone to the configuration utility.
The following rules apply to zone names:</para><itemizedlist><listitem><para>Each zone must have a unique name.</para>
</listitem><listitem><para>A zone name is case-sensitive.</para>
</listitem><listitem><para>A zone name must begin with an alphanumeric character.</para><para>The name can contain alphanumeric characters, underbars (<literal>_</literal>),
hyphens (<literal>-</literal>), and periods (<literal>.</literal>).</para>
</listitem><listitem><para>The name cannot be longer than 64 characters.</para>
</listitem><listitem><para>The name <literal>global</literal> and all names beginning
with <literal>SUNW</literal> are reserved and cannot be used.</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry><varlistentry><term><literal>zonepath</literal></term><listitem><para>The <literal>zonepath</literal> property is the path to the
zone root. Each zone has a path to its root directory that is relative to
the global zone's root directory. At installation time, the global zone directory
is required to have restricted visibility. It must be owned by <literal>root</literal> with
the mode <literal>700</literal>.</para><para>The non-global zone's root path is one level lower. The zone's root
directory has the same ownership and permissions as the root directory (<literal>/</literal>) in the global zone. The zone directory must be owned by <literal>root</literal> with the mode <literal>755</literal>. These directories are created
automatically with the correct permissions, and do not need to be verified
by the zone administrator. This hierarchy ensures that unprivileged users
in the global zone are prevented from traversing a non-global zone's file
system.</para><informaltable frame="none"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row><entry valign="top"><para>Path</para>
</entry><entry valign="top"><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>/home/export/lx-zone</literal></para>
</entry><entry><para><command>zonecfg</command> <literal>zonepath</literal></para>
</entry>
</row><row><entry><para><literal>/home/export/lx-zone/root</literal></para>
</entry><entry><para>Root of the zone</para>
</entry>
</row><row><entry><para><literal>/home/export/lx-zone/root/dev</literal></para>
</entry><entry><para>Devices created for the zone</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>See <olink targetptr="z.admin.ov-8" remap="internal">Traversing File
Systems</olink> for a further discussion of this issue.</para><note><para>You can move a zone to another location on the same system by
specifying a new, full <literal>zonepath</literal> with the <literal>move</literal> subcommand
of <command>zoneadm</command>. See <olink targetptr="gbwym" remap="internal">Moving a Non-Global
Zone</olink> for instructions.</para>
</note>
</listitem>
</varlistentry><varlistentry><term><literal>autoboot</literal></term><listitem><para>If this property is set to true, the zone is automatically
booted when the global zone is booted. Note that if the zones service, <literal>svc:/system/zones:default</literal> is disabled, the zone will not autoboot, regardless of the setting
of this property. You can enable the zones service with the <literal>svcadm</literal> command
described in the <olink targetdoc="group-refman" targetptr="svcadm-1m" remap="external"><citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page:</para><screen>global# <userinput>svcadm enable zones</userinput></screen>
</listitem>
</varlistentry><varlistentry><term><literal>bootargs</literal></term><listitem><para>This property is used to set a boot argument for the zone.
The boot argument is applied unless overridden by the <command>reboot</command>, <literal>zoneadm boot</literal>, or <literal>zoneadm reboot</literal> commands. See <olink targetptr="gdfsx" remap="internal">Branded Zone Boot Arguments</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>pool</literal></term><listitem><para>This property is used to associate the zone with a specific
resource pool on the system. Multiple zones can share the resources of one
pool. Also see <olink targetptr="gekgp" remap="internal">Specifying the dedicated-cpu Resource</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>limitpriv</literal></term><listitem><para>This property is used to specify a privilege mask other than
the default. See <olink targetptr="z.admin.ov-18" remap="internal">Privileges in a Non-Global
Zone</olink>.</para><para>Privileges are added by specifying the privilege name, with or without
the leading <literal>priv_</literal>. Privileges are excluded by preceding
the name with a dash (<literal>-</literal>) or an exclamation mark (<literal>!</literal>).
The privilege values are separated by commas and placed within quotation marks
(<literal>&ldquo;</literal>).</para><para>As described in <olink targetdoc="group-refman" targetptr="priv-str-to-set-3c" remap="external"><citerefentry><refentrytitle>priv_str_to_set</refentrytitle><manvolnum>3C</manvolnum></citerefentry></olink>, the special privilege sets
of <literal>none</literal>, <literal>all</literal>, and <literal>basic</literal> expand
to their normal definitions. Because zone configuration takes place from the
global zone, the special privilege set <literal>zone</literal> cannot be used.
Because a common use is to alter the default privilege set by adding or removing
certain privileges, the special set <literal>default</literal> maps to the
default, set of privileges. When <literal>default</literal> appears at the
beginning of the <literal>limitpriv</literal> property, it expands to the
default set.</para><para>The following entry adds the ability to set the system clock and removes
the ability to send raw Internet Control Message Protocol (ICMP) packets:</para><screen>global# zonecfg -z userzone
zonecfg:userzone> set limitpriv="default,sys_time,!net_icmpaccess"</screen><para>If the zone's privilege set contains a disallowed privilege, is missing
a required privilege, or includes an unknown privilege, an attempt to verify,
ready, or boot the zone will fail with an error message.</para>
</listitem>
</varlistentry><varlistentry><term><literal>scheduling-class</literal></term><listitem><para>This
property sets the scheduling class for the zone. See <olink targetptr="gekhp" remap="internal">Scheduling
Class in a Zone</olink> for additional information and tips.</para>
</listitem>
</varlistentry><varlistentry><term><literal>dedicated-cpu</literal></term><listitem><para>This resource
dedicates a subset of the system's processors to the zone while it is running.
The <literal>dedicated-cpu</literal> resource provides limits for <literal>ncpus</literal> and,
optionally, <literal>importance</literal>. For more information, see<olink targetptr="gekgp" remap="internal">Specifying the dedicated-cpu Resource</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>capped-cpu</literal></term><listitem><para>This resource
establishes an absolute limit on the number of CPUs for this zone. The <literal>capped-cpu</literal> resource provides limits for <literal>ncpus</literal>. For more
information, see<olink targetptr="gepzg" remap="internal">Specifying the capped-cpu Resource</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>capped-memory</literal></term><listitem><para>This resource
groups the properties used when capping memory for the zone. The <literal>capped-memory</literal> resource provides limits for <literal>physical</literal>, <literal>swap</literal>, and <literal>locked</literal> memory. At least one of these properties
must be specified.</para>
</listitem>
</varlistentry><varlistentry><term><literal>fs</literal></term><listitem><para>Each zone can have various file systems that are mounted when
the zone transitions from the installed state to the ready state. The file
system resource specifies the path to the file system mount point. For more
information about the use of file systems in zones, see <olink targetptr="z.admin.ov-2" remap="internal">File Systems and Non-Global Zones</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>net</literal></term><listitem><para>The network interface resource is the interface name. Each
zone can have network interfaces that are be set up when the zone transitions
from the installed state to the ready state.</para><para>Only the shared-IP network configuration is supported in an <literal>lx</literal> branded
zone</para>
</listitem>
</varlistentry><varlistentry><term><literal>rctl</literal></term><listitem><para>The <literal>rctl</literal> resource is used for zone-wide
resource controls. The controls are enabled when the zone transitions from
the installed state to the ready state.</para><note><para>To configure zone-wide controls using the <literal>set</literal> <replaceable>global_property_name</replaceable> subcommand of <command>zonefig</command> instead
of the <literal>rctl</literal> resource, see <olink targetptr="gcziw" remap="internal">How
to Configure the lx Branded Zone</olink>.</para>
</note>
</listitem>
</varlistentry><varlistentry><term><literal>attr</literal></term><listitem><para>This generic attribute can be used for user comments or by
other subsystems. The <literal>name</literal> property of an <literal>attr</literal> must
begin with an alphanumeric character. The <literal>name</literal> property
can contain alphanumeric characters, hyphens (<literal>-</literal>), and periods
(<literal>.</literal>). Attribute names beginning with <literal>zone.</literal> are
reserved for use by the system.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2><sect2 id="gdaux"><title>Resource Type Properties in the <literal>lx</literal> Branded
Zone</title><para>Resources also
have properties to configure. The following properties are associated with
the resource types shown.</para><variablelist><varlistentry><term><literal>dedicated-cpu</literal></term><listitem><para><literal>ncpus</literal>, <literal>importance</literal></para><para>Specify the number of CPUs and, optionally, the relative importance
of the pool. The following example specifies a CPU range for use by the zone <literal>lx-zone</literal>. <literal>importance</literal> is also set.</para><screen>zonecfg:lx-zone> <userinput>add dedicated-cpu</userinput>
zonecfg:lx-zone:dedicated-cpu> <userinput>set ncpus=1-3</userinput>
zonecfg:lx-zone:dedicated-cpu> <userinput>set importance=2</userinput>
zonecfg:lx-zone:dedicated-cpu> <userinput>end</userinput></screen>
</listitem>
</varlistentry><varlistentry><term><literal>capped-cpu</literal></term><listitem><para><literal>ncpus</literal></para><para>Specify the number of CPUs. The following example specifies a CPU limit
of 3.5 CPUs for use by the zone <literal>lx-zone</literal>.</para><screen>zonecfg:lx-zone> <userinput>add capped-cpu</userinput>
zonecfg:lx-zone:capped-cpu> <userinput>set ncpus=3.5</userinput>
zonecfg:lx-zone:capped-cpu> <userinput>end</userinput></screen>
</listitem>
</varlistentry><varlistentry><term><literal>capped-memory</literal></term><listitem><para><literal>physical</literal>, <literal>swap</literal>, <literal>locked</literal></para><para>This resource groups the properties used when capping memory for the
zone. The following example specifies the memory limits for the zone <literal>lx-zone</literal>. Each limit is optional, but at least one must be set.</para><screen>zonecfg:my-zone> <userinput>add capped-memory</userinput>
zonecfg:lx-zone:capped-memory> <userinput>set =50m</userinput>
zonecfg:lx-zone:capped-memory> <userinput>set swap=100m</userinput>
zonecfg:lx-zone:capped-memory> <userinput>set locked=30m</userinput>
zonecfg:lx-zone:capped-memory> <userinput>end</userinput></screen>
</listitem>
</varlistentry><varlistentry><term><literal>fs</literal></term><listitem><para><literal>dir</literal>, <literal>special</literal>, <literal>raw</literal>, <literal>type</literal>, <literal>options</literal></para><para>The lines in the following example add read-only access to CD or DVD
media in a non-global zone. The file system is loopback mounted with the options <literal>ro,nodevices</literal> (read-only and no devices) in the non-global zone.</para><screen>zonecfg:lx-zone> <userinput>add fs</userinput>
zonecfg:lx-zone:fs> <userinput>set dir=/cdrom</userinput>
zonecfg:lx-zone:fs> <userinput>set special=/cdrom</userinput>
zonecfg:lx-zone:fs> <userinput>set type=lofs</userinput>
zonecfg:lx-zone:fs> <userinput>add options [ro,nodevices]</userinput>
zonecfg:lx-zone:fs> <userinput>end</userinput></screen><para>Note that section 1M man pages are available for mount options that
are unique to a specific file system. The names of these man pages have the
form <literal>mount_</literal><replaceable>filesystem</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><literal>net</literal></term><listitem><para><literal>address</literal>, <literal>physical</literal></para><para>In the following example, IP address <literal>192.168.0.1</literal> is
added to a zone. An <literal>bge0</literal> card is used for the physical
interface.</para><screen>zonecfg:lx-zone> <userinput>add net</userinput>
zonecfg:lx-zone:net> <userinput>set physical=bge0</userinput>
zonecfg:lx-zone:net> <userinput>set address=192.168.0.1</userinput>
zonecfg:lx-zone:net> <userinput>end</userinput></screen><note><para>To determine which physical interface to use, type <command>ifconfig</command> <option>a</option> on your system. Each line of the output, other than loopback driver
lines, begins with the name of a card installed on your system. Lines that
contain <literal>LOOPBACK</literal> in the descriptions do not apply to cards.</para>
</note>
</listitem>
</varlistentry><varlistentry><term><literal>rctl</literal></term><listitem><para><literal>name</literal>, <literal>value</literal></para><para>Available
zone-wide resource controls are described in <olink targetptr="gcxaj" remap="internal">Zone-Wide
Resource Controls in an lx Branded Zone</olink>.</para><screen width="100">zonecfg:lx-zone> <userinput>add rctl</userinput>
zonecfg:lx-zone:rctl> <userinput>set name=zone.cpu-shares</userinput>
zonecfg:lx-zone:rctl> <userinput>add value (priv=privileged,limit=10,action=none)</userinput>
zonecfg:lx-zone:rctl> <userinput>end</userinput></screen><screen width="100">zonecfg:lx-zone> <userinput>add rctl</userinput>
zonecfg:lx-zone:rctl> <userinput>set name=zone.max-lwps</userinput>
zonecfg:lx-zone:rctl> <userinput>add value (priv=privileged,limit=100,action=deny)</userinput>
zonecfg:lx-zone:rctl> <userinput>end</userinput></screen>
</listitem>
</varlistentry><varlistentry><term><literal>attr</literal></term><listitem><para><literal>name</literal>, <literal>type</literal>, <literal>value</literal></para><para>In the following example, a comment about a zone is added.</para><screen>zonecfg:lx-zone> <userinput>add attr</userinput>
zonecfg:lx-zone:attr> <userinput>set name=comment</userinput>
zonecfg:lx-zone:attr> <userinput>set type=string</userinput>
zonecfg:lx-zone:attr> <userinput>set value="Production zone"</userinput>
zonecfg:lx-zone:attr> <userinput>end</userinput></screen>
</listitem>
</varlistentry>
</variablelist><para>You can use the <command>export</command> subcommand to print a zone
configuration to standard output. The configuration is saved in a form that
can be used in a command file.</para>
</sect2>
</sect1>
</chapter>