示例#1
0
            portal.ParameterType.STRING, "node", advanced=True,
            longDescription="Please provide the prefix you would like to use in the names of client machines. Their full names will have the format: \"<prefix>-<number>\".")

pc.defineParameter( "clientDaemonize", "Daemonize Chef clients",
                    portal.ParameterType.BOOLEAN, False, advanced=True,
                    longDescription="Please check if you want clients to periodically pull updated from the server. If checked, please set the following parameter appropriately. Otherwise, updates need to be triggered manually from the server (using knife utility)." )

pc.defineParameter( "daemonInterval", "Seconds between daemonized client runs",
                    portal.ParameterType.INTEGER, 30, advanced=True,
                    longDescription="Choose time (in seconds) between daemonized client runs. If the previous parameter is unchecked, this value is ignored." )

params = pc.bindParameters()

# Verify our parameters and throw errors.
if params.n < 0:
    perr = portal.ParameterError("Negative numer of clients? That does not work.",['n'])
    pc.reportWarning(perr)
    pass
if params.n > 8:
    perr = portal.ParameterWarning("Are you creating a real Chef system?  Otherwise, do you really need more than 8 compute nodes?  Think of your fellow users scrambling to get nodes :).",['n'])
    pc.reportWarning(perr)
    pass

IMAGE = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU14-64-STD"

# Hostbased Auth: tarball and commands for server and clients
HBA_URL = "https://s3-us-west-2.amazonaws.com/dmdu-cloudlab/hba.tar.gz"
HBA_CMD_S = "sudo /bin/bash /root/hba-server-run.sh"
HBA_CMD_C = "sudo /bin/bash /root/hba-client-run.sh"

# Chef: tarball and command for server
示例#2
0
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
import geni.rspec.igext as IG

# Create a portal context.
pc = portal.Context()

pc.defineParameter( "n", "This is not the active branch of the MiniSup project!", portal.ParameterType.INTEGER, 2 )
params = pc.bindParameters()

# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()

if params.n < 10000:
  portal.context.reportError( portal.ParameterError( "This is not the active branch of the MiniSup project!" ) )

# Lists for the nodes and such
nodeList = []

tourDescription = \
"""
This profile provides a Slurm and Open MPI cluster installed on Ubuntu 18.04.
"""
  
# Print the RSpec to the enclosing page.
pc.printRequestRSpec(request)
示例#3
0
                   portal.ParameterType.INTEGER, 2)
pc.defineParameter('lan_latency', 'Simulated additional latency (ms)',
                   portal.ParameterType.INTEGER, 0)
pc.defineParameter('lan_packet_loss',
                   'Simulated additional packet loss (0.0 - 1.0)',
                   portal.ParameterType.STRING, '0.0')
pc.defineParameter('use_bare_metal', 'Use bare metal machines',
                   portal.ParameterType.BOOLEAN, False)

params = pc.bindParameters()

# Validate public ip count
if params.public_ip_count < 1:
    pc.reportError(
        portal.ParameterError(
            'You must allocate at least 1 additional public ip.',
            ['public_ip_count']))
pc.verifyParameters()

# Validate node count
if params.node_count < 1:
    pc.reportError(
        portal.ParameterError('You must create at least 1 node.',
                              ['node_count']))

# Validate simulated latency
if params.lan_latency < 0:
    pc.reportError(
        portal.ParameterError('The latency parameter must be positive.',
                              ['lan_latency']))
示例#4
0
pc.defineParameter("nfs_storage_size", "Size of NFS Shared Storage",
                   portal.ParameterType.STRING, "60GB", None,
                   "Size of disk partition to allocate on NFS server.")

# Datasets to connect to the cluster (shared via NFS).
pc.defineParameter("dataset_urns", "datasets",
        portal.ParameterType.STRING, "", None,
        "Space separated list of datasets to mount. All datasets are " +\
        "first mounted on the NFS server at /remote, and then mounted via " +\
        "NFS on all other nodes at /datasets/dataset-name")

params = pc.bindParameters()

if params.num_sf_per_sff < 1:
    portal.context.reportError(
        portal.ParameterError("num_sf_per_sff should be >= 1."))

if params.num_sff < 1:
    portal.context.reportError(portal.ParameterError("num_sff should be >= 1"))

# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()

