Merge branch 'master' into vpc

Conflicts:
	api/src/com/cloud/api/ApiConstants.java
This commit is contained in:
Alena Prokharchyk 2012-08-02 18:18:04 -07:00
commit 0e0b75a041
261 changed files with 3127 additions and 5190 deletions

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
pod_query="GET http://10.91.30.226:8096/client/?command=deletePod&id=$x HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
delete_so="GET http://10.91.30.226:8096/client/?command=deleteServiceOffering&id=$x HTTP/1.0\n\n"
echo -e $delete_so | nc -v -q 20 10.91.30.226 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
vlan_query="GET http://10.91.30.226:8096/client/?command=deleteVlanIpRange&id=$x HTTP/1.0\n\n"
echo -e $vlan_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
zoneid=$1
templateId=$2
serviceOfferingId=$3
query="GET http://10.91.30.226:8096/client/?command=deployVirtualMachine&zoneId=$1&templateId=$2&serviceOfferingId=$3&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.226:8096/client/?command=listRouters&zoneId=$1&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.28.33:8096/client/?command=listVirtualMachines&zoneId=$1&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 20 10.91.28.33 8096

View File

@ -1,53 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf "Query job result Usage: %s: -h management-server -j jobid\n" $(basename $0) >&2
}
#options
jflag=
hflag=
jobid=
host="127.0.0.1" #defaults to localhost
while getopts 'h:j:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
j) jflag=1
jobid="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ $jflag != "1" ]
then
usage
exit 2
fi
job_query="GET http://$host:8096/client/?command=queryAsyncJobResult&jobid=$jobid HTTP/1.0\n\n"
echo -e $job_query | nc -v -w 60 $host 8096

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#run.sh runs the agent simulator client.
java -cp cloud-utils.jar:agent-simulator.jar:log4j-1.2.15.jar:apache-log4j-extras-1.0.jar:ws-commons-util-1.0.2.jar:xmlrpc-client-3.1.3.jar:cloud-agent.jar:cloud-core.jar:xmlrpc-common-3.1.3.jar:javaee-api-5.0-1.jar:gson-1.3.jar:commons-httpclient-3.1.jar:commons-logging-1.1.1.jar:commons-codec-1.4.jar:commons-collections-3.2.1.jar:commons-pool-1.4.jar:.:./conf com.cloud.agent.AgentSimulator $@

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
y=$2
name=$3
pod_query="GET http://10.91.30.226:8096/client/?command=createPod&zoneId=1&name=SSP$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1
HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.226 8096
#vlan_query="GET http://10.91.30.226/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.252 HTTP/1.0\n\n"
#echo -e $vlan_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name=$1
host_query="GET http://10.91.30.226:8096/client/?command=addHost&zoneId=1&podId=$((name+250))&username=sim&password=sim&clustername=simulator-$name&hosttags=RP$name&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -w 60 10.91.30.226 8096

View File

@ -1,39 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
workers=$1
x=$2 #CIDR - 16bytes
y=$3 #CIDR - 8 bytes
for name in `seq 1 $workers`
do
pod_query="GET http://10.91.30.226:8096/client/?command=createPod&zoneId=1&name=RP$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://10.91.30.226:8096/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$((name+250))&forVirtualNetwork=false&gateway=182.$y.$x.1&netmask=255.255.255.0&startip=182.$y.$x.2&endip=182.$y.$x.252 HTTP/1.0\n\n"
so_query="GET http://10.91.30.226:8096/client/?command=createServiceOffering&name=RP$name&displayText=RP$name&storageType=local&cpuNumber=1&cpuSpeed=1000&memory=512&offerha=false&usevirtualnetwork=false&hosttags=RP$name HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w 20 10.91.30.226 8096
echo -e $vlan_query | nc -v -w 20 10.91.30.226 8096
echo -e $so_query | nc -v -w 20 10.91.30.226 8096
let x+=1
let y+=1
done

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
so_query="GET http://10.91.30.226:8096/client/?command=createServiceOffering&name=SO$x&displayText=SO$x&storageType=local&cpuNumber=1&cpuSpeed=1000&memory=512&offerha=false&usevirtualnetwork=false&hosttags=SP$x HTTP/1.0\n\n"
echo -e $so_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
y=$2
name=$3
vlan_query="GET http://10.91.30.226/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=172.$x.$y.1&netmask=255.255.255.0&startip=172.$x.$y.2&endip=172.$x.$y.252 HTTP/1.0\n\n"
echo -e $vlan_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,55 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
a=$1 #CIDR - 16bytes
b=$2 #CIDR - 8 bytes
host=$3
zoneid=$4
zone_query="GET http://$host/client/?command=createZone&networktype=Advanced&securitygroupenabled=false&name=SimulatorAdvanced&dns1=4.2.2.2&internaldns1=4.2.2.2&vlan=10-4000&guestcidraddress=10.1.1.0%2F24 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -w 120 $host 8096
let x=a
let y=b
for name in `seq 1 1`
do
pod_query="GET http://$host/client/?command=createPod&zoneid=$zoneid&name=POD$name&netmask=255.255.0.0&startIp=172.$x.$y.2&endIp=172.$x.$y.252&gateway=172.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://$host/client/?command=createVlanIpRange&forVirtualNetwork=true&vlan=untagged&zoneid=$zoneid&podId=$name&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w 20 $host 8096
echo -e $vlan_query | nc -v -w 20 $host 8096
done
let x+=1
let y+=1
name=1
clusterid=1
for cluster in `seq 1 1`
do
cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneid=$zoneid&podId=1&clustername=POD$name-CLUSTER$cluster HTTP/1.0\n\n"
echo -e $cluster_query | nc -v -w 120 $host 8096
host_query="GET http://$host/client/?command=addHost&zoneid=$zoneid&podId=1&username=sim&password=sim&clusterid=$cluster&hypervisor=Simulator&clustertype=CloudManaged&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -w 6000 $host 8096
spool_query="GET http://$host/client/?command=createStoragePool&zoneid=$zoneid&podId=1&clusterid=$cluster&name=SPOOL$cluster&url=nfs://172.1.25.$((cluster+1))/export/share/$cluster HTTP/1.0\n\n"
echo -e $spool_query | nc -v -w 6000 $host 8096
let clusterid+=1
done
sstorquery="GET http://$host/client/?command=addSecondaryStorage&zoneid=$zoneid&url=nfs://172.1.25.32/export/share/ HTTP/1.0\n\n"
echo -e $sstorquery | nc -v -w 6000 $host 8096

View File

@ -1,53 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
a=$1 #CIDR - 16bytes
b=$2 #CIDR - 8 bytes
host=$3 #MSHOST
zoneid=$4
zone_query="GET http://$host/client/?command=createZone&networktype=Basic&securitygroupenabled=false&name=SimulatorBasic&dns1=4.2.2.2&internaldns1=4.2.2.2&vlan=10-4000 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -w 120 $host 8096
let x=a
let y=b
for name in `seq $zoneid 1`
do
pod_query="GET http://$host/client/?command=createPod&zoneId=$zoneid&name=POD$name&netmask=255.255.255.0&startIp=172.$x.$y.2&endIp=172.$x.$y.252&gateway=172.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://$host/client/?command=createVlanIpRange&vlan=untagged&zoneid=$zoneid&podId=$name&forVirtualNetwork=false&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w 20 $host 8096
echo -e $vlan_query | nc -v -w 20 $host 8096
let x+=1
let y+=1
done
clusterid=1
for podid in `seq $zoneid 1`
do
cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneid=$zoneid&podId=$podid&clustername=POD$name-CLUSTER$cluster HTTP/1.0\n\n"
echo -e $cluster_query | nc -v -w 120 $host 8096
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=$podid&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged HTTP/1.0\n\n"
echo -e $host_query | nc -v -w 6000 $host 8096
let clusterid+=1
done
sstorquery="GET http://$host/client/?command=addSecondaryStorage&zoneid=$zoneid&url=nfs://172.1.25.32/export/share/ HTTP/1.0\n\n"
echo -e $sstorquery | nc -v -w 6000 $host 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
start_router="GET http://10.91.30.226:8096/client/?command=startRouter&id=$x HTTP/1.0\n\n"
echo -e $start_router | nc -v -q 60 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
test="GET http://10.91.30.226:8096/?command=listEvents&page=1 HTTP/1.0\n\n"
echo -e $test | nc -v -q 20 10.91.30.226 8096

View File

@ -1,52 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from datetime import datetime
import sys
import matplotlib.cbook as cbook
import matplotlib.image as image
import matplotlib.pyplot as plt
def formGraph(list_timedelta):
""" Draw a graph of the performance of host add response """
plt.plot(list(map(lambda x:x.seconds, list_timedelta)))
plt.ylabel("time(s) to add host")
plt.xlabel("number of hosts")
plt.title("Add Host Performance")
plt.grid(True)
plt.show()
if __name__=='__main__':
time_file=open(sys.argv[1], 'r')
timelist=[]
diffs=[]
for line in time_file.readlines():
try:
timelist.append(datetime.strptime(line.strip(), "%d %b %Y %H:%M:%S"))
except ValueError:
print "Unable to parse:",line
stime=timelist[:-1]
btime=timelist[1:]
diffs=list(map(lambda x,y: y - x,stime,btime))
formGraph(diffs)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

View File

@ -1,37 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
zoneid=$1
templateId=$2
serviceOfferingId=$3
for j in `seq 1 100`
do
let add=0
for i in `seq 1 10`
do
let account=$(($i+$add))
echo Account Name: , $account
query="GET http://127.0.0.1/client/?command=deployVirtualMachine&zoneId=$1&hypervisor=Simulator&templateId=$2&serviceOfferingId=$3&account=DummyAccount$account&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 20 127.0.0.1 8096
done
let add=add+10
sleep 60s
done

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name=$1
account_query="GET http://127.0.0.1/client/?command=createAccount&accounttype=1&email=simulator%40simulator.com&username=$name&firstname=first$name&lastname=last$name&password=5f4dcc3b5aa765d61d8327deb882cf99&account=$name&domainid=1 HTTP/1.1\n\n"
echo -e $account_query | nc -v -q 120 127.0.0.1 8096

View File

@ -1,20 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
spool_query="GET http://127.0.0.1/client/?command=createStoragePool&zoneId=1&podId=1&clusterid=1&name=SPOOL&url=nfs://10.91.25.6/export/share/1 HTTP/1.0\n\n"
echo -e $spool_query | nc -v -q 60 127.0.0.1 8096

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name=$1
account_query="GET http://127.0.0.1/client/?command=createAccount&accounttype=0&email=simulator%40simulator.com&username=$name&firstname=first$name&lastname=last$name&password=5f4dcc3b5aa765d61d8327deb882cf99&account=$name&domainid=1 HTTP/1.1\n\n"
echo -e $account_query | nc -v -q 120 127.0.0.1 8096

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
delete="GET http://127.0.0.1/client/?command=deleteAccount&id=$x HTTP/1.0\n\n"
echo -e $delete | nc -v -q 60 127.0.0.1 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
pod_query="GET http://10.91.30.219:8096/client/?command=deletePod&id=$x HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.219 8096

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
delete_so="GET http://10.91.30.219:8096/client/?command=deleteServiceOffering&id=$x HTTP/1.0\n\n"
echo -e $delete_so | nc -v -q 20 10.91.30.219 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
vlan_query="GET http://10.91.30.219:8096/client/?command=deleteVlanIpRange&id=$x HTTP/1.0\n\n"
echo -e $vlan_query | nc -v -q 20 10.91.30.219 8096

View File

@ -1,27 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
zoneid=$1
templateId=$2
serviceOfferingId=$3
networkIds=$4
query="GET http://10.91.30.219/client/?command=deployVirtualMachine&zoneId=$1&hypervisor=Simulator&templateId=$2&serviceOfferingId=$3&networkIds=$4&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 20 10.91.30.219 8096

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
destroy="GET http://10.91.30.219:8096/client/?command=destroyVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $destroy | nc -v -q 60 10.91.30.219 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.219:8096/client/?command=listCapacity&zoneId=$1&podid=$2&response=json HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.219 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
test="GET http://10.91.30.219:8096/?command=listEvents HTTP/1.0\n\n"
echo -e $test | nc -v -q 120 10.91.30.219 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.219:8096/client/?command=listHosts&zoneId=$1&account=admin&domainid=1&page=$2 HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.219 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.219:8096/client/?command=listRouters&zoneId=$1&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.219 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.219:8096/client/?command=listTemplates&templatefilter=featured&zoneid=$1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.219 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.219:8096/client/?command=listVirtualMachines&zoneId=$1&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.219 8096

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
do
start_vm="GET http://127.0.0.1:8096/client/?command=startVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $start_vm | nc -v -q 60 127.0.0.1 8096
done
sleep 60s
for x in `seq 3 1102`
do
stop_vm="GET http://127.0.0.1/client/?command=stopVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $stop_vm | nc -v -q 60 127.0.0.1 8096
done
sleep 60s

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
y=$2
for i in `seq $x $y`
do
stop_vm="GET http://127.0.0.1/client/?command=stopVirtualMachine&id=$i HTTP/1.0\n\n"
echo -e $stop_vm | nc -v -q 60 127.0.0.1 8096
done

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
y=$2
for i in `seq $x $y`
do
start_vm="GET http://127.0.0.1:8096/client/?command=startVirtualMachine&id=$i HTTP/1.0\n\n"
echo -e $start_vm | nc -v -q 60 127.0.0.1 8096
done

View File

@ -1,28 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name=$1
while [ 1 ]
do
mysql -s -r -uroot -Dcloud -h10.1.1.215 -e"select count(id),now(),max(disconnected),mgmt_server_id,status from host group by mgmt_server_id,status;" >> $1
sleep 5
echo --------------------------------------------------------------------------------------------------------------------- >> $1
done

View File

