All 4 entries tagged Oracle

View all 121 entries tagged Oracle on Warwick Blogs | View entries tagged Oracle at Technorati | There are no images tagged Oracle on this blog

April 02, 2014

Using AI to install solaris on an LDOM

The aim of this blog is to fill in the gaps from other notes on using AI with an LDOM, not to repeat the previous notes. Also they do not document installing the hypervisor or the initial set up, there's already Paul E's notes for this.

So:

1. On your AI server, create a client, manifest/ derive script, profile and if relevant, 1st boot script (see previous notes).

2. Confgure your LDOM:

ldm add-domain DOMAIN-NAME

ldm set-vcpu NN DOMAIN-NAME

ldm set-mem NNg DOMAIN-NAME

ldm add-vnet pvid=XXX vnet01 primary-vsw0 DOMAIN-NAME

ldm add-vnet pvid=XXX vnet02 iodomain-vsw0 DOMAIN-NAME

ldm add-vdisk vdisk01 sharedVOLNAME@primary-vds0 DOMAIN-NAME

ldm set-var autoboot?=false DOMAIN-NAME

ldm set-var local-mac-address?=true DOMAIN-NAME

ldm start DOMAIN-NAME


3.You don't have to use DHCP, it's just nicer. I'll document both ways:


a) With no DHCP

ldm set-var network-boot-arguments=host-ip=IPofDOMAIN-NAME,router-ip=XXX.XXX.XXX.XXX,subnet-mask=255.255.255.0,hostname=DOMAIN-NAME,file=http://IPofAISERVER:5555/cgi-bin/wanboot-cgi

On the aiserver in the manifest you cannot use names, you need to use IP addresses as you have no DNS.

ldm ls

telnet 0 500X

ok boot net - install


b) Using DHCP

Set Next Server to the IP of your AI server

Set File Name to:
http://IPofAISERVER:5555/cgi-bin/wanboot-cgi


ldm ls

telnet 0 500X

ok boot vnet01:dhcp - install


September 19, 2013

Having fun with Oracle's Solaris 11.1 Automated Installer – Adding a repo for post install scripts

I've been having a go at post install scripts with AI

I needed to do this as I wanted to configure IPMP and this is a post install task.

Actually the notes from oracle on this were much better than the ones on AI: http://docs.oracle.com/cd/E26502_01/html/E28980/firstboot-1.html#scrolltoc

1. You create a run once script.

2. You make it into a run once service

3. Make it available for clients when they are installing in a repo

4. Specify the package in your clients manifest

1. You create a run once script:

The bit you write is in the middle, the rest is part of making it a run once only service.

#!/bin/ksh93 -vx
# Run once post install script
# Sep 2013

# Load SMF shell support definitions
. /lib/svc/share/smf_include.sh

# If nothing to do, exit with temporary disable
completed=`svcprop -p config/completed site/first-boot-script-svc:default`
[ "${completed}" = "true" ] && \
smf_method_exit $SMF_EXIT_TEMP_DISABLE completed "Configuration completed"

# Obtain the active BE name from beadm: The active BE on reboot has an R in
# the third column of 'beadm list' output. Its name is in column one.
bename=`beadm list -Hd|nawk -F ';' '$3 ~ /R/ {print $1}'`
beadm create ${bename}.orig
echo "Original boot environment saved as ${bename}.orig"

# Configure ipmp
/usr/sbin/route -p delete default ROUTER_ADDRESS -ifp net0
/usr/sbin/svcadm restart routing-setup
/usr/sbin/ipadm create-ipmp ipmp0
/usr/sbin/ipadm delete-ip net0
/usr/sbin/ipadm create-ip net0
/usr/sbin/ipadm create-ip net2
/usr/sbin/ipadm add-ipmp -i net0 -i net2 ipmp0
/usr/sbin/ipadm create-addr -a IPADDR/NN ipmp0
/usr/sbin/route -p add default ROUTER_ADDRESS
/usr/sbin/svcadm restart routing-setup

# Record that this script's work is done
svccfg -s site/first-boot-script-svc:default setprop config/completed = true
svcadm refresh site/first-boot-script-svc:default
smf_method_exit $SMF_EXIT_TEMP_DISABLE method_completed "Configuration completed"

2. You make it into a run once service

For speed I used svcbundle to create the service:

# svcbundle -s service-name=site/first-boot-script-svc -s start-method=/opt/site/first-boot-script.sh -s instance-property=config:completed:boolean:false > first-boot-script-svc-manifest.xml

# mkdir -p ../proto/lib/svc/manifest/site
# mkdir -p ../proto/opt/site
# cp first-boot-script-svc-manifest.xml ../proto/lib/svc/manifest/site
# cp first-boot-script.sh ../proto/opt/site

Create first-boot-script.p5m

