Commit 3ce4b5ab authored by Keith Downie's avatar Keith Downie

Added a few more code examples

parent 9013c347
......@@ -45,8 +45,8 @@ rspec = pg.Request()
node = pg.XenVM("node")
rspec.addResource(node)
#; Save the RSpec as the file rspec.xml.
rspec.write("rspec.xml")
#; Output the RSpec to the enclosing page.
printRspec(rspec)
}|
RSpec for two XenVM nodes with a LAN between them.
......@@ -76,7 +76,60 @@ link.addInterface(iface2)
#; Add the link to the RSpec.
rspec.addResource(link)
rspec.write("rspec.xml")
printRspec(rspec)
}|
Set a specific IP address to each node.
@codeblock|{
import geni.rspec.pg as pg
rspec = pg.Request()
node1 = pg.XenVM("node1")
iface1 = node1.addInterface("if1")
#; Specify the component id and the IPv4 address
iface1.component_id = "eth1"
iface1.addAddress(pg.IPv4Address("192.168.1.1", "255.255.255.0"))
rspec.addResource(node1)
node2 = pg.XenVM("node2")
iface2 = node2.addInterface("if2")
#; Specify the component id and the IPv4 address
iface2.component_id = "eth2"
iface2.addAddress(pg.IPv4Address("192.168.1.2", "255.255.255.0"))
rspec.addResource(node2)
link = pg.LAN("lan")
link.addInterface(iface1)
link.addInterface(iface2)
rspec.addResource(link)
printRspec(rspec)
}|
Specify an operating system and set install and execute scripts.
@codeblock|{
import geni.rspec.pg as pg
rspec = pg.Request()
node1 = pg.XenVM("node1")
#; Specify the URL for the disk image
node1.disk_image = "<URL to disk image>"
#; Install and execute scripts on the VM
node1.addService(pg.Install(url="<URL to the tarball file>", path="local"))
node1.addService(pg.Execute(shell="bash", command="<Path to executable>"))
rspec.addResource(node1)
printRspec(rspec)
}|
@section[#:tag "public-ip-access"]{Public IP Access}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment