WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] pv-grub Solaris support

To: Michael Li <Qin.L.Li@xxxxxxxxxx>
Subject: Re: [Xen-devel] pv-grub Solaris support
From: Kasper Brink <K.Brink@xxxxxxxx>
Date: Thu, 13 Oct 2011 21:51:48 +0200
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 13 Oct 2011 12:52:19 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4E9697EB.4000204@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20111012204011.GA7518@xxxxxxxxxxxxxxxxxxx> <4E9697EB.4000204@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
Hello Michael,

On Thu, Oct 13, 2011 at 03:48:59PM +0800, Michael Li wrote:
> Thank you! How can I test your utility in OVM3.0.2 platorm, I have
> Solaris latest  running as Guest OS, would like you activate the PV
> domU with your tool.

I haven't used Oracle VM myself, but hopefully the hypervisor is sufficiently
similar to vanilla Xen 4.0 that the instructions below will work.


=== Building pv-grub ===

To build a patched pv-grub, you'll need a Linux system with developer tools
installed; I used Debian Squeeze, but another distribution should be fine.
You should build pv-grub on the same arch (i386 or amd64) as the domU you
intend to run. Steps:

hg clone http://xenbits.xen.org/hg/xen-unstable.hg/
patch -p1 -d xen-unstable.hg < pv-grub_solaris.patch
cd xen-unstable.hg
# I also needed the following symlink:
ln -s . xen/include/xen/libelf
make -C stubdom pv-grub
# if the build succeeds, pv-grub will be in stubdom/mini-os-$ARCH-grub, e.g.:
cp stubdom/mini-os-x86_64-grub/mini-os.gz ../pv-grub.patched.gz


=== Converting an existing HVM domU to PV ===

There was a thread on xen-discuss about converting a HVM domU to PV:
  http://mail.opensolaris.org/pipermail/xen-discuss/2010-February/005768.html
The post above uses pygrub; with a patched pv-grub the process is similar.

The tricky part is that the root pool of the domU holds information about
the physical device paths of its vdevs, which is no longer correct when we
switch to a PV domain. This causes the domU kernel to panic when it tries
to mount the root pool. To prevent this, you must first boot the PV domain
from a Solaris installation cd (iso image), and import and export the root
pool: this writes the correct device paths to the pool.

First, download a Solaris iso image that is at least as recent your root
pool version (e.g. Solaris 11 Express).

Edit the vm.cfg file of your domU: 
# remove "builder=..." and "device_model=..." parameters 
# modify "kernel", "disk" and "extra" as follows:
kernel = '/path/to/pv-grub.patched.gz'
disk   = [ 'file:/path/to/domU/System.img,xvda,w',
           'file:/path/to/domU/sol-11-exp-201011-text-x86.iso,xvdc:cdrom,r'
         ]
# (initially, boot from the iso)
extra  ='(hd1)/boot/grub/menu.lst'

Start the domain and attach the console. Depending on how quick you are,
you should see either a countdown timer, or a "Selected disk does not
exist" error. Press "Esc" to enter the menu. Now you must edit the default
menu entry to add a "root" command (I have a separate patch to pv-grub that
fixes this, but that's not really Solaris-related).
Select edit > new line before > edit > enter "root (hd1)" > boot.

The Solaris iso should now boot. Run the following in a shell (option 3 in
the SX11 text installer):

zpool import -f rpool
# verify that the import succeeded
zpool status
zpool export rpool
# verify that the export succeeded
zpool status 

At this point you can destroy the VM. Now edit the vm.cfg to read:
  extra='(hd0,0,a)/boot/grub/menu.lst'
and optionally remove the Solaris iso from the "disk" parameter.
Start the vm again, and if all went correctly, you should see the grub
menu, and be able to boot your PV domain into the boot environment of your
choice.


=== Creating a new PV domU ===

Just follow the steps above, but instead of opening a shell for the zpool
import & export step, choose "Install Solaris".


I hope this works for you. Success/failure reports are welcome!

Best,

Kasper

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel