Showing posts with label RedHat. Show all posts
Showing posts with label RedHat. Show all posts

Saturday, June 27, 2009

PV enabling an HVM from VMware on XenServer (CentOS RedHat)

This example works for RedHat and CentOS, the instructions are slightly different for SLES and Debian.
As a condition for paravirtualization to work, a kernel that supports the Xen hypervisor needs to be installed and booted in the virtual machine.
Installing the XenServer Supported Kernel:
1. After importing the vm as HVM, boot the virtual machine and open the console.
2. (optional) update the modules within the vm to the latest revision
a. If the kernel-xen package is installed from an online repository – best practice is to fully update the distribution to avoid problems between package build revisions.
3. Install the Linux Xen kernel.
a. yum install kernel-xen
i. the xen aware kernel is installed and entries are created in grub
4. Build a new initrd without the SCSI drivers and with the xen PV drivers
a. cd /boot
b. mkinitrd --omit-scsi-modules --with=xennet --with=xenblk --preload=xenblk initrd-$(uname -r)xen-no-scsi.img $(uname -r)xen
i. This builds a new initrd for booting with pygrub that does not include SCSI drivers which are known to cause issues with pygrub and Xen virtual disk devices.
clip_image002
5. Modify the grub boot loader menu (the default entries are not pygrub compatible)
Open /boot/grub/menu.lst in the editor of your choice
clip_image004
a. Remove the kernel entry with ‘gz’ in the name
b. Rename the first “module” entry to “kernel”
c. Rename the second “module” entry to “initrd”
i. SuSE and Debian require that entries that point to root device locations described by a direct path such as: “/dev/hd*” or “/dev/sd*” be modified to point to /dev/xvd*
d. Correct the *.img pointer to the new initrd*.img created in step 4
e. (optional) Modify the title of this entry
f. Edit the line “default=” to point to the modified xen kernel entry
i. The entries begin counting at 0 – the first entry in the list is 0, the second entry is 1 and so on
ii. In our example the desired default entry “0”
g. (optional) Comment the “hiddenmenu” line if it is there (this will allow a kernel choice during boot if needed for recovery)
h. Save your changes
clip_image006
6. Shut down the guest but do not reboot.
a. Shutdown now -h
Edit the VM record of the CentOS VM to convert it to PV boot mode
In this example the VM is named “centos”
7. From the console of the XenServer host execute the following xe commands:
a. xe vm-list name-label=centos params=uuid (retrieve the UUID of the vm)
b. xe vm-param-set uuid=<vm uuid> HVM-boot-policy=”” (clear the HVM boot mode)
c. xe vm-param-set uuid=<vm uuid> PV-bootloader=pygrub (set pygrub as the boot loader)
d. xe vm-param-set uuid=<vm uuid> PV-args="console=tty0 xencons=tty" (set the display arguments)
i. Other possible options are: “console=hvc0 xencons=hvc” or “console=tty0” or “console=hvc0”
8. xe vm-disk-list uuid=<vm uuid> (this is to discover the UUID of the interface of the virtual disk)
9. xe vbd-param-set uuid=<vbd uuid> bootable=true (this sets the disk device as bootable)
clip_image008
The vm should now boot paravirtualized using a Xen aware kernel.
When booting the virtual machine, it should start up in text-mode with the high-speed PV kernel. If the virtual machine fails to boot, the most likely cause is an incorrect grub configuration; run the xe-edit-bootloader (i.e. xe-edit-bootloader –n centos) script at the XenServer host console to edit the grub.conf of the virtual machine until it boots.
Note: If the VM boots and mouse and keyboard control does not work properly, closing and re-opening XenCenter generally resolves this issue. If the issue is still not resolved, try other console settings for PV-args, being sure to reboot the vm and close and re-open XenCenter between each setting change.
Installing the XenServer Tools within the virtual machine:
Install the XenServer tools within the guest:
1. Boot the paravirtualized VM (if not already running) into the xen kernel.
2. Select the console tab of the VM
3. Select and right-click the name of the virtual machine and click "Install XenServer Tools"
4. Acknowledge the warning.
5. At the top of the console window you will notice that the "xs-tools.iso" is attached to the DVD drive. And the Linux device id within the vm.
6. Within the console of the virtual machine:
a. mkdir /media/cdrom (Create a mount point for the ISO)
b. mount /dev/xvdd /media/cdrom (mount the DVD device)
c. cd /media/cdrom/Linux (change to the dvd root / Linux folder)
d. bash install.sh (run the installation script)
e. answer “y” to accept the changes
f. cd ~ (to return to home)
g. umount /dev/xvdd (to cleanly dismount the ISO)
h. In the DVD Drive, set the selection to “<empty>”
i. reboot (to complete the tool installation)
clip_image010
7. Following reboot the general tab of the virtual machine should report the Virtualization state of the virtual machine as “Optimized”

Wednesday, April 15, 2009

Migrating RedHat from VMware to XenServer

Fixing RedHat virtual machines after migration

After import: RedHat will boot, detect new hardware, and install new device drivers. Nothing else needs to be done.

If VMware Tools was installed within the virtual machine then the following X server error will be seen.

The X Windows server will fail to start due to new video devices being detected. This is because of custom video devices and drivers that depended on the underlying VMware host. The system will prompt the user to repair the X server. If the user accepts the automated repair, X Windows will be functioning properly.

clip_image001

To repair the X Server:

Selecting Yes presents diagnosis screens. Selecting No skips the diagnosis screens and goes straight to repairing XWindows.

clip_image002

Select Yes to begin repair.

clip_image003

Enter the password for the Root user account.

RedHat begins the process of detecting the hardware and devices and modifying the configuration of X windows. A new settings dialog box is presented.

clip_image004

Click OK to accept a known working configuration.

clip_image005

Acknowledge the information box.

clip_image006

Select <Enter> to accept the dialog that the configuration has completed.

At this time X server restarts and you are able to logon to the graphical desktop.