Xen administration

From JJBwiki

Jump to: navigation, search


Contents

[edit] About Xen

Xen is a full blown virtualization solution. It runs on many different architectures and supports many different OS's. It allows for better hardware utilization and dynamic resource allocation as well as better maintenance procedures. It also presents significant advantages for administration.


[edit] Layout

[edit] Network Layout in Xen

  • You have at least 5* gigE ports on the host system (doable with 3, 5 provides card/switch level redundancy on primary and storage)
    • Currently Dell 2950's only have 4 ports, which are 2 bonds (primary and storage)
  • eth0 would be the main interface; any remaining interfaces could be allocated to something like heartbeat. (if needed)
  • All ports are native vlan untagged on the xen cluster to the appropriate primary and storage networks for the "host". Guests are vlan tagged to the appropriate networks.

[edit] Disk Layout in Xen

  • Currently we are setting up 2 raid's. two disk raid 1 (which is /, swap, boot etc) 4 disk raid 5 (/xen which is where we store the VM's)
  • Use LVM as needed (currently setting up LVM groups for /home, /opt, /var and /usr on the "host")
  • resizing disks for the guest machines is fully dependant on the file system supporting it. ext3 does not support shrinking.



[edit] Installing a machine for xen hosting.

[edit] Kickstart

  • kickstart the xen host as expected, select the appropriate rhel5 kickstart file.
  • Once you get a dhcp lease it should install a bare-bones rhel5 host that has the appropriate xen packages.

[edit] Post kickstart & Xen host networking

  • register the box with rhn and run a 'yum update'
  • setup the bonding. 2 primaries become bond0, 2 storage become bond1
  • setup the xen network portion to use the bond's for primary and storage by doing the following:
    • create a file called /etc/xen/scripts/net-start containing:
#!/bin/sh
dir=$(dirname "$0")
"$dir/network-bridge" "$@" vifnum=0 netdev=bond0
"$dir/network-bridge" "$@" vifnum=1 netdev=bond1
  • edit the /etc/xen/xend-config.sxp file (the default xen config)
    • modify this line:
(network-script network-bridge)
    • To read:
(network-script net-start)
  • setup ldap using authconfig or a script.
  • reboot

This should produce a fully updated, functioning networked host with 2 bond's ready to add some VM's



[edit] Installing and managing VM's

There is a quick version available Here

[edit] Step by step

  • Follow the overview above. Once your done, shut off the VM.
  • Edit the /etc/xen/vmname (ie /etc/xen/omniweb01) config file
# Automatically generated xen config file
name = "testvm01"
memory = "1024"
disk = [ 'tap:aio:/xen/testvm01,xvda,w', ]
vif = [ 'mac=00:16:3e:6b:ae:52, bridge=xenbr0','mac=00:16:3e:6b:ae:53, bridge=xenbr1' ]
uuid = "f25650cd-29e5-dde5-1b5d-bd63d46f5ff6"
bootloader="/usr/bin/pygrub"
vcpus=1
on_reboot   = 'restart'
on_crash    = 'restart'
  • So you can see that I added a second network interface in the above. the 'mac=' argument is useless. Note the disk, memory and vcpu settings
    • You can dynamically grow or shrink memory to any amount below the amount the machine was booted with.
      • (ie this machine can be shrunk or grown to 512 upto 1024 or vice versa, but not to 1025)
    • vcpus
  • Now you can boot the vm with the appropriate settings. However be warned that allocating memory will remove it from the "host" system, there is a setting in xend-config.sxp that sets the minimum amount of memory the host will need, default is 256m.
    • So booting a vm with 1024m on a box with 2048m will leave the host with 1024m of available memory.
      • Sometimes the available memory doesnt grow back to the "total" when a vm is aborted or shut off. This is normal, dont panic.

[edit] Issues/Bugs

  • Getting the Console to work (xm console a.k.a. /usr/sbin/xenconsole)
    • Add to /etc/inittab in each guest: co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
    • Add to bottom of /etc/securetty in each guest: xvc0
  • net-snmp (snmpd) will not start on a stock RHEL 5 system with xen.
    • The solution to this is to turn off ipv6 (which is installed and loaded REGARDLESS of what you choose in the installer.
    • Add the following line to /etc/modprobe.conf: alias net-pf-10 off
  • using the above script for handling the bonds on a system prevents restarting the 'network' service cleanly. Restarting the network service causes full network failure. (ie everything comes up but doesnt work.)
    • There is no solution at this point.
  • Dell 2950's boot incredibly slow when running the xen kernel, certain services take a long time to start (think half hour or more)
    • Adding acpi=off to the kernel as an option in grub *helps* but doesnt solve the issue.
  • Booting a VM with an improper configuration on startup can fail with no errors
    • run the xm create -c $VM command (this will attach to the console, so you can see the error)
  • Shutting down/rebooting takes a while if many VM's are running. Xen saves their state.
Personal tools