# Create a dedicated network for the experiment
sff_lans = []
for i in range(params.num_sff):
    testlan = request.LAN("local_sff%02d" % (i + 1))
    testlan.best_effort = True
    testlan.vlan_tagging = True
    testlan.link_multiplexing = True
    testlan.trivial_ok = False
示例#5
0
    "prevent vm colocation on a single machine without the machine getting enough resources."
)

pc.defineParameter("prefixName",
                   "Prefix of each node's name. Default 'node'",
                   portal.ParameterType.STRING,
                   "node",
                   advanced=True)

# Retrieve the values the user specifies during instantiation.
params = pc.bindParameters()

# Check parameter validity.
if params.nodeCount < 1:
    pc.reportError(
        portal.ParameterError("You must choose at least 1 node.",
                              ["nodeCount"]))

# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()


def getNode(name, siteName):
    if params.XenVM:
        node = request.XenVM(name)
    else:
        node = request.RawPC(name)

    node.Site(siteName)
    node.cores = params.cores
    if params.memory:
        node.ram = params.memory * 1024
#
# Get any input parameter values that will override our defaults.
#
params = portal.context.bindParameters()

#
# Verify our parameters and throw errors.
#
if params.computeNodeCount > 8:
    perr = portal.ParameterWarning("Do you really need more than 8 compute nodes?  Think of your fellow users scrambling to get nodes :).",['computeNodeCount'])
    portal.context.reportWarning(perr)
    pass

if params.OSType == 'centos' and params.archType == 'arm':
    perr = portal.ParameterError("ARM architecture type is not compatible with CentOS disk image. Please choose Ubuntu with ARM architecture type.",['OSType','archType'])
    portal.context.reportError(perr)
    pass

if params.ipAllocationStrategy == 'script':
    generateIPs = True
else:
    generateIPs = False
    pass


#
# Give the library a chance to return nice JSON-formatted exception(s) and/or
# warnings; this might sys.exit().
#
portal.context.verifyParameters()
示例#7
0
pc.defineParameter("osImage", "Select OS image",
                   portal.ParameterType.IMAGE,
                   imageList[0], imageList,
                   longDescription="Most clusters have this set of images, " +
                   "pick your favorite one.")

# Optional physical type for all nodes.
pc.defineParameter("phystype",  "Optional physical node type (d710, etc)",
                   portal.ParameterType.STRING, "")

# Retrieve the values the user specifies during instantiation.
params = pc.bindParameters()

# Check parameter validity.
if params.n < 2:
    pc.reportError(portal.ParameterError("You must choose at least 2 nodes"))

nodes = []
dbnodes = []

for i in range(params.n):
    node = request.RawPC("node" + str(i))
    node.disk_image = params.osImage
    nodes.append(node)
    
for i in range(params.nDB):
    dbnode = request.RawPC("DB" + str(i))
    dbnode.disk_image = params.osImage
    dbnodes.append(dbnode)
    
sched = request.RawPC("sched")
        portal.Parameter('freq_min', 'Allowed Spectrum Lower Bound',
                         portal.ParameterType.BANDWIDTH, 2560.0),
        portal.Parameter('freq_max', 'Allowed Spectrum Upper Bound',
                         portal.ParameterType.BANDWIDTH, 2570.0)
    ])

# Bind the context parameters
params = context.bindParameters()

# Verify freq_ranges members
for i, freq_range in enumerate(params.freq_ranges):
    if freq_range.freq_max - freq_range.freq_min < 1:
        portal.context.reportError(
            portal.ParameterError(
                'Min and Max frequencies must be separated by at least 1 MHz',
                [
                    'freq_ranges[%d].freq_min' % i,
                    'freq_ranges[%d].freq_max' % i
                ]))

# Verify the context parameters
context.verifyParameters()

# Create a request object to start building the RSpec
request = portal.context.makeRequestRSpec()

# Request a compute node from the specified cluster, name it "pc", load the default os image onto it, execute
#   Faros startup operations, and create & assign a 40Gbps interface for the LAN connection (remoting & data collection)
# faros_start.sh: DHCP daemon configuration; Git submodules update; and Install SoapySDR, Python libs, and C libs
# Note that there is a private 10Gbps link between the Faros aggregation hub and this PC
pc = request.RawPC('pc')
pc.hardware_type = COMPUTE_CLUSTER
示例#9
0
pc.defineParameter("ext_uri", "External Dataset URI",
                   portal.ParameterType.STRING, "")
