Jump to: navigation, search

Trove-with-VMF5

CREATING A VM TO WORK WITH TROVE ON VMWARE FUSION 5

PROTIP: Save time, use Vagrant: https://github.com/ed-/trove-vagrant-vmware

LEGEND:

   * Special note
   $ execute this line on the VM as ubuntu.
   # execute this line on the VM as root.
   HOST$ execute this line as yourself on the machine hosting your VM.


GET UBUNTU

   This is the first step because it takes a while to download.
   Download the Ubuntu server 12.04 LTS 64 bit from Ubuntu.com/download/server.
   * Make sure that you get 12.04 or 12.04.1 and not 12.04.2.


OPTIONAL - MAKE A CASE-SENSITIVE FS TO SHARE YOUR CODE

   * This is for OS X only, and you should only ever have to do this once.
   Use Disk Utility and create a New Blank Disk Image.
       Name it whatever you like.
       10 Gigabytes should be plenty.
       Format should be Mac OS Extended, Case Sensitive.
           Do not pick Journaled.
       No Encryption
       Single Partition or simply Hard Disk should be fine.
       Read-Write Disk Image.
   Once that has built, automatically mount this FS.
       Open System Preferences, and click Accounts, then Login Items.
       Add a new item to the list at right by clicking +
       Find the .dmg created in the last step. This automatically mounts it to /Volumes/<the name you gave the image>
   For ease of access, create a symbolic link to this directory to your home directory.
       HOST$ ln -s /Volumes/<disk image name> ~/<disk image name>


ALTERNATE - JUST MAKE A DIRECTORY FOR THE CODE

   HOST$ mkdir Openstack-Trove


FORK OUR CODE

   Trove exists as three repos. Fork them to your own github repo at your leisure.
       github.com/openstack/trove - the codebase
       github.com/openstack/python-troveclient - the client
       github.com/openstack/trove-integration - the integration stack


GET THE CODE

   In your code directory (or your newly-mounted volume), clone your repos:
       HOST$ git clone git@github.com:<you>/python-troveclient.git
       HOST$ git clone git@github.com:<you>/trove-integration.git
       HOST$ git clone git@github.com:<you>/trove.git
   In each of the three directories, add the openstack versions as remotes:
       HOST$ pushd python-troveclient; git remote add upstream git@github.com:openstack/python-troveclient.git; popd
       HOST$ pushd trove-integration; git remote add upstream git@github.com:openstack/trove-integration.git; popd
       HOST$ pushd trove; git remote add upstream git@github.com:openstack/trove.git; popd


CREATE THE VIRTUAL MACHINE

   Open VMWare Fusion.
   Create a New VM.
   Continue without disc.
   Select the Ubuntu ISO as your install disc:
       Click "Choose disc or disc image" to open the dropdown
       Select "Choose disc or disc image", even though it is already selected.
       Find the Ubuntu ISO you just downloaded.
       Click Continue.
   Linux and Ubuntu 64bit should already be selected, so Continue.
   Deselect Easy Install. We will be doing things manually.
   You will want to customize your settings:
       Name the VM.
           Ideally, choose something to suggest that this VM is for Openstack Trove.
           You can also use the Notes section to note this.
       In Sharing, add that code directory symlink you created in ~/<disk image name>.
       In Processors and Memory:
           Give your VM at least 2048MB of memory. I recommend 3072MB.
           Enable Advanced options, and enabled the first option, the one about Hypervisor.
       Add a new Network Adapter. Now you have two.
       Remove the Sound Card.
       Remove the Printer, too.
       In Advanced, set Troubleshooting to None.


INSTALL UBUNTU

   Start up the VM
       English is fine, it is just for installation.
       Of course you will want to install Ubuntu Server.
       eth0 is your primary internet connection.
       Name your machine. I suggest something all lowercase and easy to type.
       Create your new user.
           The full name is not important.
           Choose the username ubuntu.
           Choose the password ubuntu, and confirm it.
           Acknowledge in the dialogue that 'ubuntu' is a weak password.
           Do not encrypt the home directory.
       Select Guided - Use Entire Disk when prompted.
       No http proxy is needed.
       Select openssh-server by pressing Space, and then press Enter to proceed.
       Restart the machine when prompted to end the install process.


INSTALL SOME ESSENTIALS

   Give ubuntu nopassword root on the VM:
       $ sudo su - root
       # EDITOR=vim visudo
           After the %sudo line, add the following
               ubuntu ALL=(ALL) NOPASSWD:ALL
   # apt-get update
   # apt-get install -y build-essential git-core libxml2-dev libxslt1-dev


INSTALL VMWARE TOOLS

   Use the VMWare Fusion menu, it is under Virtual Machine.
   $ sudo su - root
   # mkdir /mnt/cdrom
   # mount /dev/cdrom /mnt/cdrom
   # tar xzf /mnt/cdrom/VMwareTools* -C /tmp
   # pushd /tmp/vmware-tools-distrib
   # ./vmware-install.pl -d
   # popd


LINK THE CODEBASE INTO THE VM

   # mkdir /opt/stack
   # ln -s /mnt/hgfs/<disk image name>/trove /opt/stack/trove
   # ln -s /mnt/hgfs/<disk image name>/python-troveclient /opt/stack/python-troveclient
   # ln -s /mnt/hgfs/<disk image name>/trove-integration /home/ubuntu/trove-integration


PAVE THE WAY FOR SSH

   Use 'ifconfig eth0' to find the IP address of your VM.
   $ mkdir ~ubuntu/.ssh
   Add to your host machine .ssh/config file:
       Host <name of your vm>
           HostName <IP from ifconfig>
           User ubuntu
   From your host, copy your own ssh public key to the VM:
       HOST$ scp ~/.ssh/id_rsa.pub <name of vm>:.ssh/authorized_keys
   From your host, test that you can shell to the machine with just:
       HOST$ ssh <name of machine>
       You should not be prompted for a password.
   On the VM, edit ~/.bashrc by appending the following line to the bottom:
       cd ~/trove-integration/scripts
   On the VM, turn off those annoying ssh prompts and warnings by modifying your ssh config:
       $ mkdir -p ~/.ssh
       In that directory, create the file config and add these lines:
           Host 10.0.0.*
               StrictHostKeyChecking no
               UserKnownHostsFile /dev/null


ONE MORE TOOL TO MAKE

   Create the file ~/trove-integration/scripts/fix-iptables.sh:
       #!/bin/bash
       sudo iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE
   Then make it executable:
       $ chmod +x fix-iptables.sh


SPIN UP TROVE

   $ ./redstack install
   $ ./redstack kick-start mysql
   $ ./fix-iptables.sh


RUN THE INTEGRATION TESTS

   $ ./redstack int-tests