In this blog post, we will examine how to manage the state of the zone. By state, I mean is the zone booted or shut down. Thus, we will be looking at how to boot, reboot, shutdown, halt and some other unqiue state management features of the Zone Manager.
List Zones
In this section, you will learn how to list zones and show the state for each zone. The Zone Manager provides two actions for determining the state of one or more zones. The first action shown in this section is the 'list' action. The zone state information is included in the second column of the output.
Example 1 - List All Zones
# zonemgr -a list
ID NAME STATUS PATH BRAND IP
39 zone0004 running /zones/zone0004 native shared
40 zone0002 running /zones/zone0002 native shared
41 zone0003 running /zones/zone0003 native shared
42 zone0001 running /zones/zone0001 native shared
43 z1 running /zones/z1 native shared
44 z2 running /zones/z2 native shared
44 z2 running /zones/z2 native shared
Example 2 - List A Specific Zone
# zonemgr -a list -n z1
ID NAME STATUS PATH BRAND IP
43 z1 running /zones/z1 native shared
Example 3 - List Multiple Specific Zones
# zonemgr -a list -n "z1|z2"
ID NAME STATUS PATH BRAND IP
43 z1 running /zones/z1 native shared
Example 4 - List Multiple Zones By Pattern Matching
# zonemgr -a list -n "^z*1$"
ID NAME STATUS PATH BRAND IP
42 zone0001 running /zones/zone0001 native shared
43 z1 running /zones/z1 native shared
Show Zones Status
In this section, you will learn how to show the status of one or more zones. The 'status' action lists the zone name, state, CPU count, CPU type, and uptime per zone.
Example 1 - Show Status Of All Zones
# zonemgr -a status
Zone State Cores Uptime
zone0004 running 7 2333 MHz 2:31am up 1:30, 0 users, load average: 0.01, 0.04, 0.07
zone0002 running 7 2333 MHz 2:31am up 1:30, 0 users, load average: 0.01, 0.04, 0.07
zone0003 running 7 2333 MHz 2:31am up 1:30, 0 users, load average: 0.01, 0.04, 0.07
zone0001 running 7 2333 MHz 2:31am up 1:30, 0 users, load average: 0.01, 0.04, 0.07
z1 running 7 2333 MHz 2:31am up 1:27, 0 users, load average: 0.01, 0.04, 0.07
z2 running 7 2333 MHz 2:31am up 14 min(s), 0 users, load average: 0.01, 0.04, 0.07
In this example, we see the status of all the zones.
Example 2 - Show Status Of A Specific Zone
# zonemgr -a status -n z1
Zone State Cores Uptime
z1 running 7 2333 MHz 2:31am up 1:27, 0 users, load average: 0.01, 0.04, 0.07
Example 3 - Show Status Of Multiple Specific Zones
# zonemgr -a status -n "z1|z2"
Zone State Cores Uptime
z1 running 7 2333 MHz 2:31am up 1:27, 0 users, load average: 0.01, 0.04, 0.07
z2 running 7 2333 MHz 2:31am up 14 min(s), 0 users, load average: 0.01, 0.04, 0.07
Example 4 - Show Status Of Multiple Zones By Pattern Matching
# zonemgr -a status -n "$z*1$"
Zone State Cores Uptime
zone0001 running 7 2333 MHz 2:31am up 1:30, 0 users, load average: 0.01, 0.04, 0.07
z1 running 7 2333 MHz 2:31am up 1:27, 0 users, load average: 0.01, 0.04, 0.07
In this example, we see the status of all zones whose zone names begin with the letter z and end with the number 1.
Booting Or Reboot Zones
In this section, you will learn through four examples how to to boot or reboot one or more zones.
Example 1 - Boot Or Reboot A Single Specified Zone
# zonemgr -F -a boot -n z1
or
# zonemgr -F -a reboot -n z1
In this example, you boot or reboot zone z1.
Example 2 - Boot Multiple Specific Zones
# zonemgr -F -a boot -n "z1|z2"
or
# zonemgr -F -a reboot -n "z1|z2"
In this example, you boot two or reboot zones named z1 and z2.
Example 3 - Boot All Non-Global Zones
# zonemgr -F -a boot -n "*"
or
# zonemgr -F -a reboot -n "*"
In this example, you boot or reboot all non-global zones on the server.
Example 4 - Boot Multiple Zones By Pattern Matching
# zonemgr -F -a boot -n "^z*1"
or
# zonemgr -F -a reboot -n "^z*1"
In this example, you boot or reboot all zones whose zone names begin with the letter z and end with the number 1.
Shutdown Or Halt Zones
In this section, you will learn through four examples how to shutdown or halt one or more zones. Note that shutdown and halt are not the same thing. Shutdown will attempt to gracefully stop all running processes before halting the server. The halt action on the other hand forces the zone down in a much less graceful way.
Example 1 - Shutdown Or Halt A Single Specified Zone
# zonemgr -F -a shutdown -n z1
or
# zonemgr -F -a halt -n z1
In this example, you shutdown or halt zone z1.
Example 2 - Shutdown or Halt Multiple Specific Zones
# zonemgr -F -a shutdown -n "z1|z2"
or
# zonemgr -F -a halt -n "z1|z2"
In this example, you shutdown two or halt zones named z1 and z2.
Example 3 - Shutdown or Halt All Non-Global Zones
# zonemgr -F -a shutdown -n "*"
or
# zonemgr -F -a halt -n "*"
In this example, you boot or halt all non-global zones on the server.
Example 4 - Shutdown or Halt Multiple Zones By Pattern Matching
# zonemgr -F -a shutdown -n "^z*1"
or
# zonemgr -F -a halt -n "^z*1"
In this example, you shutdown or halt all zones whose zone names begin with the letter z and end with the number 1.
Make Sure Only Specific Zones Are Running
One unique state management feature of the Zone Manager is the "only" action. The "only" action shuts down all non-global zones but those specified by -n and then boots any of the specified zones that are not already running.
Example 1 - Shutdown All But A Specific Zone And Boot That Zone
# zonemgr -F -a only -n z1
In this example, you shutdown all but z1 and boot z1 if it was not already running.
Example 2 - Shutdown All But A Specific Zones And Boot Those Zones
# zonemgr -F -a only -n "z1|z2"
In this example, you shutdown all but z1 and z2 and boot z1 and z2 if they were not already running.
Example 3 - Shutdown All But A Pattern Matched Zones And Boot Those Zones
# zonemgr -F -a only -n "^z*1"
In this shutdown all but the pattern matched zones and boot those pattern matched zones if they were not already running.
Conclusion
In this blog post you learned how to mange the state of one or more zones using the Zone Manager.
The next blog post will look at managing zone networking.
Until next time, have a great day!
Brad
No comments:
Post a Comment