Skip to content

Commit b627f5a

Browse files
committed
Simplifying the process of running the simulator.
* ant run-simulator - will seed the simulator jar and start CS * ant run-marvin -Dmarvin.config="/path/config/file" - will * configure a cloudstack as per the given configuration. marvin.config - defaults to a two host simulator in an advanced zone You can then connect your debugger over localhost:8787 or use the CS ui at localhost:8080/client for testing. From: Prasanna Santhanam(Prasanna.Santhanam@citrix.com)
1 parent ca43092 commit b627f5a

7 files changed

Lines changed: 368 additions & 3 deletions

File tree

‎build/build-marvin.xml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,16 @@
5656
</exec>
5757
<echo message="distributable tarball at: ${marvin.dist.dir}/Marvin-*.tar.gz"/>
5858
</target>
59+
60+
<target name="install-marvin" depends="package-marvin" description="installs marvin on the local machine">
61+
<echo message="Uninstalling Marvin" />
62+
<exec dir="${marvin.dist.dir}" executable="pip">
63+
<arg line="uninstall -y marvin"/>
64+
</exec>
65+
<echo message="Installing Marvin" />
66+
<exec dir="${marvin.dist.dir}" executable="pip">
67+
<arg value="install" />
68+
<arg value="Marvin-0.1.0.tar.gz" />
69+
</exec>
70+
</target>
5971
</project>

‎build/build-tests.xml‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
<property name="agent-simulator.jar" value="cloud-agent-simulator.jar" />
5050
<property name="testclient.jar" value="cloud-test.jar" />
5151

52+
<property name="simulator.setup.dir" value="${base.dir}/setup/db/" />
53+
<property name="marvin.sandbox.dir" value="${base.dir}/tools/marvin/marvin/sandbox/" />
54+
<property name="marvin.config" value="${base.dir}/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg" />
55+
<property name="marvin.config.abspath" location="${marvin.config}" />
5256

5357
<!-- =================== Agent Simulator ==================== -->
5458
<path id="agent-simulator.classpath">
@@ -98,12 +102,33 @@
98102
<copy todir="${agent-simulator.dist.dir}/conf">
99103
<fileset dir="${agent.dir}/conf">
100104
<include name="log4j-cloud.xml" />
101-
<include name="simulator.properties" />
102105
</fileset>
103106
</copy>
104107
</target>
105108
<!-- =================== Agent Simulator ==================== -->
106109

110+
<!-- Run Simulator Tests -->
111+
<target name="setup-simulator" depends="clean-all">
112+
<mkdir dir="${simulator.setup.dir}/override">
113+
</mkdir>
114+
<copy overwrite="true" file="${simulator.setup.dir}/templates.simulator.sql" tofile="${simulator.setup.dir}/override/templates.sql" />
115+
116+
<mkdir dir="${build.dir}/override">
117+
</mkdir>
118+
<copy overwrite="true" file="${build.dir}/replace.properties" tofile="${build.dir}/override/replace.properties" />
119+
<!-- Replace the COMPONENT-SPEC for components-simulator.xml -->
120+
<copy overwrite="true" file="${build.dir}/simulator.properties" tofile="${build.dir}/override/replace.properties" />
121+
</target>
122+
123+
<target name="run-simulator" depends="setup-simulator, build-all-with-simulator, deploy-server, deploydb-simulator, debug">
124+
</target>
125+
126+
<target name="run-marvin" depends="install-marvin">
127+
<exec dir="${marvin.sandbox.dir}/" executable="bash">
128+
<arg line="run-marvin.sh -d localhost -m localhost -c ${marvin.config.abspath}" />
129+
</exec>
130+
</target>
131+
<!-- -->
107132

108133
<!-- =================== QA Testing Client ==================== -->
109134
<target name="-init-test" depends="-init">

‎build/simulator.properties‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
DBUSER=cloud
2+
DBPW=cloud
3+
MSLOG=vmops.log
4+
APISERVERLOG=api.log
5+
DBHOST=localhost
6+
DBROOTPW=
7+
AGENTLOGDIR=logs
8+
AGENTLOG=logs/agent.log
9+
MSMNTDIR=/mnt
10+
COMPONENTS-SPEC=components-simulator.xml
11+
AWSAPILOG=awsapi.log

‎tools/marvin/marvin/sandbox/README.txt‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ Welcome to the marvin sandbox
33

44
In here you should find a few common deployment models of CloudStack that you
55
can configure with properties files to suit your own deployment. One deployment
6-
model for each of - advanced zone, basic zone and a demo are given.
6+
model for each of - advanced zone, basic zone and a simulator demo are given.
77

88
$ ls -
99
basic/
1010
advanced/
11-
demo/
11+
simulator/
1212

1313
Each property file is divided into logical sections and should be familiar to
1414
those who have deployed CloudStack before. Once you have your properties file
@@ -17,3 +17,14 @@ python script provided in the respective folder.
1717

