-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.js
88 lines (76 loc) · 2.15 KB
/
model.js
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
cephs = {
node: Range(4).map(i => Ceph('ceph'+i))
}
cephTestMount = ["client"]
cephTest = ["server"]
merge = ["driver", "commander", "database"]
infra = {
mergeNodes: Range(merge.length).map(i => Node(merge[i])),
cephMNodes: Range(cephTest.length).map(i => NodeMount(cephTestMount[i])),
cephNodes: Range(cephTest.length).map(i => Node(cephTest[i])),
}
switch1 = {
'name': 'switch1',
'image': 'cumulusvx-3.5',
'os': 'linux',
'cpu': { 'cores': 1 },
'memory': { 'capacity': GB(1) },
}
ports = {
switch1: 1,
}
topo = {
name: 'ceph-test',
nodes: [...cephs.node, ...infra.cephNodes, ...infra.cephMNodes, ...infra.mergeNodes],
switches: [switch1],
links: [
...cephs.node.map(x => Link(x.name, 0, 'switch1', ports.switch1++)),
...cephs.node.map(x => Link(x.name, 1, 'switch1', ports.switch1++)),
...infra.mergeNodes.map(x => Link(x.name, 0, 'switch1', ports.switch1++)),
...infra.mergeNodes.map(x => Link(x.name, 1, 'switch1', ports.switch1++)),
...infra.cephNodes.map(x => Link(x.name, 0, 'switch1', ports.switch1++)),
...infra.cephNodes.map(x => Link(x.name, 1, 'switch1', ports.switch1++)),
...infra.cephMNodes.map(x => Link(x.name, 0, 'switch1', ports.switch1++)),
...infra.cephMNodes.map(x => Link(x.name, 1, 'switch1', ports.switch1++)),
]
}
function cephDisks(nameIn) {
disks = [];
for (i = 0; i < 8; i++) {
disks.push({
size: "20G",
dev: "vd" + String.fromCharCode('b'.charCodeAt() + i) ,
bus: "virtio",
})
}
return disks
}
function Ceph(nameIn) {
return ceph = {
name: nameIn,
image: 'fedora-28',
cpu: { cores: 2 },
memory: { capacity: GB(4) },
disks: cephDisks(nameIn),
};
}
function Node(nameIn) {
return ceph = {
name: nameIn,
image: 'fedora-28',
cpu: { cores: 2 },
memory: { capacity: GB(4) },
};
}
function NodeMount(nameIn) {
return ceph = {
name: nameIn,
image: 'fedora-28',
cpu: { cores: 2 },
memory: { capacity: GB(4) },
mounts: [
// where code resides
{ source: '/home/lthurlow/go/src/gitlab.com/dcomptb/cogs', point: '/home/rvn/code' },
]
};
}