Improving Edit/run/Debug cycle by cloning zones



Following up on yesterday's entry, I thought I'd share how I improved my edit-debug-test cycle by cloning zones. In getting a repeatable process  flushed out, I needed a way to go back and start fresh after each attempt. I mentally liken (not lichen) this to software version control. If I want to try something risky, I want fork a zone branch. The solution, of course, is zone snapshots.

Given the blog title, entry title and my fondness for zones, clones & snapshots, I'm sure your not exactly in suspense. I found myself cloning zones to run my tests. In fact, I'm doing this quite regularly for a variety of tasks.

I've got a zone I call "baseline" that I've never booted. In that zone I have Java Enterprise System bits, among other things, only taking the disk space hit  once. All of my zones descend (inherit?) from baseline. For the configuration I wanted, I had created zones named das, app1 and app2. das contains the Sun Application Server 8.1 administration server while app1 and app2 contain application server node agents and instances. All of the above can be installed in th same zone, but there is simply no fun in that :) Once I installed the software and had a baseline configuration, I cloned each zone - das_ldap, das_app1, das_app2, which were to be used to test my adminstration LDAP configuration:

Ex.: zoneadm -z das_ldap clone das

Note, zonecfg must be run first to configure das_ldap.
Note #2: diskbay is my zfs pool

Boot the das_ldap zone and ... wait a second ... it is building the SMF depenencies and running sysconfig to configure the zone. #(\*&@. That's not what I want. I want a new version of the same zone, not a similar-but-different zone. Hmm. Lightbulb over John's head. OK, time to break the rules (again). Manually edit /etc/zones files. What makes this not only possible but simple? Not using a binary registry :)

##################################################################
WARNING: Running these steps will result in an unsupported zone, and
perhaps an unsupported configuration
##################################################################

Hopefully that warning will lessen the ire I am probably creating within the zones team for continually showing how to do neat things that are unsupportable :)

Instead of using zoneadm clone, and going through sysidcfg and ending up with the wrong host name, I ran the following steps:
  • Shut down zone das
  • copy /etc/zones/das.xml to /etc/zones/das2.xml, and change the zone  name (das2) and zonepath (/zones/das2) - for simple zone configurations.
  • Edit /etc/zones/index, append a line with the new zone
    (das2:installed:/zones/das2)
  • Create a snapshot & clone of das:
    # zfs snapshot diskbay/zones/das@version2
    # zfs clone diskbay/zones/das@version2 diskbay/zones/das2
  • zoneadm -z das2 boot
If I screw up something in pretty major way (never happens), I simply rinse and repeat:

# zfs destroy diskbay/zones/das2
# zfs clone diskbay/zones/das@version2 diskbay/zones/das2
# zoneadm -z das2 boot

Keep in mind that das and das2 can't be booted at the the same time since they have the same IP address.

I have been doing my best to automate any steps I take in das2. Unfortunately, there is no zoneadm merge command :) Instead, in das I play back the automated steps taken in das2 and go from there. Of course, there really is no need to go back to das. I could just keep using das2.  However, my zfs snapshot/clone dependency tree is already longer than my family tree :)


Comments:

> Not using a binary registry :) Oh c'mon. You can do better than that. The registry is as binary as a filesystem. Designated system calls let you read/write data under a hierarchical path. Only their default editor sucks.

Posted by Matthias on July 18, 2006 at 04:25 PM PDT #

John, how about filing an RFE to have an option to "zoneadm clone" to leave the sysidtool(1M) configuration alone? ;)

Posted by David Comay on July 19, 2006 at 03:04 AM PDT #

I suppose I could do that!

Followed by the second "zoneadm merge" RFE. (Just kidding)

Posted by John Clingan on July 19, 2006 at 06:03 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

John Clingan

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today