bug 10866: Putting additional unique indexs on firewall_rules_cidrs to prevent duplicate rules.

Although the code has been tested for duplicate cidrs, the additional table constraint will add a further safegaurd for this condition.
This commit is contained in:
Abhinandan Prateek 2011-07-28 10:45:24 +05:30
parent 9d4aebd7e3
commit 8a8cfe1388
2 changed files with 3 additions and 0 deletions

View File

@ -598,6 +598,7 @@ CREATE TABLE `cloud`.`firewall_rules_cidrs` (
`source_cidr` varchar(18) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_firewall_cidrs_firewall_rules` (`firewall_rule_id`),
UNIQUE INDEX `unique_rule_cidrs` (`firewall_rule_id`, `source_cidr`),
CONSTRAINT `fk_firewall_cidrs_firewall_rules` FOREIGN KEY (`firewall_rule_id`) REFERENCES `firewall_rules` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -13,6 +13,8 @@ ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__po
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__data_center_id`;
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__cluster_id`;
ALTER TABLE `cloud`.`firewall_rules_cidrs` ADD UNIQUE INDEX `unique_rule_cidrs` (`firewall_rule_id`, `source_cidr`);
INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'agent.load.threshold', '0.70', 'Percentage (as a value between 0 and 1) of connected agents after which agent load balancing will start happening');
INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.visibility', 'global', 'Load Balancer(haproxy) stats visibilty, it can be global,guest-network,disabled');
INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.uri','/admin?stats','Load Balancer(haproxy) uri.');