Using the GeniWrapper for Gush ¶
Though not officially in the main SVN trunk, the GeniWrapper interface is currently integrated into Gush. In addition to communicating with the central database in the traditional PLC API, Gush can now talk in the GeniWrapper lingo.
Assumptions on system configurations ¶
For this example, the user name is jeannie [at] cs [dot] williams [dot] edu. Its Human-Readable Name (HRN) is plc.williams.jeannie. The slice I’m working with is williams_gush. I’m running Python 2.6 on Ubuntu 9.04. The latest version of Gush has been checked out and it was correctly configured as described in UsingGush.
Here are all the python packages you need to install:
$ sudo apt-get install python-m2crypto
Note that this is not a comprehensive list. If, for instance, the Python interpreter complains that some package XYZ is not found, run sudo apt-get install python-XYZ to install the required packages. Usually this solves the missing-package problem.
Setting up GeniWrapper for Gush ¶
First, create your private key for planetlab. In your ~/.ssh/ directory, run ssh-keygen -t rsa to generate your keypairs, id_rsa (your private key) and id_rsa.pub (your public key). It doesn’t matter whether a pass phrase is specified. Upload your public key to planetlab.
Copy your private key to the directory gush/helper-scripts/sfa/.sfi/ and rename it as jeannie.pkey. Edit the configuration file sfi_config in this directory. My sfi_config file looks like this:
SFI_AUTH='plc.williams'
SFI_USER='plc.williams.jeannie'
SFI_REGISTRY='http://www.planet-lab.org:12345/'
SFI_SM='http://www.planet-lab.org:12347/'
It is possible that you may have multiple configuration files for various types of resources. You can name them differently. Note that all of them need to be in the directory gush/helper-scripts/sfa/.sfi/.
In my case, for instance, I have williams_sfi_config which looks like this:
SFI_AUTH='plc.williams'
SFI_USER='plc.williams.jeannie'
SFI_REGISTRY='http://www.planet-lab.org:12345/'
SFI_SM='http://www.planet-lab.org:12347/'
and ksu_sfi_config that reads:
SFI_AUTH='plc.ksu'
SFI_USER='plc.ksu.jeannie'
SFI_REGISTRY='http://geni-myplc.ksu.gpeni.net:12345/'
SFI_SM='http://geni-myplc.ksu.gpeni.net:12346/'
Then, edit your gush/directory.xml file to specify resources for the GENI interface. If a resource uses the old PLC API, indicate the type as “planetlab”; to use the new GENI interface, specify “geni” as the type. Also, specify the name of the configuration file for a particular GENI resource. An example would be:
<?xml version="1.0" encoding="UTF-8"?>
<gush>
<resource_manager type="planetlab">
<user>yh1@williams.edu</user>
<allsites>allsites.xml</allsites>
<port_map slice="williams_gush" port="15000"/>
</resource_manager>
<resource_manager type="geni">
<user>plc.williams.jeannie</user>
<config_file>williams_sfi_config</config_file>
<port_map slice="williams_gush" port="15000"/>
<port_map slice="williams_kudzu" port="15000"/>
</resource_manager>
<resource_manager type="geni">
<user>plc.ksu.jeannie</user>
<config_file>ksu_sfi_config</config_file>
<port_map slice="williams_gush" port="15000"/>
</resource_manager>
<resource_manager type="ssh">
</resource_manager>
</gush>
To test whether you have configured correct, run the following command in the gush/ directory.
$ helper-scripts/handle-geniplcdb.py --noemail listall
The --noemail switch is included to speed up the process, so that the Python script will not translate the HRNs of each user into the corresponding email addresses. Try the --debug switch if you wish to see debug statements. Messy print-outs expected.
If all goes well, you should see something that looks like the following. The user names are blank because of the --noemail switch. This does not affect the performance of Gush.
$ helper-scripts/handle-geniplcdb.py --noemail listall
<?xml version="1.0"?>
<gush>
<slice name="williams_gush">
<expires>1249326806</expires>
<user name=""/>
<user name=""/>
<user name=""/>
<node name="planetlab2.ucsd.edu"/>
<node name="planetlab3.williams.edu"/>
<node name="planetlab4.williams.edu"/>
<node name="planetlab2.williams.edu"/>
<node name="planetlab1.ucsd.edu"/>
<node name="planetlab5.williams.edu"/>
<node name="planetlab3.ucsd.edu"/>
<node name="planetlab1.williams.edu"/>
</slice>
</gush>
$
Running Gush with GeniWrapper ¶
By default, Gush polls the list of resources by communicating in PLC API with the planetlab server. This is achieved through the helper-scripts/handle-plcdb.pl script. To replace it with the new GeniWrapper, run Gush with the following command:
$ ./gush -P 15890 --geni
The --geni switch (or -g for short) tells Gush to obtain the list of resources with the new GeniWrapper interface. Currently, it takes some patience for Gush to learn about your slices. When it’s done, you should see this:
$ ./gush -P 15890 -d 0 --geni
Using GeniWrapper.
Gush has learned about the slice williams_gush.
gush>
At this point, Gush is no different from that which uses the old PLC API. You can run commands and carry out experiments as you normally would. If you run info nodes, you’ll find the correct list of nodes.
gush> info nodes
There are 8 known nodes:
[ P ] williams_gush@planetlab1.ucsd.edu:15000(pref=0) (Disconnected.)
[ P ] williams_gush@planetlab2.ucsd.edu:15000(pref=0) (Disconnected.)
[ P ] williams_gush@planetlab3.ucsd.edu:15000(pref=0) (Disconnected.)
[ P ] williams_gush@planetlab1.williams.edu:15000(pref=0) (Disconnected.)
[ P ] williams_gush@planetlab2.williams.edu:15000(pref=0) (Disconnected.)
[ P ] williams_gush@planetlab3.williams.edu:15000(pref=0) (Disconnected.)
[ P ] williams_gush@planetlab4.williams.edu:15000(pref=0) (Disconnected.)
[ P ] williams_gush@planetlab5.williams.edu:15000(pref=0) (Disconnected.)
gush>