XenServer, like many other bare-metal hypervisors, only supports a small bunch of RAID controllers.
The difference between it and for example VMware ESXi is that XenServer is pretty much a CentOS minimal install with some proprietary administration tools and a pretty decent remote manager (only for Windows as long as I know…) while ESXi is a completely proprietary closed source blob.
XenServer being based on CentOS makes it possible to do many weird unsupported things, like installing it on a software fake RAID on ICH8R.
To install it on a software RAID1 all we have to do is perform the usual installation (without configuring any local storage) on a single HDD (/dev/sda), copy everything on a second drive (/dev/sdb) and use mdadm to build a couple of RAID volumes.
– I’m pretty much only reposting things I read somewhere, I don’t take any credit for this guide

On /dev/sda there should be 2 partitions, check it with:

[root@xenserver ~]# sgdisk -p /dev/sda
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         8388641   4.0 GiB      0700  
   2         8390656        16777249   4.0 GiB      0700

In this case we probably would like to create a third one which will be used for the local storage.

[root@xenserver ~]# sgdisk --new=3:16779264:DISK_SIZE-34 /dev/sda
[root@xenserver ~]# sgdisk --typecode=3:fd00

DISK_SIZE is the last usable sector, in my case, since I am using a 320 GB HDD, it is: 625142414.
/dev/sdb will be used as mirror disk, so clear the partition table, install GPT on it and partition it like /dev/sda.

[root@xenserver ~]# sgdisk --zap-all /dev/sdb
[root@xenserver ~]# sgdisk --mbrtogpt --clear /dev/sdb

[root@xenserver ~]# sgdisk -p /dev/sdb
[root@xenserver ~]# sgdisk --new=1:2048:8388641 /dev/sdb
[root@xenserver ~]# sgdisk --typecode=1:fd00 /dev/sdb
[root@xenserver ~]# sgdisk --attributes=1:set:2 /dev/sdb
[root@xenserver ~]# sgdisk --new=2:8390656:16777249 /dev/sdb
[root@xenserver ~]# sgdisk --typecode=2:fd00 /dev/sdb
[root@xenserver ~]# sgdisk --new=3:16779264:DISK_SIZE-34 /dev/sdb
[root@xenserver ~]# sgdisk --typecode=3:fd00 /dev/sdb

Reboot the server – I’m not really sure if it’s needed but better safe than sorry, so…
Once rebooted create three RAID volumes with mdadm.

[root@xenserver ~]# mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb1
[root@xenserver ~]# mdadm --create /dev/md1 --level=1 --raid-devices=2 missing /dev/sdb2
[root@xenserver ~]# mdadm --create /dev/md2 --level=1 --raid-devices=2 missing /dev/sdb3

Format the newly created root RAID volume and copy all the files.

[root@xenserver ~]# mkfs.ext3 /dev/md0
[root@xenserver ~]# mount /dev/md0 /mnt
[root@xenserver ~]# cp -vxpR / /mnt

Edit /etc/fstab and set /dev/md0 as root volume.

[root@xenserver ~]# sed -i 's/LABEL=[a-zA-Z\-]*/\/dev\/md0/' /mnt/etc/fstab

Create a new initramfs.

[root@xenserver ~]# mkdir /mnt/root/initrd-raid
[root@xenserver ~]# mkinitrd -v --fstab=/mnt/etc/fstab /mnt/root/initrd-raid/initrd-`uname -r`-raid.img `uname -r`
[root@xenserver ~]# cd /mnt/root/initrd-raid
[root@xenserver ~]# zcat initrd-`uname -r`-raid.img | cpio -i
[root@xenserver ~]# sed -i 's/raidautorun \/dev\/md0/raidautorun \/dev\/md0\nraidautorun \/dev\/md1\nraidautorun \/dev\/md2/' init

Copy the new initramfs into /mnt/boot.

[root@xenserver ~]# find . -print | cpio -o -Hnewc | gzip -c > /mnt/boot/initrd-`uname -r`-raid.img
[root@xenserver ~]# rm /mnt/boot/initrd-2.6-xen.img
[root@xenserver ~]# cd /mnt/boot
[root@xenserver ~]# ln -s initrd-`uname -r`-raid.img initrd-2.6-xen.img

Edit /mnt/boot/extlinux.conf and set the new boot volume as /dev/md0.

[root@xenserver ~]# sed -i 's/LABEL=[a-zA-Z\-]*/\/dev\/md0/' extlinux.conf

Set up MBR for GPT on /dev/sdb

[root@xenserver ~]# cat /mnt/usr/share/syslinux/gptmbr.bin > /dev/sdb
[root@xenserver ~]# cd /mnt
[root@xenserver ~]# extlinux  --raid -i boot/

Reboot and start the server from the second HDD, then include /dev/sda in the RAID.

[root@xenserver ~]# sgdisk --attributes=1:set:2 /dev/sda
[root@xenserver ~]# sgdisk --typecode=1:fd00 /dev/sda
[root@xenserver ~]# sgdisk --typecode=2:fd00 /dev/sda
[root@xenserver ~]# sgdisk --typecode=3:fd00 /dev/sda
[root@xenserver ~]# mdadm -a /dev/md0 /dev/sda1
[root@xenserver ~]# mdadm -a /dev/md1 /dev/sda2
[root@xenserver ~]# mdadm -a /dev/md2 /dev/sda3

This is it, mdadm will synch the RAID volumes (this will take a while, time will vary depending on HDD size and performance).
To check RAID status/rebuild state.

[root@xenserver ~]# cat /proc/mdstat

Last thing left to do is copy the RAID setup to /etc/mdadm.conf

[root@xenserver ~]# mdadm --detail --scan >> /etc/mdadm.conf

The remaining disk space can be used as local storage for virtual machines or something else, to do it run:

[root@xenserver ~]# xe sr-create content-type=user device-config:device=/dev/md2 host-uuid= name-label="Local Storage" shared=false type=lvm