C H A P T E R  4

Using the Virtual Installation Script (virt-install)

This chapter describes using the virt-install(1M) script to install a guest operating system on a server running the Logical Domains Manager. To find more information about the virt-install script as it used with OpenSolaris xVM, refer to the following site:

http://opensolaris.org/os/community/xen/docs/


Before Using the virt-install Script

Before using the virt-install script to create the guest domain and add resources to the guest, ensure the following occurs on the LDoms control, or primary, domain:

The virt-install script adds resources to the guest domain using the existing virtual disk or switch services. Refer to the Logical Domains (LDoms) 1.0.1 Administration Guide for more information about how to do all this.


Types of virt-install Script Installations

You can start the virt-install script in two ways:

You can install the OS through a network installation in one of two ways:

Installation from Solaris Flash Archives or ISO image can be supported if those images are set up on the installation server to boot over a network. However, preconfiguration for Solaris Flash Archives or ISO image is not supported.

Installation from a local disk or CD-ROM is not supported.


Required Information for Using the virt-install Script

You must supply the following guest domain information:


Responding to Prompts Using the virt-install Script



Note - You must be a superuser to run the virt-install script.



The virt-install script asks for the information listed in Required Information for Using the virt-install Script. After you enter the required information by responding to the prompts, installation starts.

The virt-install script for LDoms stops at the OpenBoottrademark ok prompt. To continue the installation process, you must enter one of the following boot commands depending on whether you are doing a regular network installation or a JumpStart installation.

The following example shows an example of using the virt-install script with LDoms.


EXAMPLE 4-1   Example of the virt-install script for LDoms
# /usr/sbin/virt-install --connect=ldoms:///default
What is the name of your virtual machine? ldom_virt1
How much RAM should be allocated (in megabytes)? 1024
What would you like to use as the disk (path)? /ldomsOSFiles/ldom_virt1_disk
How large would you like the disk (/ldomsOSFiles/ldom_virt1_disk) to be (in gigabytes)? 7
 
Starting install...
Creating the virtual disk file /ldomsOSFiles/ldom_virt1_disk... It might take a few minutes to complete.
LDom ldom_virt1 started
 
MAC address 00:14:4f:f8:65:c4 is used for a virtual network device vnet1 ==>
****NOTE: User can enter the fixed MAC address with -mac=<mac_addr> command line
argument. Since the MAC address was not entered as a command line argument, the
LDoms Manager has automatically assigned this MAC address to the virtual network
device for the new guest domain. Use this MAC address to configure the
installation server.
Trying 127.0.0.1...
Connected to localhost.
Escape character is ’^]’.
 
Connecting to console "ldom_virt1" in group "ldom_virt1" ....
Press ~? for control options ...
 
ok boot vnet1 - install   ==> **** NOTE: enter this boot command at the ok prompt
Boot device: /virtual-devices@100/channel-devices@200/network@0
File and args: - installRequesting Internet Address for 0:14:4f:f8:65:c4
SunOS Release 5.10 Version Generic_120011-14 64-bit
Copyright 1983-2007 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...
Configured interface vnet0
Setting up Java. Please wait...
Extracting windowing system. Please wait...
Beginning system identification...
Searching for configuration file(s)...
Using sysid configuration file 10.1.1.10:/export/VSP_DEV/ldom-126/sysidcfg
Search complete.
Discovering additional network configuration...
Completing system identification...
Starting remote procedure call (RPC) services: done.
System identification complete.
Starting Solaris installation program...
Searching for JumpStart directory...
Using rules.ok from 10.1.1.10:/export/VSP_DEV/ldom-126.
Checking rules.ok file...
Using profile: prof
Using finish script: finish_script
Executing JumpStart preinstall phase...
Searching for SolStart directory...
Checking rules.ok file...
Using begin script: install_begin
Using finish script: patch_finish
Executing SolStart preinstall phase...
Executing begin script "install_begin"...
Begin script install_begin execution completed.
 
Processing profile
 - Selecting cluster (SUNWCXall)
 - Selecting all disks
 - Configuring boot device
 - Using disk (c0d0) for "rootdisk"
 - Configuring swap (c0d0s1)
 - Configuring / (c0d0s0)
 
Verifying disk configuration
 - WARNING: Changing the system’s default boot device in the EEPROM
 
Verifying space allocation
 - Total software size: 3783.25 Mbytes
 
Preparing system for Solaris install
 
Configuring disk (c0d0)
 - Creating Solaris disk label (VTOC)
 
Creating and checking UFS file systems
 - Creating / (c0d0s0)
 
Beginning Solaris software installation
 
Starting software installation
 SUNWocfd.........................done.  3782.90 Mbytes remaining.
 SUNWlucfg........................done.  3782.82 Mbytes remaining.
 SUNWcsu..........................done.  3768.09 Mbytes remaining.
 SUNWcsr..........................done.  3763.90 Mbytes remaining.
 SUNWcsl..........................done.  3749.86 Mbytes remaining.
 SUNWcnetr........................done.  3749.79 Mbytes remaining.
 SUNWjdmk-base....................done.  3748.54 Mbytes remaining.
 SUNWkvmt200.v....................done.  3748.36 Mbytes remaining.
 SUNWkvm.v........................done.  3747.83 Mbytes remaining.
 
....
 


Using the virt-install Command-Line Options

The following table lists all the command-line options available in using the virt-install script with LDoms.


TABLE 4-1   The virt-install Script Command-Line Options with LDoms
Command-Line Option Description
--check-cpu Check that virtual CPUs do not exceed the physical CPUs, and warn if they do.
--connect=URI Connect to the hypervisor at the Uniform Resource Identifier (URI). To connect to the Logical Domains hypervisor, use the following URI:

