Flying Kernel Zone

From pressy's brainbackup
Jump to: navigation, search

Solaris Kernel Zone @ Solaris Cluster @ LDOM

First of all prepair your LDOMs to allow more vNICs

root@t5ldlzc03:~# prtdiag | head -1
System Configuration:  Oracle Corporation  sun4v SPARC T5-8
root@t5ldvsvc01:~# ldm stop t5ldlzc03
Remote graceful shutdown or reboot capability is not available on t5ldlzc03
LDom t5ldlzc03 stopped
root@t5ldvsvc01:~# ldm set-vnet alt-mac-addrs=auto,auto,auto,auto,auto,auto,auto,auto net0  t5ldlzc03
root@t5ldvsvc01:~# ldm set-vnet alt-mac-addrs=auto,auto,auto,auto,auto,auto,auto,auto net1  t5ldlzc03
root@t5ldvsvc01:~# ldm start  t5ldlzc03
LDom t5ldlzc03 started

I will create a ZFS volume on a shared SAN LUN as a base/boot device for my kernel zone.

root@t5ldlzc03:~# uname -a
SunOS t5ldlzc03 5.11 11.3 sun4v sparc sun4v
root@t5ldlzc03:~# clnode show-rev
4.3_2.3.0

root@t5ldlzc03:~# pkg list entire
NAME (PUBLISHER)                                  VERSION                    IFO
entire                                            0.5.11-0.175.3.6.0.5.0     i--

root@t5ldlzc03:~# zfs set compression=lz4 t5ldzmg03
root@t5ldlzc03:~# zfs create -V 20g t5ldzmg03/t5ldzmg03
root@t5ldlzc03:~# zfs get compression  t5ldzmg03/t5ldzmg03
NAME               PROPERTY     VALUE  SOURCE
t5ldzmg03/t5ldzmg03  compression  lz4    inherited from t5ldzmg03
root@t5ldlzc03:~#
root@t5ldlzc03:~# zfs create -V 20g t5ldzmg03/t5ldzmg03-suspend
root@t5ldlzc03:~#
root@t5ldlzc03:~# virtinfo
NAME            CLASS
logical-domain  current
non-global-zone supported
kernel-zone     supported
root@t5ldlzc03:~#
root@t5ldlzc03:~# suriadm lookup-uri /dev/zvol/dsk/t5ldzmg03/t5ldzmg03
dev:zvol/dsk/t5ldzmg03/t5ldzmg03
root@t5ldlzc03:~# suriadm lookup-uri /dev/zvol/dsk/t5ldzmg03/t5ldzmg03-suspend
dev:zvol/dsk/t5ldzmg03/t5ldzmg03-suspend
root@t5ldlzc03:~#
root@t5ldlzc03:~# zonecfg -z t5ldzmg03
Use 'create' to begin configuring a new zone.
zonecfg:t5ldzmg03> create -b
zonecfg:t5ldzmg03> set brand=solaris-kz
zonecfg:t5ldzmg03> add capped-memory
zonecfg:t5ldzmg03:capped-memory> set physical=16g
zonecfg:t5ldzmg03:capped-memory> end
zonecfg:t5ldzmg03> add device
zonecfg:t5ldzmg03:device> set storage=dev:zvol/dsk/t5ldzmg03/t5ldzmg03
zonecfg:t5ldzmg03:device> set bootpri=1
zonecfg:t5ldzmg03:device> end
zonecfg:t5ldzmg03> add suspend
zonecfg:t5ldzmg03:suspend> set storage=dev:zvol/dsk/t5ldzmg03/t5ldzmg03-suspend
zonecfg:t5ldzmg03:suspend> end
zonecfg:t5ldzmg03> add anet
zonecfg:t5ldzmg03:anet> set lower-link=net0
zonecfg:t5ldzmg03:anet> end
zonecfg:t5ldzmg03> add anet
zonecfg:t5ldzmg03:anet> set lower-link=net1
zonecfg:t5ldzmg03:anet> end
zonecfg:t5ldzmg03> set autoboot=false
zonecfg:t5ldzmg03> add attr
zonecfg:t5ldzmg03:attr> set name=osc-ha-zone
zonecfg:t5ldzmg03:attr> set type=boolean
zonecfg:t5ldzmg03:attr> set value=true
zonecfg:t5ldzmg03:attr> end
zonecfg:t5ldzmg03> commit
zonecfg:t5ldzmg03> exit
root@t5ldlzc03:~#
root@t5ldlzc03:~# zoneadm list -cv
  ID NAME             STATUS      PATH                         BRAND      IP
   0 global           running     /                            solaris    shared
   - t5ldzmg03         configured  -                            solaris-kz excl
root@t5ldlzc03:~#

Ok, configuration is done; let's install it and try to boot it on the second cluster node. I will also need the configuration on that node. To test that I will switch the ZPOOL which is configured in a cluster group.

root@t5ldlzc03:~#
root@t5ldlzc03:~# zoneadm -z t5ldzmg03 install
Progress being logged to /var/log/zones/zoneadm.20160412T093941Z.t5ldzmg03.install
pkg cache: Using /var/pkg/publisher.
 Install Log: /system/volatile/install.11071/install_log
 AI Manifest: /tmp/zoneadm10552.76aG8u/devel-ai-manifest.xml
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
Installation: Starting ...

        Creating IPS image
        Installing packages from:
            solaris
                origin:  http://t4repo02.testlan.at/solaris_11_3/
            ha-cluster
                origin:  http://t4repo02.testlan.at/ha-cluster/
            solarisstudio
                origin:  http://t4repo02.testlan.at/solarisstudio/
        The following licenses have been accepted and not displayed.
        Please review the licenses for the following packages post-install:
          consolidation/osnet/osnet-incorporation
        Package licenses may be viewed using the command:
          pkg info --license <pkg_fmri>

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                            470/470   65349/65349  636.8/636.8  4.7M/s

