How to Modify Zone Resources and Properties
If you plan to modify zone properties in live
mode, ensure that the properties are supported for configuration in this mode. Otherwise, unexpected results might occur.
Example 3-4 Changing the Settings of a Resource Control
A resource control is represented in zone configuration as rctl
. In this example, multiple resource controls are configured in a zone and you are modifying zone.cpu-shares
. The change is applied to the zone without rebooting through the zoneadm apply
command.
global$ zonecfg -zoneA zonecfg:zoneA> info ... rctl 1 name: zone.max-locked-memory value: (priv=privileged,limit=524288000,action=deny) rctl 2 name: zone.cpu-shares value: (priv=privileged,limit=20,action=none) ... zonecfg:zoneA> select rctl 2 zonecfg:zoneA:rctl> info rctl 3 name: zone.cpu-shares value: (priv=privileged,limit=20,action=none) zonecfg:zoneA:rctl> remove value (priv=privileged,limit=20,action=none) zonecfg:zoneA:rctl> add value (priv=privileged,limit=30,action=none) zonecfg:zoneA:rctl> info rctl 2 name: zone.cpu-shares value: (priv=privileged,limit=30,action=none)Value of limit is changed. zonecfg:zoneA:rctl> end zonecfg:zoneA> exit global$ zoneadm -z zoneA apply Checking: Adding rctl value (priv=privileged,limit=30,action=none) Applying the changes.
Example 3-5 Reverting a Zone's autoboot
Property to the Default Setting
By default, a zone does not boot whenever the host system is rebooted. In this example, you are resetting zoneA
's autoboot
property to the default setting. The change takes effect after the zone is rebooted.
global$ zonecfg -z zoneA zonecfg:zoneA> info autoboot autoboot: true zonecfg:zoneA> clear autoboot zonecfg:zoneA> info autoboot autoboot: false zonecfg:zoneA> exit global$ zoneadm -z zoneA reboot
Example 3-6 Canceling a Modification and Restoring Saved Settings
This example shows how to discard changes you just made and revert to the settings currently in storage.
global$ zonecfg -z zoneA zonecfg:zoneA> info zonename: zoneA brand: solaris autoboot: true ... dedicated-cpu: ncpus: 1-2 importance: 10 ... zonecfg:zoneA> remove dedicated-cpu zonecfg:zoneA> info zonename: zoneA brand: solaris autoboot: true ... Dedicated-cpu no longer listed. ... zonecfg:zoneA> reload Are you sure you want to reload (y[n])? y zonecfg:zoneA> info zonename: zoneA brand: solaris autoboot: true ... dedicated-cpu:Dedicated-cpu is restored. ncpus: 1-2 importance: 10 ... zonecfg:zoneA> exit global$ zoneadm -z zoneA reboot
Example 3-7 Temporarily Modifying a Configured Property by Using live
Mode
This example shows the processes in live
mode configuration. In this scenario, zoneA
has a second anet
resource configuration that you want to remove. In the solaris
brand, anet
is a resource that can be reconfigured in live
mode.
The example begins by verifying that zoneA
is running so that live
mode can be used.
global$ zoneadm list -cv ID NAME STATUS PATH BRAND IP 0 global running / solaris shared 1 zoneA running /export/zones/zoneA solaris exclusive - zoneB installed /system/zones/zoneB solaris exclusive global$ zonecfg -z zoneA info ... anet 0 name: net0 configure-allowed-address: true auto-mac-address: 2:8:20:af:4c:0 anet 1 name: net1 configure-allowed-address: true auto-mac-address: 2:8:20:1:9b:31 ... global$ zonecfg -z zoneA -r zonecfg:zoneA> remove anet linkname=net1 zonecfg:zoneA> info ... anet 0 name: net0 configure-allowed-address: true auto-mac-address: 2:8:20:af:4c:0 ...anet 1 no longer listed. zonecfg:zoneA> exit Checking: Removing anet linkname=net1 Applying the changes
From the global zone, you can display the temporary changes as follows:
global$ zonecfg -z zoneA -r info
Rebooting the zone cancels the temporary changes. To cancel without rebooting, use the zoneadm apply
command:
global$ zoneadm -z zoneA apply Checking: Adding anet linkname=net1 Applying the changes global$ zonecfg -z zoneA info ... anet 0 name: net0 configure-allowed-address: true auto-mac-address: 2:8:20:af:4c:0 anet 1anet 1 is restored. name: net1 configure-allowed-address: true auto-mac-address: 2:8:20:1:9b:31 ...