@ -1,44 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#1. 1 host per cluster
zone_query="GET http://10.91.30.219/client/?command=createZone&networktype=Advanced&securitygroupenabled=false&name=Go&dns1=4.2.2.2&internaldns1=4.2.2.2&vlan=500-1000&guestcidraddress=10.1.1.0%2F24 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -q 120 10.91.30.219 8096
pod_query="GET http://10.91.30.219/client/?command=createPod&zoneId=1&name=Guava&netmask=255.255.0.0&startIp=172.1.2.2&endIp=172.1.255.252&gateway=172.1.2.1 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 120 10.91.30.219 8096
vlan_query="GET http://10.91.30.219/client/?command=createVlanIpRange&forVirtualNetwork=true&zoneId=1&vlan=untagged&gateway=172.2.1.1&netmask=255.255.0.0&startip=172.2.1.2&endip=172.2.255.254 HTTP/1.0\n\n"
echo -e $vlan_query | nc -v -q 120 10.91.30.219 8096
for name in `seq 1 100`
do
cluster_query="GET http://10.91.30.219/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=1&podId=1&clustername=CS$name HTTP/1.0\n\n"
echo -e $cluster_query | nc -v -q 120 10.91.30.219 8096
host_query="GET http://10.91.30.219/client/api?_=1302625706202&command=addHost&zoneId=1&podId=1&clusterid=$name&hypervisor=Simulator&clustertype=CloudManaged&hosttags=&username=sim&password=sim&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -q 60 10.91.30.219 8096
spool_query="GET http://10.91.30.219/client/?command=createStoragePool&zoneId=1&podId=1&clusterid=$name&name=SPOOL$name&url=nfs://172.1.25.$name/export/share/$name HTTP/1.0\n\n"
echo -e $spool_query | nc -v -q 60 10.91.30.219 8096
done

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
y=$2
name=$3
pod_query="GET http://10.91.30.219:8096/client/?command=createPod&zoneId=1&name=SSP$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1
HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.219 8096
#vlan_query="GET http://10.91.30.219/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.252 HTTP/1.0\n\n"
#echo -e $vlan_query | nc -v -q 20 10.91.30.219 8096

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name=$1
host_query="GET http://10.91.30.219:8096/client/?command=addHost&zoneId=1&podId=$((name+250))&username=sim&password=sim&clustername=simulator-$name&hosttags=RP$name&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -q 60 10.91.30.219 8096

View File

@ -1,39 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
workers=$1
x=$2 #CIDR - 16bytes
y=$3 #CIDR - 8 bytes
for name in `seq 1 $workers`
do
pod_query="GET http://10.91.30.219:8096/client/?command=createPod&zoneId=1&name=RP$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://10.91.30.219:8096/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$((name+250))&forVirtualNetwork=false&gateway=182.$y.$x.1&netmask=255.255.255.0&startip=182.$y.$x.2&endip=182.$y.$x.252 HTTP/1.0\n\n"
so_query="GET http://10.91.30.219:8096/client/?command=createServiceOffering&name=RP$name&displayText=RP$name&storageType=local&cpuNumber=1&cpuSpeed=1000&memory=512&offerha=false&usevirtualnetwork=false&hosttags=RP$name HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.219 8096
echo -e $vlan_query | nc -v -q 20 10.91.30.219 8096
echo -e $so_query | nc -v -q 20 10.91.30.219 8096
let x+=1
let y+=1
done

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
so_query="GET http://10.91.30.219:8096/client/?command=createServiceOffering&name=SO$x&displayText=SO$x&storageType=local&cpuNumber=1&cpuSpeed=1000&memory=512&offerha=false&usevirtualnetwork=false&hosttags=SP$x HTTP/1.0\n\n"
echo -e $so_query | nc -v -q 20 10.91.30.219 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
y=$2
name=$3
vlan_query="GET http://10.91.30.219/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=172.$x.$y.1&netmask=255.255.255.0&startip=172.$x.$y.2&endip=172.$x.$y.252 HTTP/1.0\n\n"
echo -e $vlan_query | nc -v -q 20 10.91.30.219 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
start_router="GET http://10.91.30.219:8096/client/?command=startRouter&id=$x HTTP/1.0\n\n"
echo -e $start_router | nc -v -q 60 10.91.30.219 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
start_vm="GET http://10.91.30.219:8096/client/?command=startVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $start_vm | nc -v -q 60 10.91.30.219 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
stop_vm="GET http://127.0.0.1/client/?command=stopVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $stop_vm | nc -v -q 60 127.0.0.1 8096

View File

@ -1,55 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
templateid=3
account="u"
x=$1
y=$2
p=$3
q=$4
for i in `seq 1 3`
do
serviceOfferingId=10
query="GET http://127.0.0.1/client/?command=deployVirtualMachine&zoneId=$zoneid&hypervisor=Simulator&templateId=$templateid&serviceOfferingId=$serviceOfferingId&account=$account&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 20 127.0.0.1 8096
done
sleep 15s
for x in `seq $x $y`
do
destroy="GET http://127.0.0.1:8096/client/?command=destroyVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $destroy | nc -v -q 60 127.0.0.1 8096
done
sleep 240s
for i in `seq 1 30`
do
serviceOfferingId=9
query="GET http://127.0.0.1/client/?command=deployVirtualMachine&zoneId=$zoneid&hypervisor=Simulator&templateId=$templateid&serviceOfferingId=$serviceOfferingId&account=$account&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 20 127.0.0.1 8096
done
sleep 150s
for x in `seq $p $q`
do
destroy="GET http://127.0.0.1:8096/client/?command=destroyVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $destroy | nc -v -q 60 127.0.0.1 8096
done

View File

@ -1,127 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Setup Stress. Destroy and Deploy Virtual Machines on
# Guava like environment
#Environment
#1. 1 host per cluster
# Create 300 Accounts
# Deploy 300 VMs
# Destroy 300 VMs
# Repeat
usage() {
printf "Setup Stress\nUsage: %s: -h management-server -z zoneid [-d delay] [-t templateid] -s service-offering-id [-n number of accounts]\n" $(basename $0) >&2
}
create_account() {
seq=$1
account_query="GET http://$host/client/?command=createAccount&accounttype=0&email=simulator%40simulator.com&username=$account_prefix$seq&firstname=first$seq&lastname=last$seq&password=5f4dcc3b5aa765d61d8327deb882cf99&account=$account_prefix$seq&domainid=1 HTTP/1.1\n\n"
echo -e $account_query | nc -v -q 120 $host 8096
}
stress() {
#Deploy 300 VMs in these accounts
for ((i=1;i<=$numberofaccounts;i++))
do
out=$(./deployVirtualMachine.sh -h $host -z $zoneid -t $template -s $service -a $account_prefix$i)
id=$(echo $out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
echo "deployed vm with id: " $id
VmArray[$i]=$id
done
sleep $delay
rindex=$(($RANDOM%$numberofaccounts))
#Stop/Start 300 VMs at random
for ((i=1;i<=$numberofaccounts;i++))
do
./stopVirtualMachine.sh -h $host -i ${VmArray:$rindex}
rindex=$(($RANDOM%$numberofaccounts))
echo "stopped vm with id: " ${VmArray:$rindex}
./startVirtualMachine.sh -h $host -i ${VmArray:$rindex}
rindex=$(($RANDOM%$numberofaccounts))
echo "started vm with id: " ${VmArray:$rindex}
done
sleep $delay
}
#options
hflag=1
zflag=
dflag=1
tflag=1
sflag=
nflag=1
declare -a VmArray
host="127.0.0.1" #default localhost
zoneid=
delay=300 #default 5 minutes
template=2 #default centos
service=
account_prefix="USER"
numberofaccounts=300
while getopts 'h:z:d:t:s:n:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
z) zflag=1
zoneid="$OPTARG"
;;
d) dflag=1
delay="$OPTARG"
;;
t) tflag=1
template="$OPTARG"
;;
s) sflag=1
service="$OPTARG"
;;
n) nflag=1
numberofaccounts="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ $hflag$zflag$dflag$tflag$sflag$nflag != "111111" ]
then
usage
exit 2
fi
#Create 300 Accounts
#for ((i=1;i<=$numberofaccounts;i++))
#do
# create_account $i
#done
for i in {1..5}
do
#Do the stress test
stress
done

View File

@ -1,147 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
'''
# guava uses nfs storage, before setting up make sure
# * optionally turn off stats collectors
# * expunge.delay and expunge.interval are 60s
'''
from optparse import OptionParser
from configGenerator import *
import random
def getGlobalSettings():
global_settings = {'expunge.delay': '60',
'expunge.interval': '60',
'expunge.workers': '3',
'workers': '10',
'use.user.concentrated.pod.allocation': 'true',
'vm.allocation.algorithm': 'random',
'vm.op.wait.interval': '5',
'guest.domain.suffix': 'guava.simulator',
'instance.name': 'TEST',
'direct.agent.load.size': '1000',
'default.page.size': '10000',
'linkLocalIp.nums': '10',
'check.pod.cidrs': 'false',
}
for k, v in global_settings.iteritems():
cfg = configuration()
cfg.name = k
cfg.value = v
yield cfg
def describeGuavaResources(dbnode='localhost', mshost='localhost'):
zs = cloudstackConfiguration()
numberofpods = 1
clustersPerPod = 100
hostsPerCluster = 10
z = zone()
z.dns1 = '4.2.2.2'
z.dns2 = '192.168.110.254'
z.internaldns1 = '10.91.28.6'
z.internaldns2 = '192.168.110.254'
z.name = 'Guava'
z.networktype = 'Advanced'
z.guestcidraddress = '10.1.1.0/24'
z.vlan='100-3000'
p = pod()
p.name = 'POD1'
p.gateway = '172.1.2.1'
p.startip = '172.1.2.2'
p.endip = '172.1.255.252'
p.netmask = '255.255.0.0'
v = iprange()
v.vlan = 'untagged'
v.startip = '172.2.1.2'
v.endip = '172.2.255.252'
v.gateway = '172.2.1.1'
v.netmask = '255.255.0.0'
curhost = 1
for i in range(1, clustersPerPod + 1):
c = cluster()
c.clustername = 'POD1-CLUSTER' + str(i)
c.hypervisor = 'Simulator'
c.clustertype = 'CloudManaged'
for j in range(1, hostsPerCluster + 1):
h = host()
h.username = 'root'
h.password = 'password'
h.url = 'http://sim/test-%d'%(curhost)
c.hosts.append(h)
curhost = curhost + 1
ps = primaryStorage()
ps.name = 'spool'+str(i)
ps.url = 'nfs://172.16.24.32/export/path/'+str(i)
c.primaryStorages.append(ps)
p.clusters.append(c)
secondary = secondaryStorage()
secondary.url = 'nfs://172.16.25.32/secondary/path'
z.pods.append(p)
z.ipranges.append(v)
z.secondaryStorages.append(secondary)
zs.zones.append(z)
'''Add mgt server'''
mgt = managementServer()
mgt.mgtSvrIp = mshost
zs.mgtSvr.append(mgt)
'''Add a database'''
db = dbServer()
db.dbSvr = opts.dbnode
zs.dbSvr = db
'''Add some configuration'''
[zs.globalConfig.append(cfg) for cfg in getGlobalSettings()]
''''add loggers'''
testClientLogger = logger()
testClientLogger.name = 'TestClient'
testClientLogger.file = '/var/log/testclient.log'
testCaseLogger = logger()
testCaseLogger.name = 'TestCase'
testCaseLogger.file = '/var/log/testcase.log'
zs.logger.append(testClientLogger)
zs.logger.append(testCaseLogger)
return zs
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('-o', '--output', action='store', default='./guavaCfg', dest='output', help='the path where the json config file generated')
parser.add_option('-d', '--dbnode', dest='dbnode', help='hostname/ip of the database node', action='store')
parser.add_option('-m', '--mshost', dest='mshost', help='hostname/ip of management server', action='store')
(opts, args) = parser.parse_args()
cfg = describeGuavaResources(opts.dbnode, opts.mshost)
generate_setup_config(cfg, opts.output)

View File

@ -1,139 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import unittest2 as unittest
except ImportError:
import unittest
import random
import hashlib
from cloudstackTestCase import *
class Provision(cloudstackTestCase):
'''
'''
def setUp(self):
pass
def tearDown(self):
pass
def test_1_createAccounts(self, numberOfAccounts=5):
'''
Create a bunch of user accounts
'''
mdf = hashlib.md5()
mdf.update('password')
mdf_pass = mdf.hexdigest()
api = self.testClient.getApiClient()
for i in range(1, numberOfAccounts + 1):
acct = createAccount.createAccountCmd()
acct.accounttype = 0
acct.firstname = 'user' + str(i)
acct.lastname = 'user' + str(i)
acct.password = mdf_pass
acct.username = 'user' + str(i)
acct.email = 'user@example.com'
acct.account = 'user' + str(i)
acct.domainid = 1
acctResponse = api.createAccount(acct)
self.debug("successfully created account: %s, user: %s, id: %s"%(acctResponse.account, acctResponse.username, acctResponse.id))
def test_2_createServiceOffering(self):
apiClient = self.testClient.getApiClient()
createSOcmd=createServiceOffering.createServiceOfferingCmd()
createSOcmd.name='Sample SO'
createSOcmd.displaytext='Sample SO'
createSOcmd.storagetype='shared'
createSOcmd.cpunumber=1
createSOcmd.cpuspeed=100
createSOcmd.memory=128
createSOcmd.offerha='false'
createSOresponse = apiClient.createServiceOffering(createSOcmd)
return createSOresponse.id
def deployCmd(self, account, service):
deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
deployVmCmd.zoneid = 1
deployVmCmd.hypervisor='Simulator'
deployVmCmd.account=account
deployVmCmd.domainid=1
deployVmCmd.templateid=10
deployVmCmd.serviceofferingid=service
return deployVmCmd
def listVmsInAccountCmd(self, acct):
api = self.testClient.getApiClient()
listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
listVmCmd.account = acct
listVmCmd.zoneid = 1
listVmCmd.domainid = 1
listVmResponse = api.listVirtualMachines(listVmCmd)
return listVmResponse
def destroyVmCmd(self, key):
api = self.testClient.getApiClient()
destroyVmCmd = destroyVirtualMachine.destroyVirtualMachineCmd()
destroyVmCmd.id = key
api.destroyVirtualMachine(destroyVmCmd)
def test_3_stressDeploy(self):
'''
Deploy 20 Vms in each account
'''
service_id = self.test_2_createServiceOffering()
api = self.testClient.getApiClient()
for acct in range(1, 5):
[api.deployVirtualMachine(self.deployCmd('user'+str(acct), service_id)) for x in range(0,20)]
def test_4_stressDestroy(self):
'''
Cleanup all Vms in every account
'''
api = self.testClient.getApiClient()
for acct in range(1, 6):
for vm in self.listVmsInAccountCmd('user'+str(acct)):
if vm is not None:
self.destroyVmCmd(vm.id)
def test_5_combineStress(self):
for i in range(0, 5):
self.test_3_stressDeploy()
self.test_4_stressDestroy()
def deployN(self,nargs=300,batchsize=0):
'''
Deploy Nargs number of VMs concurrently in batches of size {batchsize}.
When batchsize is 0 all Vms are deployed in one batch
VMs will be deployed in 5:2:6 ratio
'''
cmds = []
if batchsize == 0:
self.testClient.submitCmdsAndWait(cmds)
else:
while len(z) > 0:
try:
newbatch = [cmds.pop() for b in range(batchsize)] #pop batchsize items
self.testClient.submitCmdsAndWait(newbatch)
except IndexError:
break

