[CentOS-docs] new page? - Virtualization/Install MS Windows XP as a CentOS5/Xen guest

Fri Apr 17 21:22:25 UTC 2009
R P Herrold <herrold at centos.org>

On Thu, 16 Apr 2009, Ed Heron wrote:

>  I don't see a How To, on this wiki, specifically designed to address the
> task of creating a Microsoft Windows XP virtual machine as a Xen guest under
> CentOS 5.  Many of the concepts are covered in
> http://wiki.centos.org/HowTos/Xen/InstallingHVMDomU, but it appears to leave
> some things to the reader.

People -- this is NOT rocket science, and not undocumented.

WHY are we building maintenance load? What is wrong with the 
virtualization documentation we already ship?  I know I file 
bugs upstream on xen and libvirt, but no one participating on 
this thread here has so far as I can see;  if there is a 
problem of lack of clarity, the answer is NOT to write yet 
more non-authoritative doco first

This works out of the box already.  I am against such a new 
page, as it represents maintenance load to no good end that I 
have heard.

The thread wandered off topic almost at once.  I think this 
shows that it is not needed, as expereince sharing 'started' 
Please move non -docs stuff to the centos-virt ML

I use this minimal script ... prep with a:

dd an install WinXP ISO to a location

[root at centos-5 bin]# ls /var/lib/xen/ISOs
cd.iso                            openfiler-2.2-x86-disc1.iso  Windows-keys
cinch-3.0.0-rc8.i386.iso          win-2000pro.iso              win-XPpro.iso
debian-testing-amd64-netinst.iso  win-98.iso
[root at centos-5 bin]#

mkdir /var/lib/xen/ISOs
dd if=/dev/hdc of=WinXP.iso

and run this [almost all of which is man page repetition].  It 
is really a shell one liner, once the arguments are right

[root at centos-5 bin]# cat install-windows.sh
#!/bin/sh
#
#       from the man page
#
# NAME="win-2000"
ISODIR="/var/lib/xen/ISOs"
#
#       inventory available images
WIN_IMAGES=""
for i in `cd $ISODIR ; ls -1 win* | sed -e "s/.iso$//g"` ; do
         export WIN_IMAGES=`echo "$WIN_IMAGES $i"`
done
[ "x$1" = "x" ] && {
         echo "Usage: $0 (arg)" 1>&2
         echo "       where arg is one of: $WIN_IMAGES" 1>&2
         exit 1
         }
export NAME=`echo "$1"`
[ "x$NAME" = "x" ] && {
         echo "Error: NAME is empty " 1>&2
         exit 1
         }
#
#       can we see the install ISO
ISO=`echo "$ISODIR/$NAME.iso" `
[ ! -e $ISODIR/$NAME.iso ] && {
         echo "Error:  cannot see: $ISODIR/$NAME.iso " 1>&2
         exit 1
         }
#
IMAGEDIR="/var/lib/xen"
IMG=`echo "$IMAGEDIR/$NAME.img"`
#
CONFIGS="/etc/xen"
#
#       clean out any prior image
[ -e $IMG ] && rm -f $IMG
[ -e $CONFIGS/$NAME ] && rm -f $CONFIGS/$NAME
virt-install -n $NAME                           \
         -r 512 -vcpus=1                         \
         -s 8 -f $IMG                            \
         -b xenbr0                               \
         --vnc --accelerate                      \
         -v                                      \
         -c $ISO                                 \
         --os-type=windows --os-variant=win2k
#
cat - << END > /dev/null

         -n      name
         -r      ram
         -s      image size in G
         -f      filename (and location) for the image file
         -b      bridge network device (deprecated)
                 try: -w bridge:xenbr0
         -v      FULL virt
         -c      boot and install image location or name

END
[root at centos-5 bin]#

For ceonvenience;s sake, I then add the ISO image to the 
config file

[root at centos-5 xen]# cat win-XPpro
name = "win-XPpro"
uuid = "86694f27-22af-e945-a4cb-b5b32cedb8b6"
maxmem = 512
memory = 512
vcpus = 1
builder = "hvm"
kernel = "/usr/lib/xen/boot/hvmloader"
boot = "c"
pae = 1
acpi = 0
apic = 0
localtime = 1
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
device_model = "/usr/lib64/xen/bin/qemu-dm"
usbdevice = "tablet"
sdl = 0
vnc = 1
vncunused = 1
disk = [ "file:/var/lib/xen/win-XPpro.img,hda,w",
 	",hdc:cdrom,r",
 	"file:/var/lib/xen/ISOs/win-XPpro.iso,hdd:cdrom,r" ]
vif = [ "mac=00:16:3e:01:f4:a7,bridge=xenbr0" ]
serial = "pty"
[root at centos-5 xen]#

-- Russ herrold