mirror of https://github.com/apache/cloudstack.git
accidental commit
This commit is contained in:
parent
2cfdb20dae
commit
e7d3a05134
63
test.sh
63
test.sh
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/bash
|
||||
MGMT_SERVER=$MGMT_SERVER
|
||||
|
||||
#login
|
||||
curl -c admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=login&username=admin&password=password&response=json"
|
||||
|
||||
#delete service offerings
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=deleteServiceOffering&id=1&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=deleteServiceOffering&id=2&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=deleteServiceOffering&id=3&response=json"
|
||||
|
||||
#delete service offerings
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=deleteDiskOffering&id=1&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=deleteDiskOffering&id=2&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=deleteDiskOffering&id=3&response=json"
|
||||
|
||||
#create service offerings
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createServiceOffering&cpuNumber=2&cpuSpeed=2400&memory=2400&displayText=Memcached%20Node&name=Memcached%20Node&storageType=local&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createServiceOffering&cpuNumber=2&cpuSpeed=2400&memory=2400&displayText=Web%20Node&name=Web%20Node&storageType=local&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createServiceOffering&cpuNumber=2&cpuSpeed=2400&memory=2400&displayText=Database%20Node&name=Database%20Node&storageType=local&response=json"
|
||||
|
||||
#create disk offerings
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createDiskOffering&diskSize=20&displayText=Small%20Size&name=Volume%20#1&isMirrored=false&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createDiskOffering&diskSize=40&displayText=Volume%20Medium%20Size&name=Volume%20#2&isMirrored=false&response=json"
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createDiskOffering&diskSize=80&displayText=Volume%20Large%20Size&name=Volume%20#3&isMirrored=false&response=json"
|
||||
|
||||
#add secondary storage
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=addSecondaryStorage&zoneId=1&url=nfs%3A//192.168.151.16/export/secondary-storage&response=json"
|
||||
|
||||
#register template
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=registerTemplate&displayText=Rightscale%20%ami-ccb35ea5&format=VHD&isPublic=true&name=Rightscale%20ami-ccb35ea5&osTypeId=11&passwordEnabled=false&url=http%3A//nfs1.lab.vmops.com/templates/ami-ccb35ea5/ami-ccb35ea5.vhd.bz2&response=json"
|
||||
|
||||
#add primary storage
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createStoragePool&zoneId=1&podId=1&url=nfs%3A//192.168.151.16/export/primary-storage&response=json"
|
||||
|
||||
#add hosts here
|
||||
|
||||
#check if templates are ready (DomR and Rightscale AMI)
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=listTemplates&isReady=true&showAll=true&response=json"
|
||||
|
||||
#add user
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createUser&username=tester&email=tester&firstname=tester&accounttype=0&password=<md5hash>&lastname=tester&response=json"
|
||||
|
||||
#login user
|
||||
curl -c usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=login&username=tester&password=tester&response=json"
|
||||
|
||||
#create VMs
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=deployVirtualMachine&zoneId=1&serviceofferingId=4&diskOfferingId=4&templateId=201&displayName=Farmville2&group=Farmville%20Group&response=json"
|
||||
|
||||
#get IP (n times)
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=associateIpAddress&zoneId=1&response=json"
|
||||
|
||||
#list IP addresses
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=listPublicIpAddresses&zoneId=1&response=json"
|
||||
|
||||
#create security group and add rule
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=createSecurityGroup&name=ssh1&description=ssh1&response=json"
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=createNetworkRule&privateport=22&protocol=TCP&publicport=22&securitygroupid=1&response=json"
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=queryAsyncJobResult&jobId=8&response=json"
|
||||
|
||||
#assign security group
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=assignSecurityGroup&groupids=1&publicip=172.24.0.102&virtualmachineid=5&response=json" | awk '{print $(NF-1)}'
|
||||
curl -b usercookie.txt -sS "http://$MGMT_SERVER/client/api?command=queryAsyncJobResult&jobId=8&response=json"
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
MGMT_SERVER=localhost
|
||||
PASSWORD=password
|
||||
USERNAME=root
|
||||
sessionkey=$1
|
||||
|
||||
zoneId=5
|
||||
podId=5
|
||||
ip=192.168.140.11
|
||||
cluster=CV
|
||||
err=$(curl -sS "http://${MGMT_SERVER}:8096/?command=addHost&zoneId=$zoneId&cluster=$clustername&podId=$podId&url=http://$ip&username=$USERNAME&password=$PASSWORD&sessionkey=$sessionkey&response=json")
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# Netscape HTTP Cookie File
|
||||
# http://curl.haxx.se/rfc/cookie_spec.html
|
||||
# This file was generated by libcurl! Edit at your own risk.
|
||||
|
||||
localhost FALSE /client FALSE 0 JSESSIONID 71E3FBC27B8B647B09FFAABB458D1E20
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
. /etc/rc.d/init.d/functions
|
||||
source $(dirname $0)/hosts.properties
|
||||
|
||||
set -x
|
||||
|
||||
|
||||
|
||||
cleanup_xen_host(){
|
||||
ssh root@$1 "for vm in \`xe vm-list | grep name-label | grep -v Control | awk '{print \$4}'\`; do uuid=\`xe vm-list name-label=\$vm | grep uuid | awk '{print \$5}'\`; echo \$uuid; xe vm-shutdown --force uuid=\$uuid; xe vm-destroy uuid=\$uuid; done"
|
||||
ssh root@$1 "for vlan in \`xe vlan-list | grep uuid | awk '{print \$5}'\`; do echo \$vlan; xe vlan-destroy uuid=\$vlan; done"
|
||||
ssh root@$1 "for vlan in \`xe network-list | grep name-label | grep VLAN| awk '{print \$4}'\`; do echo \$vlan; uuid=\`xe network-list name-label=\$vlan | grep uuid | awk '{print \$5}'\`; xe network-destroy uuid=\$uuid; done"
|
||||
ssh root@$1 "for sr in \`xe sr-list type=nfs name-description=storage | grep uuid | awk '{print \$5}'\`; do pbd=\`xe pbd-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; echo \$pbd; xe pbd-unplug uuid=\$pbd; xe pbd-destroy uuid=\$pbd; xe sr-forget uuid=\$sr; done"
|
||||
ssh root@$1 "for sr in \`xe sr-list type=nfs | grep uuid | awk '{print \$5}'\`; do pbd=\`xe pbd-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; echo \$pbd; xe pbd-unplug uuid=\$pbd; xe pbd-destroy uuid=\$pbd; xe sr-forget uuid=\$sr; done"
|
||||
ssh root@$1 "sr=\`xe sr-list type=lvm | grep uuid | awk '{print \$5}'\`; for vdi in \`xe vdi-list sr-uuid=\$sr | grep ^uuid | awk '{ print \$5}'\` ; do echo \$vdi; xe vdi-destroy uuid=\$vdi; done"
|
||||
}
|
||||
|
||||
cleanup_primary() {
|
||||
ssh root@nfs1.lab.vmops.com 'rm -vf /export/home/chiradeep/primary/*.vhd'
|
||||
}
|
||||
|
||||
dir=$(dirname "$0")
|
||||
if [ -f $dir/../deploy.properties ]; then
|
||||
. "$dir/../deploy.properties"
|
||||
fi
|
||||
|
||||
#Kill vms and delete vlans on all computing hosts
|
||||
for i in $COMPUTE
|
||||
do
|
||||
cleanup_xen_host $i
|
||||
done
|
||||
|
||||
cleanup_primary
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
sessionkey=$(curl -c admincookie.txt -sS "http://localhost:8080/client/api?command=login&username=admin&password=5f4dcc3b5aa765d61d8327deb882cf99&response=json" | awk -F "," '{print $13}' | awk -F":" '{print $2}' | tr -d '[:space:]' | tr -d '"')
|
||||
|
||||
echo $sessionkey
|
||||
|
|
@ -1 +0,0 @@
|
|||
COMPUTE=192.168.140.11
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
MGMT_SERVER=localhost:8080
|
||||
|
||||
set -x
|
||||
sessionkey=$1
|
||||
#create zone
|
||||
# curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=createZone&name=$ZONENAME&dns1=$EXTDNS1&internaldns1=8.8.8.8&guestcidraddress=10.1.1.1/24&vlan=1000-1100&response=json"
|
||||
echo
|
||||
#update zone
|
||||
#curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=updateZone&id=1&name=$ZONENAME&DNS1=$EXTDNS1&internaldns1=$INTDNS1&guestcidraddress=10.1.1.1/24&vlan=1000-1100&response=json"
|
||||
echo
|
||||
|
||||
#add pods
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=updatePod&id=5&name=CV&gateway=192.168.140.1&cidr=192.168.140.0%2F24&startip=192.168.140.150&endip=192.168.140.155&sessionkey=$sessionkey&response=json"
|
||||
echo
|
||||
#curl -b admincookie.txt -sS "http://localhost:8080/client/api?command=createPod&name=POD2&zoneid=1&gateway=192.168.203.1&cidr=192.168.203.0%2F24&startip=192.168.203.65&endip=192.168.203.72&response=json"
|
||||
echo
|
||||
|
||||
#add secondary storage
|
||||
curl -b admincookie.txt -sS "http://$MGMT_SERVER/client/api?command=addSecondaryStorage&zoneId=5&url=nfs%3A//nfs1.lab.vmops.com/export/home/chiradeep/secondary/&sessionkey=$sessionkey&response=json"
|
||||
echo
|
||||
|
||||
#register template
|
||||
|
||||
#curl -b admincookie.txt -sS "http://localhost:8080/client/api?command=registerTemplate&displayText=Rightscale%20%ami-ccb35ea5&format=VHD&isPublic=true&name=Rightscale%20ami-ccb35ea5&osTypeId=11&passwordEnabled=false&url=http%3A//192.168.90.243/templates/zynga/ami-ccb35ea5.vhd.bz2&displayText=ZyngaRSTemplate&zoneId=1&ostypeid=12&sessionkey=$sessionkey&response=json"
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
sessionkey=$($(dirname $0)/createlogin.sh)
|
||||
$(dirname $0)/setupzone.sh $sessionkey
|
||||
$(dirname $0)/addhosts.sh $sessionkey
|
||||
Loading…
Reference in New Issue