Friday, August 03, 2007

Solaris Container with a 1 CPU Resource pool

We're going to create a Resource Pool with only 1 CPU, then create a zone and associate it to the resource pool.

In the global zone:

# psrinfo -v

Status of virtual processor 0 as of: 08/02/2007 16:13:20
on-line since 07/31/2007 12:04:58.
The i386 processor operates at 3392 MHz,
and has an i387 compatible floating point processor.
Status of virtual processor 1 as of: 08/02/2007 16:13:20
on-line since 07/31/2007 12:05:09.
The i386 processor operates at 3392 MHz,
and has an i387 compatible floating point processor.

Creating the resouce pool:
We will use the pooladm(1M) and poolcfg(1M) commands to create and configure the resouce pool:

Enable resource pools:
# pooladm -e


Save current configuration:
# pooladm -s


List current configuration:
# pooladm

system default
string system.comment
int system.version 1
boolean system.bind-default true
string system.poold.objectives wt-load

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 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 72
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

Create a processor set with 1 CPU:
# poolcfg -c 'create pset edb-pset (uint pset.min=1; uint pset.max=1)'


Create a resource pool:
# poolcfg -c 'create pool edb-pool'


Associate the pool to the processor set:
# poolcfg -c 'associate pool edb-pool (pset edb-pset)'


Enable the configuration:
# pooladm -c


See the results:
# pooladm

system default
string system.comment
int system.version 1
boolean system.bind-default true
string system.poold.objectives wt-load

pool edb-pool
int pool.sys_id 1
boolean pool.active true
boolean pool.default false
int pool.importance 1
string pool.comment
pset edb-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 edb-pset
int pset.sys_id 1
boolean pset.default false
uint pset.min 1
uint pset.max 1
string pset.units population
uint pset.load 2
uint pset.size 1
string pset.comment

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 71
uint pset.size 1
string pset.comment

cpu
int cpu.sys_id 1
string cpu.comment
string cpu.status on-line


Creating the zone:

# zonecfg -z edb-zone
edb-zone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:edb-zone> create
zonecfg:edb-zone> set zonepath=/export/home/zones/edb-zone
zonecfg:edb-zone> set autoboot=true
zonecfg:edb-zone> add net
zonecfg:edb-zone:net> set address=192.168.1.5
zonecfg:edb-zone:net> set physical=bge0
zonecfg:edb-zone:net> end
zonecfg:edb-zone> set pool=edb-pool
zonecfg:edb-zone> verify
zonecfg:edb-zone> commit
zonecfg:edb-zone> exit

The important part is associating the pool to edb-pool. (set pool=edb-pool). We can also add inherit-pkg-dir set /opt and so on if desired.
The zonepath should be a ZFS filesystem (zfs set compression=on) to speed things up.

Installing the zone:

# zoneadm -z edb-zone install
Preparing to install zone <edb-zone>.
Creating list of files to copy from the global zone.
Copying <39853> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1233> packages on the zone.
Initialized <1233> packages on zone.
Zone <edb-zone> is initialized.
The file </export/home/zones/edb-zone/root/var/sadm/system/logs/install_log> contains a log of the zone installation.


Boot the zone, login and answer the initial boot configuration questions:

# zoneadm -z edb-zone boot
# zlogin -C edb-zone

-> Answer questions:

Confirm the following information. If it is correct, press F2;
to change any information, press F4.

Name service: DNS
Domain name: domain.local
Server address(es): 192.168.1.2
192.168.1.3
Search domain(s): domain.local

Use ESC-2 if F2 doesn't work.

To logout (you can change the escape sequence if it conflicts with ssh with "zlogin -e")
~.

After that, login, and see if it works:

# psrinfo -v
Status of virtual processor 0 as of: 08/02/2007 16:23:55
on-line since 07/31/2007 12:04:58.
The i386 processor operates at 3392 MHz,
and has an i387 compatible floating point processor.

#


Check if all services are running properly:

# svcs -xv
# svcs -xv ssh

Enable ssh if needed:

# svcadm enable ssh

Don't forget to edit /etc/hosts and add the hostname if you don't add it to DNS:

FQDN issues:

# svcs -xv
svc:/system/webconsole:console (java web console)
State: offline since Thu Aug 02 16:24:48 2007
Reason: Start method is running.
See: http://sun.com/msg/SMF-8000-C4
See: man -M /usr/share/man -s 1M smcwebserver
See: /var/svc/log/system-webconsole:console.log
Impact: This service is not running.

svc:/system/postrun:default (Postponed package postinstall command execution)
State: offline since Thu Aug 02 16:23:38 2007
Reason: Start method is running.
See: http://sun.com/msg/SMF-8000-C4
See: /var/svc/log/system-postrun:default.log
Impact: This service is not running.
#



Fixing them:


# ed /etc/hosts
1027
1,$n
1 # CDDL HEADER START
2 #
3 # The contents of this file are subject to the terms of the
4 # Common Development and Distribution License (the "License").
5 # You may not use this file except in compliance with the License.
6 #
7 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8 # or http://www.opensolaris.org/os/licensing.
9 # See the License for the specific language governing permissions
10 # and limitations under the License.
11 #
12 # When distributing Covered Code, include this CDDL HEADER in each
13 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14 # If applicable, add the following below this CDDL HEADER, with the
15 # fields enclosed by brackets "[]" replaced with your own identifying
16 # information: Portions Copyright [yyyy] [name of copyright owner]
17 #
18 # CDDL HEADER END
19 #
20 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
21 # Use is subject to license terms.
22 #
23 # ident "@(#)hosts 1.7 06/08/01 SMI"
24 #
25 # Internet host table
26 #
27 ::1 localhost
28 127.0.0.1 localhost
29 192.168.1.5 edb-zone loghost
29d
a
192.168.1.5 edb-zone edb-zone.domain.local
.
w
1038
q


# ping edb-zone
edb-zone is alive
# ping edb-zone.domain.local
edb-zone.domain.local is alive
# svcs -xv
#

0 comments: