Apache Tashi

Documentation

Setting up Tashi on a single test machine

There are several dependencies you need to setup Tashi, they include:

  • Apache Thrift
  • Xen or Qemu/KVM
  • Python 2.4 or greater
  • MySQL or sqlite if you wish to use them as the data backend

Once These are setup and configured, check out the Tashi code:

svn co http://svn.apache.org/repos/asf/incubator/tashi/trunk ./tashi

Then, run make:

mryan3@mryan3-d4:~/scratch/tashi$ make
Building tashi.services...
Generating Python code for 'services.thrift'...
Copying generated code to 'tashi.services' package...
Generatign Python code for 'messagingthrift'...
Copying generated code to 'tashi.messaging.messagingthrift' package...
Symlinking in clustermanager...
Symlinking in nodemanager...
Symlinking in tashi-client...
Building nmd...
Done

Now, you may need to need to modify some configuration parameters to make Tashi work in your environment. If you place a file called Tashi.cfg in etc, it will override settings in TashiDefaults.cfg. Some pertinent options:

  • [ClusterManager]data - This specifies whether you use a pickled data file or the SQL backend
  • [NodeManager]VmControl - This specifies which VMM backend you use

If you haven't installed Tashi in /usr/lib/python2.5/site-packages/ or the equivalent folder, you must set the PYTHONPATH environment variable so that python can find the Tashi code:

mryan3@mryan3-d4:~/scratch/tashi$ export PYTHONPATH=`pwd`/src

Start the cluster manager (CM) first:

mryan3@mryan3-d4:~/scratch/tashi$ DEBUG=1 ./bin/clustermanager.py 
2009-02-19 11:19:04,276 [./bin/clustermanager.py:INFO] Using configuration file(s) ['./etc/TashiDefaults.cfg']
2009-02-19 11:19:04,276 [./bin/clustermanager.py:INFO] Starting cluster manager


In [1]: 

I recommend running in debug mode if you haven't got it up and running yet.

Then, add your first host to Tashi. If your box's hostname was "mryan3-d4" and you used the pickled data format, you'd do:

In [1]: from tashi.services.ttypes import Host

In [2]: from tashi.services.ttypes import HostState

In [3]: data.hosts[1] = Host(d={'id':1,'name':'mryan3-d4','state': HostState.Normal,'up':False})

In [4]: data.save()

In [5]:

If you were using MySQL (or sqlite), you'd have to populate a row in the database with columns named "id", "name", "state", and "up".

Then quit the CM and restart it to force the creation of host locks.

Add a user that matches both your user name and id:

In [1]: from tashi.services.ttypes import User

In [2]: data.users[13090] = User(d={'id':13090,'name':'mryan3'})

In [3]: data.save()

Now, you can start the node manager (NM). You may have to run this as root if you have trouble gettings VMs to start as a normal user:

root@mryan3-d4:/home/mryan3/scratch/tashi$ DEBUG=1 ./bin/nodemanager.py 
2009-02-19 11:25:50,470 [__main__:INFO] Using configuration file(s) ['./etc/TashiDefaults.cfg']
2009-02-19 11:25:50,475 [./src/tashi/nodemanager/vmcontrol/qemu.pyc:INFO] No vm information found in /var/tmp/VmControlQemu/


In [1]: 

After a few seconds, you should see no error messages on the NM and you should be able to run "tashi-client getHosts":

mryan3@mryan3-d4:~/scratch/tashi$ ./bin/tashi-client.py getHosts
 id name      decayed up   state  version                      memory cores
---------------------------------------------------------------------------
 1  mryan3-d4 False   True Normal Wed Feb  4 15:20:15 EST 2009 3894   4    

Now that those are running, you can start the scheduler:

mryan3@mryan3-d4:~/scratch/tashi$ python ./src/tashi/agents/examplepolicy.py 

Make sure an image is placed in /var/tmp/images (or wherever you configured it to be):

mryan3@mryan3-d4:~/scratch/tashi$ ls -la /var/tmp/images/
total 2385696
drwxr-xr-x 2 mryan3 mryan3       4096 2009-02-19 12:21 .
drwxrwxrwt 7 root   root         4096 2009-02-19 12:20 ..
-rw-r--r-- 1 mryan3 mryan3 2440556544 2009-02-19 12:22 CentOS-5.2-i386.qcow2

And finally, you can use the client to try to create a VM:

mryan3@mryan3-d4:~/scratch/tashi$ ./bin/tashi-client.py createVm --name foobar --disks CentOS-5.2-i386.qcow2
{
    hostObj: None
    hostId: None
    name: foobar
    typeObj: {'cores': 1, 'memory': 128, 'id': 1, 'name': 'foo'}
    userId: 13090
    decayed: False
    disks: [
        {'uri': 'CentOS-5.2-i386.qcow2', 'persistent': False}
    ]
    vmId: None
    userObj: None
    state: Pending
    nics: [
        {'mac': '52:54:00:e5:1d:ca', 'network': 1}
    ]
    type: 1
    id: 1
    hints: {}
}

The VM will use a TAP device on your system and will be accessible over it. If you statically configure the guest for this test, that will work. It is also possible to setup a bridge and run a DHCP server on the host to provide IP addresses to the guest. In either case, you should be able to log into your guest shortly after that command completes.

mryan3@mryan3-d4:~/scratch/tashi$ ssh root@192.168.127.223
The authenticity of host '192.168.127.223 (192.168.127.223)' can't be established.
RSA key fingerprint is 3d:4b:43:25:05:d8:89:23:ec:9b:6c:1b:42:59:e7:70.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.127.223' (RSA) to the list of known hosts.
root@192.168.127.223's password: 
Last login: Thu Jan  8 10:25:10 2009
[root@localhost ~]# 

Setting up Tashi on a cluster

UNDER CONSTRUCTION