1818
The demo files are from the tutorial for testing with python that can be found
1919
on the wiki.cloudstack.org
20+
21+
A common deployment model of a simulator.cfg that can be used for debugging is
22+
included. This will configure an advanced zone with simulators that can be used
23+
for debugging purposes when you do not have hardware to debug with.
24+
25+
To do this:
26+
$ cd cloudstack-oss/
27+
$ ant run-simulator #This will start up the mgmt server with the simulator seeded
28+
29+
## In another shell
30+
$ ant run-simulator
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"zones": [
3+
{
4+
"name": "Sandbox-simulator",
5+
"guestcidraddress": "10.1.1.0/24",
6+
"providers": [
7+
{
8+
"broadcastdomainrange": "ZONE",
9+
"name": "VirtualRouter"
10+
}
11+
],
12+
"dns1": "10.147.28.6",
13+
"vlan": "100-200",
14+
"ipranges": [
15+
{
16+
"startip": "10.147.31.2",
17+
"endip": "10.147.31.200",
18+
"netmask": "255.255.255.0",
19+
"vlan": "31",
20+
"gateway": "10.147.31.1"
21+
}
22+
],
23+
"networktype": "Advanced",
24+
"pods": [
25+
{
26+
"endip": "10.147.29.200",
27+
"name": "POD0",
28+
"startip": "10.147.29.2",
29+
"netmask": "255.255.255.0",
30+
"clusters": [
31+
{
32+
"clustername": "C0",
33+
"hypervisor": "simulator",
34+
"hosts": [
35+
{
36+
"username": "root",
37+
"url": "http://sim/c0/h0",
38+
"password": "password"
39+
},
40+
{
41+
"username": "root",
42+
"url": "http://sim/c0/h1",
43+
"password": "password"
44+
}
45+
],
46+
"clustertype": "CloudManaged",
47+
"primaryStorages": [
48+
{
49+
"url": "nfs://10.147.28.6:/export/home/sandbox/primary",
50+
"name": "PS0"
51+
}
52+
]
53+
}
54+
],
55+
"gateway": "10.147.29.1"
56+
}
57+
],
58+
"internaldns1": "10.147.28.6",
59+
"secondaryStorages": [
60+
{
61+
"url": "nfs://10.147.28.6:/export/home/sandbox/secondary"
62+
}
63+
]
64+
}
65+
],
66+
"dbSvr": {
67+
"dbSvr": "localhost",
68+
"passwd": "cloud",
69+
"db": "cloud",
70+
"port": 3306,
71+
"user": "cloud"
72+
},
73+
"logger": [
74+
{
75+
"name": "TestClient",
76+
"file": "/var/log/testclient.log"
77+
},
78+
{
79+
"name": "TestCase",
80+
"file": "/var/log/testcase.log"
81+
}
82+
],
83+
"globalConfig": [
84+
{
85+
"name": "storage.cleanup.interval",
86+
"value": "300"
87+
},
88+
{
89+
"name": "vm.op.wait.interval",
90+
"value": "5"
91+
},
92+
{
93+
"name": "default.page.size",
94+
"value": "10000"
95+
},
96+
{
97+
"name": "instance.name",
98+
"value": "QA"
99+
},
100+
{
101+
"name": "workers",
102+
"value": "10"
103+
},
104+
{
105+
"name": "use.user.concentrated.pod.allocation",
106+
"value": "false"
107+
},
108+
{
109+
"name": "account.cleanup.interval",
110+
"value": "600"
111+
},
112+
{
113+
"name": "guest.domain.suffix",
114+
"value": "sandbox.simulator"
115+
},
116+
{
117+
"name": "expunge.delay",
118+
"value": "60"
119+
},
120+
{
121+
"name": "network.gc.wait",
122+
"value": "60"
123+
},
124+
{
125+
"name": "network.gc.interval",
126+
"value": "60"
127+
},
128+
{
129+
"name": "vm.allocation.algorithm",
130+
"value": "random"
131+
},
132+
{
133+
"name": "expunge.interval",
134+
"value": "60"
135+
},
136+
{
137+
"name": "expunge.workers",
138+
"value": "3"
139+
},
140+
{
141+
"name": "check.pod.cidrs",
142+
"value": "true"
143+
},
144+
{
145+
"name": "secstorage.allowed.internal.sites",
146+
"value": "10.147.28.0/24"
147+
},
148+
{
149+
"name": "direct.agent.load.size",
150+
"value": "1000"
151+
}
152+
],
153+
"mgtSvr": [
154+
{
155+
"mgtSvrIp": "localhost",
156+
"port": 8096
157+
}
158+
]
159+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
usage() {
20+
printf "Usage: %s:\n
21+
[-m mgmt-server ] \n
22+
[-c config-file ] \n
23+
[-d db node url ]\n" $(basename $0) >&2
24+
}
25+
26+
failed() {
27+
exit $1
28+
}
29+
30+
#defaults
31+
FMT=$(date +"%d_%I_%Y_%s")
32+
MGMT_SVR="localhost"
33+
CONFIG="demo/simulator/simulator-smoke.cfg"
34+
DB_SVR="localhost"
35+
36+
while getopts 'd:m:c:' OPTION
37+
do
38+
case $OPTION in
39+
d) dflag=1
40+
DB_SVR="$OPTARG"
41+
;;
42+
m) mflag=1
43+
MGMT_SVR="$OPTARG"
44+
;;
45+
c) cflag=1
46+
CONFIG="$OPTARG"
47+
;;
48+
?) usage
49+
failed 2
50+
;;
51+
esac
52+
done
53+
54+
$(mysql -uroot -Dcloud -h$MGMT_SVR -s -N -r -e"update configuration set value='8096' where name='integration.api.port'")
55+
version_tuple=$(python -c 'import sys; print(sys.version_info[:2])')
56+
57+
if [[ $version_tuple == "(2, 7)" ]]
58+
then
59+
python -m marvin.deployAndRun -c $CONFIG -t /tmp/t.log -r /tmp/r.log -d /tmp
60+
sleep 60
61+
python -m marvin.deployAndRun -c $CONFIG -t /tmp/t.log -r /tmp/r.log -f testSetupSuccess.py -l
62+
cat /tmp/r.log
63+
echo "Done"
64+
else
65+
echo "Python version 2.7 not detected on system. Aborting"
66+
fi

0 commit comments

Comments
 (0)