set name=pkg.fmri value=first-boot-script@1.0,5.11-0
set name=pkg.summary value="first-boot script"
set name=pkg.description value="Script that runs at first boot after AI installation"
set name=info.classification value=\
"org.opensolaris.category.2008:System/Administration and Configuration"
file lib/svc/manifest/site/first-boot-script-svc-manifest.xml \
path=lib/svc/manifest/site/first-boot-script-svc-manifest.xml owner=root \
group=sys mode=0444
dir path=opt/site owner=root group=sys mode=0755
file opt/site/first-boot-script.sh path=opt/site/first-boot-script.sh \
owner=root group=sys mode=0555


3. Make it available for clients when they are installing in a repo

I created a new repo for this:

# pkgrepo create /repo/firstbootrepo
# pkgrepo -s /repo/firstbootrepo add-publisher firstboot
# pkgrepo set -s /repo/firstbootrepo/ publisher/prefix=firstboot

# pkgsend publish -d ../proto -s /repo/firstbootrepo/ first-boot-script.p5m

# svccfg -s pkg/server add firstboot
# svccfg -s pkg/server:firstboot setprop pkg/port=NN
# svccfg -s pkg/server:firstboot setprop pkg/inst_root=/repo/firstbootrepo
# svccfg -s pkg/server:firstboot setprop pkg/readonly=true

# svcadm disable application/pkg/server:firstboot
# svcadm enable application/pkg/server:firstboot

Tip top tip (Sep 2013, Solaris v11.1) whenever you have published anything the service needs to be disabled and re-enabled before you can see the package!

4. Specify the package in your clients manifest

In the <software type="IPS"> section locate <source> and add your publisher, add a <new software_data_action="install">

<software type="IPS">
<destination>
<image>
<!-- Specify locales to install -->
<facet set="false">facet.locale.*</facet>
<facet set="true">facet.locale.en</facet>
<facet set="true">facet.locale.en_GB</facet>
</image>
</destination>
<source>
<publisher name="solaris">
<origin name="http://SERVERNAME/solaris"/>
</publisher>
<publisher name="firstboot">
<origin name="http://SERVERNAME:NN/firstboot"/>
</publisher>
</source>
<!--
By default the latest build available, in the specified IPS
repository, is installed. If another build is required, the
build number has to be appended to the 'entire' package in the
following form:

<name>pkg:/entire@0.5.11-0.build#</name>
-->
<software_data action="install">
<name>pkg:/entire@latest</name>
<name>pkg:/group/system/solaris-large-server</name>
<name>pkg:/system/locale/extra</name>
</software_data>
<software_data action="install">
<name>pkg:/first-boot-script</name>
</software_data>
</software>

September 17, 2013

Having fun with Oracle's Solaris 11.1 Automated Installer

I thought I'd provide a complete script that will derive a manifest. This one will create a swap that is the size of the memory of the machine and create a mirrored root with a spare disk:

#!/bin/ksh93 -vx
# Create a mirrored root pool plus a spare disk in the pool for all the disks on the machine
# (apart from the annoying USB disk)
# Mount some filesystems


MFST=/tmp/base_manifest.xml
cat <<HERE >${MFST}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE auto_install SYSTEM "file:///usr/share/install/ai.dtd.1">
<auto_install>
<ai_instance name="orig_default" auto_reboot="false">
<software type="IPS">
<destination>
<image>
<!-- Specify locales to install -->
<facet set="false">facet.locale.*</facet>
<facet set="true">facet.locale.en</facet>
<facet set="true">facet.locale.en_GB</facet>
</image>
</destination>
<source>
<publisher name="solaris">
<origin name="http://servername/solaris"/>
</publisher>
</source>
<!--
By default the latest build available, in the specified IPS
repository, is installed. If another build is required, the
build number has to be appended to the 'entire' package in the
following form:

<name>pkg:/entire@0.5.11-0.build#</name>
-->
<software_data action="install">
<name>pkg:/entire@latest</name>
<name>pkg:/group/system/solaris-large-server</name>
</software_data>
</software>
</ai_instance>
</auto_install>
HERE

SCRIPT_SUCCESS=0
SCRIPT_FAILURE=1

function handler
{
exit $SCRIPT_FAILURE
}

trap handler ERR

/usr/bin/aimanifest load ${MFST}

donotuse=1 # don't want to pick up built in usb disk
set -A filesystem_name_arr export export/home zones
no_filesystems=2
set -A mountpoint_arr \/export \/export\/home \/zones
K=1024
let G=${K}*${K}*${K}
let mem_size=${SI_MEMSIZE}/${G}

/usr/bin/aimanifest add -r target/logical@nodump false
/usr/bin/aimanifest set target/logical@noswap false

/usr/bin/aimanifest add -r target/logical/zpool@name rpool
/usr/bin/aimanifest set target/logical/zpool[@name=rpool]@is_root true

vdev=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/vdev@name rpool_vdev)
/usr/bin/aimanifest set ${vdev}@redundancy mirror