pc.defineParameter(
    "agree",
    "I agree to use only deidentified data",
    portal.ParameterType.BOOLEAN,
    True,
    longDescription=
    "By checking the box, I agree to store and process only deidentified data on this node."
)
params = pc.bindParameters()

# Performing the validations.
if not params.agree or params.num_nodes < 2:
    pc.reportError(
        portal.ParameterError("Cannot proceed with the experiment.",
                              [params.agree, params.num_nodes]), True)

# Setting the required NFS network options.
nfsLan = request.LAN("nfsLan")
nfsLan.best_effort = True
nfsLan.vlan_tagging = True
nfsLan.link_multiplexing = True

# Defining the NFS server.
nfsServer = request.RawPC("nfs")
nfsServer.disk_image = params.os_image

# Attaching the NFS server to LAN.
nfsLan.addInterface(nfsServer.addInterface())

# Defining the initialization script for the server
示例#10
0
# Default the cluster size to 8 nodes.
context.defineParameter("size", "Cluster Size",
        portal.ParameterType.INTEGER, 8, [],
        "Specify the size of the cluster. Please make sure there are two " +\
        "additional nodes; one for management (rcmaster), and one for " +\
        "nfs (rcnfs). To check availability of nodes, visit " +\
        "\"https://www.cloudlab.us/cluster-graphs.php\"")

params = context.bindParameters()

# Reject requests for clusters smaller than 8 nodes. Allow 2 nodes (rcmaster
# and rcnfs) for microbenchmarking.
if params.size < 8 and params.size != 2:
    context.reportError(
        portal.ParameterError("The cluster must consist of atleast 8 nodes."))

request = rspec.Request()

# Create a local area network.
lan = rspec.LAN()
request.addResource(lan)

# Setup node names so that existing RAMCloud scripts can be used on the
# cluster.
rc_aliases = ["rcmaster", "rcnfs"]
for i in range(params.size - 2):
    rc_aliases.append("rc%02d" % (i + 1))

# Setup the cluster one node at a time.
for i in range(params.size):
示例#11
0
    portal.ParameterType.STRING, 'd710')
pc.defineParameter(
    'mode', 'Type of experiment to instantiate (slate_cluster or experiment)',
    portal.ParameterType.STRING, 'slate_cluster')
pc.defineParameter('public_ip_count',
                   'The number of additional public IPs to allocate',
                   portal.ParameterType.INTEGER, 4)
pc.defineParameter('create_lan', 'Create virtual LAN',
                   portal.ParameterType.BOOLEAN, 'False')

params = pc.bindParameters()

# validate node count
if params.node_count < 1:
    pc.reportError(
        portal.ParameterError('You must choose at least 1 node.',
                              ['node_count']))

# validate public ip address count
if params.public_ip_count < 0 or params.public_ip_count > 16:
    pc.reportError(
        portal.ParameterError(
            'The number of requested ip addresses must be between 0 and 16.'),
        ['public_ip_count'])

# validate hardware choices
if params.node_type_worker not in SUPPORTED_HARDWARE_TYPES:
    pc.reportError(
        portal.ParameterError('You must choose a valid hardware type.',
                              ['node_type_worker']))
if params.node_type_master not in SUPPORTED_HARDWARE_TYPES:
    pc.reportError(
示例#12
0
def raiseError(msg):
    portal.context.reportError(portal.ParameterError(msg))
示例#13
0
# define network parameters
portal.context.defineParameter("physical_host_type",
                               "Type of physical host (d740, d840, or d820)",
                               portal.ParameterType.STRING, 'd740')

portal.context.defineParameter("node_count",
                               "The number of client nodes to create",
                               portal.ParameterType.INTEGER, 1)

# retrieve the values the user specifies during instantiation
params = portal.context.bindParameters()

# check node type validity
if params.physical_host_type not in GLOBALS.PHYSICAL_NODE_TYPES:
    portal.context.reportError(portal.ParameterError("Invalid node type."))

# check node count validity
if params.node_count < 1 or params.node_count > 30:
    portal.context.reportError(
        portal.ParameterError("Number of nodes must be between 1 and 30"))


def make_VM(name, image, instantiate_on, cores, ram):
    """Creates a VM with the specified parameters

    Returns that VM
    """
    node = request.XenVM(name)
    node.disk_image = image
    node.cores = cores
示例#14
0
# Create a Request object to start building RSpec
request = pc.makeRequestRSpec()

# Create some user-configurable parameters
pc.defineParameter('public_ip_count',
                   'The number of additional public IPs to allocate',
                   portal.ParameterType.INTEGER, 2)

params = pc.bindParameters()

# Validate parameters
if params.public_ip_count < 1:
    pc.reportError(
        portal.ParameterError(
            'You must allocate at least 1 additional public ip.',
            ['public_ip_count']))
pc.verifyParameters()

# Create two nodes
node1 = request.RawPC('node1')
node2 = request.RawPC('node2')

# Assign nodes to different sites
node1.Site("A")
node2.Site("B")

# Set node images
node1.disk_image = CENTOS7_IMG
node2.disk_image = CENTOS7_IMG
示例#15
0
                   portal.ParameterType.STRING, "60GB", [],
                   "Size of disk partition to allocate on NFS server.")

