VirtualizationWorkshop09 < GridkaSchool09 < TWiki http://www-ekp.physik.uni-karlsruhe.de/~twiki/bin/view/GridkaSchool... Hands On Virtualization using XEN Hands On Virtualization using XEN General Setup The Machine Hardware Host Preparation (Standard UBUNTU XEN Host) Installation of the XEN Packages Modification of the Bootloader GRUB Reboot the Host System Explore Your New XEN dom0 Hardware Host Virtual Machine Preparation Start Your Virtual Machine Working with the Virtual Machines Network Setup on the Host System Start/Stop the Virtual Machines Change the Memory Allocated to the VM High Availability Shared Network Storage Solution Host Preparation Phase Configure the DRBD Device Startup the DRBD Device Setup the Filesystem on the Device Test the DRBD Raid Device Migration of the VMs Advanced tutorial (if you have time left): libvirt usage with XEN Installation of libvirt and tools VM libvirt configuration virsh usage libvirt GUI example "virt-manager" Additional Information General Setup The Machine Hardware The host systems are running Ubuntu 9.04 (Jaunty Jackalope). The following procedures will be possible on most common linux distributions with specific changes to the software installation steps. For Ubuntu we will use the Advanced Packaging Tool ( apt ) similar to Debian . RedHat or SuSE are using rpm or some GUI (Graphical User Interface) installation tool. Each workshop group has access to two hardware hosts: hostname gks- <1/2>-X .fzk.de gks- <1/2>-Y .fzk.de Replace <1/2> and X and Y with the numbers given on the workshop handout. Host Preparation (Standard UBUNTU XEN Host) 1 von 15 16.12.2009 15:13 VirtualizationWorkshop09 < GridkaSchool09 < TWiki http://www-ekp.physik.uni-karlsruhe.de/~twiki/bin/view/GridkaSchool... Installation of the XEN Packages The following procedure has to be done on both hardware hosts: At first logon to both hosts as user root (take the password and X, Y from the handout): ssh -p24 root@gks-<1/2>-X.fzk.de and ssh -p24 root@gks-<1/2>-Y.fzk.de In order to install the needed packages you have to execute the following commands to update the package repository in the first place and then install the XEN package: ( Please do not upgrade the machines, as with a new kernel you will have a new boot loader configuration, which will not work. Therefore, the reboot of the machine would fail.) . $> aptitude update and $> aptitude install ubuntu-xen-server (You can use as well the -y switch to automatically answer 'yes/no' questions during the installation process with 'yes': aptitude install -y ubuntu-xen-server ) The package ubuntu-xen-server is the Ubuntu XEN meta-package. Aptitude will resolve all package dependencies and install all other needed ones. Usually all Linux distributions deliver a meta-package for XEN in a similar way. In this Ubuntu release there is no Xen kernel delivered within the standard Ubuntu package repository. Therefore we have to download the XEN patched kernel manually from the Debian repository: The kernel modules: $> wget http://security.debian.org/debian-security/pool/updates/main/l/linux-2.6/li nux-modules-2.6.26-2-xen-68 $> dpkg -i linux-modules-2.6.26-2-xen-686_2.6.26-17lenny2_i386.deb The kernel: $> wget http://security.debian.org/debian-security/pool/updates/main/l/linux-2.6/lin ux-image-2.6.26-2-xen-686_2 $> dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-17lenny2_i386.deb Typically the bootloader of the linux distribution is configured during the installation procedure of the XEN software tools in the right way. In our case the bootloader of our default machines was modified to enable the cloned installation of all workshop machines and you will be asked by a dialogue, which grub-config you want to install. The following dialogue-box should show up after the ubuntu-xen-server installation. Choose the first option and press 'OK' 2 von 15 16.12.2009 15:13 VirtualizationWorkshop09 < GridkaSchool09 < TWiki http://www-ekp.physik.uni-karlsruhe.de/~twiki/bin/view/GridkaSchool... Wait for the installation process to finish. Modification of the Bootloader GRUB Now we have to tell the bootloader of the linux system to use our new installed XEN kernel for system startup. Therefore you have to manually edit the configuration file of the used bootloader - in our case GRUB. To modify files, use your favourite editor, e.g. nano , pico , vi , vim or ed are installed already. (In case you prefer another editor, feel free to install it via aptitude .) Now open the GRUB configuration file: /boot/grub/menu.lst and ensure that the installation process has added the following needed configuration lines: [...] ## ## End Default Options ## title Xen 3.3 / Ubuntu 9.04, kernel 2.6.26-2-xen-686 root (hd0,0) kernel /boot/xen-3.3.gz module /boot/vmlinuz-2.6.26-2-xen-686 root=/dev/hda1 ro console=tty0 module /boot/initrd.img-2.6.26-2-xen-686 quiet [...] Search for the 3 von 15 16.12.2009 15:13 VirtualizationWorkshop09 < GridkaSchool09 < TWiki http://www-ekp.physik.uni-karlsruhe.de/~twiki/bin/view/GridkaSchool... ## ## End Default Options ## part and verify that the first block looks like the above one. There you have to change the line: root /dev/hda1(hd0,0) to root (hd0,0) and module /boot/vmlinuz-2.6.26-2-xen-686 root=HERE_IS_SOMETHIN_LONG ro console=tty0 to module /boot/vmlinuz-2.6.26-2-xen-686 root=/dev/hda1 ro console=tty0 (Just change root=HERE_IS_SOMETHIN_LONG to root=/dev/hda1 .) Reboot the Host System All needed packages are installed, but the machines are still running the standard UBUNTU linux kernel which lacks the ability of being a XEN dom0 (hardware host). To replace the running with the newly installed XEN-patched kernel, keep the fingers crossed and reboot the machines: $> reboot; exit After waiting some seconds we try to log in again via: $> ssh -p24 root@gks-<1/2>-X/Y.fzk.de In case the machines do not come back to business after the reboot, contact one of the workshop organisers to reset them. Explore Your New XEN dom0 Hardware Host In order to get the status (e.g. memory usage, etc.) of running virtual machines and the host, use the following command: $> xm list The XEN administration tool lists all your virtual instances including the host (dom0 / Domain-0) and manages the xen-hypervisor (type xm --help for a detailed documentation). For now it should return an entry for the dom0 (memory, etc. will vary): Name ID Mem VCPUs State Time(s) Domain-0 0 1895 2 r----- 71.1 Your host has also to bridge the networking of its virtual machines (VMs) to its own network interfaces. A detailed description of the XEN networking concept can be found here . XEN will create the needed network bridge (eth0, in some distributions called xenbr0) automatically and you can check this by executing $> brctl show 4 von 15 16.12.2009 15:13 VirtualizationWorkshop09 < GridkaSchool09 < TWiki http://www-ekp.physik.uni-karlsruhe.de/~twiki/bin/view/GridkaSchool... In the list, an entry for the bridge eth0 should be present which is linked to the physical network interface peth0, e.g.: bridge name bridge id STP enabled interfaces eth0 8000.00e0812a2eaf no peth0 Now the standard XEN setup procedure for UBUNTU is finished! Congratulations, you have just configured your first XEN host machine. Please prepare both hosts before you move on to the next part of the tutorial! Virtual Machine Preparation Pick ONE host were you setup the VM. The other host should be left untouched for now! Your XEN installation also includes the xen-tools, a very usefull script-package to create VMs easily. We will use them to create a first VM on our host. Have a look at /etc/xen-tools/xen-tools.conf . This is the configuration file for the various scripts, e.g. the automatic setup tool xen-create-image . The following guest systems are supported and tested: UBUNTU (edgy, feisty, dapper), Debian (sid, sarge, etch, lenny), CentOS (4, 5) and fedora-core (4, 5, 6, 7). We leave the standard configuration (which is configured for creating a Debian VM) as it is - except for one line which we have to uncomment to have a serial console: serial_device = hvc0 #default Then use the following command line to start the creation/installation process: $> xen-create-image --dist lenny --hostname=testvm1 \ --ip <your VM-IP (handout)> \ --gateway 141.52.174.1 --netmask 255.255.255.0 \ --dir /xenhome --size 400Mb --passwd --fs ext3 \ --role=udev #important for newer distributions. will install udev (Tip: If you need to re-create the VM for some reason, you can use the --force option to overwrite your old VM or you have to manually delete the VM, which can be found in /xenhome/domains/testvm1 and the config file /etc/xen/testvm1.cfg ) This will configure a XEN domU virtual machine and start the installation. This can take a while.... Get some coffee ;-). Please do this only on one host and for one VM to reduce our network load!!! During the installation it will ask you for the root password which you can choose on your own (please not too simple and you have to remember it!!). More information about the installation process can be found in /var/log/xen-tools/testvm1.log After the installation has finished please have a look at the generated VM configuration file /etc/xen/testvm1.cfg . # Configuration file for the Xen instance testvm1, created # by xen-tools 3.9 on Thu Aug 27 07:56:10 2009. # # # Kernel + memory size # kernel = '/boot/vmlinuz-2.6.26-2-xen-686' ramdisk = '/boot/initrd.img-2.6.26-2-xen-686' memory = '128' 5 von 15 16.12.2009 15:13 VirtualizationWorkshop09 < GridkaSchool09 < TWiki http://www-ekp.physik.uni-karlsruhe.de/~twiki/bin/view/GridkaSchool..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages15 Page
-
File Size-