Changes between Version 2 and Version 3 of Internal/VMHostSetup


Ignore:
Timestamp:
Nov 23, 2011, 10:08:23 PM (12 years ago)
Author:
ssugrim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/VMHostSetup

    v2 v3  
    77Emulator: KVM
    88}}}
     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
    912
    1013=== Building the Host ===
     
    4245    openvswitch-common_1.2.2.10448_amd64.deb
    4346    openvswitch-switch_1.2.2.10448_amd64.deb
    44     openvswitch-brcompat_1.2.2.10448_amd64.deb
    4547    }}}
    4648    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.
    4750 1. Once these are installed you can start/restart the openvswitch dameon
    4851    {{{
     
    6164    dhclient br0
    6265    }}}
    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
     73switch='br0'
     74/sbin/ifconfig $1 0.0.0.0 up
     75ovs-vsctl add-port ${switch} $1
     76--------------------------------------------------------------------
     77
     78/etc/ovs-ifdown
     79--------------------------------------------------------------------
     80#!/bin/sh
     81
     82switch='br0'
     83/sbin/ifconfig $1 0.0.0.0 down
     84ovs-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],
    6589    I took these steps to bring up the bridge daemon. According to the kvm documentation,
    6690    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.''
    6892    {{{
    6993    insmod /lib/modules/2.6.38-8-server/kernel/brcompat_mod.ko
     
    7296 1. Now we're ready to install the KVM packages documented [https://help.ubuntu.com/community/KVM/Installation here], all but the bridge-utils:
    7397    {{{
    74     sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder virt-manager
     98    sudo apt-get install qemu-kvm
    7599    }}}
    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.
    77102
    78103----
    79104=== Building the client OS ===
     105This 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.
    80106
     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    {{{
     109kvm-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    {{{
     117kvm -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    {{{
     133kvm -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 ====
    81137 1. copy the install iso to some directory (I used /root)
    82138    {{{
     
    88144    [[Image(virtmannet.jpg)]]
    89145 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 
    92147refrences:
     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
    93152 * https://help.ubuntu.com/community/KVM
    94153 * http://openvswitch.org/releases/binaries/1.2.2.10448/natty_amd64/