View File

@ -1,194 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
'''
# Kumquat uses nfs storage, before setting up make sure
# * optionally turn off stats collectors
# * expunge.delay and expunge.interval are 60s
'''
from optparse import OptionParser
from configGenerator import *
import random
def getGlobalSettings():
global_settings = {'expunge.delay': '60',
'expunge.interval': '60',
'capacity.skipcounting.hours': '2',
'cpu.overprovisioning.factor': '1.5',
'expunge.workers': '3',
'workers': '10',
'use.user.concentrated.pod.allocation': 'true',
'vm.allocation.algorithm': 'random',
'vm.op.wait.interval': '5',
'guest.domain.suffix': 'kumquat.simulator',
'instance.name': 'KIM',
'direct.agent.load.size': '16',
'default.page.size': '500',
'linkLocalIp.nums': '10',
'check.pod.cidrs': 'false',
'max.account.public.ips': '10000',
'max.account.snapshots': '10000',
'max.account.templates': '10000',
'max.account.user.vms': '10000',
'max.account.volumes': '10000',
}
for k, v in global_settings.iteritems():
cfg = configuration()
cfg.name = k
cfg.value = v
yield cfg
def podIpRangeGenerator():
x=1
y=2
while 1:
if y == 255:
x=x+1
if x == 255:
x=1
break
y=1
y=y+1
#pod mangement network
yield ('172.'+str(x)+'.'+str(y)+'.129', '172.'+str(x)+'.'+str(y)+'.130', '172.'+str(x)+'.'+str(y)+'.189')
def vlanIpRangeGenerator():
x=1
y=2
while 1:
if y == 255:
x=x+1
if x==255:
x=1
break
y=1
y=y+1
#vlan ip range
yield ('172.'+str(x)+'.'+str(y)+'.129', '172.'+str(x)+'.'+str(y)+'.190', '172.'+str(x)+'.'+str(y)+'.249')
def describeKumquatResources(dbnode='localhost', mshost='localhost'):
zs = cloudstackConfiguration()
numberofpods = 5
clustersPerPod = 2
hostsPerCluster = 8
curpod = 0
curhost = 0
z = zone()
z.dns1 = '4.2.2.2'
z.dns2 = '192.168.110.254'
z.internaldns1 = '10.91.28.6'
z.internaldns2 = '192.168.110.254'
z.name = 'Kumquat'
z.networktype = 'Advanced'
z.guestcidraddress = '10.1.1.0/24'
z.vlan='100-3000'
for podRange,vlanRange in zip(podIpRangeGenerator(), vlanIpRangeGenerator()):
p = pod()
curpod=curpod+1
p.name = 'POD'+str(curpod)
p.gateway=podRange[0]
p.startip=podRange[1]
p.endip=podRange[2]
p.netmask='255.255.255.128'
for i in range(1,clustersPerPod+1):
c = cluster()
c.clustername = 'POD'+str(curpod)+'-CLUSTER'+str(i)
c.hypervisor = 'Simulator'
c.clustertype = 'CloudManaged'
ps = primaryStorage()
ps.name = 'spool'+str(i)
ps.url = 'nfs://172.16.24.32/export/path/'+str(curpod)+'/'+str(i)
c.primaryStorages.append(ps)
for i in range(1, hostsPerCluster + 1):
h = host()
h.username = 'root'
h.password = 'password'
h.url = "http://sim/test-%d"%(curhost)
c.hosts.append(h)
curhost=curhost+1
p.clusters.append(c)
z.pods.append(p)
if curpod == numberofpods:
break
v = iprange()
v.vlan = 'untagged'
v.gateway='172.2.1.1'
v.startip='172.2.1.2'
v.endip='172.2.255.252'
v.netmask="255.255.0.0"
z.ipranges.append(v)
secondary = secondaryStorage()
secondary.url = 'nfs://172.16.25.32/secondary/path'
z.secondaryStorages.append(secondary)
zs.zones.append(z)
'''Add mgt server'''
mgt = managementServer()
mgt.mgtSvrIp = mshost
zs.mgtSvr.append(mgt)
'''Add a database'''
db = dbServer()
db.dbSvr = opts.dbnode
zs.dbSvr = db
'''Add some configuration'''
[zs.globalConfig.append(cfg) for cfg in getGlobalSettings()]
''''add loggers'''
testClientLogger = logger()
testClientLogger.name = 'TestClient'
testClientLogger.file = '/var/log/testclient.log'
testCaseLogger = logger()
testCaseLogger.name = 'TestCase'
testCaseLogger.file = '/var/log/testcase.log'
zs.logger.append(testClientLogger)
zs.logger.append(testCaseLogger)
return zs
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('-o', '--output', action='store', default='./KumquatCfg', dest='output', help='the path where the json config file generated')
parser.add_option('-d', '--dbnode', dest='dbnode', help='hostname/ip of the database node', action='store')
parser.add_option('-m', '--mshost', dest='mshost', help='hostname/ip of management server', action='store')
(opts, args) = parser.parse_args()
cfg = describeKumquatResources(opts.dbnode, opts.mshost)
generate_setup_config(cfg, opts.output)

View File

@ -1,259 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import unittest2 as unittest
except ImportError:
import unittest
import random
import hashlib
from cloudstackTestCase import *
import string
import time
import pdb
class Provision(cloudstackTestCase):
numberOfAccounts = 5
accounts = []
def setUp(self):
pass
def tearDown(self):
pass
def setupServiceOffering(self):
socreate = createServiceOffering.createServiceOfferingCmd()
socreate.cpunumber = 1
socreate.cpuspeed = 100
socreate.displaytext = 'Sample SO'
socreate.memory = 128
socreate.name = 'Sample SO'
api = self.testClient.getApiClient()
soresponse = api.createServiceOffering(socreate)
return soresponse.id
def test_1_createAccounts(self):
'''
Create a bunch of user accounts
'''
mdf = hashlib.md5()
mdf.update('password')
mdf_pass = mdf.hexdigest()
api = self.testClient.getApiClient()
for i in range(1, self.numberOfAccounts + 1):
acct = createAccount.createAccountCmd()
acct.accounttype = 0
name = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(10))
acct.firstname = name
acct.lastname = name
acct.password = mdf_pass
acct.username = name
acct.email = 'user@example.com'
acct.account = name
acct.domainid = 1
acctResponse = api.createAccount(acct)
self.accounts.append(acctResponse.account.name)
self.debug("created account %s with id %d:"%(acctResponse.account.name, acctResponse.account.id))
def deployCmd(self, acct):
deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
deployVmCmd.zoneid = 1
deployVmCmd.hypervisor='Simulator'
deployVmCmd.account=acct
deployVmCmd.domainid=1
deployVmCmd.templateid=10
deployVmCmd.serviceofferingid=self.setupServiceOffering()
return deployVmCmd
def destroyCmd(self, vmid):
destroyVmCmd = destroyVirtualMachine.destroyVirtualMachineCmd()
destroyVmCmd.zoneid = 1
destroyVmCmd.id = vmid
return destroyVmCmd
def startCmd(self, vmid):
startVmCmd = startVirtualMachine.startVirtualMachineCmd()
startVmCmd.id = vmid
return startVmCmd
def listVmsInAccount(self, acct):
listVm = listVirtualMachines.listVirtualMachinesCmd()
listVm.account = acct
listVm.zoneid = 1
listVm.domainid = 1
return self.testClient.getApiClient().listVirtualMachines(listVm)
def listAccounts(self, acct):
listacct = listAccounts.listAccountsCmd()
listacct.name = acct
listacct.accounttype = 0
return self.testClient.getApiClient().listAccounts(listacct)
def test_2_stressDeploy(self):
api = self.testClient.getApiClient()
for acct in self.accounts:
[api.deployVirtualMachine(self.deployCmd(acct)) for x in range(0, 25)]
def test_3_parallelDeployAndDestroy(self):
p_accts = []
#create 3 user accounts
mdf = hashlib.md5()
mdf.update('password')
mdf_pass = mdf.hexdigest()
api = self.testClient.getApiClient()
for i in range(1, 3):
acct = createAccount.createAccountCmd()
acct.accounttype = 0
name = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(10))
acct.firstname = name
acct.lastname = name
acct.password = mdf_pass
acct.username = name
acct.email = 'puser@example.com'
acct.account = name
acct.domainid = 1
acctResponse = api.createAccount(acct)
p_accts.append(acctResponse.account.name)
self.debug("created account %s under root"%name)
#deploy VMs each parallely in all three accounts
deployCmds = []
for acct in p_accts:
for i in range(0, 50):
deployCmds.append(self.deployCmd(acct))
random.shuffle(deployCmds)
self.execCmds(deployCmds)
#destroy VMs each parallely in all three accounts
destroyCmds = []
for acct in p_accts:
acctVms = self.listVmsInAccount(acct)
self.debug("%d vms deployed in account: %s. Destroying them"%(len(acctVms),acct))
for vm in acctVms[:45]:
destroyCmds.append(self.destroyCmd(vm.id))
random.shuffle(destroyCmds)
self.execCmds(destroyCmds)
for acct in p_accts:
acctVms = self.listVmsInAccount(acct)
self.assertEqual(len(acctVms), 5)
listacct = self.listAccounts(acct)
self.assertEqual(int(listacct[0].vmrunning) + int(listacct[0].vmstopped),\
int(listacct[0].vmtotal))
self.debug("%d vms found left in account: %s. Finishing Test"%(len(acctVms),acct))
def test_4_listVm(self):
allVms = self.listVmsInAccount(None)
self.debug("%d vms in all"%len(allVms))
def test_5_multipleStartRequests(self):
'''
Start a few Vms, start them again before they reach running state,
make sure the resource count remains consistent
'''
mdf = hashlib.md5()
mdf.update('password')
mdf_pass = mdf.hexdigest()
api = self.testClient.getApiClient()
acct = createAccount.createAccountCmd()
acct.accounttype = 0
name = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(10))
acct.firstname = name
acct.lastname = name
acct.password = mdf_pass
acct.username = name
acct.email = 'puser@example.com'
acct.account = name
acct.domainid = 1
acctResponse = api.createAccount(acct)
for i in range(0, 5):
resp = api.deployVirtualMachine(self.deployCmd(name))
api.startVirtualMachine(self.startCmd(resp.id))
acctVms = self.listVmsInAccount(name)
self.debug("%d vms found in account: %s."%(len(acctVms),name))
self.assertEqual(5, len(acctVms))
listacctresponse = self.listAccounts(name)
self.assertEqual(int(listacctresponse[0].vmrunning) +\
int(listacctresponse[0].vmstopped),\
int(listacctresponse[0].vmtotal))
def test_6_multipleDestroyRequests(self):
'''
Start a few Vms, destroy them, destroy them again before they reach
expunging state, make sure the resource count remains consistent
'''
mdf = hashlib.md5()
mdf.update('password')
mdf_pass = mdf.hexdigest()
api = self.testClient.getApiClient()
acct = createAccount.createAccountCmd()
acct.accounttype = 0
name = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(10))
acct.firstname = name
acct.lastname = name
acct.password = mdf_pass
acct.username = name
acct.email = 'puser@example.com'
acct.account = name
acct.domainid = 1
acctResponse = api.createAccount(acct)
vmlist = []
for i in range(0, 5):
resp = api.deployVirtualMachine(self.deployCmd(name))
vmlist.append(resp.id)
for vm in vmlist:
api.destroyVirtualMachine(self.destroyCmd(vm))
time.sleep(1)
api.destroyVirtualMachine(self.destroyCmd(vm))
acctVms = self.listVmsInAccount(name)
if acctVms is not None:
self.debug("%d vms found in account: %s."%(len(acctVms),name))
self.assertEqual(5, len(acctVms))
listacctresponse = self.listAccounts(name)
self.assertEqual(int(listacctresponse[0].vmrunning) +\
int(listacctresponse[0].vmstopped),\
int(listacctresponse[0].vmtotal))
def execCmds(self,cmds=[],batchsize=0):
'''
When batchsize is 0 all Vms are deployed in one batch
'''
if batchsize == 0:
self.testClient.submitCmdsAndWait(cmds)
else:
while len(cmds) > 0:
try:
newbatch = [cmds.pop() for b in range(batchsize)] #pop batchsize items
self.testClient.submitCmdsAndWait(newbatch)
except IndexError:
break

View File

