Installing Xen (xVM) on OpenSolaris

I have a friend that will try to “sell” an opensource, Linux, product as solution to just about any problem in the IT world. Although I am not adverse to opensource products in the enterprise realm, IT professionals, such as myself, have become respectively reliant on support contacts with hardware and software vendors. A few years back and prior, support options were not generally available for opensource alternatives of “mainstream” solutions. Today this is not as true; with the demise of economic wealth came a rise for less-expensive, enterprise quality products. There are already a few opensource type operating systems with powerful features, such as RedHat Enterprise Linux (RHEL) and OpenSolaris, that have excellent support contact options. In addition, there are opensource solutions, such as Asterisk the open source telephony project and Zimbra the opensource email project, that also have support contact options. And to top it off, if the manufacturer does not have professional support, you can find support through FindOpenSourceSupport.com or OpenLogic. If great support options are available for opensource solutions, then why does IT spend significant capital on “closed” box solutions, such as VMware, when SUN’s xVM is robust and essentially free??

On to the true purpose of this artcle, let’s get virtualizing with OpenSolaris’ rendition of Xen, SUN xVM.

OpenSolaris

I am going to assume that you already have OpenSolaris installed. At the time of this article, I was using 2009-06. The second assumption is that all the following commands are ran as root. The third assumption is that your installation of OpenSolaris has access to the Internet.

Installing xVM

In the first step we will create a new boot environment using the beadm tool. Option “-a” states to activate the new boot environment and the “-d xvm” defines the description for the boot environment. The final xvm is the name of the boot environment.

# pfexec beadm create -a -d xvm xvm

The second step will install the xVM software packages into the newly created boot environment. The first command mounts the boot environment. The second command installs the xvm-gui package which has all of the xVM dependencies associated, forcing a full install of xVM.

# pfexec beadm mount xvm /tmp/xvm-be
# pfexec pkg -R /tmp/xvm-be install xvm-gui
# pfexec beadm umount xvm

Configuring your Grub Boot Menu

The next step requires that you modify your boot menu, grub/menu.lst. In the new installation of OpenSolaris, this file will reside as /rpool/boot/grub/menu.lst. Use your favorite editor to open menu.lst:

# nano /rpool/boot/grub/menu.lst

At the bottom of the file, add the following lines:

title xvm
findroot (pool_rpool,0,a)
bootfs rpool/ROOT/xvm
kernel$ /boot/$ISADIR/xen.gz
module$ /platform/i86xpv/kernel/$ISADIR/unix /platform/i86xpv/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=text
module$ /platform/i86pc/$ISADIR/boot_archive

Note: if you already have a “title xvm” section, and your installation was similar to mine, you will likely find that the boot configuration I specified above will work better. However, if you would like to try the boot configuration that was automatically entered, move along with the article and test a connection to the xVM services using the Virtual Machine Manager. If it fails, replace the “title xvm” with my version above and reboot.

menulst

Save the menu.lst file and reboot your OpenSolaris server:

# reboot

Enabling xVM Services

The final step to installing the xVM hypervisor in OpenSolaris is to enable the services for xVM, this is accomplished with the following two commands:

# svcadm enable -r xvm/virtd
# svcadm enable -r xvm/domains

Jump In!

Being that I am a Windows administrator by trade, I enjoy the GUI interface. Such would be my choice in any Linux environment too. Using the Applications menu choose System Tools > Virtual Machine Manager and connect to the localhost.

virtmgmt

As a final note, be sure to check out the documentation on OpenSolaris.org.

-Aaron Gilbert

About aaron

IT is not just a job but also a passion. Everything I have accomplished, both personally and professionally, has been generally entertaining, bordering on fun. Some of my projects, such as working with SharePoint Services workflow actions in Visual Studio or building a custom iSCSI SAN using the OpenSolaris, ZFS and COMSTAR, has been quite rewarding. You may think nerd...I think developing a new trend!