-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcloudlab_profile.py
109 lines (86 loc) · 3.68 KB
/
cloudlab_profile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
"""
Allocate a cluster of CloudLab machines to run Kayak/Splinter/Sandstorm.
v1.1 Add xl170 and m510
v1.2 Allocate 400G disk space
v1.3 Allow custom image
v1.4 Rename first host to 'server'
v1.5 Change the Image type to 18.04 STD
v1.6 Add c6220
Instructions:
"""
import geni.urn as urn
import geni.portal as portal
import geni.rspec.pg as rspec
import geni.aggregate.cloudlab as cloudlab
# The possible set of base disk-images that this cluster can be booted with.
# The second field of every tupule is what is displayed on the cloudlab
# dashboard.
images = [ ("UBUNTU18-64-STD", "Ubuntu 18.04 (64-bit)") ]
# The possible set of node-types this cluster can be configured with.
nodes = [
("d430", "d430 (2 x Xeon E5 2630v3, 64 GB RAM, 10 Gbps Intel Ethernet)"),
("c6420", "c6420 (2 x Xeon Gold 6142, 384 GB RAM, 10 Gbps Intel Ethernet)"),
("c6220", "c6220 (2 x Xeon E5-2650v2, 64 GB RAM, 10 Gbps Intel Ethernet, Mellanox FDR CX3)"),
("xl170", "xl170 (2 x E5-2640v4, 64 GB RAM, Mellanox ConnectX-4)"),
("m510", "m510 (2 x Xeon-D, 64 GB RAM, Mellanox ConnectX-3)"),
]
# The set of disks to mount.
disks = [ "/dev/sdb", "/dev/sdc" ]
# Allows for general parameters like disk image to be passed in. Useful for
# setting up the cloudlab dashboard for this profile.
context = portal.Context()
# Default the disk image to 64-bit Ubuntu 16.04
context.defineParameter("image", "Disk Image",
portal.ParameterType.IMAGE, images[0], images,
"Specify the base disk image that all the nodes of the cluster " +\
"should be booted with.")
# Default the node type to the d430.
context.defineParameter("type", "Node Type",
portal.ParameterType.NODETYPE, nodes[0], nodes,
"Specify the type of nodes the cluster should be configured with. " +\
"For more details, refer to " +\
"\"http://docs.cloudlab.us/hardware.html#%28part._apt-cluster%29\"")
# Default the cluster size to 2 nodes.
context.defineParameter("size", "Cluster Size",
portal.ParameterType.INTEGER, 2, [],
"Specify the size of the cluster." +\
"To check availability of nodes, visit " +\
"\"https://www.cloudlab.us/cluster-graphs.php\"")
context.defineParameter("size_root", "The size for / (GB)", portal.ParameterType.INTEGER, 400)
params = context.bindParameters()
request = rspec.Request()
# Create a local area network over a 10 Gbps.
lan = rspec.LAN()
lan.bandwidth = 10000000 # This is in kbps.
# Setup node names.
rc_aliases = []
rc_aliases.append("server")
for i in range(1, params.size):
rc_aliases.append("sandstorm%02d" % (i))
# Setup the cluster one node at a time.
for i in range(params.size):
node = rspec.RawPC(rc_aliases[i])
node.hardware_type = params.type
node.disk_image = urn.Image(cloudlab.Utah, "emulab-ops:%s" % params.image)
# node.disk_image = urn.Image("utah.cloudlab.us", "gaia-PG0:splinter_ubt_mlx5")
bs = node.Blockstore(str(i), "/")
bs.size = str(params.size_root) + 'GB'
# Install and run the startup scripts.
node.addService(rspec.Install(
url="https://github.com/chinkulkarni/cloudLab-scripts/" +\
"archive/master.tar.gz",
path="/local"))
node.addService(rspec.Execute(
shell="sh", command="sudo mv /local/cloudLab-scripts-master " +\
"/local/scripts"))
node.addService(rspec.Execute(
shell="sh",
command="sudo /local/scripts/sandstorm_setup.sh"))
request.addResource(node)
# Add this node to the LAN.
iface = node.addInterface("eth0")
lan.addInterface(iface)
# Add the lan to the request.
request.addResource(lan)
# Generate the RSpec
context.printRequestRSpec(request)