Changes between Version 2 and Version 3 of Internal/VMHostSetup
- Timestamp:
- Nov 23, 2011, 10:08:23 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Internal/VMHostSetup
v2 v3 7 7 Emulator: KVM 8 8 }}} 9 10 '''UPDATE:''' I've amended the directions to eliminate the need for bridging compatibly. This requires us to not use libvirt and virt-manager/virsh. We want to use open vswitch in it's native mode with out the bridge. This should be a more "flexible" setup. 11 9 12 10 13 === Building the Host === … … 42 45 openvswitch-common_1.2.2.10448_amd64.deb 43 46 openvswitch-switch_1.2.2.10448_amd64.deb 44 openvswitch-brcompat_1.2.2.10448_amd64.deb45 47 }}} 46 48 and then Installed them in that order with "dpkg -i". 49 [[BR]]'''NOTE:''' The package '''openvswitch-brcompat_1.2.2.10448_amd64.deb''' was removed because we are not using bridge compatability. 47 50 1. Once these are installed you can start/restart the openvswitch dameon 48 51 {{{ … … 61 64 dhclient br0 62 65 }}} 63 In retrospect I could have used brctl once I brought up the compatibly daemon. 64 1. As referenced in the brcompat documentation [http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.bridge;hb=HEAD here], 66 1. Make the ovs-ifup and ovs-ifdown scripts as referenced [http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.KVM;hb=HEAD here]. 67 Make sure to chmod +x them. 68 {{{ 69 /etc/ovs-ifup 70 -------------------------------------------------------------------- 71 #!/bin/sh 72 73 switch='br0' 74 /sbin/ifconfig $1 0.0.0.0 up 75 ovs-vsctl add-port ${switch} $1 76 -------------------------------------------------------------------- 77 78 /etc/ovs-ifdown 79 -------------------------------------------------------------------- 80 #!/bin/sh 81 82 switch='br0' 83 /sbin/ifconfig $1 0.0.0.0 down 84 ovs-vsctl del-port ${switch} $1 85 -------------------------------------------------------------------- 86 }}} 87 1. '''NOTE:''' Omit this step since we are not using bridging compatability.[[BR]]'' 88 As referenced in the brcompat documentation [http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.bridge;hb=HEAD here], 65 89 I took these steps to bring up the bridge daemon. According to the kvm documentation, 66 90 you don't really need brcompat however virtmanager fails to build VM's if you don't bring up the daemon. '''NOTE''' you do not need, and should not install bridge-utils, 67 it will load the bridge modules and create conflicts with openvswitch_mod. 91 it will load the bridge modules and create conflicts with openvswitch_mod.'' 68 92 {{{ 69 93 insmod /lib/modules/2.6.38-8-server/kernel/brcompat_mod.ko … … 72 96 1. Now we're ready to install the KVM packages documented [https://help.ubuntu.com/community/KVM/Installation here], all but the bridge-utils: 73 97 {{{ 74 sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder virt-manager98 sudo apt-get install qemu-kvm 75 99 }}} 76 1. From here we should be able to fire up virt-manager and build a VM. 100 '''NOTE:''' This step has been amended to exclude: '''libvirt-bin ubuntu-vm-builder virt-manager'''. This is because we are no longer using bridging compatibly. 101 1. Next we will build a vm using the command line tools. 77 102 78 103 ---- 79 104 === Building the client OS === 105 This process is clubbed together from a collection of references listed at the bottom. The crux of the process is that instead of using libvirt based tools (e.g. virsh/virt-manager), we will use the qemu/kvm tools directly. A Virtual machine is really only two components, a running process that is spawned via the kvm exectuable (an alias form qemu), and a disk image that is the state of the running VM. To get the virtual machine up we need to build the disk and then start the process. One the process is spawned, a vnc session will begin listening on the proper port (usually 5900). You can connect a vnc client to this port, and thus get "console" access to the VM. 80 106 107 1. Building the disk: We use the kvm-img tool to build the disk image. there are many formats but we will used the qcow2 type since it supports snapshots. 108 {{{ 109 kvm-img create -f qcow2 filename 110 }}} 111 1. Spawing the process: This can be as simple as: 112 {{{ 113 kvm filename 114 }}} 115 However we'll want to add a few parameters to get the machine in a usable mode. 116 {{{ 117 kvm -vnc :0 -m 2048 -smp 2 -net nic,macaddr=00:11:22:EE:EE:EE -net tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -drive file=/root/test_mac.img -cdrom /root/ubuntu-11.04-server-amd64.iso -boot d 118 }}} 119 The paramenters are: 120 * -vnc - specify which vnc session to spawn, this argument can be specified in several diffrent ways. 121 * -m - Memeory 122 * -snp - #of cpus 123 * -net nic,.. - specify the mac of the first interface. more can be added but the flags will be diffrent. 124 * -net tap,... - specify how the other end of the nic gets connected. In this case we used the vswitch start up scripts 125 * -drive - the name of the disk drive (there are many ways to specify this flag, include -hda,etc ...) 126 * -cdrom - location of the iso to use as a cd-rom (alternatively you could use /dev/cdrom) 127 * -boot d - specify boot params like boot order, if omitted will default to the first disk 128 1. Once this done you can point your vnc client (locally, or if you specified the parameters correctly remotely) to the specfied port and answer the prompts to 129 preform an installation. 130 1. After the os is installed, it will try to reboot and fail. At this point you can "shut down" the machine by kill -9 the process. 131 1. Next "remove" the cdrom and start the vm again. It should boot appropriately. Note the missing -boot param. 132 {{{ 133 kvm -vnc :0 -m 2048 -smp 2 -net nic,macaddr=00:11:22:EE:EE:EE -net tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -drive file=/root/test_mac.img 134 }}} 135 ---- 136 ==== Old process, Deprecated ==== 81 137 1. copy the install iso to some directory (I used /root) 82 138 {{{ … … 88 144 [[Image(virtmannet.jpg)]] 89 145 1. When you get to the ubuntu install screen, Rember to press f4 on the ubuntu install menu to get the virtual machine version. 90 91 146 92 147 refrences: 148 * http://translate.googleusercontent.com/translate_c?hl=en&ie=UTF8&rurl=translate.google.de&sl=de&tl=en&u=http://qemu-buch.de/de/index.php/QEMU-KVM-Buch/_Inhaltsverzeichnis&usg=ALkJrhir9hvb8x9SA1RJNnNapZstHXVYGg 149 * http://en.wikibooks.org/wiki/QEMU 150 * http://www.crashcourse.ca/wiki/index.php/QEMU 151 * http://wiki.qemu.org/Manual#User_Documentation 93 152 * https://help.ubuntu.com/community/KVM 94 153 * http://openvswitch.org/releases/binaries/1.2.2.10448/natty_amd64/