# Datasets to connect to the cluster (shared via NFS).
pc.defineParameter(
    "dataset_urns", "datasets", portal.ParameterType.STRING, "", None,
    "Space separated list of datasets to mount. All datasets are " +
    "first mounted on the NFS server at /remote, and then mounted via " +
    "NFS on all other nodes at /datasets/dataset-name")

params = pc.bindParameters()

if params.num_tor < 2 or (params.num_tor % 2) != 0:
    portal.context.reportError(
        portal.ParameterError(
            "You must specify the number of tor switches to be a multiple of two (and >=2)."
        ))

# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()

# Create a dedicated network for the experiment
tors = []
for i in range(params.num_tor):
    testlan = request.LAN("tor%02d" % (i + 1))
    testlan.best_effort = True
    testlan.vlan_tagging = True
    testlan.link_multiplexing = True
    testlan.trivial_ok = False
    testlan.bandwidth = params.bw_tor
    testlan.latency = 0.001 * params.latency_tor
示例#16
0
portal.context.defineParameter(
    "image", "Image", portal.ParameterType.IMAGE,
    "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD")
portal.context.defineParameter("node_type", "Node Type",
                               portal.ParameterType.NODETYPE, "")
portal.context.defineParameter("num_nodes", "Number of nodes",
                               portal.ParameterType.INTEGER, 1)

# Retrieve the values the user specifies during instantiation.
params = portal.context.bindParameters()

request = portal.context.makeRequestRSpec()

if params.num_nodes < 1:
    portal.context.reportError(
        portal.ParameterError("You must choose at least 1 node."))

nodes = []
for node_index in range(0, params.num_nodes):
    node = request.RawPC("node{}".format(node_index))
    nodes.append(node)
    if len(params.node_type.strip()) > 0:
        node.hardware_type = params.node_type

    node.disk_image = params.image

    node.addService(
        pg.Execute(shell="bash", command="/local/repository/hadoop.bash"))
    node.addService(
        pg.Execute(shell="bash", command="/local/repository/spark.bash"))
示例#17
0
pc.defineParameter("netflowNodes",
                   "Netflow Collector Nodes",
                   portal.ParameterType.STRING,
                   "node-5 node-cb",
                   groupId="safeedge")
pc.defineParameter("snifferNodes",
                   "OSPF Sniffer Nodes",
                   portal.ParameterType.STRING,
                   "node-9 node-2",
                   groupId="safeedge")

params = pc.bindParameters()

if params.coresPerVM < 1:
    pc.reportError(
        portal.ParameterError("Must specify at least one core per VM",
                              ['coresPerVM']))
if params.ramPerVM < 1:
    pc.reportError(
        portal.ParameterError("Must specify at least one core per VM",
                              ['ramPerVM']))
if not params.controllerNode:
    pc.reportError(
        portal.ParameterError(
            "Must specify exactly one node as the controller",
            ['controllerNode']))
if not params.netflowNodes:
    pc.reportError(
        portal.ParameterError(
            "Must specify one or more nodes as netflow collectors",
            ['netflowNodes']))
if not params.snifferNodes:
# Describe the parameter(s) this profile script can accept.
portal.context.defineParameter("n", "Number of VMs",
                               portal.ParameterType.INTEGER, 15)
#portal.context.defineParameter( "os", "disk image", portal.ParameterType.DISK_IMAGE, "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD")

# Retrieve the values the user specifies during instantiation.
params = portal.context.bindParameters()

# Create a Request object to start building the RSpec.
request = portal.context.makeRequestRSpec()

