Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Virtualization <ul><li>In the early days of computing, virtualization as we know it today didn't really exist. Instead, emulation was used. </li></ul><ul><li>In emulation, the behavior of a complete computer is copied to a software program. The emulation layer talks to an operating system which on its turn talks to the computer hardware. The operating system that you want to install in an emulation layer doesn't see that it is used in an emulated environemt and therefore you can install it as you are used to install your favourite operating system. </li></ul><ul><li>Two popular open source emulators are QEMU ( en Bochs </li></ul><ul><li>( </li></ul>
  2. 2. Virtualization <ul><li>One of the most important properties of emulation, is that all hardware is emulated, the CPU as well. </li></ul><ul><li>This has advantages, such as the fact that you can run an operating system that was developed for another architecture on your architecture. With this advantage however, also comes the most important disadvantage; this same option to virtualize a complete CPU comes with a heavy performance price. </li></ul>
  3. 3. Virtualization <ul><li>In the next generation, virtualization was taken to a higher level. This means that between the emulation layer that was responsible for interpreting instructions from the virtualized machines and the </li></ul><ul><li>hardware, no host operating system was required between virtual machines and hardware anymore. </li></ul><ul><li>Instead the virtual machine monitor, also known as the hypervisor was introduced to run directly on the hardware. Because of this new architecture, virtualization became much more efficient. VMware for </li></ul><ul><li>example was very succesful with this approach as implemented in VMware ESX. </li></ul>
  4. 4. Virtualization <ul><li>There are however two different approaches when virtualization is used this way. In the old approach all instructions that were generated by the virtualized machine needed to be translated to the appropriate format for the CPU, which involves a lot of work for the hypervisor. </li></ul><ul><li>In the new approach which is used by Xen, there is no translation between the instructions that leave the virtualized machine </li></ul><ul><li>and the CPU that executes them. </li></ul><ul><li>This can be accomplished in two ways . </li></ul><ul><li>Option number one is to use a CPU that understands the unmodified instructions that are generated by the virtualized operating system and interprets them (full virtualization). </li></ul><ul><li>Option number two is to modify the operating system so that it generates instructions that are optimized for use in a virtualized environment (para virtualization). </li></ul>
  5. 5. Full versus Para Virtualization <ul><li>Full virtualization is one way of handling virtualization. Using this method, the virtual machine talks to a component called the virtual machine monito r and this virtual machine monitor talks to the hardware platform directly. </li></ul><ul><li>To use full virtualization in a Xen environment, you need a CPU that understands unmodified instructions that are generated by the virtualized operating system. Without this special feature on the CPU's, it's not possible to use full virtualization in Xen. </li></ul><ul><li>This is because in the Xen approach not every instruction that is generated by the virtualized operating system is translated to a format that every CPU understands, because this is very resource intensive. Instead, the virtualization feature that is implemented in modern CPU's helps the virtualized operating system in a way that it can send out unmodified instructions. </li></ul><ul><li>The main advantage of full virtualization, is that an unmodified operating system is installed. This means that virtually every operating system that runs on the same architecture can be virtualized. </li></ul>
  6. 6. Full versus Para Virtualization <ul><li>The most efficient approach in virtualization, is para virtualization . </li></ul><ul><li>In para virtualization , the guest operating system uses a specialized API to talk to the virtual machine monitor which is responsible for handling the virtualization requests and putting them to the real hardware. </li></ul><ul><li>Because of this special API , the virtual machine manager doesn't need to do a resource intensive translation of instructions any more before they can be passed to the hardware. </li></ul><ul><li>Also, when using the paravirtualization API, the virtualized operating system is capable of generating much more efficients instructions. </li></ul><ul><li>A disadvantage however, is that you do need a modified operating system that includes this specific API and for certain operating systems (Windows mainly) this is an important disadvantage because such an API is not available. </li></ul>
  7. 7. Virtualization <ul><li>What is virtulization? </li></ul><ul><li>• virtulization is a broad term that refers to the abstraction </li></ul><ul><li>of computer resources. </li></ul><ul><li>• Server virtulization </li></ul><ul><li>– Hardware – ex: IBM pSeries and zSeries LPARS </li></ul><ul><li>– Software – ex: Vmware, Xen, Solaris Containers, SWsoft </li></ul><ul><li>Virtuozzo, Virtual Box, KVM </li></ul><ul><li>• Storage virtulization </li></ul><ul><li>– Hardware – ex: RAID, SAN </li></ul><ul><li>– Software – ex: iSCSI, Veratis Storage Foundation, Software </li></ul><ul><li>RAID </li></ul>
  8. 8. Virtualization
  9. 9. Virtualization <ul><li>Virtual Machines </li></ul><ul><li>• Enabled by layer that sits between the OS and </li></ul><ul><li>hardware </li></ul><ul><li>– OS instances think they are controlling the “real” machine* </li></ul><ul><li>– Virtulization layer mediates access to hardware resources </li></ul><ul><li>– Permits multiple OS instances to coexist on a single server </li></ul><ul><li>– Even incompatible OS's can share a single server </li></ul><ul><li>– the “layer” is referred to as a Virtual Machine Monitor (VMM) </li></ul>
  10. 10. Full Virtualization <ul><li>full virtualization on CPUs that have been designed specifically for virtualization. (Examples include the next-generation AMD processors with AMD-V.) A fully virtualized operating system is one that has not been modified specifically to run in a virtual environment, so it is unaware that it is being virtualized. As a result, the hypervisor traps and emulates every I/O and hardware instruction that is deemed privileged by the hypervisor. </li></ul><ul><li>Typically, the overhead occurring from these trapping and emulation operations would have a significant impact on performance. However, the AMD processors with AMD-V have been designed specifically for virtualization. The Xen hypervisor interacts with the virtualization extensions in the AMD processors not only to improve performance </li></ul><ul><li>and efficiency, but also to provide hardwarebased isolation between these unmodified guest operating systems running on a virtualization server. </li></ul><ul><li>The main benefit of full virtualization comes from its ability to host legacy operating systems that have not been paravirtualized. The ability to host these legacy operating systems in a virtualized environment is critical to a data center’s server-consolidation efforts. This feature is mandatory for virtualizing proprietary operating systems, including those from Microsoft*. </li></ul>
  11. 11. Full Virtualization <ul><li>To run full virtualization guests on systems with Hardware-assisted Virtual Machine (HVM), Intel, or AMD platforms, you must check to ensure your CPUs have the capabilities needed to do so. </li></ul><ul><li>To check if you have the CPU flags for Intel support, enter the following: </li></ul><ul><li>grep vmx /proc/cpuinfo </li></ul><ul><li>The output displays: </li></ul><ul><li>flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm </li></ul><ul><li>If a vmx flag appears then you have Intel support. </li></ul><ul><li>To check if you have the CPU flags for AMD support, enter the following: </li></ul><ul><li>grep svm /proc/cpuinfo </li></ul><ul><li>cat /proc/cpuinfo | grep svm </li></ul><ul><li>The output displays: </li></ul><ul><li>flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush dt acpi mmx fxsr sse sse2 ss ht tm syscall nx mmtext fxsr_opt rdtscp lm 3dnowext pni cx16 lahf_lm cmp_legacy svm cr8_legacy </li></ul>
  12. 12. Paravirtualization <ul><li>Xen’s unique performance benefits accrue from its use of paravirtualization. With paravirtualization,the operating system running inside of a virtual machine (known as a guest operating system) is modified to run on top of a hypervisor. </li></ul><ul><li>virtualized operating system instance is aware that it is running in a virtualized state and has been fine-tuned for optimal performance </li></ul><ul><li>in that environment. </li></ul><ul><li>Paravirtualization allows the hypervisor to avoid hard-to-virtualize processor instructions by replacing them with procedure calls that </li></ul><ul><li>provide that functionality. A paravirtualized operating system loads and runs virtual drivers that are capable of interacting with Xen to access resources on the host virtual server. In other words, it does not require complete emulation of computer devices. </li></ul>
  13. 13. Full & Paravirtualization Overview
  14. 14. <ul><li>32-bit hosts runs only 32-bit paravirtual guests. 64-bit hosts runs only 64-bit paravirtual guests. And a 64-bit full virtualization host runs 32-bit, 32-bit PAE, or 64-bit guests. A 32-bit full virtualization host runs both PAE and non-PAE full virtualization guests. </li></ul>
  15. 15. Xen Architecture
  16. 16. Xen Terminology <ul><li>guest operating system : An operating system that can run within the Xen environment. </li></ul><ul><li>hypervisor : Code running at a higher privilege level than the supervisor code of its guest operating systems. The hypervisor is Xen itself. It goes between the hardware and the operating systems of the various domain s. The hypervisor is responsible for checking page tables, allocating resources for new domains, and scheduling domains. It presents the domains with a VirtualMachine that looks similar but not identical to the native architecture. It is also responsible for booting the machine enough that it can start dom0 . </li></ul><ul><li>Just as applications can interact with an OS by giving it syscalls, domains interact with the hypervisor by giving it hypercall s. The hypervisor responds by sending the domain an event, which fulfils the same function as an IRQ on real hardware. </li></ul><ul><li>virtual machine monitor (&quot; vmm &quot;): In this context, the hypervisor. </li></ul><ul><li>domain : A running virtual machine within which a guest OS executes. </li></ul><ul><li>domain0 (&quot; dom0 &quot;): The first domain, automatically started at boot time. Dom0 has permission to control all hardware on the system, and is used to manage the hypervisor and the other domains. </li></ul>
  17. 17. Xen Terminology <ul><li>unprivileged domain (&quot; domU &quot;): A domain with no special hardware access. </li></ul><ul><li>Full virtualization : An approach to virtualization which requires no modifications to the hosted operating system, providing the illusion of a complete system of real hardware devices. </li></ul><ul><li>paravirtualization : An approach to virtualization which requires modifications to the operating system in order to run in a virtual machine. Xen uses paravirtualization but preserves binary compatibility for user space applications. </li></ul><ul><li>HVM : Hardware Virtual Machine, which is the full-virtualization mode supported by Xen. This mode requires hardware support, e.g. Intel's Virtualization Technology (VT) and AMD's Pacifica technology. </li></ul><ul><li>SVM : full-virtualization support on AMD's Pacifica-enabled processors </li></ul><ul><li>VT-x : full-virtualization support on Intel's x86 VT-enabled processors </li></ul><ul><li>VT-i : full-virtualization support on Intel's IA-64 VT-enabled processors </li></ul>
  18. 18. Xen Terminology <ul><li>backend : one half of a communication end point - interdomain communication is implemented using a frontend and backend device model interacting via event channels. </li></ul><ul><li>frontend : the device as presented to the guest; other half of the communication endpoint. </li></ul><ul><li>vif : virtual interface; the name of the network backend device connected by an event channel to a network front end on the guest. </li></ul><ul><li>vethN : local networking front end on dom0; renamed to ethN by xen network scripts in bridging mode (FIXME) </li></ul><ul><li>pethN : real physical device (after renaming) </li></ul><ul><li>Live migration : A technique for moving a running virtual machine to another physical host, without stopping it or the services running on it. </li></ul>
  19. 19. hypervisor <ul><li>Hypervisors are currently classified in two types: </li></ul><ul><li>A Type 1 (or native or bare-metal ) hypervisor is software that runs directly on a given hardware platform (as an operating system control program ). </li></ul><ul><li>A guest operating system thus runs at the second level above the hardware. The classic type 1 hypervisor was CP/CMS , developed at IBM in the 1960s, ancestor of IBM's current z/VM . More recent examples are Xen , Oracle VM, VMware 's ESX Server , L4 microkernels , TRANGO, IBM's LPAR hypervisor (PR/SM), Microsoft's Hyper-V (currently in Beta), and Sun's Logical Domains Hypervisor (released in 2005). A variation of this is embedding the hypervisor in the firmware of the platform, as is done in the case of Hitachi 's Virtage hypervisor. KVM , which turns a complete Linux kernel into a hypervisor, is also Type 1. </li></ul>
  20. 20. hypervisor <ul><li>A Type 2 (or hosted ) hypervisor is software that runs within an operating system environment. A &quot;guest&quot; operating system thus runs at the third level above the hardware. Examples include VMware Server (formerly known as GSX), VMware Workstation , VMware Fusion , the open source QEMU , Microsoft 's Virtual PC and Microsoft Virtual Server products, InnoTek's VirtualBox , as well as SWsoft 's Parallels Workstation and Parallels Desktop . </li></ul><ul><li>The term hypervisor apparently originated in IBM 's CP-370 reimplementation of CP-67 for the System/370 , released in 1972 as VM/370 . The term hypervisor call , or hypercall , referred to the paravirtualization interface, by which a &quot;guest&quot; operating system could access services directly from the (higher-level) control program – analogous to making a &quot;supervisor call&quot; to the (same level) operating system. (The term &quot; supervisor &quot; refers to the operating system kernel , which on IBM mainframes runs in supervisor state .) </li></ul>
  21. 21. Virtualization Technologies (cont) <ul><li>• Classification by Interface </li></ul><ul><li>– Fully emulated Hardware (Xen Full-Virtualization) </li></ul><ul><li>> Use of unmodified OS </li></ul><ul><li>> Privileged Instructions to be cached (performance relevant) </li></ul><ul><li>– Semi emulated Hardware (Xen Para-Vitualization) </li></ul><ul><li>> Modified Guest OS required </li></ul><ul><li>> API for Operations and Processor Instructions </li></ul>
  22. 22. Prerequisites <ul><li>Prerequisites </li></ul><ul><li>The following is a full list of prerequisites. </li></ul><ul><li>A working Linux distribution using the GRUB bootloader and running on a P6-class (or newer) CPU. </li></ul><ul><li>The iproute2 package. </li></ul><ul><li>The Linux bridge-utils1 (e.g., /sbin/brctl) </li></ul><ul><li>An installation of Twisted v1.3 or above2. There may be a binary package available </li></ul><ul><li>for your distribution; alternatively it can be installed by running ` make install-twisted' in the root of the Xen source tree. </li></ul>
  23. 23. Prerequisites <ul><li>Build tools (gcc v3.2.x or v3.3.x, binutils, GNU make). </li></ul><ul><li>Development installation of libcurl (e.g., libcurl-devel) </li></ul><ul><li>Development installation of zlib (e.g., zlib-dev). </li></ul><ul><li>Development installation of Python v2.2 or later (e.g., python-dev). </li></ul><ul><li>Once you have satised the relevant prerequisites, you can now install either a binary or source distribution of Xen. </li></ul>
  24. 24. Installing from Binary Tarball <ul><li>Pre-built tarballs are available for download from the Xen download page </li></ul><ul><li> </li></ul><ul><li>Once you've downloaded the tarball, simply unpack and install: </li></ul><ul><li># tar zxvf xen-2.0-install.tgz </li></ul><ul><li># cd xen-2.0-install </li></ul><ul><li># sh ./ </li></ul>
  25. 25. GRUB Conguration <ul><li>An entry should be added to grub.conf (often found under /boot/ or /boot/grub/) </li></ul><ul><li>to allow Xen / XenLinux to boot. This le is sometimes called menu.lst, depending </li></ul><ul><li>on your distribution. The entry should look something like the following: </li></ul><ul><li>title Xen 2.0 / XenLinux 2.6 </li></ul><ul><li>kernel /boot/xen-2.0.gz dom0_mem=131072 </li></ul><ul><li>module /boot/vmlinuz-2.6-xen0 root=/dev/sda4 ro console=tty0 </li></ul><ul><li>The kernel line tells GRUB where to nd Xen itself and what boot parameters should </li></ul><ul><li>be passed to it (in this case, setting domain 0's memory allocation in kilobytes and the </li></ul><ul><li>settings for the serial port). </li></ul>
  26. 26. GRUB Conguration <ul><li>Serial Console (optional) </li></ul><ul><li>In order to congure Xen serial console output, it is necessary to add an boot option to your GRUB cong; e.g. replace the above kernel line with: </li></ul><ul><li>kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1 </li></ul><ul><li>This congures Xen to output on COM1 at 115,200 baud, 8 data bits, 1 stop bit and no parity. Modify these parameters for your set up. </li></ul><ul><li>One can also congure XenLinux to share the serial console; to achieve this append </li></ul><ul><li>. console=ttyS0. to your module line. </li></ul><ul><li>If you wish to be able to log in over the XenLinux serial console it is necessary to add a line into /etc/inittab, just as per regular Linux. Simply add the line: </li></ul><ul><li>c:2345:respawn:/sbin/mingetty ttyS0 </li></ul><ul><li>and you should be able to log in. Note that to successfully log in as root over the serial line will require adding ttyS0 to /etc/securetty in most modern distributions. </li></ul>
  27. 27. Xen Boot Options <ul><li>These options are used to configure Xen's behaviour at runtime. They should be appended to Xen's command line, either manually or by editing grub.conf. </li></ul><ul><li>noreboot Don't reboot the machine automatically on errors. This is useful to catch debug output if you aren't catching console messages via the serial line. nosmp Disable SMP support. This option is implied by `ignorebiostables'. watchdog Enable NMI watchdog which can report certain failures. noirqbalance Disable software IRQ balancing and affinity. This can be used on systems such as Dell 1850/2850 that have workarounds in hardware for IRQ-routing issues. badpage=<page number>,<page number>, ... Specify a list of pages not to be allocated for use because they contain bad bytes. For example, if your memory tester says that byte 0x12345678 is bad, you would place `badpage=0x12345' on Xen's command line. </li></ul>
  28. 28. <ul><li>com1=<baud>,DPS,<io_base>,<irq> com2=<baud>,DPS,<io_base>,<irq> </li></ul><ul><li>Xen supports up to two 16550-compatible serial ports. For example: `com1=9600, 8n1, 0x408, 5' maps COM1 to a 9600-baud port, 8 data bits, no parity, 1 stop bit, I/O port base 0x408, IRQ 5. If some configuration options are standard (e.g., I/O base and IRQ), then only a prefix of the full configuration string need be specified. If the baud rate is pre-configured (e.g., by the bootloader) then you can specify `auto' in place of a numeric baud rate. </li></ul><ul><li>console=<specifier list> </li></ul><ul><li>Specify the destination for Xen console I/O. This is a comma-separated list of, for example: </li></ul><ul><li>vga Use VGA console and allow keyboard input . </li></ul><ul><li>com1 Use serial port com1. </li></ul><ul><li>com2H Use serial port com2. Transmitted chars will have the MSB set. Received chars must have MSB set. </li></ul><ul><li>com2L Use serial port com2. Transmitted chars will have the MSB cleared. Received chars must have MSB cleared. </li></ul>
  29. 29. <ul><li>sync_console </li></ul><ul><li>Force synchronous console output. This is useful if you system fails unexpectedly before it has sent all available output to the console. In most cases Xen will automatically enter synchronous mode when an exceptional event occurs, but this option provides a manual fallback. </li></ul><ul><li>conswitch=<switch-char><auto-switch-char> </li></ul><ul><li>Specify how to switch serial-console input between Xen and DOM0. The required sequence is CTRL-<switch-char> pressed three times. Specifying the backtick character disables switching. The <auto-switch-char> specifies whether Xen should auto-switch input to DOM0 when it boots -- if it is `x' then auto-switching is disabled. Any other value, or omitting the character, enables auto-switching. [NB. Default switch-char is `a'.] </li></ul><ul><li>nmi=xxx </li></ul><ul><li>Specify what to do with an NMI parity or I/O error. `nmi=fatal': Xen prints a diagnostic and then hangs. `nmi=dom0': Inform DOM0 of the NMI. `nmi=ignore': Ignore the NMI. </li></ul>
  30. 30. <ul><li>mem=xxx </li></ul><ul><li>Set the physical RAM address limit. Any RAM appearing beyond this physical address in the memory map will be ignored. This parameter may be specified with a B, K, M or G suffix, representing bytes, kilobytes, megabytes and gigabytes respectively. The default unit, if no suffix is specified, is kilobytes. </li></ul><ul><li>dom0_mem=xxx </li></ul><ul><li>Set the amount of memory to be allocated to domain0. In Xen 3.x the parameter may be specified with a B, K, M or G suffix, representing bytes, kilobytes, megabytes and gigabytes respectively; if no suffix is specified, the parameter defaults to kilobytes. In previous versions of Xen, suffixes were not supported and the value is always interpreted as kilobytes. </li></ul><ul><li>tbuf_size=xxx </li></ul><ul><li>Set the size of the per-cpu trace buffers, in pages (default 1). Note that the trace buffers are only enabled in debug builds. Most users can ignore this feature completely. </li></ul>
  31. 31. <ul><li>sched=xxx </li></ul><ul><li>Select the CPU scheduler Xen should use. The current possibilities are `sedf' (default) and `bvt'. </li></ul><ul><li>apic_verbosity=debug,verbose Print more detailed information about local APIC and IOAPIC configuration. </li></ul><ul><li>lapic Force use of local APIC even when left disabled by uniprocessor BIOS. </li></ul><ul><li>nolapic Ignore local APIC in a uniprocessor system, even if enabled by the BIOS. </li></ul><ul><li>apic=bigsmp,default,es7000,summit Specify NUMA platform. This can usually be probed automatically. In addition, the following options may be specified on the Xen command line. Since domain 0 shares responsibility for booting the platform, Xen will automatically propagate these options to its command line. These options are taken from Linux's command-line syntax with unchanged semantics. </li></ul>
  32. 32. <ul><li>acpi=off,force,strict,ht,noirq,... </li></ul><ul><li>Modify how Xen (and domain 0) parses the BIOS ACPI tables. </li></ul><ul><li>acpi_skip_timer_override </li></ul><ul><li>Instruct Xen (and domain 0) to ignore timer-interrupt override instructions specified by the BIOS ACPI tables. </li></ul><ul><li>noapic </li></ul><ul><li>Instruct Xen (and domain 0) to ignore any IOAPICs that are present in the system, and instead continue to use the legacy PIC. </li></ul><ul><li>xencons=xxx </li></ul><ul><li>Specify the device node to which the Xen virtual console driver is attached. The following options are supported: </li></ul><ul><li>`xencons=off': disable virtual console </li></ul><ul><li>`xencons=tty': attach console to /dev/tty1 (tty0 at boot-time) `xencons=ttyS': attach console to /dev/ttyS0 </li></ul><ul><li>The default is ttyS for dom0 and tty for all other domains. </li></ul>
  33. 33. XEN-NETWORKING <ul><li>Virtual Ethernet interfaces </li></ul><ul><li>Xen creates, by default, seven pair of &quot;connected virtual ethernet interfaces&quot; for use by dom0. Think of them as two ethernet interfaces connected by an internal crossover ethernet cable. veth0 is connected to vif0.0, veth1 is connected to vif0.1, etc, up to veth7 -> vif0.7. You can use them by configuring IP and MAC addresses on the veth# end, then attaching the vif0.# end to a bridge. </li></ul>
  35. 35. XEN-NETWORKING <ul><li>Every time you create a running domU instance, it is assigned a new domain id number. </li></ul><ul><li>For each new domU, Xen creates new &quot;connected virtual ethernet interfaces&quot;, with one end of each pair is within the domU and the other end exists within dom0. For linux domU's, the device name it sees is named eth0. </li></ul><ul><li>The other end of that virtual ethernet interface pair exists within dom0 as interface vif<id#>.0. </li></ul><ul><li>For example, domU #5's eth0 is attached to vif5.0. </li></ul><ul><li>If you create multiple network interfaces for a domU, it's ends will be eth0, eth1, etc, whereas the dom0 end will be vif<id#>.0, vif<id#>.1, etc. </li></ul>
  36. 36. Logical network cards connected between dom0 and dom1:
  37. 37. Bridging
  38. 38. <ul><li>network-bridge </li></ul><ul><li>When xend starts up, it runs the network-bridge script, which: </li></ul><ul><li>creates a new bridge named xenbr0 </li></ul><ul><li>&quot;real&quot; ethernet interface eth0 is brought down </li></ul><ul><li>the IP and MAC addresses of eth0 are copied to virtual network interface veth0 </li></ul><ul><li>real interface eth0 is renamed peth0 </li></ul><ul><li>virtual interface veth0 is renamed eth0 </li></ul><ul><li>peth0 and vif0.0 are attached to bridge xenbr0 </li></ul><ul><li>the bridge, peth0, eth0 and vif0.0 are brought up </li></ul><ul><li>It is good to have the physical interface and the dom0 interface separated; thus you can e.g. setup a firewall on dom0 that does not affect the traffic to the domUs (just for protecting dom0 alone). </li></ul><ul><li>vif-bridge </li></ul><ul><li>When a domU starts up, xend (running in dom0) runs the vif-bridge script, which: </li></ul><ul><li>attaches vif<id#>.0 to xenbr0 </li></ul><ul><li>vif<id#>.0 is brought up </li></ul>
  39. 39. <ul><li>you can change the bridge name from xenbr0 using: </li></ul><ul><li>(network-script 'network-bridge bridge=mybridge') in xend- config.sxp and rebooting or restarting xend </li></ul><ul><li>you can create multiple network interfaces, and attach them to different bridges using: vif=[ 'mac=00:16:3e:70:01:01,bridge=br0', 'mac=00:16:3e:70:02:01,bridge=br1' ] </li></ul>
  40. 40. Domain Management Tools <ul><li>Command-line Management </li></ul><ul><li>Command line management tasks are also performed using the xm tool. For online </li></ul><ul><li>help for the commands available, type: </li></ul><ul><li># xm help </li></ul><ul><li>You can also type xm help <command> for more information on a given command. </li></ul>
  41. 41. Starting/Stopping a Domain at Boot Time <ul><li>You can start or stop running domains at any time. Domain0 waits for all running domains to shutdown before restarting. </li></ul><ul><li>You must place the configuration files of the domains you wish to shut down in the /etc/xen/ directory. </li></ul><ul><li>All the domains that you want to start at boot time must be symlinked to /etc/xen/auto . </li></ul><ul><li>chkconfig xendomains on </li></ul><ul><li>The chkconfig xendomains on command does not automatically start domains; instead it will start the domains on the next boot. </li></ul><ul><li>chkconfig xendomains off </li></ul><ul><li>Terminates all running Red Hat Virtualization domains. The chkconfig xendomains off command shuts down the domains on the next boot. </li></ul>
  42. 42. Xend <ul><li>The Xend node control daemon performs system management functions related to virtual machines. It forms a central point of control of virtualized resources, and must be running in order to start and manage virtual machines. Xend must be run as root because it needs access to privileged system management functions. </li></ul><ul><li>Xend can be started on the command line as well, and supports the following set of parameters: </li></ul><ul><li># xend start start xend, if not already running </li></ul><ul><li># xend stop stop xend if already running </li></ul><ul><li># xend restart restart xend if running, otherwise start it </li></ul><ul><li># xend status indicates xend status by its return code </li></ul>
  43. 43. Logging <ul><li>As xend runs, events will be logged to / var/log/xend.log and (less frequently) to /var/log/xend-debug.log . These, along with the standard syslog files , are useful when troubleshooting problems. </li></ul>
  44. 44. Configuring Xend <ul><li>Xend is written in Python. At startup, it reads its configuration information from the file /etc/xen/xend-config.sxp . The Xen installation places an example xend-config.sxp file in the /etc/xen subdirectory which should work for most installations. </li></ul>
  45. 45. <ul><li>An HTTP interface and a Unix domain socket API are available to communicate with Xend. This allows remote users to pass commands to the daemon. </li></ul><ul><li>By default, Xend does not start an HTTP server. It does start a Unix domain socket management server, as the low level utility xm requires it. For support of cross-machine migration, Xend can start a relocation server . This support is not enabled by default for security reasons. </li></ul><ul><li>From the file: </li></ul><ul><li>#(xend-http-server no) </li></ul><ul><li>(xend-http-server yes) </li></ul><ul><li>#(xend-unix-server yes) </li></ul><ul><li>#(xend-relocation-server no) </li></ul><ul><li>(xend-relocation-server yes) </li></ul><ul><li>Comment or uncomment lines in that file to disable or enable features that you require. </li></ul><ul><li>Connections from remote hosts are disabled by default: </li></ul><ul><li># Address xend should listen on for HTTP connections, if xend-http-server is </li></ul><ul><li># set. </li></ul><ul><li># Specifying 'localhost' prevents remote connections. </li></ul><ul><li># Specifying the empty string '' (the default) allows all connections. </li></ul><ul><li>#(xend-address '') </li></ul><ul><li>(xend-address localhost) </li></ul><ul><li>It is recommended that if migration support is not needed, the xend-relocation-server parameter value be changed to ``no'' or commented out. </li></ul>
  46. 46. Xm <ul><li>The xm tool is the primary tool for managing Xen from the console. The general format of an xm command line is: </li></ul><ul><li># xm command [switches] [arguments] [variables] </li></ul><ul><li># xm help </li></ul><ul><li>This will list the most commonly used commands. The full list can be obtained using xm help --long. You can also type xm help <command> for more information on a given command. </li></ul>
  47. 47. <ul><li>One useful command is </li></ul><ul><li># xm list </li></ul><ul><li>which lists all domains running in rows of the following format: </li></ul><ul><li>name domid memory vcpus state cputime </li></ul><ul><li>The meaning of each field is as follows: </li></ul><ul><li>name The descriptive name of the virtual machine. </li></ul><ul><li>domid The number of the domain ID this virtual machine is running in. </li></ul><ul><li>memory Memory size in megabytes. </li></ul><ul><li>vcpus The number of virtual CPUs this domain has. </li></ul><ul><li>state Domain state consists of 5 fields: </li></ul><ul><li>r running b blocked p paused s shutdown c crashed </li></ul><ul><li>cputime How much CPU time (in seconds) the domain has used so far. </li></ul><ul><li>The xm list command also supports a long output format when the -l switch is used. This outputs the full details of the running domains in xend's SXP configuration format. </li></ul><ul><li>You can get access to the console of a particular domain using the # xm console command (e.g. # xm console myVM). </li></ul>
  48. 48. 5.1 Configuration Files <ul><li>Xen configuration files contain the following standard variables. Unless otherwise stated, configuration items should be enclosed in quotes: see the configuration scripts in /etc/xen/ for concrete examples. </li></ul><ul><li>kernel Path to the kernel image. </li></ul><ul><li>ramdisk Path to a ramdisk image (optional). </li></ul><ul><li>memory Memory size in megabytes. </li></ul><ul><li>vcpus The number of virtual CPUs . </li></ul><ul><li>console Port to export the domain console on (default 9600 + domain ID). </li></ul><ul><li>vif Network interface configuration. e.g. vif = [ 'mac=00:16:3E:00:00:11, bridge=xen-br0', 'bridge=xen-br1' ] </li></ul><ul><li>disk List of block devices to export to the domain e.g. disk = [ 'phy:hda1,sda1,r' ] </li></ul><ul><li>dhcp Set to `dhcp' if you want to use DHCP to configure networking. </li></ul><ul><li>netmask Manually configured IP netmask. </li></ul><ul><li>gateway Manually configured IP gateway. </li></ul><ul><li>hostname Set the hostname for the virtual machine. </li></ul><ul><li>root Specify the root device parameter on the kernel command line. </li></ul><ul><li>nfs_server IP address for the NFS server (if any). </li></ul><ul><li>nfs_root Path of the root filesystem on the NFS server (if any). </li></ul><ul><li>extra Extra string to append to the kernel command line (if any) </li></ul>
  49. 49. Domain Save and Restore <ul><li>The administrator of a Xen system may suspend a virtual machine's current state into a disk file in domain  0, allowing it to be resumed at a later time. </li></ul><ul><li>For example you can suspend a domain called ``VM1'' to disk using the command: </li></ul><ul><li># xm save VM1 VM1.chk </li></ul><ul><li>This will stop the domain named ``VM1'' and save its current state into a file called VM1.chk. </li></ul><ul><li>To resume execution of this domain, use the xm restore command: </li></ul><ul><li># xm restore VM1.chk </li></ul><ul><li>This will restore the state of the domain and resume its execution. </li></ul>