@ -1,19 +0,0 @@
rem - Licensed to the Apache Software Foundation (ASF) under one
rem - or more contributor license agreements. See the NOTICE file
rem - distributed with this work for additional information
rem - regarding copyright ownership. The ASF licenses this file
rem - to you under the Apache License, Version 2.0 (the
rem - "License"); you may not use this file except in compliance
rem - with the License. You may obtain a copy of the License at
rem -
rem - http://www.apache.org/licenses/LICENSE-2.0
rem -
rem - Unless required by applicable law or agreed to in writing,
rem - software distributed under the License is distributed on an
rem - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
rem - KIND, either express or implied. See the License for the
rem - specific language governing permissions and limitations
rem - under the License.
java -cp cloud-utils.jar;agent-simulator.jar;log4j-1.2.15.jar;apache-log4j-extras-1.0.jar;ws-commons-util-1.0.2.jar;xmlrpc-client-3.1.3.jar;cloud-agent.jar;cloud-core.jar;xmlrpc-common-3.1.3.jar;javaee-api-5.0-1.jar;gson-1.3.jar;commons-httpclient-3.1.jar;commons-logging-1.1.1.jar;commons-codec-1.3.jar;commons-collections-3.2.1.jar;commons-pool-1.4.jar;.\;.\conf com.cloud.agent.AgentSimulator %*

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
pod_query="GET http://10.91.30.226:8096/client/?command=deletePod&id=$x HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
delete_so="GET http://10.91.30.226:8096/client/?command=deleteServiceOffering&id=$x HTTP/1.0\n\n"
echo -e $delete_so | nc -v -q 20 10.91.30.226 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
vlan_query="GET http://10.91.30.226:8096/client/?command=deleteVlanIpRange&id=$x HTTP/1.0\n\n"
echo -e $vlan_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,206 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf "Deploy many VMs: %s: -h management-server -n numberofvms [[-b batchsize] [-w wait for success] [-d db-node]]\n" $(basename $0) >&2
printf "-w option when specifed waits for successful deployment of batchsize (specifed by -b option) number of VMs. default batchsize =100\n"
}
getSgListRandom() {
num_groups=$((RANDOM%groups_per_vm))
if [[ $num_groups -eq 0 ]]; then
num_groups=1 #set back to default
fi
#form sg list string
local sg_list=""
for ((i=0;i<$num_groups;i++))
do
sgid=$((RANDOM%numberofgroups))
if [[ $sgid -eq 0 || $sgid -eq 1 ]]; then
sgid=1 #set back to default security group
sg_list=$sgid","$sg_list
continue
fi
sg_exists="GET http://$host/client/?command=listSecurityGroups&id=$sgid HTTP/1.0\n\n"
sg_out=$(echo -e $sg_exists | nc -v -q 60 $host 8096)
count=$(echo $sg_out | sed 's/\(.*<count>\)\([0-9]*\)\(.*\)/\2/g')
if [[ $count != "1" ]]; then #FAIL: Invalid security group was randomly selected
continue
fi
sg_list=$sgid","$sg_list
done
echo "$sg_list"
}
waitDeploy() {
local dbnode=$1
local batchsize=$2
while [ 1 ]
do
donecount=$(mysql -uroot -Dcloud -h$dbnode -s -r --skip-column-names -e"select count(*) from async_job where job_cmd like '%DeployVM%' and last_updated is null")
echo "[DEBUG] " $(date) " " $donecount " VMs still deploying"
if [[ $donecount == "0" || $donecount -eq 0 ]]
then
break
fi
sleep $(($donecount*2))s #2 seconds per VM
done
}
hflag=
nflag=1
wflag=
bflag=
dflag=
iterator=0
declare -a sg_array=('79' '79' '79' '79' '79' '79' '79' '79' '79')
#declare -a sg_array=('72' '73' '74' '75' '76' '77' '78' '79' '80')
host="127.0.0.1" #defaults to locahost
numberofvms=1040 #defaults
batchsize=100 #default
dbnode=
waitSuccess=false
while getopts 'h:n:b:d:w' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
n) nflag=1
numberofvms="$OPTARG"
;;
w) wflag=1
waitSuccess=true
;;
b) bflag=1
batchsize="$OPTARG"
;;
d) dflag=1
dbnode="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ $hflag$nflag != "11" ]
then
usage
exit 2
fi
if [[ $wflag == "1" && $dflag != "1" ]]
then
echo "please specify dbnode -d option"
usage
exit 2
fi
if [[ $bflag == "1" && $wflag != "1" ]]
then
echo "-w option mandatory when -b is given"
usage
exit 2
fi
tag1=$(($numberofvms*5/13))
tag2=$(($numberofvms*2/13))
tag3=$(($numberofvms*6/13))
tag1_so=9 #defaults from a regular installation
tag2_so=10
tag3_so=11
vmcount=0
echo -n "Service Offering ID with TAG1 hosttag: "
read tag1_so
echo -n "Service Offering ID with TAG2 hosttag: "
read tag2_so
echo -n "Service Offering ID with TAG3 hosttag: "
read tag3_so
echo "Deploying TAG1 VMs with Service Offering: " $tag1_so
for ((c=1;c<$tag1;c++))
do
if [[ $vmcount -eq $batchsize && waitSuccess ]]
then
waitDeploy $dbnode $batchsize
vmcount=0
fi
sglist=${sg_array[$((iterator % 9))]}
iterator=$((iterator+1))
job_out=$(./deployVirtualMachine.sh -h $host -z 1 -t 2 -s $tag1_so -u -g $sglist)
job_id=$(echo $job_out | sed 's/\(.*<jobid>\)\([0-9]*\)\(.*\)/\2/g')
vmid=$(echo $job_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
echo "[DEBUG] $(date) deployed vm: " $vmid " in job: " $job_id
vmcount=$((vmcount+1))
done
sleep 60s
echo "Deploying TAG2 VMs with Service Offering: " $tag2_so
for ((c=1;c<$tag2;c++))
do
if [[ $vmcount -eq $batchsize && wflag == "1" ]]
then
waitDeploy $dbnode $batchsize
vmcount=0
fi
sglist=${sg_array[$((iterator % 9))]}
iterator=$((iterator+1))
job_out=$(./deployVirtualMachine.sh -h $host -z 1 -t 2 -s $tag2_so -u -g $sglist)
job_id=$(echo $job_out | sed 's/\(.*<jobid>\)\([0-9]*\)\(.*\)/\2/g')
vmid=$(echo $job_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
echo "[DEBUG] $(date) deployed vm: " $vmid " in job: " $job_id
vmcount=$((vmcount+1))
done
sleep 60s
echo "Deploying TAG3 VMs with Service Offering: " $tag3_so
for ((c=1;c<$tag3;c++))
do
if [[ $vmcount -eq $batchsize && wflag == "1" ]]
then
waitDeploy $dbnode $batchsize
vmcount=0
fi
sglist=${sg_array[$((iterator % 9))]}
iterator=$((iterator+1))
job_out=$(./deployVirtualMachine.sh -h $host -z 1 -t 2 -s $tag3_so -u -g $sglist)
job_id=$(echo $job_out | sed 's/\(.*<jobid>\)\([0-9]*\)\(.*\)/\2/g')
vmid=$(echo $job_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
echo "[DEBUG] $(date) deployed vm: " $vmid " in job: " $job_id
vmcount=$((vmcount+1))
done

View File

@ -1,159 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf "Deploy many VMs: %s: -h management-server -n numberofvms [[-b batchsize] [-w wait for success] [-d db-node]]\n" $(basename $0) >&2
}
waitDeploy() {
local dbnode=$1
local batchsize=$2
while [ 1 ]
do
donecount=$(mysql -uroot -Dcloud -h$dbnode -s -r --skip-column-names -e"select count(*) from async_job where job_cmd like '%DeployVM%' and last_updated is null")
echo "[DEBUG] " $(date) " " $donecount " VMs still deploying"
if [[ $donecount == "0" || $donecount -eq 0 ]]
then
break
fi
sleep $(($donecount*2))s #2 seconds per VM
done
}
hflag=
nflag=1
wflag=
bflag=
dflag=
iterator=0
host="127.0.0.1" #defaults to locahost
numberofvms=1040 #defaults
numberofgroups=
groups_per_vm=1 #default one group per vm
batchsize=100
waitSuccess=false
while getopts 'h:n:b:d:w' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
n) nflag=1
numberofvms="$OPTARG"
;;
w) wflag=1
waitSuccess=true
;;
b) bflag=1
batchsize="$OPTARG"
;;
d) dflag=1
dbnode="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ $hflag$nflag != "11" ]
then
usage
exit 2
fi
if [[ $wflag == "1" && $dflag != "1" ]]
then
echo "please specify dbnode -d option"
usage
exit 2
fi
if [[ $bflag == "1" && $wflag != "1" ]]
then
echo "-w option mandatory when -b is given"
usage
exit 2
fi
tag1=$(($numberofvms*5/13))
tag2=$(($numberofvms*2/13))
tag3=$(($numberofvms*6/13))
tag1_so=9 #defaults from a regular installation
tag2_so=10
tag3_so=11
vmcount=0
echo -n "Service Offering ID with TAG1 hosttag: "
read tag1_so
echo -n "Service Offering ID with TAG2 hosttag: "
read tag2_so
echo -n "Service Offering ID with TAG3 hosttag: "
read tag3_so
echo "Deploying TAG1 VMs with Service Offering: " $tag1_so
for ((c=1;c<$tag1;c++))
do
if [[ $vmcount -eq $batchsize && waitSuccess ]]
then
waitDeploy $dbnode $batchsize
vmcount=0
fi
job_out=$(./deployVirtualMachine.sh -h $host -z 1 -t 2 -s $tag1_so -u)
job_id=$(echo $job_out | sed 's/\(.*<jobid>\)\([0-9]*\)\(.*\)/\2/g')
vmid=$(echo $job_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
echo "[DEBUG] $(date) deployed vm: " $vmid " in job: " $job_id
vmcount=$((vmcount+1))
done
echo "Deploying TAG2 VMs with Service Offering: " $tag2_so
for ((c=1;c<$tag2;c++))
do
if [[ $vmcount -eq $batchsize && waitSuccess ]]
then
waitDeploy $dbnode $batchsize
vmcount=0
fi
job_out=$(./deployVirtualMachine.sh -h $host -z 1 -t 2 -s $tag2_so -u)
job_id=$(echo $job_out | sed 's/\(.*<jobid>\)\([0-9]*\)\(.*\)/\2/g')
vmid=$(echo $job_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
echo "[DEBUG] $(date) deployed vm: " $vmid " in job: " $job_id
vmcount=$((vmcount+1))
done
echo "Deploying TAG3 VMs with Service Offering: " $tag3_so
for ((c=1;c<$tag3;c++))
do
if [[ $vmcount -eq $batchsize && waitSuccess ]]
then
waitDeploy $dbnode $batchsize
vmcount=0
fi
job_out=$(./deployVirtualMachine.sh -h $host -z 1 -t 2 -s $tag3_so -u)
job_id=$(echo $job_out | sed 's/\(.*<jobid>\)\([0-9]*\)\(.*\)/\2/g')
vmid=$(echo $job_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
echo "[DEBUG] $(date) deployed vm: " $vmid " in job: " $job_id
vmcount=$((vmcount+1))
done

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
zoneid=$1
templateId=$2
serviceOfferingId=$3
query="GET http://10.91.30.226:8096/client/?command=deployVirtualMachine&zoneId=$1&templateId=$2&serviceOfferingId=$3&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,52 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf "Destroy System Virtual Machine\nUsage: %s: -h management-server-ip -i vmid\n" $(basename $0) >&2
}
hflag=
iflag=
vmid=
host="127.0.0.1" #defaults to localhost
while getopts 'h:i:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
i) iflag=1
vmid="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [[ $iflag != "1" ]]
then
usage
exit 2
fi
destroy="GET http://$host:8096/client/?command=destroySystemVm&id=$vmid HTTP/1.0\n\n"
echo -e $destroy | nc -v -w 60 $host 8096

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
destroy="GET http://10.91.30.226:8096/client/?command=destroyVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $destroy | nc -v -q 60 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.226:8096/client/?command=listCapacity&zoneId=$1&podid=$2&response=json HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
test="GET http://10.91.30.226:8096/?command=listEvents&page=1 HTTP/1.0\n\n"
echo -e $test | nc -v -q 120 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.226:8096/client/?command=listHosts&zoneId=$1&account=admin&domainid=1&page=$2 HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.226:8096/client/?command=listRouters&zoneId=$1&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.226 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.212:8096/client/?command=listTemplates&templatefilter=featured&zoneid=$1 HTTP/1.0\n\n"
echo -e $query | nc -v -w 120 10.91.30.212 8096

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query="GET http://10.91.30.226:8096/client/?command=listVirtualMachines&zoneId=$1&account=admin&domainid=1 HTTP/1.0\n\n"
echo -e $query | nc -v -q 120 10.91.30.226 8096

View File

@ -1,36 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
while [ 1 ]
do
echo ==== $(date) ====
# mysql -uroot -Dcloud -h$host -e"select count(*), status, mgmt_server_id from host group by status, mgmt_server_id;"
mysql -uroot -Dcloud -h$host -e"select count(*), state, type from vm_instance group by state, type;"
mysql -uroot -Dcloud -h$host -e"select avg(timestampdiff(second,created,last_updated)),count(id),job_cmd,job_status,job_result_code from async_job where last_updated is not null group by job_cmd,job_status,job_result_code;"
mysql -uroot -Dcloud -h$host -e "select count(*) as locks from op_lock;"
echo === last 5 successful DeployVM ===
mysql -uroot -Dcloud -h$host -e"select created,last_updated,id, timestampdiff(second,created,last_updated) from async_job where job_cmd like '%DeployVM%' and job_result_code=0 and last_updated is not null order by id desc limit 5;"
echo === nwgroup status ===
mysql -uroot -Dcloud -h$host -e"select step, count(*) from op_nwgrp_work group by step;"
mysql -uroot -Dcloud -h$host -e"select avg(timestampdiff(second,created,taken)), count(id),mgmt_server_id from op_nwgrp_work where step='Done' and taken is not null and created < taken group by mgmt_server_id;"
mysql -uroot -Dcloud -h$host -e"select id,mgmt_server_id,instance_id,created,taken,timestampdiff(second,created,taken) from op_nwgrp_work where taken is not null and created!=taken order by id desc limit 5;"
echo
echo
echo
sleep 30s
done

View File

@ -1,228 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# zucchini uses local storage, before setting up make sure
# * xen.public.network.device is set
# * use.local.storage and systemvm.use.local.storage are true
# * optionally turn off stats collectors
# * expunge.delay and expunge.interval are 60s
# * ping.interval is around 3m
# * turn off dns updates to entire zone, network.dns.basiczone.update=pod
# * capacity.skipcounting.hours=0
# * direct.agent.load.size=1000
# This script will only setup an approximate number of hosts. To achieve the ratio
# by 13. So if 4000 hosts are added, you might see only 3900 come up
# 10 hosts per pod @ 1 host per cluster in a single zone
# Each pod has a /25, so 128 addresses. I think we reserved 5 IP addresses for system VMs in each pod.
# Then we had something like 60 addresses for hosts and 60 addresses for VMs.
#Environment
#1. Approximately 10 hosts per pod.
#2. Only 3 host tags.
#3. With in each pod, the host tags are the same. Homogenous Pods
#5. In simulator.properties, workers=1
usage() {
printf "Setup Zucchini Like Environment\nUsage: %s: -h management-server -z zoneid [-d delay] -n numberofhosts\n" $(basename $0) >&2
}
a=1 #CIDR - 16bytes
b=2 #CIDR - 8 bytes
#options
hflag=1
zflag=
dflag=1
nflag=1
host="127.0.0.1" #default localhost
zoneid=
delay=300 #default 5 minutes
numberofhosts=1300 #default 1300 hosts
tag1="TAG1"
tag2="TAG2"
tag3="TAG3"
while getopts 'h:z:d:n:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
z) zflag=1
zoneid="$OPTARG"
;;
d) dflag=1
delay="$OPTARG"
;;
n) nflag=1
numberofhosts="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ $zflag$nflag != "11" ]
then
usage
exit 2
fi
numberofpods=$(($numberofhosts/10)) #10 hosts per pod
tag_one_range=$(($numberofpods*5/13))
tag_two_range=$(($numberofpods*2/13))
tag_three_range=$(($numberofpods-$tag_one_range-$tag_two_range))
clusters_per_pod=10 #each cluster has one host
hosts_per_pod=10
declare -a pod_array
declare -a cluster_array
echo "Split Ratio :: " $tag_one_range":"$tag_two_range":"$tag_three_range
#create the zone
zone_query="GET http://$host/client/?command=createZone&networktype=Basic&securitygroupenabled=false&name=Zucchini&dns1=4.2.2.2&internaldns1=4.2.2.2 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -w $delay $host 8096
#Add Secondary Storage
sstor_query="GET http://$host/client/?command=addSecondaryStorage&zoneid=$zoneid&url=nfs://172.16.15.32/export/share/secondary HTTP/1.0\n\n"
echo -e $sstor_query | nc -v -w $delay $host 8096
let x=a
let y=b
echo "[DEBUG] $(date) Starting Creation of $numberofpods Pods"
for ((name=1;name<=$numberofpods;name++))
do
echo "[DEBUG] $(date) Creating pod[POD$name]"
pod_query="GET http://$host/client/?command=createPod&zoneId=$zoneid&name=POD$name&netmask=255.255.255.128&startIp=172.$x.$y.130&endIp=172.$x.$y.189&gateway=172.$x.$y.129 HTTP/1.0\n\n"
pod_out=$(echo -e $pod_query | nc -v -w $delay $host 8096)
pod_id=$(echo $pod_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$pod_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) pod [POD$name] creation failed"; continue
fi
echo "[DEBUG] $(date) Created pod["$pod_id":POD"$name"]"
pod_array[$name]=$pod_id
echo "[DEBUG] $(date) Creating vlan for pod[POD$name]"
vlan_query="GET http://$host/client/?command=createVlanIpRange&vlan=untagged&zoneid=$zoneid&podId=$pod_id&forVirtualNetwork=false&gateway=172.$x.$y.129&netmask=255.255.255.128&startip=172.$x.$y.190&endip=172.$x.$y.249 HTTP/1.0\n\n"
vlan_out=$(echo -e $vlan_query | nc -v -w $delay $host 8096)
vlan_id=$(echo $vlan_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$vlan_id" =~ ^[0-9]+$ ]] ; then
let y+=1
if [ "$y" -eq 256 ]
then
let x+=1
y=1
fi
exec >&2; echo "[ERROR] $(date) vlan creation for pod[POD$name] failed"; continue
fi
echo "[DEBUG] $(date) Created vlan for pod[POD$name]"
#add clusters
echo "[DEBUG] $(date) Starting Creation of $clusters_per_pod clusters for pod[POD$name]"
for ((cluster=1;cluster<=$clusters_per_pod;cluster++))
do
echo "[DEBUG] $(date) Creating cluster[POD$name-CLUSTER$cluster] for pod[POD$name]"
cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=$zoneid&podId=$pod_id&clustername=POD$name-CLUSTER$cluster HTTP/1.0\n\n"
cluster_out=$(echo -e $cluster_query | nc -v -w $delay $host 8096)
cluster_id=$(echo $cluster_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$cluster_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) cluster[POD$name-CLUSTER$cluster] creation for pod[POD$name] failed"; continue
fi
echo "[DEBUG] $(date) Created cluster["$cluster_id":POD"$name"-CLUSTER"$cluster"]"
cluster_array[$(($name*$clusters_per_pod + $cluster))]=$cluster_id
done
echo "[DEBUG] $(date) Finished Creating clusters for pod[POD$name]"
let y+=1
if [ "$y" -eq 256 ]
then
let x+=1
y=1
fi
done
echo "[DEBUG] $(date) Finished Creating $numberofpods Pods"
#echo "DEBUG:Pods and Clusters"
#echo "PODS:("${#pod_array[@]}")" ${pod_array[@]}
#echo "CLUSTERS:("${#cluster_array[@]}")" ${cluster_array[@]}
echo
echo
#Add hosts
#TAG1
for ((i=1;i<=$tag_one_range;i++))
do
podid=${pod_array[$i]}
for ((j=1;j<=$hosts_per_pod;j++))
do
clusterid=${cluster_array[$(($i*$clusters_per_pod + $j))]}
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=$podid&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag1 HTTP/1.0\n\n"
host_out=$(echo -e $host_query | nc -v -w $delay $host 8096)
host_id=$(echo $host_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$host_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) host addition failed in [pod:$podid,cluster:$clusterid]"; continue
fi
host_name=$(echo $host_out | sed 's/\(.*<name>\)\(SimulatedAgent.[-0-9a-zA-Z]*\)\(.*\)/\2/g')
echo "[DEBUG] $date added host [$host_id:$host_name] to [pod:$podid,cluster:$clusterid] for TAG1"
done
done
#TAG2
for ((i=$(($tag_one_range + 1));i<=$(($tag_one_range + $tag_two_range));i++))
do
podid=${pod_array[$i]}
for ((j=1;j<=$hosts_per_pod;j++))
do
clusterid=${cluster_array[$(($i*$clusters_per_pod + $j))]}
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=$podid&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag2 HTTP/1.0\n\n"
host_out=$(echo -e $host_query | nc -v -w $delay $host 8096)
host_id=$(echo $host_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$host_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) host addition failed in [pod:$podid,cluster:$clusterid]"; continue
fi
host_name=$(echo $host_out | sed 's/\(.*<name>\)\(SimulatedAgent.[-0-9a-zA-Z]*\)\(.*\)/\2/g')
echo "[DEBUG] $date added host [$host_id:$host_name] to [pod:$podid,cluster:$clusterid] for TAG2"
done
done
#TAG3
for ((i=$(($tag_two_range + $tag_one_range + 1));i<=$(($tag_three_range + $tag_two_range + $tag_one_range));i++))
do
podid=${pod_array[$i]}
for ((j=1;j<=$hosts_per_pod;j++))
do
clusterid=${cluster_array[$(($i*$clusters_per_pod + $j))]}
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=$podid&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag3 HTTP/1.0\n\n"
host_out=$(echo -e $host_query | nc -v -w $delay $host 8096)
host_id=$(echo $host_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$host_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) host addition failed in [pod:$podid,cluster:$clusterid]"; continue
fi
host_name=$(echo $host_out | sed 's/\(.*<name>\)\(SimulatedAgent.[-0-9a-zA-Z]*\)\(.*\)/\2/g')
echo "[DEBUG] $date added host [$host_id:$host_name] to [pod:$podid,cluster:$clusterid] for TAG3"
done
done
echo "Setup complete"
exit 0

View File

@ -1,28 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name=$1
while [ 1 ]
do
mysql -s -r -uroot -Dcloud -h10.1.1.215 -e"select count(id),now(),max(disconnected),mgmt_server_id,status from host group by mgmt_server_id,status;" >> $1
sleep 5
echo --------------------------------------------------------------------------------------------------------------------- >> $1
done

View File

@ -1,90 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#1. Approximately 10 hosts per pod.
#2. Only 3 host tags.
a=$1 #CIDR - 16bytes
b=$2 #CIDR - 8 bytes
zone_query="GET http://10.91.30.219/client/?command=createZone&name=Zucchini&dns1=4.2.2.2&internaldns1=4.2.2.2&vlan=10-4000&guestcidraddress=10.1.1.0%2F24 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -q 120 10.91.30.219 8096
# Pod Ratio: 38:15:47 @ 10 hosts per pod
let x=a
let y=b
for name in `seq 1 152`
do
pod_query="GET http://10.91.30.219:8096/client/?command=createPod&zoneId=1&name=POD$name&cidr=172.$x.$y.0%2F24&startIp=172.$x.$y.2&endIp=172.$x.$y.252&gateway=172.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://10.91.30.219:8096/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.219 8096
echo -e $vlan_query | nc -v -q 20 10.91.30.219 8096
for cluster in `seq 1 10`
do
host_query="GET http://10.91.30.219:8096/client/?command=addHost&zoneId=1&podId=$name&username=sim&password=sim&clustername=simulator-POD$name-CLUSTER$cluster&hosttags=TAG1&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -q 6000 10.91.30.219 8096
done
let x+=1
let y+=1
done
#reset for tag2
let x=a
let y=b
for name in `seq 153 212`
do
pod_query="GET http://10.91.30.219:8096/client/?command=createPod&zoneId=1&name=POD$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://10.91.30.219:8096/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=182.$y.$x.1&netmask=255.255.255.0&startip=182.$y.$x.2&endip=182.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.219 8096
echo -e $vlan_query | nc -v -q 20 10.91.30.219 8096
for cluster in `seq 1 10`
do
host_query="GET http://10.91.30.219:8096/client/?command=addHost&zoneId=1&podId=$name&username=sim&password=sim&clustername=simulator-POD$name-CLUSTER$cluster&hosttags=TAG2&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -q 6000 10.91.30.219 8096
done
let x+=1
let y+=1
done
#reset for TAG3
let x=a
let y=b
for name in `seq 213 400`
do
pod_query="GET http://10.91.30.219:8096/client/?command=createPod&zoneId=1&name=POD$name&cidr=192.$x.$y.0%2F24&startIp=192.$x.$y.2&endIp=192.$x.$y.252&gateway=192.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://10.91.30.219:8096/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=192.$y.$x.1&netmask=255.255.255.0&startip=192.$y.$x.2&endip=192.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.219 8096
echo -e $vlan_query | nc -v -q 20 10.91.30.219 8096
for cluster in `seq 1 10`
do
host_query="GET http://10.91.30.219:8096/client/?command=addHost&zoneId=1&podId=$name&username=sim&password=sim&clustername=simulator-POD$name-CLUSTER$cluster&hosttags=TAG3&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -q 6000 10.91.30.219 8096
done
let x+=1
let y+=1
done

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
y=$2
name=$3
pod_query="GET http://10.91.30.212:8096/client/?command=createPod&zoneId=1&name=SSP$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1
HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w 20 10.91.30.212 8096
#vlan_query="GET http://10.91.30.212/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.252 HTTP/1.0\n\n"
#echo -e $vlan_query | nc -v -w 20 10.91.30.212 8096

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name=$1
host_query="GET http://10.91.30.226:8096/client/?command=addHost&zoneId=1&podId=$((name+250))&username=sim&password=sim&clustername=simulator-$name&hosttags=RP$name&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -q 60 10.91.30.226 8096

View File

@ -1,39 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
workers=$1
x=$2 #CIDR - 16bytes
y=$3 #CIDR - 8 bytes
for name in `seq 1 $workers`
do
pod_query="GET http://10.91.30.226:8096/client/?command=createPod&zoneId=1&name=RP$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://10.91.30.226:8096/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$((name+250))&forVirtualNetwork=false&gateway=182.$y.$x.1&netmask=255.255.255.0&startip=182.$y.$x.2&endip=182.$y.$x.252 HTTP/1.0\n\n"
so_query="GET http://10.91.30.226:8096/client/?command=createServiceOffering&name=RP$name&displayText=RP$name&storageType=local&cpuNumber=1&cpuSpeed=1000&memory=512&offerha=false&usevirtualnetwork=false&hosttags=RP$name HTTP/1.0\n\n"
echo -e $pod_query | nc -v -q 20 10.91.30.226 8096
echo -e $vlan_query | nc -v -q 20 10.91.30.226 8096
echo -e $so_query | nc -v -q 20 10.91.30.226 8096
let x+=1
let y+=1
done

View File

@ -1,24 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
so_query="GET http://10.91.30.226:8096/client/?command=createServiceOffering&name=SO$x&displayText=SO$x&storageType=local&cpuNumber=1&cpuSpeed=1000&memory=512&offerha=false&usevirtualnetwork=false&hosttags=SP$x HTTP/1.0\n\n"
echo -e $so_query | nc -v -q 20 10.91.30.226 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
y=$2
name=$3
vlan_query="GET http://10.91.30.212/client/?command=createVlanIpRange&vlan=untagged&zoneid=1&podId=$name&forVirtualNetwork=false&gateway=172.$x.$y.1&netmask=255.255.255.0&startip=172.$x.$y.2&endip=172.$x.$y.252 HTTP/1.0\n\n"
echo -e $vlan_query | nc -v -w 20 10.91.30.212 8096

View File

@ -1,252 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# zucchini uses local storage, before setting up make sure
# * xen.public.network.device is set
# * use.local.storage and systemvm.use.local.storage are true
# * optionally turn off stats collectors
# * expunge.delay and expunge.interval are 60s
# * ping.interval is around 3m
# * turn off dns updates to entire zone, network.dns.basiczone.update=pod
# * capacity.skipcounting.hours=0
# * direct.agent.load.size=1000
# * security groups are enabled
# This script will only setup an approximate number of hosts. To achieve the ratio
# by 13. So if 4000 hosts are added, you might see only 3900 come up
# 10 hosts per pod @ 1 host per cluster in a single zone
# Each pod has a /25, so 128 addresses. I think we reserved 5 IP addresses for system VMs in each pod.
# Then we had something like 60 addresses for hosts and 60 addresses for VMs.
#Environment
#1. Approximately 10 hosts per pod.
#2. Only 3 host tags.
#3. With in each pod, the host tags are the same. Homogenous Pods
#5. In simulator.properties, workers=1
usage() {
printf "Setup Zucchini Like Environment\nUsage: %s: -h management-server -z zoneid [-d delay] -n numberofhosts [-g numberof security groups]\n" $(basename $0) >&2
}
a=1 #CIDR - 16bytes
b=2 #CIDR - 8 bytes
#options
hflag=1
zflag=
dflag=1
nflag=1
gflag=1
host="127.0.0.1" #default localhost
zoneid=
delay=300 #default 5 minutes
numberofhosts=1300 #default 1300 hosts
numberofgroups=130 #default 130 groups
tag1="TAG1"
tag2="TAG2"
tag3="TAG3"
while getopts 'h:z:d:n:g:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
z) zflag=1
zoneid="$OPTARG"
;;
d) dflag=1
delay="$OPTARG"
;;
n) nflag=1
numberofhosts="$OPTARG"
;;
g) gflag=1
numberofgroups="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ $zflag$nflag != "11" ]
then
usage
exit 2
fi
numberofpods=$(($numberofhosts/10)) #10 hosts per pod
tag_one_range=$(($numberofpods*5/13))
tag_two_range=$(($numberofpods*2/13))
tag_three_range=$(($numberofpods-$tag_one_range-$tag_two_range))
clusters_per_pod=10 #each cluster has one host
hosts_per_pod=10
declare -a pod_array
declare -a cluster_array
echo "Split Ratio :: " $tag_one_range":"$tag_two_range":"$tag_three_range
#create the zone
zone_query="GET http://$host/client/?command=createZone&networktype=Basic&securitygroupenabled=true&name=Zucchini&dns1=4.2.2.2&internaldns1=4.2.2.2 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -w $delay $host 8096
#Add Secondary Storage
sstor_query="GET http://$host/client/?command=addSecondaryStorage&zoneid=$zoneid&url=nfs://172.16.15.32/export/share/secondary HTTP/1.0\n\n"
echo -e $sstor_query | nc -v -w $delay $host 8096
let x=a
let y=b
echo "[DEBUG] $(date) Starting Creation of $numberofpods Pods"
for ((name=1;name<=$numberofpods;name++))
do
echo "[DEBUG] $(date) Creating pod[POD$name]"
pod_query="GET http://$host/client/?command=createPod&zoneId=$zoneid&name=POD$name&netmask=255.255.255.128&startIp=172.$x.$y.130&endIp=172.$x.$y.189&gateway=172.$x.$y.129 HTTP/1.0\n\n"
pod_out=$(echo -e $pod_query | nc -v -w $delay $host 8096)
pod_id=$(echo $pod_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$pod_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) pod [POD$name] creation failed"; continue
fi
echo "[DEBUG] $(date) Created pod["$pod_id":POD"$name"]"
pod_array[$name]=$pod_id
echo "[DEBUG] $(date) Creating vlan for pod[POD$name]"
vlan_query="GET http://$host/client/?command=createVlanIpRange&vlan=untagged&zoneid=$zoneid&podId=$pod_id&forVirtualNetwork=false&gateway=172.$x.$y.129&netmask=255.255.255.128&startip=172.$x.$y.190&endip=172.$x.$y.249 HTTP/1.0\n\n"
vlan_out=$(echo -e $vlan_query | nc -v -w $delay $host 8096)
vlan_id=$(echo $vlan_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$vlan_id" =~ ^[0-9]+$ ]] ; then
let y+=1
if [ "$y" -eq 256 ]
then
let x+=1
y=1
fi
exec >&2; echo "[ERROR] $(date) vlan creation for pod[POD$name] failed"; continue
fi
echo "[DEBUG] $(date) Created vlan for pod[POD$name]"
#add clusters
echo "[DEBUG] $(date) Starting Creation of $clusters_per_pod clusters for pod[POD$name]"
for ((cluster=1;cluster<=$clusters_per_pod;cluster++))
do
echo "[DEBUG] $(date) Creating cluster[POD$name-CLUSTER$cluster] for pod[POD$name]"
cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=$zoneid&podId=$pod_id&clustername=POD$name-CLUSTER$cluster HTTP/1.0\n\n"
cluster_out=$(echo -e $cluster_query | nc -v -w $delay $host 8096)
cluster_id=$(echo $cluster_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$cluster_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) cluster[POD$name-CLUSTER$cluster] creation for pod[POD$name] failed"; continue
fi
echo "[DEBUG] $(date) Created cluster["$cluster_id":POD"$name"-CLUSTER"$cluster"]"
cluster_array[$(($name*$clusters_per_pod + $cluster))]=$cluster_id
done
echo "[DEBUG] $(date) Finished Creating clusters for pod[POD$name]"
let y+=1
if [ "$y" -eq 256 ]
then
let x+=1
y=1
fi
done
echo "[DEBUG] $(date) Finished Creating $numberofpods Pods"
#echo "DEBUG:Pods and Clusters"
#echo "PODS:("${#pod_array[@]}")" ${pod_array[@]}
#echo "CLUSTERS:("${#cluster_array[@]}")" ${cluster_array[@]}
echo
echo
echo "[DEBUG] $(date) Creating $numberofgroups security groups"
for ((sg=1;sg<=$numberofgroups;sg++))
do
sg_create_query="GET http://$host/client/?command=createSecurityGroup&name=zGroup$sg&description=zGroup$sg&domainid=1&account=admin HTTP/1.0\n\n"
sg_create_out=$(echo -e $sg_create_query | nc -v -w $delay $host 8096)
sg_id=$(echo $sg_create_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$sg_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) security group[zGroup$sg] creation failed"; continue
fi
echo "[DEBUG] $(date) Created security group[$sg_id:zGroup$sg]"
echo "[DEBUG] $(date) Adding ingress rule start,end=$((2000 + $sg)), $((2000 + $sg)) to security group[$sg_id:zGroup$sg]"
sg_auth_query="GET http://$host/client/?command=authorizeSecurityGroupIngress&domainid=1&account=admin&securitygroupid=$sg_id&protocol=TCP&startport=$((2000 + $sg))&endport=$((2000 + $sg))&usersecuritygrouplist[0].account=admin&usersecuritygrouplist[0].group=zGroup$sg HTTP/1.0\n\n"
sg_auth_out=$(echo -e $sg_auth_query | nc -v -w $delay $host 8096)
done
echo "[DEBUG] $(date) Finished Creating security groups"
#Add hosts
#TAG1
for ((i=1;i<=$tag_one_range;i++))
do
podid=${pod_array[$i]}
for ((j=1;j<=$hosts_per_pod;j++))
do
clusterid=${cluster_array[$(($i*$clusters_per_pod + $j))]}
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=$podid&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag1 HTTP/1.0\n\n"
host_out=$(echo -e $host_query | nc -v -w $delay $host 8096)
host_id=$(echo $host_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$host_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) host addition failed in [pod:$podid,cluster:$clusterid]"; continue
fi
host_name=$(echo $host_out | sed 's/\(.*<name>\)\(SimulatedAgent.[-0-9a-zA-Z]*\)\(.*\)/\2/g')
echo "[DEBUG] $date added host [$host_id:$host_name] to [pod:$podid,cluster:$clusterid] for TAG1"
done
done
#TAG2
for ((i=$(($tag_one_range + 1));i<=$(($tag_one_range + $tag_two_range));i++))
do
podid=${pod_array[$i]}
for ((j=1;j<=$hosts_per_pod;j++))
do
clusterid=${cluster_array[$(($i*$clusters_per_pod + $j))]}
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=$podid&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag2 HTTP/1.0\n\n"
host_out=$(echo -e $host_query | nc -v -w $delay $host 8096)
host_id=$(echo $host_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$host_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) host addition failed in [pod:$podid,cluster:$clusterid]"; continue
fi
host_name=$(echo $host_out | sed 's/\(.*<name>\)\(SimulatedAgent.[-0-9a-zA-Z]*\)\(.*\)/\2/g')
echo "[DEBUG] $date added host [$host_id:$host_name] to [pod:$podid,cluster:$clusterid] for TAG2"
done
done
#TAG3
for ((i=$(($tag_two_range + $tag_one_range + 1));i<=$(($tag_three_range + $tag_two_range + $tag_one_range));i++))
do
podid=${pod_array[$i]}
for ((j=1;j<=$hosts_per_pod;j++))
do
clusterid=${cluster_array[$(($i*$clusters_per_pod + $j))]}
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=$podid&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag3 HTTP/1.0\n\n"
host_out=$(echo -e $host_query | nc -v -w $delay $host 8096)
host_id=$(echo $host_out | sed 's/\(.*<id>\)\([0-9]*\)\(.*\)/\2/g')
if ! [[ "$host_id" =~ ^[0-9]+$ ]] ; then
exec >&2; echo "[ERROR] $(date) host addition failed in [pod:$podid,cluster:$clusterid]"; continue
fi
host_name=$(echo $host_out | sed 's/\(.*<name>\)\(SimulatedAgent.[-0-9a-zA-Z]*\)\(.*\)/\2/g')
echo "[DEBUG] $date added host [$host_id:$host_name] to [pod:$podid,cluster:$clusterid] for TAG3"
done
done
echo "Setup complete"
exit 0

View File

@ -1,158 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# zucchini uses local storage, before setting up make sure
# * xen.public.network.device is set
# * use.local.storage and systemvm.use.local.storage are true
# * optionally turn off stats collector
# * expunge.delay and expunge.interval are 60s
# * capacity.skipcounting.hours=0
#Environment
#1. Small setup for zucchini : 13, 26, 39, 52 hosts only
#2. Only 3 host tags.
#5. simulator.properties, workers=1
usage() {
printf "Setup Zucchini Like Environment\nUsage: %s: -h management-server -z zoneid [-d delay] -n numberofhosts\n" $(basename $0) >&2
}
a=1 #CIDR - 16bytes
b=2 #CIDR - 8 bytes
#options
hflag=1
zflag=1
dflag=1
nflag=1
host="127.0.0.1" #default localhost
zoneid=
delay=300 #default 5 minutes
numberofhosts=13 #default 13 hosts
tag1="TAG1"
tag2="TAG2"
tag3="TAG3"
while getopts 'h:z:d:n:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
z) zflag=1
zoneid="$OPTARG"
;;
d) dflag=1
delay="$OPTARG"
;;
n) nflag=1
numberofhosts="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ $hflag$zflag$dflag$nflag != "1111" ]
then
usage
exit 2
fi
if [ $numberofhosts -gt 52 ]
then
echo "Can't exceed 52 hosts"
exit 130
fi
numberofpods=3 #130 hosts per pod. So need only 3. each pod is homogenous
tag_one_range=$(($numberofhosts*5/13))
tag_two_range=$(($numberofhosts*2/13))
tag_three_range=$(($numberofhosts-$tag_one_range-$tag_two_range))
#create the zone
zone_query="GET http://$host/client/?command=createZone&networktype=Basic&securitygroupenabled=true&name=Zucchini&dns1=4.2.2.2&internaldns1=4.2.2.2 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -w $delay $host 8096
sstor_query="GET http://$host/client/?command=addSecondaryStorage&zoneid=$zoneid&url=nfs://172.16.15.32/export/share/secondary HTTP/1.0\n\n"
echo -e $sstor_query | nc -v -w $delay $host 8096
let x=a
let y=b
for name in `seq 1 $numberofpods`
do
pod_query="GET http://$host/client/?command=createPod&zoneId=$zoneid&name=POD$name&netmask=255.255.255.0&startIp=172.$x.$y.2&endIp=172.$x.$y.131&gateway=172.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://$host/client/?command=createVlanIpRange&vlan=untagged&zoneid=$zoneid&podId=$name&forVirtualNetwork=false&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.131 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w $delay $host 8096
echo -e $vlan_query | nc -v -w $delay $host 8096
let x+=1
let y+=1
done
#add clusters -
#for i in `seq 1 10`
# cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=$zoneid&podId=$podid&clustername=POD$podid-CLUSTER$cluster HTTP/1.0\n\n"
# echo -e $cluster_query | nc -v -w $delay $host 8096
#do
clusterid=1
#TAG1
for cluster in `seq 1 $tag_one_range`
do
cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=$zoneid&podId=1&clustername=POD1-CLUSTER$cluster HTTP/1.0\n\n"
echo -e $cluster_query | nc -v -w $delay $host 8096
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=1&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag1 HTTP/1.0\n\n"
echo -e $host_query | nc -v -w $delay $host 8096
let clusterid+=1
done
#TAG2
for cluster in `seq $(($tag_one_range + 1)) $(($tag_one_range + $tag_two_range))`
do
cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=$zoneid&podId=2&clustername=POD2-CLUSTER$cluster HTTP/1.0\n\n"
echo -e $cluster_query | nc -v -w $delay $host 8096
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=2&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag2 HTTP/1.0\n\n"
echo -e $host_query | nc -v -w $delay $host 8096
let clusterid+=1
done
#TAG3
for cluster in `seq $(($tag_two_range + $tag_one_range + 1)) $(($tag_three_range + $tag_two_range + $tag_one_range))`
do
cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=$zoneid&podId=3&clustername=POD3-CLUSTER$cluster HTTP/1.0\n\n"
echo -e $cluster_query | nc -v -w $delay $host 8096
host_query="GET http://$host/client/?command=addHost&zoneId=$zoneid&podId=3&username=sim&password=sim&clusterid=$clusterid&url=http%3A%2F%2Fsim&hypervisor=Simulator&clustertype=CloudManaged&hosttags=$tag3 HTTP/1.0\n\n"
echo -e $host_query | nc -v -w $delay $host 8096
let clusterid+=1
done
for i in {1..60}
do
sg_create_query="GET http://$host/client/?command=createSecurityGroup&name=TestGroup1&description=Test HTTP/1.0\n\n"
echo -e $sg_create_query | nc -v -w $delay $host 8096
sg_auth_query="GET http://$host/client/?command=authorizeSecurityGroupIngress&domainid=1&account=admin&securitygroupid=$((i+2))&protocol=TCP&startport=2002&endport=2002&usersecuritygrouplist[0].account=admin&usersecuritygrouplist[0].group=TestGroup1 HTTP/1.0\n\n"
echo -e $sg_create_query | nc -v -w $delay $host 8096
done
echo "Setup complete"
exit 0

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
./setupServiceOffering.sh -h $host -i T1 -l -m 7168 -c 1024 -n 1 -g TAG1
./setupServiceOffering.sh -h $host -i T2 -l -m 7168 -c 1024 -n 1 -g TAG2
./setupServiceOffering.sh -h $host -i T3 -l -m 7168 -c 1024 -n 1 -g TAG3

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
start_router="GET http://10.91.30.226:8096/client/?command=startRouter&id=$x HTTP/1.0\n\n"
echo -e $start_router | nc -v -q 60 10.91.30.226 8096

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
x=$1
start_vm="GET http://10.91.30.226:8096/client/?command=startVirtualMachine&id=$x HTTP/1.0\n\n"
echo -e $start_vm | nc -v -q 60 10.91.30.226 8096

