Thursday, 27 June 2013

 Last session we gone through the basic of Solaris Zones, in this article you will get more details about the configuring Zone and adding the resources. Let we can start with Zone Components and sub commands which will be very important while configuring the Zones.

Zone Components
                                       Definition

zonepathPath of the zone root which is from global zone's file space.
AutobootDefine whether we need automatically boot the zone
poolAssociate the zone with a resource pool; multiple zones may share a pool.
netNetwork interface of Zone
fsFile systems from the zone's /etc/vfstab, automounted file systems configured within the zone, manually mounted file systems or ZFS mounts from within the zone
datasetTo manage non-global zone with ZFS file system.
inherit-pkg-dirIn a sparse root zone, represents directories containing packaged software that a non-global zone shares with the global zone. (Should not be used in a whole root zone.)
deviceDevices that should be configured in a non-global zone.
rctlZone-wide  resource controls  such as zone.cpu-shares andzone.max-lwps
attrZone comments

also please note the below "sub commands", this will also important while configuration the zone.

SUB COMMANDS
addAdd the specified resource or components
cancelEnds the resource specification and returns to the global scope without retaining partially specified resources.
commitSave the current configuration to the disk.
createCreate new zone configurations
deleteDestroy configuration.
endEnds the resource specification
exitEnds the zonecfg session.
infoDisplay information about the configuration of the current scope.
removeRemove the specified resource
revertReturn to the last state written to disk.
setSet the specified property to the specified value
verifyVerify the current configuration for correctness.

Let we can see how to add the listed zone components with using "zonecfg" command

* Set zonepath and Autoboot (the zones servicesvc:/system/zones:defaultmust also be enabled when we go for autoboot=true)
zonecfg:zone1> set zonepath=/export/home/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
* In the following example, Filesystem is added into the non-global zone
bash-3.00# zonecfg -z zone1
zonecfg:zone1> add fs
zonecfg:zone1:fs> set dir=/test/mnt
zonecfg:zone1:fs> set special=/dev/vx/dsk/zonedg/vol1
zonecfg:zone1:fs> set raw=/dev/vx/rdsk/zonedg/vol1
zonecfg:zone1:fs> set type=vxfs
zonecfg:zone1:fs> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
* In the following example, Network is added into the non-global zone
zonecfg:zone1> add net
zonecfg:zone1:net> set physical=e1000g0
zonecfg:zone1:net> set address=192.168.10.35
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
* In the following example, ZFS Dataset filesystem is added into the non-global zone
bash-3.00# zonecfg -z zone1
zonecfg:zone1> add dataset
zonecfg:zone1:dataset> set name=zonepool/zone1vol
zonecfg:zone1:dataset> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
* In this example, Specify the Memory Limits. Each limit is optional, but at least one must be set.
zonecfg:zone1> add capped-memory
zonecfg:zone1:capped-memory> set physical=50m
zonecfg:zone1:capped-memory> set swap=100m
zonecfg:zone1:capped-memory> set locked=30m
zonecfg:zone1:capped-memory> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
* In this example, Assigning Dedicated CPU (1-3). we can set the importance as well.
zonecfg:zone1> add dedicated-cpu
zonecfg:zone1:dedicated-cpu> set ncpus=1-3
zonecfg:zone1:dedicated-cpu> set importance=2
zonecfg:zone1:dedicated-cpu> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
*In this example, specifies Capped CPU of 3.5 CPUs for the zone1
zonecfg:zone1> add capped-cpu
zonecfg:zone1:capped-cpu> set ncpus=3.5
zonecfg:zone1:capped-cpu> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
Thanks for reading this article, Hopefully now you understand the configuration method of Solaris Zones.

Please continue to read  step by step configuration method of sparse root zone and whole root zones. Procedure for Creating Sparse Root Zone