Citrix XenServer

From Univention Wiki

Jump to: navigation, search
Produktlogo UCS kurz.png Version 3.1


Introduction

This article decribes the UCS installation on Citrix XenServer.

XenServer is a virtualization solution from Citrix. It is based on the open source Xen Hypervisor. This information applies to XenServer 6.1.

For the administration of XenServer the windows tool XenCenter can be used. The Xen hvypervisor supports two different types of virtualization:

  • Paravirtualization - modified guests (PV)
  • Hardware-assisted virtualization, allowing for unmodified guests (HVM)

The installation of UCS as a PV virtual machine is currently not possible, therefore the UCS installation is converted afterwards from HVM to PV.

Installation of UCS in HVM mode

A new virtual machine can be created via New VM in XenCenter. The template Other Install Media must be selected. As installation media the UCS DVD can be used.

Currently the boot menu of the DVD is not shown during the boot in the XenCenter console. The UCS installer is available after about two minutes. For more details see here and here.

During the partitioning the following issues should be considered:

  1. /boot must be the first partition
  2. /boot must use ext3 as file system

Preparing the UCS installation for the paravirtualization convertion

If /boot is not the first partition or ext4 has been used as file system for it, it is necessary to change it. This example converts a system that was installed using automatic partitioning. Please be careful! This is only an example, you have to adapt it to your environment.

  1. First parted should be installed, for example as user root on the console:
    root@ucs-server:~# univention-install parted
  2. The current partition table must be checked, for example:
    root@ucs-server:~# parted 
     GNU Parted 2.3 
     Using /dev/sda 
     Welcome to GNU Parted! Type 'help' to view a list of commands. 
     (parted) p 
     Model: ATA QEMU HARDDISK (scsi) 
     Disk /dev/sda: 10.7GB 
     Sector size (logical/physical): 512B/512B 
     Partition Table: gpt 
     
     Number  Start   End     Size    File system     Name                 Flags 
     1      16.8MB  25.2MB  8389kB                  BIOS Boot Partition  bios_grub 
     2      25.2MB  562MB   537MB   ext4            /boot 
     3      562MB   1592MB  1030MB  linux-swap(v1)  SWAP 
     4      1593MB  10.6GB  9010MB                  LVMPV                lvm 
     
     (parted) q
  3. If /boot is ext4 or not the first partition, like in this example, the content of /boot should be saved, for example
    cp -a /boot /boot.BACKUP
  4. After that /boot should be unmounted
    umount /boot
  5. In this example the BIOS boot partition is the first partition and /boot the second. The partition should be deleted and re-created in different order, for example:
    root@ucs-server:~# parted
     [...]
     (parted) p
     Model: ATA QEMU HARDDISK (scsi)
     Disk /dev/sda: 10.7GB
     Sector size (logical/physical): 512B/512B
     Partition Table: gpt
     
     Number  Start   End     Size    File system     Name                 Flags
     1      16.8MB  25.2MB  8389kB                  BIOS Boot Partition  bios_grub
     2      25.2MB  562MB   537MB   ext4            /boot
     3      562MB   1592MB  1030MB  linux-swap(v1)  SWAP
     4      1593MB  10.6GB  9010MB                  LVMPV                lvm
     
     (parted) rm 1
     (parted) rm 2
     (parted) mkpart "/boot" ext3 16MB 528MB
     (parted) mkpart "BIOS Boot Partition" 528MB 537MB
     (parted) set 2 bios_grub on
     (parted) quit
  6. Now /boot and the BIOS Boot Partition have been recreated in the correct order. A file system on the /boot partition has to be created:
    root@ucs-server:~# mkfs.ext3 /dev/sda1
  7. After that the file /etc/fstab must be updated with the new partition information, the new UUID and ext3 instead of ext4:
    root@ucs-server:~# uuid=$(blkid -o value /dev/sda1 | head -n 1)
    root@ucs-server:~# sed -i "s|UUID=.*[\t ]*/boot|UUID=$uuid\t/boot|" /etc/fstab
    root@ucs-server:~# sed -i 's|\(/boot[\t ]*\)ext4|\1ext3|' /etc/fstab
  8. Now /boot can be mounted and the backup can be copied to the new partition, for example:
    root@ucs-server:~# mount /boot
    root@ucs-server:~# cp -a /boot.BACKUP/* /boot/
    
  9. Since the BIOS Boot Partition has been recreated, grub must be reinstalled:
    root@ucs-server:~# grub-install /dev/sda
    Installation finished. No error reported.
    root@ucs-server:~# update-grub
    Generating grub.cfg ...
    [...]

The system should be rebooted to test if these changes were successful.

Convert the UCS system to paravirtualization

If /boot is the first partition and the file system is in ext3 format, the following steps have to be done:

  1. To prepare the system to use the Citrix XenServer console a getty process should be started on hvc0:
    root@ucs-server:~# echo "vc:2345:respawn:/sbin/getty 38400 hvc0" >>/etc/inittab
  2. Shut down the UCS system:
    root@ucs-server:~# halt -p
  3. Get the UUID of the UCS virtual machine, "ucs-vm" should be replaced with the name of the UCS virtual machine:
    [root@xenserver-citrix ~]# UUID=$(xe vm-list name-label="ucs-vm" params=uuid --minimal)
    [root@xenserver-citrix ~]# echo $UUID
  4. Disable HVM for this virtual machine and activate PV:
    [root@xenserver-citrix ~]# xe vm-param-set uuid=$UUID HVM-boot-policy=""
    [root@xenserver-citrix ~]# xe vm-param-set uuid=$UUID PV-bootloader=pygrub
    [root@xenserver-citrix ~]# xe vm-param-set uuid=$UUID PV-args="console=hvc0"
  5. Search the configured hard disk. In this given example the first entry is the DVD (hdd) and the second entry is the hard disk (hda):
    [root@xenserver-citrix ~]# xe vbd-list vm-uuid=$UUID
     uuid ( RO)             : 56c0d70d-7b82-569d-e9a4-11f6d0bf3520
              vm-uuid ( RO): 6ecc2dd6-ff68-5d6d-f7e7-912f25ea244f
        vm-name-label ( RO): ucs-vm
             vdi-uuid ( RO): <not in database>
                empty ( RO): true
               device ( RO): hdd
     
     
     uuid ( RO)             : 3c43c999-071b-cedf-e66e-4d06d3b16494
              vm-uuid ( RO): 6ecc2dd6-ff68-5d6d-f7e7-912f25ea244f
        vm-name-label ( RO): ucs-vm
             vdi-uuid ( RO): 2515b8e1-dc90-4363-8112-6c2cfdc1901e
                empty ( RO): false
               device ( RO): hda
  6. The hard disk must be configured as bootable, for example:
    [root@xenserver-citrix ~]# xe vbd-param-set uuid=3c43c999-071b-cedf-e66e-4d06d3b16494 bootable=true
  7. After that the virtual machine can be started.

Convert back from PV to HVM

  1. A system can be converted back to HVM with the following steps:
    [root@xenserver-citrix ~]# UUID=$(xe vm-list name-label="ucs-vm" params=uuid --minimal)
    [root@xenserver-citrix ~]# xe vm-param-set uuid=$UUID HVM-boot-policy="BIOS order"
    [root@xenserver-citrix ~]# xe vm-param-set uuid=$UUID PV-bootloader""
Personal tools