Simulator specific schema and db objects

Seperating the simulator entities into a seperate database. During
performance tests this helps isolate connection losses happening in
cloud from those happening in the simulator.
reviewed-by : Marvin (vm lifecycle test)
This commit is contained in:
Prasanna Santhanam 2012-08-23 21:12:51 +05:30
parent f7a1e888cf
commit 18427b1682
3 changed files with 46 additions and 13 deletions

View File

@ -0,0 +1,11 @@
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

@ -10,14 +10,14 @@
# limitations under the License.
#
# Automatically generated by addcopyright.py at 04/03/2012
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),
@ -43,7 +43,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,
@ -51,7 +51,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),
@ -62,7 +62,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,
@ -78,7 +78,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,
@ -92,7 +92,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,
@ -103,7 +103,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

@ -51,6 +51,11 @@ if [ ! -f create-index-fk.sql ]; then
exit 6;
fi
if [ ! -f create-database-simulator.sql ]; then
printf "Error: Unable to find create-database-simulator.sql\n"
exit 7;
fi
PATHSEP=':'
if [[ $OSTYPE == "cygwin" ]] ; then
export CATALINA_HOME=`cygpath -m $CATALINA_HOME`
@ -75,6 +80,23 @@ elif [ $mysqlout -ne 0 ]; then
exit 11
fi
mysql --user=root --password=$3 < create-database-simulator.sql > /dev/null 2>/dev/null
mysqlout=$?
if [ $mysqlout -eq 1 ]; then
printf "Please enter root password for MySQL.\n"
mysql --user=root --password < create-database-simulator.sql
if [ $? -ne 0 ]; then
printf "Error: Cannot execute create-database-simulator.sql\n"
exit 10
fi
elif [ $mysqlout -eq 127 ]; then
printf "Error: Cannot execute create-database-simulator.sql - mysql command not found.\n"
exit 11
elif [ $mysqlout -ne 0 ]; then
printf "Error: Cannot execute create-database-simulator.sql\n"
exit 11
fi
mysql --user=cloud --password=cloud cloud < create-schema.sql
if [ $? -ne 0 ]; then
printf "Error: Cannot execute create-schema.sql\n"