View File

@ -1,49 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf "Stop Router: %s: -h management-server -i vmid\n" $(basename $0) >&2
}
iflag=
hflag=
host="127.0.0.1" #defaults to localhost
vmid=
while getopts 'h:i:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
i) iflag=1
vmid="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [[ $iflag != "1" ]]
then
usage
exit 2
fi
stop_vm="GET http://$host:8096/client/?command=stopRouter&id=$vmid HTTP/1.0\n\n"
echo -e $stop_vm | nc -v -w 60 $host 8096

View File

@ -1,49 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf "Stop Virtual Machine: %s: -h management-server -i vmid\n" $(basename $0) >&2
}
iflag=
hflag=
host="127.0.0.1" #defaults to localhost
vmid=
while getopts 'h:i:' OPTION
do
case $OPTION in
h) hflag=1
host="$OPTARG"
;;
i) iflag=1
vmid="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [[ $iflag != "1" ]]
then
usage
exit 2
fi
stop_vm="GET http://$host:8096/client/?command=stopVirtualMachine&id=$vmid HTTP/1.0\n\n"
echo -e $stop_vm | nc -v -w 60 $host 8096

View File

@ -1,119 +0,0 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#1. Approximately 10 hosts per pod.
#2. Only 3 host tags.
a=$1 #CIDR - 16bytes
b=$2 #CIDR - 8 bytes
host=$3 #MSHOST
zone=$4
zone_query="GET http://$host/client/?command=createZone&name=Zucchini&dns1=4.2.2.2&internaldns1=4.2.2.2&vlan=10-4000&guestcidraddress=10.1.1.0%2F24 HTTP/1.0\n\n"
echo -e $zone_query | nc -v -w 120 $host 8096
# Pod Ratio: 38:15:47
let x=a
let y=b
for name in `seq 1 152`
do
pod_query="GET http://$host/client/?command=createPod&zoneId=$zone&name=POD$name&cidr=172.$x.$y.0%2F24&startIp=172.$x.$y.2&endIp=172.$x.$y.252&gateway=172.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://$host/client/?command=createVlanIpRange&vlan=untagged&zoneid=$zone&podId=$name&forVirtualNetwork=false&gateway=172.$y.$x.1&netmask=255.255.255.0&startip=172.$y.$x.2&endip=172.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w 20 $host 8096
echo -e $vlan_query | nc -v -w 20 $host 8096
let x+=1
let y+=1
done
let x=a
let y=b
for name in `seq 153 212`
do
pod_query="GET http://$host/client/?command=createPod&zoneId=$zone&name=POD$name&cidr=182.$x.$y.0%2F24&startIp=182.$x.$y.2&endIp=182.$x.$y.252&gateway=182.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://$host/client/?command=createVlanIpRange&vlan=untagged&zoneid=$zone&podId=$name&forVirtualNetwork=false&gateway=182.$y.$x.1&netmask=255.255.255.0&startip=182.$y.$x.2&endip=182.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w 20 $host 8096
echo -e $vlan_query | nc -v -w 20 $host 8096
let x+=1
let y+=1
done
let x=a
let y=b
for name in `seq 213 400`
do
pod_query="GET http://$host/client/?command=createPod&zoneId=$zone&name=POD$name&cidr=192.$x.$y.0%2F24&startIp=192.$x.$y.2&endIp=192.$x.$y.252&gateway=192.$x.$y.1 HTTP/1.0\n\n"
vlan_query="GET http://$host/client/?command=createVlanIpRange&vlan=untagged&zoneid=$zone&podId=$name&forVirtualNetwork=false&gateway=192.$y.$x.1&netmask=255.255.255.0&startip=192.$y.$x.2&endip=192.$y.$x.252 HTTP/1.0\n\n"
echo -e $pod_query | nc -v -w 20 $host 8096
echo -e $vlan_query | nc -v -w 20 $host 8096
let x+=1
let y+=1
done
#add clusters
#for name in `seq 1 400`
#do
# for cluster in `seq 1 10`
# do
# cluster_query="GET http://$host/client/?command=addCluster&hypervisor=Simulator&clustertype=CloudManaged&zoneId=$zone&podId=$name&clustername=POD$name-CLUSTER$cluster HTTP/1.0\n\n"
# echo -e $cluster_query | nc -v -w 120 $host 8096
# done
#done
# @ 10 hosts per pod @ 10 clusters per pod
clusterid=1
#TAG1
for podid in `seq 58 152`
do
for i in `seq 1 10`
do
host_query="GET http://$host/client/?command=addHost&zoneId=$zone&podId=$podid&username=sim&password=sim&clustername=CLUSTER$clusterid&hosttags=TAG1&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -w 6000 $host 8096
done
let clusterid+=1
done
#TAG2
for podid in `seq 153 212`
do
for i in `seq 1 10`
do
host_query="GET http://$host/client/?command=addHost&zoneId=$zone&podId=$podid&username=sim&password=sim&clustername=CLUSTER$clusterid&hosttags=TAG2&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -w 6000 $host 8096
done
let clusterid+=1
done
#TAG3
for podid in `seq 213 400`
do
for i in `seq 1 10`
do
host_query="GET http://$host/client/?command=addHost&zoneId=$zone&podId=$podid&username=sim&password=sim&cluster=CLUSTER$clusterid&hosttags=TAG3&url=http%3A%2F%2Fsim HTTP/1.0\n\n"
echo -e $host_query | nc -v -w 6000 $host 8096
done
let clusterid+=1
done

