property files and build file fixes for simulator db changes

This commit is contained in:
Prasanna Santhanam 2012-09-17 17:32:22 +05:30
parent efc58cdea3
commit 6e9d7aa45b
6 changed files with 58 additions and 158 deletions

View File

@ -69,3 +69,15 @@ db.usage.autoReconnect=true
# awsapi database settings
db.awsapi.name=cloudbridge
# Simulator database settings
db.simulator.username=@DBUSER@
db.simulator.password=@DBPW@
db.simulator.host=@DBHOST@
db.simulator.port=3306
db.simulator.name=simulator
db.simulator.maxActive=250
db.simulator.maxIdle=30
db.simulator.maxWait=10000
db.simulator.autoReconnect=true

View File

@ -0,0 +1,29 @@
-- 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.
DROP DATABASE IF EXISTS `simulator`;
CREATE DATABASE `simulator`;
GRANT ALL ON simulator.* to cloud@`localhost` identified by 'cloud';
GRANT ALL ON simulator.* to cloud@`%` identified by 'cloud';
GRANT process ON *.* TO cloud@`localhost`;
GRANT process ON *.* TO cloud@`%`;
commit;

View File

@ -15,14 +15,14 @@
-- specific language governing permissions and limitations
-- under the License.
DROP TABLE IF EXISTS `cloud`.`mockhost`;
DROP TABLE IF EXISTS `cloud`.`mocksecstorage`;
DROP TABLE IF EXISTS `cloud`.`mockstoragepool`;
DROP TABLE IF EXISTS `cloud`.`mockvm`;
DROP TABLE IF EXISTS `cloud`.`mockvolume`;
DROP TABLE IF EXISTS `cloud`.`mocksecurityrules`;
DROP TABLE IF EXISTS `simulator`.`mockhost`;
DROP TABLE IF EXISTS `simulator`.`mocksecstorage`;
DROP TABLE IF EXISTS `simulator`.`mockstoragepool`;
DROP TABLE IF EXISTS `simulator`.`mockvm`;
DROP TABLE IF EXISTS `simulator`.`mockvolume`;
DROP TABLE IF EXISTS `simulator`.`mocksecurityrules`;
CREATE TABLE `cloud`.`mockhost` (
CREATE TABLE `simulator`.`mockhost` (
`id` bigint unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`private_ip_address` char(40),
@ -48,7 +48,7 @@ CREATE TABLE `cloud`.`mockhost` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`mocksecstorage` (
CREATE TABLE `simulator`.`mocksecstorage` (
`id` bigint unsigned NOT NULL auto_increment,
`url` varchar(255),
`capacity` bigint unsigned,
@ -56,7 +56,7 @@ CREATE TABLE `cloud`.`mocksecstorage` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`mockstoragepool` (
CREATE TABLE `simulator`.`mockstoragepool` (
`id` bigint unsigned NOT NULL auto_increment,
`guid` varchar(255),
`mount_point` varchar(255),
@ -67,7 +67,7 @@ CREATE TABLE `cloud`.`mockstoragepool` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`mockvm` (
CREATE TABLE `simulator`.`mockvm` (
`id` bigint unsigned NOT NULL auto_increment,
`name` varchar(255),
`host_id` bigint unsigned,
@ -83,7 +83,7 @@ CREATE TABLE `cloud`.`mockvm` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`mockvolume` (
CREATE TABLE `simulator`.`mockvolume` (
`id` bigint unsigned NOT NULL auto_increment,
`name` varchar(255),
`size` bigint unsigned,
@ -97,7 +97,7 @@ CREATE TABLE `cloud`.`mockvolume` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`mockconfiguration` (
CREATE TABLE `simulator`.`mockconfiguration` (
`id` bigint unsigned NOT NULL auto_increment,
`data_center_id` bigint unsigned,
`pod_id` bigint unsigned,
@ -108,7 +108,7 @@ CREATE TABLE `cloud`.`mockconfiguration` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cloud`.`mocksecurityrules` (
CREATE TABLE `simulator`.`mocksecurityrules` (
`id` bigint unsigned NOT NULL auto_increment,
`vmid` bigint unsigned,
`signature` varchar(255),

View File

@ -87,6 +87,10 @@ echo "Recreating Database cloud_usage."
mysql --user=root --password=$3 < create-database-premium.sql > /dev/null 2>/dev/null
handle_error create-database-premium.sql
echo "Recreating Database simulator."
mysql --user=root --password=$3 < create-database-simulator.sql > /dev/null 2>/dev/null
handle_error create-database-simulator.sql
mysql --user=cloud --password=cloud cloud < create-schema.sql
if [ $? -ne 0 ]; then
printf "Error: Cannot execute create-schema.sql\n"

View File

@ -1,145 +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.
#!/usr/bin/env python
try:
import unittest2 as unittest
except ImportError:
import unittest
import random
import hashlib
from cloudstackTestCase import *
import remoteSSHClient
class SampleScenarios(cloudstackTestCase):
'''
'''
def setUp(self):
pass
def tearDown(self):
pass
def test_1_createAccounts(self, numberOfAccounts=2):
'''
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=2
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 5 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,5)]
@unittest.skip("skipping destroys")
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("skipping destroys")
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

0
tools/marvin/marvin/sandbox/run-marvin.sh Normal file → Executable file
View File