# Check parameter validity.
if params.n < 4 or params.n > 16:
    portal.context.reportError(
        portal.ParameterError(
            "You must choose at least 4 and no more than 15 VMs."))

link = request.LAN("lan")

for i in range(params.n):

    if i == 0:
        node = request.XenVM("head")
        node.addService(
            pg.Execute(
                shell="sh",
                command="sudo chmod 755 /local/repository/setup_firewall.sh"))
        node.addService(
            pg.Execute(shell="sh",
                       command="sudo /local/repository/setup_firewall.sh"))
        node.addService(
示例#19
0
# Create a portal object,
pc = portal.Context()

# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()

pc.defineParameter("node_type", "Hardware spec of nodes to use. <br> Refer <a href=\"http://docs.aptlab.net/hardware.html#%28part._apt-cluster%29\">manual</a> for more details.",
 portal.ParameterType.NODETYPE, "c6220", legalValues=["r320", "c6220"], advanced=False, groupId=None)
pc.defineParameter("num_nodes", "Number of nodes to use.<br> Check cluster availability <a href=\"https://www.cloudlab.us/cluster-graphs.php\">here</a>.",
 portal.ParameterType.INTEGER, 2, legalValues=[], advanced=False, groupId=None)

DISK_IMAGE = 'urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU16-64-STD'

params = pc.bindParameters()
if params.num_nodes < 1:
    pc.reportError(portal.ParameterError("You must choose a minimum of 1 node "))
pc.verifyParameters()

# Link link-0
link = request.Link('link-0')
link.Site('site-1')

for i in range(params.num_nodes):
    node = request.RawPC("node-%s" % i)
    node.hardware_type = params.node_type
    node.disk_image = DISK_IMAGE
    node.routable_control_ip = True
    node.Site("site-1")
    node.addService(pg.Execute(shell="bash", command="/proj/nova-PG0/mianlusc/scripts/setup/setup-ssh.sh"))
    # node.addService(pg.Execute(shell="bash", command="/proj/nova-PG0/mianlusc/scripts/setup/setup-env.sh"))
    iface = node.addInterface("interface-%s" % i)
示例#20
0
    0,
    longDescription=
    "Specify the default LAN bandwidth in Mbps for all EPC LANs. Leave at \"0\" to indicate \"best effort\". Values that do not line up with common physical interface speeds (e.g. 10, 100, or 1000) WILL cause the insertion of link shaping elements.",
    advanced=True)

#
# Get any input parameter values that will override our defaults.
#
params = pc.bindParameters()

#
# Verify parameters and setup errors/warnings to be reported back.
#
if params.NUMCLI > 32 or params.NUMCLI < 1:
    perr = portal.ParameterError(
        "You cannot ask for fewer than one or more than 32 client nodes!",
        ['NUMCLI'])
    pc.reportError(perr)

if params.NUMENB < 1 or params.NUMENB > 3:
    perr = portal.ParameterError(
        "You cannot ask for fewer than one or more than three eNodeB nodes!",
        ['NUMENB'])
    pc.reportError(perr)

if int(params.LINKBW) not in [0, 10, 100, 1000]:
    pwarn = portal.ParameterWarning(
        "You are asking for a default link bandwidth that is NOT a standard physical link speed. Link shaping resources WILL be inserted!",
        ['LINKBW'])
    pc.reportWarning(pwarn)
示例#21
0
                   3)

#pc.defineParameter( "raw", "Use physical nodes", portal.ParameterType.BOOLEAN, False )

#pc.defineParameter( "mem", "Memory per VM", portal.ParameterType.INTEGER, 256 )

pc.defineParameter("i", "OS: 0 is Ubuntu 14.04; 1 is Centos 7.1",
                   portal.ParameterType.INTEGER, 1)

params = pc.bindParameters()

rspec = RSpec.Request()

# Check parameter validity
if params.n < 3 or params.n > 96:
    perr = portal.ParameterError("You must choose from 3 to 96", ['n'])
    pc.reportError(perr)

# Check parameter for image
if params.i == 0:
    IMAGE = "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU14-64-STD"
else:
    IMAGE = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD"

#IMAGE = "urn:publicid:IDN+emulab.net+image+emulab-ops//hadoop-273"
DOWNLOAD = "https://github.com/ifding/hadoopOnGeni/raw/master/download.tar.gz"

lan = RSpec.LAN()
rspec.addResource(lan)