zvol=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/zvol@name swap)
/usr/bin/aimanifest set ${zvol}@action create
/usr/bin/aimanifest set ${zvol}@use swap
/usr/bin/aimanifest add ${zvol}/size@val ${mem_size}gb

vdev=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/vdev@name rpool_vdev_spare)
/usr/bin/aimanifest set ${vdev}@redundancy spare

for ((j=0;j<=$no_filesystems;j++)) ; do
filesys=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/filesystem@name ${filesystem_name_arr[$j]})
/usr/bin/aimanifest set ${filesys}@mountpoint ${mountpoint_arr[$j]}
done

/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/be@name solaris

vdev_name=rpool_vdev

for ((i=1;i<=$SI_NUMDISKS-$donotuse;i++)) ; do

# doesn't work as described in the oracle notes, but this does
eval temp_disk="$"SI_DISKNAME_${i}
eval curr_disk=$temp_disk

if [[ $i -eq $SI_NUMDISKS-$donotuse ]]; then
vdev_name=rpool_vdev_spare
fi

disk=$(/usr/bin/aimanifest add -r target/disk@in_vdev ${vdev_name})
/usr/bin/aimanifest set ${disk}@whole_disk true
/usr/bin/aimanifest set ${disk}@in_zpool rpool

disk_name=$(/usr/bin/aimanifest add -r ${disk}/disk_name@name ${curr_disk})
/usr/bin/aimanifest set ${disk_name}@name_type ctd

done

exit $SCRIPT_SUCCESS

September 11, 2013

Having fun with Oracle's Solaris 11.1 Automated Installer

Preamble:

If I get any apostrophes wrong, hey I'm sorry, buy me chocolate and commiserate with my ignorance, please don't shout at me! (same goes for spelling, but people are more tolerant with that).

I'm intending this to be my AI diary as I keep forgetting important things, it's not supposed to be documentation, as documentation has to be perfect and I will eventually produce some lovely stuff, this is more like my on-going thoughts and discoveries.

Todays fun with derived manifests:

I'm trying stuff out with derived manifest at the moment, I've found the Oracle notes only go so far.

Here's how I have a mirrored root pool with spare disk :

/usr/bin/aimanifest add -r target/logical/zpool@name rpool
/usr/bin/aimanifest set target/logical/zpool[@name=rpool]@is_root true

vdev=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/vdev@name rpool_vdev)
/usr/bin/aimanifest set ${vdev}@redundancy mirror

vdev=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/vdev@name rpool_vdev_spare)
/usr/bin/aimanifest set ${vdev}@redundancy spare

The above bungs the below into the derived manifest

<zpool name="rpool" is_root="true">
<vdev name="rpool_vdev" redundancy="mirror"/>
<vdev name="rpool_vdev_spare" redundancy="spare"/>
</zpool

Here's how to configure the swap to your own size:

zvol=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/zvol@name swap)
/usr/bin/aimanifest set ${zvol}@action create
/usr/bin/aimanifest set ${zvol}@use swap
/usr/bin/aimanifest add ${zvol}/size@val 64gb

In this example I wanted the swap to match memory size, but the variable was supposed to be in Mbytes but was actually in bytes, solaris didn't like the value as it was not a a multiple of volume block size (actual error was: InstallationLogger ERROR cannot create 'rpool/swap': volume size must be a multiple of volume block size) , to get around this I converted the value into Gbytes, but obviously when they fix this undocumented feature my script will need to be fixed also. You could say how about specifying the block size, but I would say don't think you can with manifests!

So then altogether it looks like this:

K=1024
let G=${K}*${K}*${K}
let mem_size=${SI_MEMSIZE}/${G}

# some other stuff here

zvol=$(/usr/bin/aimanifest add -r target/logical/zpool[@name=rpool]/zvol@name swap)
/usr/bin/aimanifest set ${zvol}@action create
/usr/bin/aimanifest set ${zvol}@use swap
/usr/bin/aimanifest add ${zvol}/size@val ${mem_size}gb

Which bungs this into the derived manifest:

<zvol name="swap" action="create" use="swap">
<size val="63gb"/>
</zvol>

Whoop whoop!

This is really useful:
http://docs.oracle.com/cd/E26502_01/html/E28978/instal.html#glniv

Here's the list of variables available:
http://docs.oracle.com/cd/E26502_01/html/E28980/provision-2.html#provision-3


November 2018

Mo Tu We Th Fr Sa Su
Oct |  Today  |
         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      

Search this blog

Tags

Galleries

Most recent comments

  • Hello, It was more for internal consumption, I will check it over and send you a version, can you em… by Maria MacCallum on this entry
  • Hello Maria, i don't see the script setup–zone.sh, can you post it ? I'am looking too for an example… by FRANCISCO on this entry
  • Solaris 11.2 returns the value of SI_MEMSIZE in Mb's now by Maria MacCallum on this entry

Blog archive

Loading…
RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXVIII