Wednesday, May 19, 2010

Fixing /etc/init.d/xendomains in Centos 5 (selinux problem)

If you've ever tried to use CentOS 5 as a hypervisor with Xen with your VM images on a different device, you might have noticed that your xendomains in /etc/xen/auto/ don't restart as they should.

The only other reference I could find was this:

As with the author of the linked post I saw countless errors such as:

No handlers could be found for logger "xend"
Error: Disk isn't accessible (or equivalent)

Needless to say, I was also annoyed but I managed to find a fix that didn't require disabling selinux:

mount your other volume here:
/var/lib/xen/images
(the default location for Xen images)

restorecon /var/lib/xen/images

then run restorecon on all vm files within /var/lib/xen/images
( cd /var/lib/xen/images; restorecon *; )

selinux knows that /var/lib/xen/images should be the location of Xen VM images, so it will adjust their selinux flags accordingly when running restorecon, and then things will work.

Don't forget to update your /etc/xen/auto VM definitions to point to the new vm file locations.

Upon rebooting, your /etc/xen/auto/ VMs should now start appropriatly.