#name node
示例#22
0
pc.defineParameter("n", "Number of Raw machines", portal.ParameterType.INTEGER, 3)
pc.defineParameter("t", "Type of Raw machines", portal.ParameterType.STRING, "m510")
pc.defineParameter("i", "Disk Image of Raw machines", portal.ParameterType.STRING, "urn:publicid:IDN+emulab.net+image+emulab-ops:UBUNTU18-64-STD")
pc.defineParameter("s", "Data Space of Raw machines", portal.ParameterType.STRING, "30GB")
pc.defineParameter("p", "Path of BlockStorage", portal.ParameterType.STRING, "/block_store")
pc.defineParameter("d", "Data Image of Raw machines", portal.ParameterType.STRING, "")

# Retrieve the values the user specifies during instantiation
params = pc.bindParameters()

# Create a Request object to start building the RSpec
rspec = pg.Request()

# Check parameter validity
if params.n < 1 or params.n > 64:
    pc.reportError(portal.ParameterError( "You must choose from 1 to 64"))
    
# Create nodes and links
link = pg.LAN("lan")

for i in range (params.n):
    node = pg.RawPC("node-"+str(i))
    if params.s != '':
        bs = node.Blockstore("bs"+str(i), params.p)
        bs.size = params.s
    if params.d != '':
        bsimg = node.Blockstore("bsi"+str(i), "/reusable_data")
        bsimg.dataset = params.d
    node.hardware_type=params.t
    node.disk_image=params.i
    rspec.addResource(node)
示例#23
0
# Define parameters
portal.context.defineParameter( "n", "Number of VMs", portal.ParameterType.INTEGER, 4 )

# Get user specified values
params = portal.context.bindParameters()

#Create portal context
pc = portal.Context()

# Create a Request object to start building the RSpec
request = pc.makeRequestRSpec()

# Check parameters
if params.n < 1 or params.n > 4:
    pc.reportError( portal.ParameterError( "You must choose at least 1 and no more than 4 VMs." ) )

link = request.LAN("lan")

# Use a loop to create and assign values to XenVM nodes
for i in range( params.n ):
    node = request.XenVM( "node-" + str( i + 1) )
    node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD"
    if (i + 1) == 1:
        node.routable_control_ip = True
    inface = node.addInterface("if1")
    
    # Assign component id and IPv4 address
    inface.component_id = "eth1"
    inface.addAddress(rspec.IPv4Address("192.168.1." + str( i + 1 ), "255.255.255.0"))
示例#24
0
pc.defineParameter(
    "numNetworkInterface",
    "Number of Network Interface Except the Control Interface",
    portal.ParameterType.INTEGER,
    1,
    longDescription=
    "Number of Network Interface Except the Control Interface. On machine i interface j, the ip will be 192.168.{j+1}.{i}"
)

# Retrieve the values the user specifies during instantiation.
params = pc.bindParameters()

# Check parameter validity.
if params.nodeCount < 1:
    pc.reportError(
        portal.ParameterError("You must choose at least 1 node.",
                              ["nodeCount"]))

if params.tempFileSystemSize < 0 or params.tempFileSystemSize > 200:
    pc.reportError(
        portal.ParameterError(
            "Please specify a size greater then zero and " + "less then 200GB",
            ["nodeCount"]))

pc.verifyParameters()

lans = []
# Create link/lan.
for j in range(params.numNetworkInterface):
    if params.nodeCount > 1:
        if params.nodeCount == 2:
            lan = request.Link()
示例#25
0
    PNODE_D840 = "d840"  # 64 cores, 768 GB RAM


# define network parameters
portal.context.defineParameter("node_count", "Client Nodes",
                               portal.ParameterType.INTEGER, 5)
portal.context.defineParameter("router_count", "Routers",
                               portal.ParameterType.INTEGER, 3)

# retrieve the values the user specifies during instantiation
params = portal.context.bindParameters()

#  check parameter validity
if params.node_count < 1 or params.node_count > 30:
    portal.context.reportError(
        portal.ParameterError(
            "You must choose at least 1 and no more than 30 nodes."))

#  check parameter validity
if params.router_count < 1 or params.router_count > 3:
    portal.context.reportError(
        portal.ParameterError(
            "You must choose at least 1 and no more than 3 routers."))


def mkVM(name, image, instantiateOn, cores, ram):
    """Creates a VM with the specified parameters

    Returns that VM
    """
    node = request.XenVM(name)
    node.disk_image = image