Ich kam gestern in die Verlegenheit mal schnell eine Zone aufsetzten zu müssen. Ich dachte mir, wenn ich das mal schnell mache, dann wenigsten mit RAM-Quota und CPU-Begrenzung. Es kann evtl. sein, dass man pkg:/service/resource installieren muss. Dieses Paket ist für die Verwaltung von RAM-Resourcen zuständig.
Ressourcenpools anstellen
rennecke@walhalla ~ % pfexec pooladm -e
Aktuelle Konfiguration in der /etc/pooladm.conf sichern
rennecke@walhalla ~ % pfexec pooladm -s
Nun erstellen wir einen Pool mit einem CPU-Set, welches über maximal 2 CPUs verfügt
rennecke@walhalla ~ % pfexec poolcfg -c 'create pset zone-pset (uint pset.min=1; uint pset.max=2)'
rennecke@walhalla ~ % pfexec poolcfg -c 'create pool zone-pool'
rennecke@walhalla ~ % pfexec poolcfg -c 'associate pool zone-pool (pset zone-pset)'
Als nächstes aktivieren wir die Konfiguration und speichern sie
rennecke@walhalla ~ % pfexec pooladm -c
rennecke@walhalla ~ % pfexec pooladm -s
rennecke@walhalla ~ % pfexec pooladm
system default
string system.comment
int system.version 1
boolean system.bind-default true
string system.poold.objectives wt-load
pool zone-pool
int pool.sys_id 1
boolean pool.active true
boolean pool.default false
int pool.importance 1
string pool.comment
pset zone-pset
pool pool_default
int pool.sys_id 0
boolean pool.active true
boolean pool.default true
int pool.importance 1
string pool.comment
pset pset_default
pset zone-pset
int pset.sys_id 1
boolean pset.default false
uint pset.min 1
uint pset.max 2
string pset.units population
uint pset.load 5
uint pset.size 2
string pset.comment
cpu
int cpu.sys_id 1
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 0
string cpu.comment
string cpu.status on-line
pset pset_default
int pset.sys_id -1
boolean pset.default true
uint pset.min 1
uint pset.max 65536
string pset.units population
uint pset.load 562
uint pset.size 2
string pset.comment
cpu
int cpu.sys_id 3
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 2
string cpu.comment
string cpu.status on-line
Nun kommen wir zum eigenlichen erstellen der Zone
rennecke@walhalla ~ % pfexec zonecfg -z zone1
zone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1> create
zonecfg:zone1> set zonepath=/export/zone/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> add net
zonecfg:zone1:net> set address=192.168.1.10/24
zonecfg:zone1:net> set physical=rge0
zonecfg:zone1:net> set defrouter=192.168.1.1
zonecfg:zone1:net> end
zonecfg:zone1> set pool=zone-pool
zonecfg:zone1> add capped-memory
zonecfg:zone1:capped-memory> set physical=200m
zonecfg:zone1:capped-memory> set swap=400m
zonecfg:zone1:capped-memory> set locked=30m
zonecfg:zone1:capped-memory> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
Ich denke, dass sich alles von selbst erklärt, wenn jedmand Fragen hat, dann bitte einen Kommentar bzw. die Manpage lesen. Als nächsten Schritt installieren wir die Zone und booten sie anschließend.
rennecke@walhalla ~ % pfexec zoneadm -z zone1 install
A ZFS file system has been created for this zone.
Publisher: Using opensolaris.org (http://pkg.opensolaris.org/dev/ ).
Publisher: Using pending (http://pkg.opensolaris.org/pending/).
Publisher: Using contrib.opensolaris.org (http://pkg.opensolaris.org/contrib/).
Image: Preparing at /export/zone/zone1/root.
Cache: Using /var/pkg/download.
Sanity Check: Looking for 'entire' incorporation.
Installing: Core System (output follows)
DOWNLOAD PKGS FILES XFER (MB)
Completed 44/44 12305/12305 85.9/85.9
PHASE ACTIONS
Installationsphase 17833/17833
Für dieses Abbild sind keine Updates erforderlich.
Installing: Additional Packages (output follows)
DOWNLOAD PKGS FILES XFER (MB)
Completed 36/36 3233/3233 20.6/20.6
PHASE ACTIONS
Installationsphase 4329/4329
Note: Man pages can be obtained by installing SUNWman
Postinstall: Copying SMF seed repository ... done.
Postinstall: Applying workarounds.
Done: Installation completed in 606,736 seconds.
Next Steps: Boot the zone, then log into the zone console (zlogin -C)
to complete the configuration process.
Die Geschwindigkeit zum erstellen der Zone hängt von der Downloadgewindigkeit maßgeblich ab. Wenn man Pech hat, wartet man sehr lange auf die 100 MB…
Nachdem nun die Zone installiert ist müssen wir sie nur noch booten und initial konfigurieren
rennecke@walhalla ~ % pfexec zoneadm -z zone1 boot
rennecke@walhalla ~ % pfexec zlogin -C zone1
[Connected to zone 'zone1' console]
You did not enter a selection.
What type of terminal are you using?
1) ANSI Standard CRT
2) DEC VT100
3) PC Console
4) Sun Command Tool
5) Sun Workstation
6) X Terminal Emulator (xterms)
7) Other
Type the number of your choice and press Return: 2
Es ist sehr zu empfehlen für die Konfiguration ein VT100 Terminal zu nehmen. Das ich zwar nicht schön, aber man kann auj jeder Konsole ordentlich arbeiten, ohne das was verschoben wird.