http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/api/src/com/cloud/event/EventTypes.java ----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/api/src/org/apache/cloudstack/api/ApiConstants.java ---------------------------------------------------------------------- diff --cc api/src/org/apache/cloudstack/api/ApiConstants.java index e930d86,b40b26c..0436906 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@@ -443,9 -445,21 +450,24 @@@ public class ApiConstants public static final String AUTOSCALE_USER_ID = "autoscaleuserid"; public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername"; public static final String UCS_DN = "ucsdn"; + public static final String GSLB_PROVIDER = "gslbprovider"; + public static final String GSLB_PROVIDER_PUBLIC_IP = "gslbproviderpublicip"; + public static final String GSLB_PROVIDER_PRIVATE_IP = "gslbproviderprivateip"; + public static final String VM_SNAPSHOT_DESCRIPTION = "description"; + public static final String VM_SNAPSHOT_DISPLAYNAME = "name"; + public static final String VM_SNAPSHOT_ID = "vmsnapshotid"; + public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids"; + public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory"; + public static final String IMAGE_STORE_UUID = "imagestoreuuid"; + public static final String GUEST_VM_CIDR = "guestvmcidr"; + public static final String NETWORK_CIDR = "networkcidr"; + public static final String RESERVED_IP_RANGE = "reservediprange"; + public static final String UCS_MANAGER_ID = "ucsmanagerid"; + public static final String UCS_PROFILE_DN = "profiledn"; + public static final String UCS_BLADE_DN = "bladedn"; + public static final String UCS_BLADE_ID = "bladeid"; + public static final String VM_GUEST_IP = "vmguestip"; + public static final String OLDER_THAN = "olderthan"; public enum HostDetails { all, capacity, events, stats, min; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/api/src/org/apache/cloudstack/api/ResponseGenerator.java ---------------------------------------------------------------------- diff --cc api/src/org/apache/cloudstack/api/ResponseGenerator.java index 11ca452,a602514..0b73fd4 --- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java +++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java @@@ -58,16 -165,10 +143,19 @@@ import com.cloud.user.User import com.cloud.user.UserAccount; import com.cloud.uservm.UserVm; import com.cloud.vm.InstanceGroup; + import com.cloud.vm.Nic; + import com.cloud.vm.NicSecondaryIp; -import com.cloud.vm.VirtualMachine; + import com.cloud.vm.snapshot.VMSnapshot; +import com.cloud.vm.VirtualMachine; +import org.apache.cloudstack.api.ApiConstants.HostDetails; +import org.apache.cloudstack.api.ApiConstants.VMDetails; +import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd; +import org.apache.cloudstack.api.response.*; +import org.apache.cloudstack.region.Region; + +import java.text.DecimalFormat; +import java.util.EnumSet; +import java.util.List; public interface ResponseGenerator { UserResponse createUserResponse(UserAccount user); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/client/tomcatconf/commands.properties.in ---------------------------------------------------------------------- diff --cc client/tomcatconf/commands.properties.in index fd9e733,5018236..16e9822 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@@ -538,11 -547,11 +547,19 @@@ updateRegion= removeRegion=1 listRegions=15 - +#### GSLB (Global Server Load Balancing) commands +createGlobalLoadBalancerRule=15 +deleteGlobalLoadBalancerRule=15 +updateGlobalLoadBalancerRule=15 +listGlobalLoadBalancerRules=15 +assignToGlobalLoadBalancerRule=15 +removeFromGlobalLoadBalancerRule=15 ++ + ### VM Snapshot commands + listVMSnapshot=15 + createVMSnapshot=15 + deleteVMSnapshot=15 + revertToSnapshot=15 + + #### Baremetal commands + addBaremetalHost=1 http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/server/src/com/cloud/api/ApiResponseHelper.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/api/ApiResponseHelper.java index 8c3391d,fbfc955..3e95da9 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@@ -93,8 -199,17 +183,18 @@@ import org.apache.cloudstack.api.Respon import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd; import org.apache.cloudstack.api.response.*; import org.apache.cloudstack.region.Region; + import org.apache.cloudstack.usage.Usage; + import org.apache.cloudstack.usage.UsageService; + import org.apache.cloudstack.usage.UsageTypes; + import com.cloud.vm.VmStats; + import com.cloud.vm.dao.UserVmData; + import com.cloud.vm.dao.UserVmData.NicData; + import com.cloud.vm.dao.UserVmData.SecurityGroupData; + import com.cloud.vm.snapshot.VMSnapshot; + import org.apache.cloudstack.api.ResponseGenerator; + import org.apache.cloudstack.api.response.VMSnapshotResponse; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import java.text.DecimalFormat; import java.util.*; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/server/src/com/cloud/configuration/Config.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/configuration/Config.java index 1b59ad5,64465a2..07e4c89 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@@ -29,11 -34,8 +34,12 @@@ import com.cloud.storage.secondary.Seco import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.template.TemplateManager; import com.cloud.vm.UserVmManager; + import com.cloud.vm.snapshot.VMSnapshotManager; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + public enum Config { // Alert @@@ -366,8 -373,19 +377,21 @@@ IntervalToEchoBaremetalSecurityGroupAgent("Advanced", ManagementServer.class, Integer.class, "interval.baremetal.securitygroup.agent.echo", "10", "Interval to echo baremetal security group agent, in seconds", null), TimeoutToEchoBaremetalSecurityGroupAgent("Advanced", ManagementServer.class, Integer.class, "timeout.baremetal.securitygroup.agent.echo", "3600", "Timeout to echo baremetal security group agent, in seconds, the provisioning process will be treated as a failure", null), + CloudDnsName("Advanced", ManagementServer.class, String.class, "cloud.dns.name", "default", " DNS name of the cloud", null); + + ApiLimitEnabled("Advanced", ManagementServer.class, Boolean.class, "api.throttling.enabled", "true", "Enable/disable Api rate limit", null), + ApiLimitInterval("Advanced", ManagementServer.class, Integer.class, "api.throttling.interval", "1", "Time interval (in seconds) to reset API count", null), + ApiLimitMax("Advanced", ManagementServer.class, Integer.class, "api.throttling.max", "25", "Max allowed number of APIs within fixed interval", null), + ApiLimitCacheSize("Advanced", ManagementServer.class, Integer.class, "api.throttling.cachesize", "50000", "Account based API count cache size", null), + + + // VMSnapshots + VMSnapshotMax("Advanced", VMSnapshotManager.class, Integer.class, "vmsnapshot.max", "10", "Maximum vm snapshots for a vm", null), + VMSnapshotCreateWait("Advanced", VMSnapshotManager.class, Integer.class, "vmsnapshot.create.wait", "600", "In second, timeout for create vm snapshot", null), + VMSnapshotExpungeInterval("Advanced", VMSnapshotManager.class, Integer.class, "vmsnapshot.expunge.interval", "60", "The interval (in seconds) to wait before running the expunge thread.", null), + VMSnapshotExpungeWorkers("Advanced", VMSnapshotManager.class, Integer.class, "vmsnapshot.expunge.workers", "1", "Number of workers performing expunge ", null); + + private final String _category; private final Class<?> _componentClass; private final Class<?> _type; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/server/src/com/cloud/network/ExternalLoadBalancerDeviceManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fea98fa6/setup/db/create-schema.sql ---------------------------------------------------------------------- diff --cc setup/db/create-schema.sql index c837a44,7361681..a4ddb06 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@@ -2130,10 -2081,8 +2083,11 @@@ CREATE TABLE `cloud`.`external_load_bal `device_state` varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'state (enabled/disabled/shutdown) of the device', `allocation_state` varchar(32) NOT NULL DEFAULT 'Free' COMMENT 'Allocation state (Free/Shared/Dedicated/Provider) of the device', `is_dedicated` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if device/appliance is provisioned for dedicated use only', + `is_inline` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer will be used in in-line configuration with firewall', `is_managed` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance is provisioned and its life cycle is managed by by cloudstack', + `is_gslb_provider` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance is acting as gslb service provider in the zone', + `gslb_site_publicip` varchar(255) DEFAULT NULL COMMENT 'GSLB service Provider site public ip', + `gslb_site_privateip` varchar(255) DEFAULT NULL COMMENT 'GSLB service Provider site private ip', `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external load balancer device', `parent_host_id` bigint unsigned COMMENT 'if the load balancer appliance is cloudstack managed, then host id on which this appliance is provisioned', PRIMARY KEY (`id`), @@@ -2481,209 -2419,5 +2435,33 @@@ CREATE TABLE `cloud`.`nicira_nvp_nic_ma PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - CREATE TABLE `cloud`.`nicira_nvp_router_map` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `logicalrouter_uuid` varchar(255) NOT NULL UNIQUE COMMENT 'nicira uuid of logical router', - `network_id` bigint unsigned NOT NULL UNIQUE COMMENT 'cloudstack id of the network', - PRIMARY KEY (`id`), - CONSTRAINT `fk_nicira_nvp_router_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`external_bigswitch_vns_devices` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(255) UNIQUE, - `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch vns device is added', - `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch vns device', - `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch vns device', - `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch vns device', - PRIMARY KEY (`id`), - CONSTRAINT `fk_external_bigswitch_vns_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_external_bigswitch_vns_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`counter` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40), - `source` varchar(255) NOT NULL COMMENT 'source e.g. netscaler, snmp', - `name` varchar(255) NOT NULL COMMENT 'Counter name', - `value` varchar(255) NOT NULL COMMENT 'Value in case of source=snmp', - `removed` datetime COMMENT 'date removed if not null', - `created` datetime NOT NULL COMMENT 'date created', - PRIMARY KEY (`id`), - CONSTRAINT `uc_counter__uuid` UNIQUE (`uuid`), - INDEX `i_counter__removed`(`removed`), - INDEX `i_counter__source`(`source`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`conditions` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40), - `counter_id` bigint unsigned NOT NULL COMMENT 'Counter Id', - `threshold` bigint unsigned NOT NULL COMMENT 'threshold value for the given counter', - `relational_operator` char(2) COMMENT 'relational operator to be used upon the counter and condition', - `domain_id` bigint unsigned NOT NULL COMMENT 'domain the Condition belongs to', - `account_id` bigint unsigned NOT NULL COMMENT 'owner of this Condition', - `removed` datetime COMMENT 'date removed if not null', - `created` datetime NOT NULL COMMENT 'date created', - PRIMARY KEY (`id`), - CONSTRAINT `fk_conditions__counter_id` FOREIGN KEY `fk_condition__counter_id`(`counter_id`) REFERENCES `counter`(`id`), - CONSTRAINT `fk_conditions__account_id` FOREIGN KEY `fk_condition__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_conditions__domain_id` FOREIGN KEY `fk_condition__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_conditions__uuid` UNIQUE (`uuid`), - INDEX `i_conditions__removed`(`removed`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`autoscale_vmprofiles` ( - `id` bigint unsigned NOT NULL auto_increment, - `uuid` varchar(40), - `zone_id` bigint unsigned NOT NULL, - `domain_id` bigint unsigned NOT NULL, - `account_id` bigint unsigned NOT NULL, - `autoscale_user_id` bigint unsigned NOT NULL, - `service_offering_id` bigint unsigned NOT NULL, - `template_id` bigint unsigned NOT NULL, - `other_deploy_params` varchar(1024) COMMENT 'other deployment parameters that is in addition to zoneid,serviceofferingid,domainid', - `destroy_vm_grace_period` int unsigned COMMENT 'the time allowed for existing connections to get closed before a vm is destroyed', - `counter_params` varchar(1024) COMMENT 'the parameters for the counter to be used to get metric information from VMs', - `created` datetime NOT NULL COMMENT 'date created', - `removed` datetime COMMENT 'date removed if not null', - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_vmprofiles__domain_id` FOREIGN KEY `fk_autoscale_vmprofiles__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmprofiles__account_id` FOREIGN KEY `fk_autoscale_vmprofiles__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmprofiles__autoscale_user_id` FOREIGN KEY `fk_autoscale_vmprofiles__autoscale_user_id` (`autoscale_user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_autoscale_vmprofiles__uuid` UNIQUE (`uuid`), - INDEX `i_autoscale_vmprofiles__removed`(`removed`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`autoscale_policies` ( - `id` bigint unsigned NOT NULL auto_increment, - `uuid` varchar(40), - `domain_id` bigint unsigned NOT NULL, - `account_id` bigint unsigned NOT NULL, - `duration` int unsigned NOT NULL, - `quiet_time` int unsigned NOT NULL, - `action` varchar(15), - `created` datetime NOT NULL COMMENT 'date created', - `removed` datetime COMMENT 'date removed if not null', - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_policies__domain_id` FOREIGN KEY `fk_autoscale_policies__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_policies__account_id` FOREIGN KEY `fk_autoscale_policies__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_autoscale_policies__uuid` UNIQUE (`uuid`), - INDEX `i_autoscale_policies__removed`(`removed`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`autoscale_vmgroups` ( - `id` bigint unsigned NOT NULL auto_increment, - `uuid` varchar(40), - `zone_id` bigint unsigned NOT NULL, - `domain_id` bigint unsigned NOT NULL, - `account_id` bigint unsigned NOT NULL, - `load_balancer_id` bigint unsigned NOT NULL, - `min_members` int unsigned DEFAULT 1, - `max_members` int unsigned NOT NULL, - `member_port` int unsigned NOT NULL, - `interval` int unsigned NOT NULL, - `profile_id` bigint unsigned NOT NULL, - `state` varchar(255) NOT NULL COMMENT 'enabled or disabled, a vmgroup is disabled to stop autoscaling activity', - `created` datetime NOT NULL COMMENT 'date created', - `removed` datetime COMMENT 'date removed if not null', - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_vmgroup__autoscale_vmprofile_id` FOREIGN KEY(`profile_id`) REFERENCES `autoscale_vmprofiles`(`id`), - CONSTRAINT `fk_autoscale_vmgroup__load_balancer_id` FOREIGN KEY(`load_balancer_id`) REFERENCES `load_balancing_rules`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroups__domain_id` FOREIGN KEY `fk_autoscale_vmgroups__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroups__account_id` FOREIGN KEY `fk_autoscale_vmgroups__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroups__zone_id` FOREIGN KEY `fk_autoscale_vmgroups__zone_id`(`zone_id`) REFERENCES `data_center`(`id`), - CONSTRAINT `uc_autoscale_vmgroups__uuid` UNIQUE (`uuid`), - INDEX `i_autoscale_vmgroups__removed`(`removed`), - INDEX `i_autoscale_vmgroups__load_balancer_id`(`load_balancer_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`autoscale_policy_condition_map` ( - `id` bigint unsigned NOT NULL auto_increment, - `policy_id` bigint unsigned NOT NULL, - `condition_id` bigint unsigned NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_policy_condition_map__policy_id` FOREIGN KEY `fk_autoscale_policy_condition_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_policy_condition_map__condition_id` FOREIGN KEY `fk_autoscale_policy_condition_map__condition_id` (`condition_id`) REFERENCES `conditions` (`id`), - INDEX `i_autoscale_policy_condition_map__policy_id`(`policy_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`autoscale_vmgroup_policy_map` ( - `id` bigint unsigned NOT NULL auto_increment, - `vmgroup_id` bigint unsigned NOT NULL, - `policy_id` bigint unsigned NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_vmgroup_policy_map__vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__vmgroup_id` (`vmgroup_id`) REFERENCES `autoscale_vmgroups` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroup_policy_map__policy_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`), - INDEX `i_autoscale_vmgroup_policy_map__vmgroup_id`(`vmgroup_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - CREATE TABLE `cloud`.`region_sync` ( - `id` bigint unsigned NOT NULL auto_increment, - `region_id` int unsigned NOT NULL, - `api` varchar(1024) NOT NULL, - `created` datetime NOT NULL COMMENT 'date created', - `processed` tinyint NOT NULL default '0', - PRIMARY KEY (`id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (1, UUID(), 'snmp','Linux User CPU - percentage', '1.3.6.1.4.1.2021.11.9.0', now()); - INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (2, UUID(), 'snmp','Linux System CPU - percentage', '1.3.6.1.4.1.2021.11.10.0', now()); - INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (3, UUID(), 'snmp','Linux CPU Idle - percentage', '1.3.6.1.4.1.2021.11.11.0', now()); - INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (100, UUID(), 'netscaler','Response Time - microseconds', 'RESPTIME', now()); - - CREATE TABLE `cloud`.`user_ipv6_address` ( - `id` bigint unsigned NOT NULL UNIQUE auto_increment, - `uuid` varchar(40), - `account_id` bigint unsigned NULL, - `domain_id` bigint unsigned NULL, - `ip_address` char(50) NOT NULL, - `data_center_id` bigint unsigned NOT NULL COMMENT 'zone that it belongs to', - `vlan_id` bigint unsigned NOT NULL, - `state` char(32) NOT NULL default 'Free' COMMENT 'state of the ip address', - `mac_address` varchar(40) NOT NULL COMMENT 'mac address of this ip', - `source_network_id` bigint unsigned NOT NULL COMMENT 'network id ip belongs to', - `network_id` bigint unsigned COMMENT 'network this public ip address is associated with', - `physical_network_id` bigint unsigned NOT NULL COMMENT 'physical network id that this configuration is based on', - `created` datetime NULL COMMENT 'Date this ip was allocated to someone', - PRIMARY KEY (`id`), - UNIQUE (`ip_address`, `source_network_id`), - CONSTRAINT `fk_user_ipv6_address__source_network_id` FOREIGN KEY (`source_network_id`) REFERENCES `networks`(`id`), - CONSTRAINT `fk_user_ipv6_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), - CONSTRAINT `fk_user_ipv6_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`), - CONSTRAINT `fk_user_ipv6_address__vlan_id` FOREIGN KEY (`vlan_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_user_ipv6_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_user_ipv6_address__uuid` UNIQUE (`uuid`), - CONSTRAINT `fk_user_ipv6_address__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - +CREATE TABLE `cloud`.`global_load_balancing_rules` ( + `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', + `uuid` varchar(40), + `account_id` bigint unsigned NOT NULL COMMENT 'account id', + `region_id` int unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `description` varchar(4096) NULL COMMENT 'description', + `state` char(32) NOT NULL COMMENT 'current state of this rule', + `algorithm` varchar(255) NOT NULL COMMENT 'load balancing algorithm used to distribbute traffic across zones', + `persistence` varchar(255) NOT NULL COMMENT 'session persistence used across the zone', + `gslb_domain_name` varchar(255) NOT NULL COMMENT 'DNS name for the GSLB service that is used to provide a FQDN for the GSLB service', + `service_type` varchar(255) NOT NULL COMMENT 'type of the GSLB service', + PRIMARY KEY (`id`), + CONSTRAINT `fk_global_load_balancing_rules_account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_global_load_balancing_rules_region_id` FOREIGN KEY(`region_id`) REFERENCES `region`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`global_load_balancer_lb_rule_map` ( + `id` bigint unsigned NOT NULL auto_increment, + `gslb_rule_id` bigint unsigned NOT NULL, + `lb_rule_id` bigint unsigned NOT NULL, + `revoke` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 is when rule is set for Revoke', + PRIMARY KEY (`id`), + UNIQUE KEY (`gslb_rule_id`, `lb_rule_id`), + CONSTRAINT `fk_gslb_rule_id` FOREIGN KEY(`gslb_rule_id`) REFERENCES `global_load_balancing_rules`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_lb_rule_id` FOREIGN KEY(`lb_rule_id`) REFERENCES `load_balancing_rules`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + SET foreign_key_checks = 1;