Commit e908b769 authored by Robert Ricci's avatar Robert Ricci

Add an example that requests a VM with a custom size

parent c69de2dd
Pipeline #1758 passed with stage
in 2 minutes and 8 seconds
"""An example of constructing a profile with a single Xen VM.
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 the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# Create the Portal context.
pc = portal.Context()
# Create a Request object to start building the RSpec.
rspec = pg.Request()
# Create a XenVM and add it to the RSpec.
node = pg.XenVM("node")
# Ask for two cores
node.cores = 2
# Ask for 2GB of ram
node.ram = 2048
# Add an extra 8GB virtual disk.
node.disk = 8
# Add the node to the RSpec
rspec.addResource(node)
# Print the RSpec to the enclosing page.
pc.printRequestRSpec(rspec)
......@@ -74,6 +74,15 @@ profile you create unless you are doing something quite unusual. The
in this example, is very much specific to this example and you should
expect to tailor this portion of the script in each profile.
@section[#:tag "geni-lib-example-single-vm-sized"]{A VM with a custom size}
@code-sample["geni-lib-single-vm-sized.py"]
The previous example requests a VM with the default number of cores, quantity
of RAM, and disk size. It's also possible to customize these value, as this
example does by setting the @tt{cores}, @tt{ram}, and @tt{disk}
properties of the @tt{node}.
@section[#:tag "geni-lib-example-single-pc"]{A single physical host}
@code-sample["geni-lib-single-pc.py"]
......
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