kvm and xen are already part of sandbox/advanced

This commit is contained in:
Prasanna Santhanam 2011-12-05 21:47:00 +05:30
parent 5ee096c00d
commit d5424b0d31
4 changed files with 0 additions and 521 deletions

View File

@ -1,137 +0,0 @@
{
"zones": [
{
"name": "Sandbox-KVM",
"guestcidraddress": "10.1.1.0/24",
"dns2": "10.223.110.254",
"dns1": "10.147.28.6",
"vlan": "660-669",
"ipranges": [
{
"startip": "10.147.32.105",
"endip": "10.147.32.109",
"netmask": "255.255.255.0",
"gateway": "10.147.32.1"
}
],
"networktype": "Advanced",
"pods": [
{
"endip": "10.147.31.109",
"name": "POD1",
"startip": "10.147.31.105",
"netmask": "255.255.255.0",
"clusters": [
{
"clustername": "KVM0",
"hypervisor": "KVM",
"hosts": [
{
"username": "root",
"url": "http://10.147.31.40",
"password": "password"
}
],
"clustertype": "CloudManaged",
"primaryStorages": [
{
"url": "nfs://10.147.28.6/export/home/prasanna/kamakura",
"name": "PS0"
}
]
}
],
"gateway": "10.147.31.1"
}
],
"internaldns1": "10.147.28.6",
"internaldns2": "10.223.110.254",
"secondaryStorages": [
{
"url": "nfs://10.147.28.6/export/home/prasanna/secondary"
}
]
}
],
"dbSvr": {
"dbSvr": "10.147.28.75",
"passwd": "cloud",
"db": "cloud",
"port": 3306,
"user": "cloud"
},
"logger": [
{
"name": "TestClient",
"file": "/var/log/testclient.log"
},
{
"name": "TestCase",
"file": "/var/log/testcase.log"
}
],
"globalConfig": [
{
"name": "use.user.concentrated.pod.allocation",
"value": "false"
},
{
"name": "default.page.size",
"value": "10000"
},
{
"name": "direct.agent.load.size",
"value": "1000"
},
{
"name": "expunge.delay",
"value": "60"
},
{
"name": "vm.allocation.algorithm",
"value": "random"
},
{
"name": "check.pod.cidrs",
"value": "true"
},
{
"name": "instance.name",
"value": "KVMQA"
},
{
"name": "workers",
"value": "10"
},
{
"name": "vm.op.wait.interval",
"value": "5"
},
{
"name": "guest.domain.suffix",
"value": "sandbox.kvm"
},
{
"name": "expunge.interval",
"value": "60"
},
{
"name": "linkLocalIp.nums",
"value": "10"
},
{
"name": "expunge.workers",
"value": "3"
},
{
"name": "secstorage.allowed.internal.sites",
"value": "10.147.28.0/24"
}
],
"mgtSvr": [
{
"mgtSvrIp": "10.147.28.76",
"port": 8096
}
]
}

View File

@ -1,134 +0,0 @@
#!/usr/bin/env python
'''
############################################################
# Experimental state of scripts
# * Need to be reviewed
# * Only a sandbox
# * DNS settings are internal
# * VLAN settings are internal
# * IP Ranges are internal
# * Storage share is internal
############################################################
'''
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': 'false',
'vm.allocation.algorithm': 'random',
'vm.op.wait.interval': '5',
'guest.domain.suffix': 'sandbox.kvm',
'instance.name': 'KVMQA',
'direct.agent.load.size': '1000',
'default.page.size': '10000',
'linkLocalIp.nums': '10',
'check.pod.cidrs': 'true',
'secstorage.allowed.internal.sites': '10.147.28.0/24',
}
for k, v in global_settings.iteritems():
cfg = configuration()
cfg.name = k
cfg.value = v
yield cfg
def describeResources(dbnode='localhost', mshost='localhost', kvmhost='localhost'):
zs = cloudstackConfiguration()
numberofpods = 1
clustersPerPod = 1
hostsPerCluster = 2
z = zone()
z.dns1 = '10.147.28.6'
z.dns2 = '10.223.110.254'
z.internaldns1 = '10.147.28.6'
z.internaldns2 = '10.223.110.254'
z.name = 'Sandbox-KVM'
z.networktype = 'Advanced'
z.guestcidraddress = '10.1.1.0/24'
z.vlan='660-669'
p = pod()
p.name = 'POD1'
p.gateway = '10.147.31.1'
p.startip = '10.147.31.105'
p.endip = '10.147.31.109'
p.netmask = '255.255.255.0'
v = iprange()
v.gateway = '10.147.32.1'
v.startip = '10.147.32.105'
v.endip = '10.147.32.109'
v.netmask = '255.255.255.0'
c = cluster()
c.clustername = 'KVM0'
c.hypervisor = 'KVM'
c.clustertype = 'CloudManaged'
h = host()
h.username = 'root'
h.password = 'password'
h.url = 'http://%s'%(kvmhost)
c.hosts.append(h)
ps = primaryStorage()
ps.name = 'PS0'
ps.url = 'nfs://10.147.28.6/export/home/prasanna/kamakura' ## TODO: Make this configurable
c.primaryStorages.append(ps)
p.clusters.append(c)
secondary = secondaryStorage()
secondary.url = 'nfs://10.147.28.6/export/home/prasanna/secondary' ## TODO: Make this configurable
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='./sandbox.kvm.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('-k', '--hypervisor', dest='hypervisor', help='hostname/ip of hypervisor server', action='store')
(opts, args) = parser.parse_args()
cfg = describeResources(opts.dbnode, opts.mshost, opts.hypervisor)
generate_setup_config(cfg, opts.output)

View File

@ -1,125 +0,0 @@
#!/usr/bin/env python
try:
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.account=account
deployVmCmd.domainid=1
deployVmCmd.templateid=4 #CentOS Default Builtin
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)]
@unittest.skip("testing")
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)
@unittest.skip("testing")
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,125 +0,0 @@
#!/usr/bin/env python
try:
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.account=account
deployVmCmd.domainid=1
deployVmCmd.templateid=4 #CentOS Default Builtin
deployVmCmd.serviceofferingid=service
deployVmCmd.diskofferingid=3 #standard 5 GB disk
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)
@unittest.skip("testing")
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