Tuesday 12 July 2016

OVM for SPARC Primer part 2

Creating a guest domain:


First create a framework for the new domain with the following command:

bash-3.00# ldm add-domain testdomain

This populates the initial properties configuration of the guest domain.
The guest domain does not have any resources associated to it at this stage & is in an inactive state as shown below:

bash-3.00# ldm list testdomain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
testdomain       inactive   ------


Add resources to the guest domain:

Add CPU:

bash-3.00# ldm add-vcpu 2 testdomain

Add memory:

bash-3.00# ldm add-memory 1g testdomain

Add virtual network device:

bash-3.00# ldm add-vnet vnet8 primary-vsw1 testdomain

Add disk device:

For the purpose of this demo I created a zfs volume to use as a disk device for the guest domain. In a real world scenario you’d probably use a physical disk or SAN assigned LUN.

The procedure for creating the volume is as follows:

bash-3.00# mkfile 500m test
bash-3.00# zpool create tpool /root/test
bash-3.00# zfs create -V 400m tpool/vol1

Now to add the virtual disk device to be used with the guest domain, we first add the virtual disk device service or vdsdev. This will connect the volume to the disk service.

bash-3.00# ldm add-vdsdev /dev/zvol/dsk/tpool/vol1 testdisk@primary-vds0

Now we will create the binding from the disk service to a virtual disk device, or vdisk, on our guest domain:

bash-3.00# ldm add-vdisk vdisk7 testdisk@primary-vds0 testdomain


Now we will set the boot parameter to false. With this when we power on our guest domain it will boot up to OBP & will stop there.

bash-3.00# ldm set-variable auto-boot\?=false testdomain

Although we have allocated resources to the guest domain these are not associated with the guest domain yet i.e. the resources can be allocated to another guest domain & this would prevent start-up of our guest domain in case of a resource crunch.

bash-3.00# ldm list-domain testdomain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
testdomain       inactive   ------          2     1G

In order to bind the resources to the guest domain type the following command:

bash-3.00# ldm bind-domain testdomain
bash-3.00# ldm list-domain testdomain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
testdomain       bound      ------  5003    2     1G

To boot the newly created guest domain type:

bash-3.00# ldm start-domain testdomain
LDom testdomain started

Now, you can login to the console of the guest domain as follows:

bash-3.00# ldm list-domain testdomain
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
testdomain       active     -t----  5003    2     1G        50%  1m
bash-3.00#
bash-3.00# telnet localhost 5003
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
{0} ok banner
SPARC T3-1B, No Keyboard
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.33.0.b, 1024 MB memory available, Serial #83363569.
Ethernet address 0:14:4f:f8:6:f1, Host ID: 84f806f1.

In the ldm list-domain output under the flags column the flag t means transitioning stage implying that the ldom is powered on but is not running an active instance of an OS at the moment.
In its current state the guest domain is an empty container. To install an OS into it, set a variable to mark a device as the boot device for the ldom. Then attach a Solaris OS ISO to the guest domain & at the ok prompt boot from the iso & proceed with the install.


No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...