In [ ]:
sudo yum -y install git
git clone https://github.com/linhbngo/Distributed-and-Cluster-Computing.git
Always do git pull at the beginning of the class
If you have conflicts with git pull:
git stash save
git pull
This notebook is to be run inside Jupyter. If you see In [ ]: to the left of a cell, it means that this is an executable Jupyter cell.
To run a Jupyter cell, one of the followings can be done:
Run button in the tool barShift-EnterCtrl-EnterIn an executable Jupyter cell, the ! denotes a Linux command (or a sequence of commands) that will be sent to execute in the CentOS VM. All Linux commands in shell will assume a starting directory that is the current directory of the notebook.
In an executable Jupyter cell, the %% at the first line of the cell denotes a cell magic (a single configuration option that directs how the cell is executed). %%writefile is a cell magic that instruct Jupyter to not execute the remainder of the cell, but to save them in to a file whose path is specified after the cell magic.
Step 1. Set up emulab geni-lib package for CloudLab
Open a new terminal and run the following command:
$ sudo yum install -y unzip
$ conda create -n python2 python=2.7
$ source activate python2
$ conda install ipykernel
$ python -m ipykernel install --name python2 --user
$ conda install lxml
Python 2
In [ ]:
!unzip codes/cloudlab/emulab-0.9.zip -d codes/cloudlab
In [ ]:
!cd codes/cloudlab/emulab-geni-lib-1baf79cf12cb/;\
source activate python2;\
python setup.py install --user
In [ ]:
!ls /home/lngo/.local/lib/python2.7/site-packages/
In [ ]:
!rm -Rf codes/cloudlab/emulab-geni-lib-1baf79cf12cb/
Step 2: Reload geni-lib for the first time
On the top bar of this notebook, select Kernel and then Restart
In [ ]:
%%writefile codes/cloudlab/xenvm.py
"""An example of constructing a profile with a single Xen VM from CloudLab.
Instructions:
Wait for the profile instance to start, and then log in to the VM via the
ssh port specified below. (Note that in this case, you will need to access
the VM through a high port on the physical host, since we have not requested
a public IP address for the VM itself.)
"""
import geni.portal as portal
import geni.rspec.pg as rspec
# Create a Request object to start building the RSpec.
request = portal.context.makeRequestRSpec()
# Create a XenVM
node = request.XenVM("node")
node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD"
node.routable_control_ip = "true"
node.addService(rspec.Execute(shell="/bin/sh",
command="sudo yum update"))
node.addService(rspec.Execute(shell="/bin/sh",
command="sudo yum install -y httpd"))
node.addService(rspec.Execute(shell="/bin/sh",
command="sudo systemctl restart httpd.service"))
# Print the RSpec to the enclosing page.
portal.context.printRequestRSpec()
Step 3: Test emulab geni-lib installation
Executing the cell below should produce an XML element with the following content:
<rspec xmlns:client="http://www.protogeni.net/resources/rspec/ext/client/1" xmlns:emulab="http://www.protogeni.net/resources/rspec/ext/emulab/1" xmlns:jacks="http://www.protogeni.net/resources/rspec/ext/jacks/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.geni.net/resources/rspec/3" xsi:schemaLocation="http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/request.xsd" type="request">
<rspec_tour xmlns="http://www.protogeni.net/resources/rspec/ext/apt-tour/1">
<description type="markdown">An example of constructing a profile with a single Xen VM.</description>
<instructions type="markdown">Wait for the profile instance to start, and then log in to the VM via the
ssh port specified below. (Note that in this case, you will need to access
the VM through a high port on the physical host, since we have not requested
a public IP address for the VM itself.)
</instructions>
</rspec_tour>
<node client_id="node" exclusive="false">
<sliver_type name="emulab-xen"/>
</node>
</rspec>
In [ ]:
!source activate python2;\
python codes/cloudlab/xenvm.py
If things fail, where to go?
/var/tmp/start-up*
Example of designing an experimental profile for Cloud Computing infrastructure on CloudLab using geni-lib