Thursday Mar 05, 2009

Non-Global Zone Hostid Emulation for Everyone!

Suppose that you want to consolidate systems running legacy applications that are licensed based on your systems' hostids or migrate the applications to new machines. If your applications' publishers are unable or unwilling to relicense your applications (perhaps the publishers no longer exist), then you are stuck with your legacy applications running on their original, possibly outdated systems because the new hosts would most likely have different hostids. Moving your applications to new hosts would probably impact the applications and prevent them from functioning. How can you overcome this difficulty?

A solution is now available via Solaris non-global zones (a.k.a. containers). With the putback of PSARC 2008/647 (Configurable Hostids for Non-Global Zones), administrators can give each non-global zone in OpenSolaris a 32-bit hostid via zonecfg starting in build 108. (The default non-global zone behavior is to use the global zone's [i.e., the physical host's] hostid.) All processes that execute within the zone will see the configured hostid instead of the physical host's hostid. This hostid emulation feature will be available in OpenSolaris 2009.06.

Here is an example of zone-emulated hostid in action. Suppose that you create and boot a non-global zone without using the hostid emulation feature. Here is what you might see:

# zonecfg -z godel
godel: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:godel> create
zonecfg:godel> set zonepath=/zones/godel
zonecfg:godel> info
zonename: godel
zonepath: /zones/godel
brand: native
autoboot: false
bootargs: 
pool: 
limitpriv: 
scheduling-class: 
ip-type: shared
hostid: 
inherit-pkg-dir:
	dir: /lib
inherit-pkg-dir:
	dir: /platform
inherit-pkg-dir:
	dir: /sbin
inherit-pkg-dir:
	dir: /usr
zonecfg:godel> exit

# zoneadm -z godel install
A ZFS file system has been created for this zone.
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <9718> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1442> packages on the zone.
Initialized <1442> packages on zone.
Zone  is initialized.
The file  contains a log of the zone installation.

# zoneadm -z godel boot

# zlogin godel "zonename && hostid"
godel
83405c0b

# zonename && hostid
global
83405c0b

The system's hostid is the same within the non-global zone and the global zone. Now specify a hostid for the zone via zonecfg, reboot the zone, and observe the results:

# zonecfg -z godel set hostid=1337833f

# zoneadm -z godel reboot

# zlogin godel "zonename && hostid"
godel
1337833f

# zonename && hostid
global
83405c0b

You can specify any 32-bit hexadecimal hostid for a non-global zone except 0xffffffff and the hostid will take effect on subsequent boots of the non-global zone. ('Boots' means boots from the global zone via zoneadm, as in "zoneadm -z <zone_name> boot" or "zoneadm -z <zone_name> reboot".) The hostid emulation feature is available for all native-based brands (native, ipkg, cluster, etc.); however, Linux containers (i.e., lx-branded zones) do not support hostid emulation via zonecfg. To emulate hostids in Linux containers, modify the /etc/hostid file within the container.

Migrating non-global zones with legacy hostid-bound licensed software across physical hosts is a cakewalk. Detach the zone, migrate it to the new system, attach it, specify the source system's hostid for the now-attached zone, boot the zone, and viola!, the licensed software still thinks it's on the old system.

About

I am a kernel developer at Sun Microsystems, Inc., working on zones and resource pools. This blog logs some of my thoughts regarding my work and the [mis]adventures that I have while working on Solaris.

Search

Categories
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