Wednesday, October 29, 2008

Can't access serial devices in Dom0. How to fix it?

A lot of xen users report that when they access a serial device while running xen kernel, they get "Cannot get serial info: Invalid argument", but while running the generic kernel (non-xen kernel), they have no problem to access the serial device. Eg,

[root@xen ~]# setserial /dev/ttyS0
Cannot get serial info: Invalid argument

To solve this, kernel output need to be redirected to xen console by adding "console=xvc console=tty0 xencons=xvc" to "module /vmlinuz" line in grub.conf as below.

module /vmlinuz-2.6.18-92.1.13.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet console=xvc console=tty0 xencons=xvc

Reboot the host and everything would work fine after that.

[root@xen ~]# setserial /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 7

I can't access the PV guest serial console via "xm console" or "virsh console" in RHEL5 xen. How can I fix it?

This would work out of the box in most cases, but in certain scenarios it may not work as expected. If someone hits such a situation, please make sure below things are done correctly.

1 - Edit /boot/grub/grub.conf of the guest and add "console=tty0 console=xvc0" to the kernel line, if you wanted the boot messages to appear on the serial console.

Eg, RHEL4 PV guest grub.conf would look like as below.

title Red Hat Enterprise Linux ES (2.6.9-78.ELxenU)
root (hd0,0)
kernel /boot/vmlinuz-2.6.9-78.ELxenU ro root=LABEL=/ console=tty0 console=xvc0
initrd /boot/initrd-2.6.9-78.ELxenU.img

2 - Add the below line to /etc/inittab under "Run gettys in standard run levels" if a login prompt is needed on serial console after system is booted.

co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav

3 - Add "xvc0" to /etc/securetty if root to log in need to be allowed from this console.

Make sure that the guest is rebooted after checking the abov three points.

Friday, October 17, 2008

How to install a fully virtualized guest using multiple cds which requires cdrom media change during installation?

RHEL3 and RHEL4 till U6 comes in multiple cds. With RHEL-5.2, a fully virtualized guest can be installed using these multiple cds. CD change is possible whenever requested by anaconda. Steps are similiare to the methods we follow in Vmware. Below are the steps.

- Start the installation of the Fully virtualized guest from the first CD, as usual from virt-manager.

- When anaconda requests to change the cd and insert 2nd cd, please do the following.

- On the virt-manager console click View -> Details -> Hardware -> Select "Disk hdc" (the one with the cdrom icon in the right side) -> Click "Disconnect" in the right side-> The button would change to "Connect". Click "Connect" -> Select the 2nd cd from the Brwose list and click OK -> Click "OK" in the disk change window from anaconda.

This should work fine and the installation would resume from the second cd. Follow the same steps for all cds till installation is finished. The same steps would work for windows guests as well if a media change is required.

Note: You may need to edit /etc/xen/guest configuration file and change,

boot = "d"

to

boot = "c"

to properly start the guest after the installation is finished.

What is pci-passthrough and how to do it with xen in RHEL5?

The informations below are specific to RHEL5 and could be applied to fc6 and above.

Pci passthrough is used to exclusively export a pci device to a paravirtualized or fully virtualized guest rather than sharing that for guests and dom0. While doing this, the exported pci device wouldn't be available for dom0 and any other guests. Ex, NIC.

Paravirtualized guests: Pci passthrough should work on RHEL5 guests. It's not expected to work on rhel4 PV guests. PCI passthrough requires support in both dom0 (backend) and in the guest (front end). This front end support has not been implemented in RHEL4 PV kernel yet.

Fully Virtualized guest: Not supported. PCI passthrough to fully virtualized guests requires special hardware support. This is called VT-d on intel paltform and IOMMU on AMD platform. (AMD is yet to release such a hardware). Even if someone possesses this hardware, it requires support in xen code and the RHEL version of xen doesn't have this code.

Bottom line. PCI passthrough would work only if the guest is RHEL5 PV and fc6 and above guests. Below is details on how to configure this.

- Get the pci id of a pci device in dom0 by running "lspci".

- Hide the pci device from dom0. I added the below entry in my /etc/modprobe.conf to hide my Broadcom network card from dom0 which uses bnx2 driver and rebooted dom0. Change it to suite your requirement

install bnx2 /sbin/modprobe pciback ; /sbin/modprobe --first-time --ignore-install bnx2
options pciback hide=(0000:09:00.0) verbose_request=1

- Pass the deivce through by adding the below line in /etc/xen/ file.

pci = [ "0000:09:00.0" ]