View File

@ -1,217 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
'''
# zucchini uses local storage, before setting up make sure
# * xen.public.network.device is set
# * use.local.storage and systemvm.use.local.storage are true
# * optionally turn off stats collectors
# * expunge.delay and expunge.interval are 60s
# * ping.interval is around 3m
# * turn off dns updates to entire zone, network.dns.basiczone.update=pod
# * capacity.skipcounting.hours=0
# * direct.agent.load.size=1000
# * security groups are enabled
# This script will only setup an approximate number of hosts. To achieve the ratio
# by 13. So if 4000 hosts are added, you might see only 3900 come up
# 10 hosts per pod @ 1 host per cluster in a single zone
# Each pod has a /25, so 128 addresses. I think we reserved 5 IP addresses for system VMs in each pod.
# Then we had something like 60 addresses for hosts and 60 addresses for VMs.
#Environment
#1. Approximately 10 hosts per pod.
#2. Only 3 host tags.
#3. With in each pod, the host tags are the same. Homogenous Pods
#5. In simulator.properties, workers=1
'''
from optparse import OptionParser
from configGenerator import *
import random
def getGlobalSettings():
global_settings = {'expunge.delay': '60',
'expunge.interval': '60',
'expunge.workers': '3',
'workers': '10',
'network.dns.basiczone.updates':'pod',
'use.user.concentrated.pod.allocation':'false',
'vm.allocation.algorithm':'firstfit',
'capacity.check.period':'0',
# 'host.stats.interval':'-1',
# 'vm.stats.interval':'-1',
# 'storage.stats.interval':'-1',
# 'router.stats.interval':'-1',
'vm.op.wait.interval':'5',
'xen.public.network.device':'10.10.10.10', #only a dummy for the simulator
'guest.domain.suffix':'zucchini.simulator',
'instance.name':'ZIM',
'direct.agent.load.size':'1000',
'default.page.size':'10000',
'linkLocalIp.nums':'4',
'system.vm.use.local.storage':'true',
'use.local.storage':'true',
'check.pod.cidrs':'false',
}
for k,v in global_settings.iteritems():
cfg=configuration()
cfg.name=k
cfg.value=v
yield cfg
def podIpRangeGenerator():
x=1
y=2
while 1:
if y == 255:
x=x+1
if x == 255:
x=1
break
y=1
y=y+1
#pod mangement network
yield ('172.'+str(x)+'.'+str(y)+'.129', '172.'+str(x)+'.'+str(y)+'.130', '172.'+str(x)+'.'+str(y)+'.189')
def vlanIpRangeGenerator():
x=1
y=2
while 1:
if y == 255:
x=x+1
if x==255:
x=1
break
y=1
y=y+1
#vlan ip range
yield ('172.'+str(x)+'.'+str(y)+'.129', '172.'+str(x)+'.'+str(y)+'.190', '172.'+str(x)+'.'+str(y)+'.249')
def describeZucchiniResources(numberOfAgents=1300, dbnode='localhost', mshost='localhost', randomize=False, sgenabled=False):
zs=cloudstackConfiguration()
numberofpods=numberOfAgents/10
tagOneHosts = numberOfAgents*5/13
tagTwoHosts = numberOfAgents*2/13
tagThreeHosts = numberOfAgents-tagOneHosts-tagTwoHosts
clustersPerPod=10
hostsPerPod=10
z = zone()
z.dns1 = '4.2.2.2'
z.dns2 = '192.168.110.254'
z.internaldns1 = '10.91.28.6'
z.internaldns2 = '192.168.110.254'
z.name = 'Zucchini'
z.networktype = 'Basic'
z.securitygroupenabled = sgenabled
hosttags=['TAG1' for x in range(tagOneHosts)] + ['TAG2' for x in range(tagTwoHosts)] + ['TAG3' for x in range(tagThreeHosts)]
curhost=0
curpod=0
if randomize:
random.shuffle(hosttags) #randomize the host distribution
for podRange,vlanRange in zip(podIpRangeGenerator(), vlanIpRangeGenerator()):
p = pod()
curpod=curpod+1
p.name = 'POD'+str(curpod)
p.gateway=podRange[0]
p.startip=podRange[1]
p.endip=podRange[2]
p.netmask='255.255.255.128'
v = iprange()
v.gateway=vlanRange[0]
v.startip=vlanRange[1]
v.endip=vlanRange[2]
v.netmask="255.255.255.128"
p.guestIpRanges.append(v)
for i in range(1,clustersPerPod+1):
c = cluster()
c.clustername = 'POD'+str(curpod)+'-CLUSTER'+str(i)
c.hypervisor = 'Simulator'
c.clustertype = 'CloudManaged'
try:
h = host()
h.username = 'root'
h.password = 'password'
h.url = "http://sim/test-%d"%(curhost)
h.hosttags = hosttags.pop()
c.hosts.append(h)
curhost=curhost+1
p.clusters.append(c)
except IndexError:
break
#end clusters
z.pods.append(p)
if curpod == numberofpods or curhost == numberOfAgents:
break
#end pods
secondary = secondaryStorage()
secondary.url = 'nfs://172.16.25.32/secondary/path'
z.secondaryStorages.append(secondary)
zs.zones.append(z)
'''Add mgt server'''
mgt = managementServer()
mgt.mgtSvrIp = mshost #could be the LB balancing the cluster of management server as well
zs.mgtSvr.append(mgt)
'''Add a database'''
db = dbServer()
db.dbSvr = opts.dbnode
zs.dbSvr = db
'''Add some configuration'''
[zs.globalConfig.append(cfg) for cfg in getGlobalSettings()]
''''add loggers'''
testClientLogger = logger()
testClientLogger.name = "TestClient"
testClientLogger.file = "/var/log/testclient.log"
testCaseLogger = logger()
testCaseLogger.name = "TestCase"
testCaseLogger.file = "/var/log/testcase.log"
zs.logger.append(testClientLogger)
zs.logger.append(testCaseLogger)
return zs
if __name__=="__main__":
parser = OptionParser()
# parser.add_option('-h','--host',dest='host',help='location of management server(s) or load-balancer')
parser.add_option('-n', '--number-of-agents', action='store', dest='agents', help='number of agents in the deployment')
parser.add_option('-g', '--enable-security-groups', dest='sgenabled', help='specify if security groups are to be enabled', default=False, action='store_true')
parser.add_option('-o', '--output', action='store', default='./z.cfg', dest='output', help='the path where the json config file generated')
parser.add_option('-d', '--dbnode', dest='dbnode', help='hostname/ip of the database node', action='store')
parser.add_option('-m', '--mshost', dest='mshost', help='hostname/ip of management server', action='store')
parser.add_option('-r', '--randomize', dest='randomize', help='randomize the distribution of tags (hetergenous clusters)', action='store_true', default=False)
(opts, args) = parser.parse_args()
mandatories = ['agents']
for m in mandatories:
if not opts.__dict__[m]:
print 'mandatory option missing'
cfg = describeZucchiniResources(int(opts.agents), opts.dbnode, opts.mshost, opts.randomize, opts.sgenabled)
generate_setup_config(cfg, opts.output)