--connect=ldoms:///default

-d, --debug Display debugging information.
-f disk_image,

--file=disk_image

Specify the file to use as a disk image.
-h, --help Display list of virt-install command-line options.
-m mac_addr,

--mac=mac_addr

Specify a fixed MAC address for the guest domain’s virtual network device. If not provided, the Logical Domains Manager automatically allocates a MAC address when the virtual network device is added to the guest domain.

The following MAC address blocks are used by the Logical Domains Manager for automatic MAC address allocation. You cannot manually request an address in this range:

00:14:4F:F8:00:00 - 00:14:4F:FB:FF:FF

You can use the following range for manual MAC address allocation:

00:14:4F:FC:00:00 - 00:14:4F:FF:FF:FF

Refer to “Assigning MAC Addresses Automatically or Manually” in the Logical Domains (LDoms) 1.0.1 Administration Guide for more information about MAC address allocation.

-n, --name=name Specify the name of the guest domain. This must be a unique name; if a guest domain with the same name already exists, the virt-install script issues an error and exits.
--vcpus=N Specify the number of virtual CPUs for the guest domain. If not specified, the default is 1.
-p, --paravirt For OpenSolaris xVM users, indicates the guest domain is paravirtualized instead of a fully virtualized guest.

Note - LDoms guest domains are always paravirtualized, so you do not need to use this option with LDoms software.

-r mem_amount

--ram=mem_amount

Specify the amount of memory, in megabytes, to allocate for the guest domain.
-s disksize,

--file-size=disksize

Specify the size of the disk image, in gigabytes, if the disk image does not already exist.

Note - The virt-install script for LDoms supports the Solaris OS installation. The Solaris 10 Installation Guide states that the entire Solaris software package requires 6.7 gigabytes. Therefore, the virt-install script issues a warning message if the entered disk size is too small (less than 6.7 gigabytes) or too big (greater than 8 gigabytes).



Logical Domains Manager Commands Used in the virt-install Script

The virt-install script for LDoms software uses the Logical Domains Manager command-line interface (CLI) to create the guest domain, add resources, and bind and start the new guest domain. The following Logical Domains Manager (ldm) commands are used in the virt-install script.


TABLE 4-2   The ldm Commands Used in the virt-install Script
Command Description
ldm add-domain Creates a logical domain.
ldm add-vcpu Adds virtual CPUs to an existing logical domain.
ldm add-memory Adds memory to an existing logical domain.
ldm add-vnet vnet1 Adds the virtual network device (vnet1) to an existing logical domain.
ldm add-vdsdev Adds a device (entire disk, disk slice, file, or disk volume) to be exported by the virtual disk server to an existing logical domain.
ldm add-vdisk Adds a virtual disk to an existing logical domain.
ldm set-var Sets one or more variables for an existing logical domain.
ldm bind-domain Binds resources to a created logical domain.
ldm start-domain Starts a bound logical domain.
ldm list-domain Lists a logical domain and its state.

After the guest domain is created and started, the virt-install script uses the following command to connect to the console of a guest domain.


# telnet localhost console_port


Example JumpStart Files to Be Used With the virt-install Script

JumpStart configuration files are manually created and managed. You can initiate a custom JumpStart installation through network installation after setting up the server. When you create a profile server, you must ensure that systems can access the JumpStart directory on the profile server during a custom JumpStart installation. Each time that you add a system for network installation, use the add-install-client command to specify the profile server. Use the add-install-client command to create the /etc/bootparams entry for the guest domain. The guest domain gets its IP address as part of the JumpStart process, either using DHCP or a static IP address.

The following example script does the following:


EXAMPLE 4-2   Example JumpStart File
#!/bin/ksh
 
RELEASE_DIR=/export/s10u4/combined.s10s_u4wos/latest/Solaris_10
CONF_PROF_DIR=/export/VSP_DEV
CLIENT=ldom-126
IP=10.1.1.126
ENET_ADDR=00:14:4f:f8:65:c4
CLASS=sun4v
 
network=‘echo $IP | cut -d. -f1-3‘
 
case $network in
   10.1.1 )
         INSTALL_SVR=install-1200-gw1 ;;
   10.1.2 )
         INSTALL_SVR=install-1200-gw2 ;;
   *        )
         print "error: $network unknown.\n"
         return 1 ;;
esac
 
$RELEASE_DIR/Misc/jumpstart_sample/check && { $RELEASE_DIR/Tools/add_install_client -i $IP -e
$ENET_ADDR -c $INSTALL_SVR:$CONF_PROF_DIR/$CLIENT -p
$INSTALL_SVR:$CONF_PROF_DIR/$CLIENT $CLIENT $CLASS
}
 
# generate sysidcfg file, required.
 
cat > sysidcfg <<EOF!
system_locale=C
timezone=US/Central
timeserver=localhost
terminal=vt100
name_service=NONE
security_policy=NONE
nfs4_domain=default
network_interface=primary {hostname=$CLIENT ip_address=$IP netmask=255.255.255.0protocol_ipv6=no}
# password=imp
root_password=PUWxm0hAKz8hw
EOF!

The following profile is an example for Logical Domains software. Virtual disk device names in Logical Domains software differ from physical disk device names in that they do not contain a target ID in the device name.


EXAMPLE 4-3   Example JumpStart Profile
# root_device is format of c0d0s0 for virtual disk device
install_type    initial_install
system_type     standalone
partitioning    explicit
cluster         SUNWCXall
root_device     c0d0s0
filesys         rootdisk.s0        free    /
filesys         rootdisk.s1        1000    swap