PHASE                                          ITEMS
Installing new actions                   89538/89538
Updating package state database                 Done
Updating package cache                           0/0
Updating image state                            Done
Creating fast lookup database                   Done
Installation: Succeeded
        Done: Installation completed in 356.049 seconds.

root@t5ldlzc03:~# zoneadm -z t5ldzmg03 boot
root@t5ldlzc03:~# zlogin -C t5ldzmg03
[...]
root@t5ldlzc03:~# zoneadm -z t5ldzmg03 shutdown
zone 't5ldzmg03': updating /platform/sun4v/boot_archive
root@t5ldlzc03:~# zoneadm -z t5ldzmg03 detach -F
root@t5ldlzc03:~#
root@t5ldlzc03:~#
root@t5ldlzc03:~# zonecfg -z t5ldzmg03 export -f /tmp/t5ldzmg03.export
root@t5ldlzc03:~# scp  /tmp/t5ldzmg03.export root@t5ldlzc04:/tmp/.
root@t5ldlzc03:~#
root@t5ldlzc03:~# clrg create t5ldzmg03-rg
root@t5ldlzc03:~# clrt register SUNW.HAStoragePlus
root@t5ldlzc03:~# clrs create -t SUNW.HAStoragePlus -g t5ldzmg03-rg -p Zpools=t5ldzmg03 t5ldzmg03-stor-res
root@t5ldlzc03:~# clrg online -emM -n t5ldlzc03 t5ldzmg03-rg
root@t5ldlzc03:~# clrg switch -n t5ldlzc04 t5ldzmg03-rg
root@t5ldlzc04:~# zoneadm -z t5ldzmg03 attach -x force-takeover
root@t5ldlzc04:~# zoneadm -z  t5ldzmg03 boot
root@t5ldlzc04:~# zlogin -C  t5ldzmg03
[Connected to zone 't5ldzmg03' console]
Hostname: t5ldzmg03

t5ldzmg03 console login: root
Password:
Last login: Tue Apr 12 13:52:41 2016 on console
Apr 12 14:00:56 t5ldzmg03 login: ROOT LOGIN /dev/console
Oracle Corporation      SunOS 5.11      11.3    February 2016
root@t5ldzmg03:~# svcs -xv 
[...]
root@t5ldlzc04:~# zoneadm -z t5ldzmg03 shutdown
root@t5ldlzc04:~# zoneadm -z t5ldzmg03 detach -F
root@t5ldlzc04:~# clrg switch -n t5ldlzc03 t5ldzmg03-rg


Now I will register the zone as a cluster resource and make the zone high avaiable. There is an own agent from Oracle for that which I will use.

root@t5ldlzc03:~# pkg list ha-cluster/data-service/ha-zones
NAME (PUBLISHER)                                  VERSION                    IFO
ha-cluster/data-service/ha-zones (ha-cluster)     4.3-0.24.0                 i--
root@t5ldlzc03:~#
root@t5ldlzc03:~# clrt register SUNW.gds
root@t5ldlzc03:~# cd /opt/SUNWsczone/sczbt/util
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util# ls
ha-solaris-zone-boot-env-id  sczbt_config                 sczbt_register
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util# vi [..]
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util# cat t5ldzmg03.sczbt.config
RS=t5ldzmg03-zone-res
RG=t5ldzmg03-rg
PARAMETERDIR=
SC_NETWORK=false
SC_LH=
FAILOVER=true
HAS_RS=t5ldzmg03-stor-res
Zonename="t5ldzmg03"
Zonebrand="solaris-kz"
Zonebootopt=""
Milestone="svc:/milestone/multi-user-server"
LXrunlevel="3"
SLrunlevel="3"
Mounts=""
Migrationtype="warm"
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util#
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util# ./sczbt_register -f ./t5ldzmg03.sczbt.config
sourcing ./t5ldzmg03.sczbt.config
Registration of resource type ORCL.ha-zone_sczbt succeeded.
Registration of resource t5ldzmg03-zone-res succeeded.
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util# clrs enable t5ldzmg03-zone-res
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util# clrs status

=== Cluster Resources ===

Resource Name         Node Name     State       Status Message
-------------         ---------     -----       --------------
t5ldzmg03-zone-res     t5ldlzc03      Online      Online - Service is online.
                      t5ldlzc04      Offline     Offline

t5ldzmg03-stor-res     t5ldlzc03      Online      Online
                      t5ldlzc04      Offline     Offline

root@t5ldlzc03:/opt/SUNWsczone/sczbt/util#
root@t5ldlzc03:/opt/SUNWsczone/sczbt/util# clrs status

=== Cluster Resources ===

Resource Name         Node Name     State       Status Message
-------------         ---------     -----       --------------
t5ldzmg03-zone-res     t5ldlzc03      Offline     Offline
                      t5ldlzc04      Online      Online - Service is online.

t5ldzmg03-stor-res     t5ldlzc03      Offline     Offline
                      t5ldlzc04      Online      Online

root@t5ldlzc03:/opt/SUNWsczone/sczbt/util#

That's it... we have now a HA kernel zoneĀ :-)