View File

@ -1,53 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import unittest2 as unittest
except ImportError:
import unittest
import timeit
import random
from cloudstackAPI import *
from cloudstackTestCase import *
class ListVmTests(cloudstackTestCase):
'''
List Virtual Machine tests
'''
def setUp(self):
pass
def tearDown(self):
pass
def listAllVm(self):
numVms = 0
api = self.testClient.getApiClient()
listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
listVmCmd.account = 'admin'
listVmCmd.zoneid = 1
listVmCmd.domainid = 1
listVmResponse = api.listVirtualMachines(listVmCmd)
if listVmResponse is not None:
numVms = len(listVmResponse)
@unittest.skip("skipping")
def test_timeListVm(self):
t = timeit.Timer(self.listAllVm)
l = t.repeat(50, 50)

View File

@ -1,184 +0,0 @@
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import unittest2 as unittest
except ImportError:
import unittest
import random
from cloudstackAPI import *
from cloudstackTestCase import *
class Provision(cloudstackTestCase):
'''
This should test basic provisioning of virtual machines
1. Deploy a no-frills VM
2. Deploy with tags - hosttags
3. Deploy with/without security groups
'''
solist = {}
sgid = []
def setUp(self):
pass
def tearDown(self):
pass
def test_0_createServiceOfferings(self):
for tag in ['TAG1', 'TAG2', 'TAG3']:
csocmd = createServiceOffering.createServiceOfferingCmd()
csocmd.cpunumber = 1
csocmd.cpuspeed = 2048
csocmd.displaytext = tag
csocmd.memory = 7168
csocmd.name = tag
csocmd.hosttags = tag
csocmd.storagetype = 'local'
csoresponse = self.testClient.getApiClient().createServiceOffering(csocmd)
self.debug(csoresponse)
self.solist[tag]=csoresponse.id
def test_1_createSecurityGroupAndRules(self):
apiClient = self.testClient.getApiClient()
sgCmd=createSecurityGroup.createSecurityGroupCmd()
sgCmd.description='default-ps'
sgCmd.name='default-ps'
sgCmd.account='admin'
sgCmd.domainid='1'
sgRes = apiClient.createSecurityGroup(sgCmd)
self.sgid.append(sgRes.id)
ruleCmd=authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
ruleCmd.cidrlist = '172.1.0.0/12'
ruleCmd.startport = '1'
ruleCmd.endport = '65535'
ruleCmd.protocol = 'TCP'
ruleCmd.securitygroupid = sgRes.id
ruleCmd.account='admin'
ruleCmd.domainid='1'
sgIngressresponse=apiClient.authorizeSecurityGroupIngress(ruleCmd)
ruleCmd=authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
ruleCmd.cidrlist = '172.1.0.0/12'
ruleCmd.startport = '22'
ruleCmd.endport = '22'
ruleCmd.protocol = 'TCP'
ruleCmd.securitygroupid = sgRes.id
ruleCmd.account='admin'
ruleCmd.domainid='1'
sgIngressresponse=apiClient.authorizeSecurityGroupIngress(ruleCmd)
ruleCmd=authorizeSecurityGroupIngress.authorizeSecurityGroupIngressCmd()
ruleCmd.cidrlist = '10.0.0.0/8'
ruleCmd.startport = '80'
ruleCmd.endport = '80'
ruleCmd.protocol = 'TCP'
ruleCmd.securitygroupid = sgRes.id
ruleCmd.account='admin'
ruleCmd.domainid='1'
sgIngressresponse=apiClient.authorizeSecurityGroupIngress(ruleCmd)
self.debug("Security group created with id: %d"%sgRes.id)
@unittest.skip("needs fixing")
def test_2_DeployVMWithHostTags(self):
'''
Deploy 3 virtual machines one with each hosttag
'''
for k,v in self.solist:
deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
deployVmCmd.zoneid = 1
deployVmCmd.hypervisor='Simulator'
deployVmCmd.serviceofferingid=v
deployVmCmd.account='admin'
deployVmCmd.domainid=1
deployVmCmd.templateid=10
deployVmResponse = self.testClient.getApiClient().deployVirtualMachine(deployVmCmd)
self.debug("Deployed VM :%d in job: %d"%(deployVmResponse[0].id, deployVmResponse[0].jobid))
def deployCmd(self, tag, sgid):
deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
deployVmCmd.zoneid = 1
deployVmCmd.hypervisor='Simulator'
deployVmCmd.serviceofferingid=self.solist[tag]
deployVmCmd.account='admin'
deployVmCmd.domainid=1
deployVmCmd.templateid=10
deployVmCmd.securitygroupids=sgid
return deployVmCmd
def listVmsInAccountCmd(self, acct='admin'):
api = self.testClient.getApiClient()
listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
listVmCmd.account = acct
listVmCmd.zoneid = 1
listVmCmd.domainid = 1
listVmResponse = api.listVirtualMachines(listVmCmd)
return listVmResponse
def destroyCmd(self, vmid):
destroyVmCmd = destroyVirtualMachine.destroyVirtualMachineCmd()
destroyVmCmd.zoneid=1
destroyVmCmd.id=vmid
self.testClient.getApiClient().destroyVirtualMachine(destroyVmCmd)
def deployN(self,nargs=300,batchsize=0):
'''
Deploy Nargs number of VMs concurrently in batches of size {batchsize}.
When batchsize is 0 all Vms are deployed in one batch
VMs will be deployed in 5:2:6 ratio
'''
tag1=nargs*5/13
tag2=nargs*2/13
tag3=nargs-tag1-tag2
cmds = []
[cmds.append(self.deployCmd('TAG1', self.sgid[0])) for i in range(tag1)]
[cmds.append(self.deployCmd('TAG2', self.sgid[0])) for i in range(tag2)]
[cmds.append(self.deployCmd('TAG3', self.sgid[0])) for i in range(tag3)]
random.shuffle(cmds) #with mix-and-match of Tags
if batchsize == 0:
self.testClient.submitCmdsAndWait(cmds)
else:
while len(cmds) > 0:
try:
newbatch = [cmds.pop() for b in range(batchsize)] #pop batchsize items
self.testClient.submitCmdsAndWait(newbatch)
except IndexError:
break
def test_3_bulkDeploy(self):
self.deployN(nargs=500,batchsize=100)
def test_4_bulkDestroy(self):
api = self.testClient.getApiClient()
for vm in self.listVmsInAccountCmd('admin'):
if vm is not None:
self.destroyCmd(vm.id)

