martes, 29 de abril de 2008

Install Solaris 10 U5 in a guest LDOM from CDROM/DVD or ISO

With the new release of Solaris 10 5/08 (Update 5) we now have the chance to install guest Logical Domains from CDROM/DVD or an ISO image. In the previous releases, the only way to install Solaris 10 in a LDOM was using a Jumpstart Server.

Here we go, fasten your seatbelt ;):


This is the starting point, three standard services with some values (virtual disk service, virtual console service and virtual network service).
#
ldm ls-services
VDS

NAME VOLUME OPTIONS DEVICE

primary-vds0 vol0 /disco1

VCC
NAME PORT-RANGE

primary-vcc0 5000-5100

VSW
NAME MAC NET-DEV DEVICE MODE

primary-net0 00:14:4f:fb:2b:da e1000g0 switch@0 prog,promisc


#
ldm list-domain
NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME

primary active -n-cv SP 4 1G 8.2% 16h 36m

ldom1 bound ----- 5000 4 2G


Now we can start adding some resources to the guest domain we're creating (CPU and Memory):

#
ldm add-domain ldom2
#
ldm add-vcpu 4 ldom2
#
ldm add-memory 4g ldom2

The next commands set up the virtualized network interface and the file that will be used as a virtual disk to install Solaris

#
ldm add-vnet vnet0 primary-net0 ldom2

# mkfile 6g /datos1/disco2
# ldm add-vdiskserverdevice /datos1/disco2 vol1@primary-vds0

# ldm add-vdisk vdisk0 vol1@primary-vds0 ldom2
#
ldm set-variable auto-boot\?=false ldom2

And now the new feature with Solaris 10 U5, we add the ISO image as a virtual device that will be used as the installation media:

#
ldm add-vdiskserverdevice /root/sol-10-u5-ga-sparc-dvd.iso iso@primary-vds0

#
ldm add-vdisk iso iso@primary-vds0 ldom2

-- Start of NOTE --
Note: The procedure to install from a CDROM or DVD is the same:
# cdrw -l
Looking for CD devices...
Node Connected Device Device type

----------------------+--------------------------------+-----------------

/dev/rdsk/c0t0d0s2 | MATSHITA CD-RW CW-8124 DZ13 | CD Reader/Writer


# ldm add-vdiskserverdevice /dev/dsk/c0t0d0s2 cdrom@primary-vds0

#
ldm add-vdisk cdrom cdrom@primary-vds0 ldom2

----End of NOTE----

Let's bind and start the new domain:

#
ldm bind-domain ldom2
#
ldm start-domain ldom2
LDom ldom2 started


#
telnet localhost 5001
Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.


Connecting to console "ldom2" in group "ldom2" ....

Press ~? for control options ..


{0} ok show-disks

a) /virtual-devices@100/channel-devices@200/disk@1

b) /virtual-devices@100/channel-devices@200/disk@0

q) NO SELECTION

Enter Selection, q to quit: a

/virtual-devices@100/channel-devices@200/disk@1 has been selected.

Type ^Y ( Control-Y ) to insert it in the command line.

e.g. ok nvalias mydev ^Y

for creating devalias mydev for
/virtual-devices@100/channel-devices@200/disk@1

{0} ok devalias

iso /virtual-devices@100/channel-devices@200/disk@1

vdisk0 /virtual-devices@100/channel-devices@200/disk@0

vnet0 /virtual-devices@100/channel-devices@200/network@0

net /virtual-devices@100/channel-devices@200/network@0

disk /virtual-devices@100/channel-devices@200/disk@0

virtual-console /virtual-devices/console@1

name aliases

We now boot from the virtualized iso image appending the :f (this is to specify the slice 6 of the DVD/ISO image). This can also be done using boot iso:f

{0} ok boot /virtual-devices@100/channel-devices@200/disk@1:f
Boot device: /virtual-devices@100/channel-devices@200/disk@1:f File
and args:

SunOS Release 5.10 Version Generic_127127-11 64-bit

Copyright 1983-2008 Sun Microsystems, Inc. All rights reserved.

Use is subject to license terms.

Configuring devices.

Using RPC Bootparams for network configuration information.

Attempting to configure interface vnet0...

Skipped interface vnet0

Setting up Java. Please wait...

Extracting windowing system. Please wait...

Beginning system identification...



That's all :). Very usefull and good feature that comes from OpenSolaris.