geni-lib-os-install-scripts.py 792 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
"""An example of constructing a profile with install and execute services.
manually.

Instructions:
Wait for the profile instance to start, and then log in to the VM via the
ssh port specified below.  The install and execute services are handled
automatically during profile instantiation, with no manual intervention
required.
"""

11
import geni.portal as portal
12
import geni.rspec.pg as pg 
13

14 15
pc = portal.Context()
rspec = pg.Request()
16

17
node1 = pg.XenVM("node1")
18 19 20 21 22

# Specify the URL for the disk image
node1.disk_image = "<URL to disk image>"

# Install and execute scripts on the VM
23 24
node1.addService(pg.Install(url="http://example.org/sample.tar.gz", path="/local"))
node1.addService(pg.Execute(shell="bash", command="/local/example.sh"))
25

26 27 28
rspec.addResource(node1)

pc.printRequestRSpec(rspec)