View File

@ -1,46 +0,0 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
update configuration set value='pod' where name='network.dns.basiczone.updates';
update configuration set value='false' where name='use.user.concentrated.pod.allocation';
update configuration set value='firstfit' where name='vm.allocation.algorithm';
update configuration set value='60' where name='expunge.delay';
update configuration set value='60' where name='expunge.interval';
update configuration set value='3' where name='expunge.workers';
update configuration set value='10' where name='workers';
update configuration set value='0' where name='capacity.check.period';
update configuration set value='-1' where name='host.stats.interval';
update configuration set value='-1' where name='vm.stats.interval';
update configuration set value='-1' where name='storage.stats.interval';
update configuration set value='-1' where name='router.stats.interval';
update configuration set value='5' where name like 'vm.op.wait.interval';
update configuration set value='10.10.10.10' where name='xen.public.network.device';
update configuration set value='zcloud.simulator' where name='guest.domain.suffix';
update configuration set value='ZIM' where name='instance.name';
update configuration set value='1000' where name='direct.agent.load.size';
update configuration set value='10000' where name='default.page.size';
update configuration set value='4' where name='linkLocalIp.nums';
update configuration set value='true' where name like '%local.storage%';
update configuration set value='false' where name like '%check.pod.cidr%';
update configuration set value='100' where name like '%network.security%pool%';
update configuration set value='120' where name like 'network.securitygroups.work.cleanup.interval';

View File

@ -183,6 +183,7 @@ public class ApiConstants {
public static final String TARGET_IQN = "targetiqn";
public static final String TEMPLATE_FILTER = "templatefilter";
public static final String TEMPLATE_ID = "templateid";
public static final String ISO_ID = "isoid";
public static final String TIMEOUT = "timeout";
public static final String TIMEZONE = "timezone";
public static final String TYPE = "type";
@ -378,6 +379,7 @@ public class ApiConstants {
public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
public enum HostDetails {
all, capacity, events, stats, min;
}

View File

@ -17,10 +17,12 @@
package com.cloud.api.commands;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCreateCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.VpcResponse;
@ -31,6 +33,8 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.UserContext;
@Implementation(description="Creates a VPC", responseObject=VpcResponse.class)
public class CreateVPCCmd extends BaseAsyncCreateCmd{
public static final Logger s_logger = Logger.getLogger(CreateVPCCmd.class.getName());
private static final String s_name = "createvpcresponse";

View File

@ -22,6 +22,7 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
@ -31,6 +32,8 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.Account;
@Implementation(description="Deletes a VPC", responseObject=SuccessResponse.class)
public class DeleteVPCCmd extends BaseAsyncCmd{
public static final Logger s_logger = Logger.getLogger(DeleteVPCCmd.class.getName());
private static final String s_name = "deletevpcresponse";

View File

@ -87,7 +87,14 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.DETAILS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma separated list of host details requested, " +
"value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]. If no parameter is passed in, the details will be defaulted to all" )
private List<String> viewDetails;
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.LONG, description="list vms by template")
private Long templateId;
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.ISO_ID, type=CommandType.LONG, description="list vms by iso")
private Long isoId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -140,7 +147,15 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
public Long getStorageId() {
return storageId;
}
public Long getTemplateId() {
return templateId;
}
public Long getIsoId() {
return isoId;
}
public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
EnumSet<VMDetails> dv;
if (viewDetails==null || viewDetails.size() <=0){

View File

@ -22,9 +22,11 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.SuccessResponse;
import com.cloud.api.response.VpcResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@ -32,6 +34,7 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.Account;
@Implementation(description="Restarts a VPC", responseObject=VpcResponse.class)
public class RestartVPCCmd extends BaseAsyncCmd{
public static final Logger s_logger = Logger.getLogger(RestartVPCCmd.class.getName());
private static final String _name = "restartvpcresponse";

View File

@ -22,6 +22,7 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseAsyncCmd;
import com.cloud.api.BaseCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.VpcResponse;
@ -29,6 +30,7 @@ import com.cloud.event.EventTypes;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.Account;
@Implementation(description="Updates a VPC", responseObject=VpcResponse.class)
public class UpdateVPCCmd extends BaseAsyncCmd{
public static final Logger s_logger = Logger.getLogger(UpdateVPCCmd.class.getName());
private static final String _name = "updatevpcresponse";

View File

@ -131,6 +131,7 @@
<property name="console-proxy.jar" value="cloud-console-proxy.jar" />
<property name="api.jar" value="cloud-api.jar"/>
<property name="vmware-base.jar" value="cloud-vmware-base.jar" />
<property name="vmware.jar" value="cloud-vmware.jar" />
<!--
Import information about the build version and company information

View File

@ -325,6 +325,7 @@
</fileset>
<fileset dir="${server.test.dir}">
<include name="**/*Test.java"/>
<exclude name="**/upgrade/*.java"/>
</fileset>
</batchtest>
</junit>
@ -354,6 +355,7 @@
</fileset>
<fileset dir="${server.test.dir}">
<include name="**/${test}.java"/>
<exclude name="**/upgrade/*.java"/>
</fileset>
</batchtest>
</junit>

View File

@ -1,3 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
%define __os_install_post %{nil}
%global debug_package %{nil}
@ -432,6 +449,9 @@ fi
%{_javadir}/%{name}-plugin-nicira-nvp.jar
%{_javadir}/%{name}-plugin-elb.jar
%{_javadir}/%{name}-plugin-netapp.jar
%{_javadir}/%{name}-plugin-hypervisor-kvm.jar
/usr/share/java/libvirt-0.4.8.jar
%config(noreplace) %{_sysconfdir}/%{name}/server/*
%files agent-scripts
@ -456,7 +476,6 @@ fi
%{_javadir}/%{name}-ehcache.jar
%{_javadir}/%{name}-email.jar
%{_javadir}/%{name}-httpcore-4.0.jar
%{_javadir}/%{name}-libvirt-0.4.5.jar
%{_javadir}/%{name}-log4j.jar
%{_javadir}/%{name}-trilead-ssh2-build213.jar
%{_javadir}/%{name}-cglib.jar
@ -480,6 +499,7 @@ fi
%{_javadir}/%{name}-jasypt-1.8.jar
%{_javadir}/%{name}-commons-configuration-1.8.jar
%{_javadir}/%{name}-commons-lang-2.6.jar
%{_javadir}/libvirt-0.4.8.jar
%files core
@ -532,7 +552,6 @@ fi
%files agent-libs
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-agent.jar
%{_javadir}/%{name}-kvm.jar
%files agent
%defattr(0644,root,root,0755)
@ -542,7 +561,6 @@ fi
%config(noreplace) %{_sysconfdir}/%{name}/agent/environment.properties
%config(noreplace) %{_sysconfdir}/%{name}/agent/log4j-%{name}.xml
%attr(0755,root,root) %{_initrddir}/%{name}-agent
%attr(0755,root,root) %{_libexecdir}/agent-runner
%attr(0755,root,root) %{_bindir}/%{name}-setup-agent
%dir %attr(0770,root,root) %{_localstatedir}/log/%{name}/agent
%attr(0755,root,root) %{_bindir}/mycloud-setup-agent
@ -563,7 +581,6 @@ fi
%defattr(0644,root,root,0775)
%{_javadir}/%{name}-usage.jar
%attr(0755,root,root) %{_initrddir}/%{name}-usage
%attr(0755,root,root) %{_libexecdir}/usage-runner
%dir %attr(0770,root,%{name}) %{_localstatedir}/log/%{name}/usage
%config(noreplace) %{_sysconfdir}/%{name}/usage/usage-components.xml
%config(noreplace) %{_sysconfdir}/%{name}/usage/log4j-%{name}_usage.xml

View File

@ -1,4 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

Some files were not shown because too many files have changed in this diff Show More