Merge branch 'master' into internallb1 Conflicts: api/src/com/cloud/network/IpAddress.java server/src/com/cloud/network/NetworkServiceImpl.java setup/db/db/schema-410to420.sql
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0cfe96bd Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0cfe96bd Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0cfe96bd Branch: refs/heads/internallb Commit: 0cfe96bd00a79ccb9ddebed760c6dde257599074 Parents: 501f2ff 11162f5 Author: Alena Prokharchyk <alena.prokharc...@citrix.com> Authored: Wed Apr 17 15:41:51 2013 -0700 Committer: Alena Prokharchyk <alena.prokharc...@citrix.com> Committed: Wed Apr 17 15:51:05 2013 -0700 ---------------------------------------------------------------------- api/src/com/cloud/network/IpAddress.java | 8 - api/src/com/cloud/network/NetworkService.java | 2 +- api/src/com/cloud/network/PhysicalNetwork.java | 5 +- api/src/com/cloud/network/PublicIpAddress.java | 3 - api/src/com/cloud/server/ManagementService.java | 2 - api/src/com/cloud/user/Account.java | 4 + api/src/com/cloud/user/User.java | 2 + .../org/apache/cloudstack/api/ApiConstants.java | 2 +- .../admin/config/ListDeploymentPlannersCmd.java | 71 --- .../admin/network/UpdatePhysicalNetworkCmd.java | 8 +- .../admin/offering/CreateServiceOfferingCmd.java | 6 - .../api/command/user/tag/CreateTagsCmd.java | 2 +- .../api/command/user/tag/DeleteTagsCmd.java | 2 +- .../api/command/user/tag/ListTagsCmd.java | 2 +- .../cloudstack/api/command/user/vm/ListVMsCmd.java | 2 +- .../cloudstack/api/response/AccountResponse.java | 7 + .../cloudstack/api/response/UserResponse.java | 8 + client/tomcatconf/applicationContext.xml.in | 1 - core/src/com/cloud/user/AccountVO.java | 7 + core/src/com/cloud/user/UserVO.java | 11 +- docs/en-US/Release_Notes.xml | 422 ++++++--------- docs/en-US/source-build.xml | 4 +- .../hypervisor/kvm/resource/KVMHAMonitor.java | 51 ++- .../kvm/resource/LibvirtComputingResource.java | 25 +- .../CloudStackPrimaryDataStoreLifeCycleImpl.java | 3 +- server/src/com/cloud/api/ApiResponseHelper.java | 3 +- .../src/com/cloud/api/query/QueryManagerImpl.java | 1 + .../cloud/api/query/dao/AccountJoinDaoImpl.java | 8 +- .../api/query/dao/UserAccountJoinDaoImpl.java | 1 + .../src/com/cloud/api/query/vo/AccountJoinVO.java | 10 + .../com/cloud/api/query/vo/UserAccountJoinVO.java | 16 +- server/src/com/cloud/configuration/Config.java | 2 +- .../cloud/configuration/ConfigurationManager.java | 3 +- .../configuration/ConfigurationManagerImpl.java | 19 +- server/src/com/cloud/dc/dao/DataCenterVnetDao.java | 6 + .../com/cloud/dc/dao/DataCenterVnetDaoImpl.java | 50 ++- .../network/ExternalFirewallDeviceManagerImpl.java | 14 +- .../src/com/cloud/network/NetworkServiceImpl.java | 281 +++++++--- server/src/com/cloud/network/addr/PublicIp.java | 18 +- server/src/com/cloud/network/dao/IPAddressVO.java | 2 - .../com/cloud/network/dao/PhysicalNetworkVO.java | 20 +- .../com/cloud/network/guru/GuestNetworkGuru.java | 14 +- .../com/cloud/server/ConfigurationServerImpl.java | 12 +- .../src/com/cloud/server/ManagementServerImpl.java | 19 - .../src/com/cloud/service/ServiceOfferingVO.java | 23 - .../src/com/cloud/storage/StorageManagerImpl.java | 4 +- server/src/com/cloud/user/AccountManagerImpl.java | 15 +- server/src/com/cloud/vm/UserVmManagerImpl.java | 5 + .../com/cloud/vm/VirtualMachineManagerImpl.java | 5 + .../affinity/AffinityGroupServiceImpl.java | 2 +- .../gslb/GlobalLoadBalancingRulesServiceImpl.java | 11 + .../configuration/ConfigurationManagerTest.java | 4 +- .../com/cloud/network/MockNetworkManagerImpl.java | 2 +- .../cloud/network/UpdatePhysicalNetworkTest.java | 68 +++ .../cloud/vpc/MockConfigurationManagerImpl.java | 2 +- .../test/com/cloud/vpc/MockNetworkManagerImpl.java | 2 +- setup/db/db/schema-410to420.sql | 360 +++++++------ test/integration/component/test_accounts.py | 10 +- .../component/test_allocation_states.py | 2 +- test/integration/component/test_blocker_bugs.py | 8 +- test/integration/component/test_egress_rules.py | 13 +- test/integration/component/test_eip_elb.py | 3 +- .../integration/component/test_network_offering.py | 5 +- test/integration/component/test_project_configs.py | 6 +- test/integration/component/test_project_limits.py | 4 +- .../component/test_project_resources.py | 7 +- test/integration/component/test_project_usage.py | 10 +- test/integration/component/test_projects.py | 8 +- test/integration/component/test_resource_limits.py | 4 +- test/integration/component/test_routers.py | 5 +- test/integration/component/test_security_groups.py | 9 +- test/integration/component/test_snapshots.py | 8 +- test/integration/component/test_templates.py | 3 +- test/integration/component/test_usage.py | 10 +- .../integration/component/test_vm_passwdenabled.py | 1 + test/integration/component/test_volumes.py | 6 +- test/integration/smoke/test_non_contigiousvlan.py | 125 +++++ tools/apidoc/gen_toc.py | 1 + tools/marvin/marvin/asyncJobMgr.py | 2 +- tools/marvin/marvin/cloudstackConnection.py | 238 +++++---- tools/marvin/marvin/cloudstackTestClient.py | 3 +- tools/marvin/marvin/codegenerator.py | 4 +- tools/marvin/marvin/deployDataCenter.py | 1 - tools/marvin/marvin/jsonHelper.py | 7 +- tools/marvin/setup.py | 1 + ui/scripts/cloudStack.js | 6 +- ui/scripts/regions.js | 308 +++++++++-- ui/scripts/system.js | 52 ++- ui/scripts/zoneWizard.js | 16 +- 89 files changed, 1631 insertions(+), 917 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/api/src/com/cloud/network/IpAddress.java ---------------------------------------------------------------------- diff --cc api/src/com/cloud/network/IpAddress.java index a1fcb79,71c9b4e..c48e8b9 --- a/api/src/com/cloud/network/IpAddress.java +++ b/api/src/com/cloud/network/IpAddress.java @@@ -78,18 -78,7 +78,10 @@@ public interface IpAddress extends Cont boolean getSystem(); - /** - * @return - */ Long getVpcId(); - /** - * @param vpcId - */ - void setVpcId(Long vpcId); String getVmIp(); - void setVmIp(String vmIp); + + Long getNetworkId(); + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/api/src/org/apache/cloudstack/api/ApiConstants.java ---------------------------------------------------------------------- diff --cc api/src/org/apache/cloudstack/api/ApiConstants.java index bac5819,8c32bb3..70c3665 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@@ -473,15 -474,8 +474,14 @@@ public class ApiConstants public static final String HEALTHCHECK_HEALTHY_THRESHOLD = "healthythreshold"; public static final String HEALTHCHECK_UNHEALTHY_THRESHOLD = "unhealthythreshold"; public static final String HEALTHCHECK_PINGPATH = "pingpath"; + public static final String SOURCE_PORT = "sourceport"; + public static final String INSTANCE_PORT = "instanceport"; + public static final String SOURCE_IP = "sourceipaddress"; + public static final String SOURCE_IP_NETWORK_ID = "sourceipaddressnetworkid"; + public static final String SCHEME = "scheme"; + public static final String PROVIDER_TYPE = "providertype"; public static final String AFFINITY_GROUP_IDS = "affinitygroupids"; public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames"; - public static final String DEPLOYMENT_PLANNER = "deploymentplanner"; public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile"; public enum HostDetails { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/client/tomcatconf/applicationContext.xml.in ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/api/ApiResponseHelper.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/api/query/QueryManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/configuration/ConfigurationManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/configuration/ConfigurationManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/network/NetworkServiceImpl.java ---------------------------------------------------------------------- diff --cc server/src/com/cloud/network/NetworkServiceImpl.java index 27c8aa7,12c6068..0d949ab --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@@ -16,50 -16,13 +16,53 @@@ // under the License. package com.cloud.network; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.InvalidParameterException; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.acl.ControlledEntity.ACLType; ++import org.apache.cloudstack.acl.SecurityChecker; +import org.apache.cloudstack.acl.SecurityChecker.AccessType; +import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd; +import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd; +import org.apache.cloudstack.api.command.user.network.ListNetworksCmd; +import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd; +import org.apache.cloudstack.api.command.user.vm.ListNicsCmd; +import org.apache.cloudstack.network.element.InternalLoadBalancerElementService; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + import com.cloud.configuration.Config; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.dc.*; +import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.DataCenterVO; ++import com.cloud.dc.DataCenterVnetVO; +import com.cloud.dc.Pod; import com.cloud.dc.Vlan.VlanType; -import com.cloud.dc.dao.*; +import com.cloud.dc.VlanVO; +import com.cloud.dc.dao.AccountVlanMapDao; +import com.cloud.dc.dao.DataCenterDao; ++import com.cloud.dc.dao.DataCenterVnetDao; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.dc.dao.VlanDao; import com.cloud.deploy.DeployDestination; import com.cloud.domain.Domain; import com.cloud.domain.DomainVO; @@@ -259,8 -201,8 +262,10 @@@ public class NetworkServiceImpl extend HostDao _hostDao; @Inject HostPodDao _hostPodDao; + @Inject + InternalLoadBalancerElementService _internalLbElementSvc; + @Inject + DataCenterVnetDao _datacneter_vnet; int _cidrLimit; boolean _allowSubdomainNetworkAccess; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/network/dao/IPAddressVO.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/network/guru/GuestNetworkGuru.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/server/ConfigurationServerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/src/com/cloud/server/ManagementServerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/test/com/cloud/network/MockNetworkManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/server/test/com/cloud/vpc/MockNetworkManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cfe96bd/setup/db/db/schema-410to420.sql ---------------------------------------------------------------------- diff --cc setup/db/db/schema-410to420.sql index 1d8a6f1,a36be0e..52acd3c --- a/setup/db/db/schema-410to420.sql +++ b/setup/db/db/schema-410to420.sql @@@ -471,14 -329,7 +329,7 @@@ CREATE TABLE `cloud`.`vm_snapshots` ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `vm_snapshot_enabled` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Whether VM snapshot is supported by hypervisor'; UPDATE `cloud`.`hypervisor_capabilities` SET `vm_snapshot_enabled`=1 WHERE `hypervisor_type` in ('VMware', 'XenServer'); - - ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address` varchar(40) COMMENT 'source ip address for the load balancer rule'; - ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address_network_id` bigint unsigned COMMENT 'the id of the network where source ip belongs to'; - ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `scheme` varchar(40) NOT NULL COMMENT 'load balancer scheme; can be Internal or Public'; - UPDATE `cloud`.`load_balancing_rules` SET `scheme`='Public'; - - -- ++ DROP VIEW IF EXISTS `cloud`.`user_vm_view`; CREATE VIEW `cloud`.`user_vm_view` AS select @@@ -588,7 -439,7 +439,7 @@@ async_job.uuid job_uuid, async_job.job_status job_status, async_job.account_id job_account_id, -- affinity_group.id affinity_group_id, ++ affinity_group.id affinity_group_id, affinity_group.uuid affinity_group_uuid, affinity_group.name affinity_group_name, affinity_group.description affinity_group_description @@@ -653,7 -504,7 +504,7 @@@ and async_job.job_status = 0 left join `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id -- left join ++ left join `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id; DROP VIEW IF EXISTS `cloud`.`affinity_group_view`; @@@ -726,133 -577,198 +577,334 @@@ CREATE TABLE `cloud`.`network_asa1000v_ ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`; -- Re-enable foreign key checking, at the end of the upgrade path --SET foreign_key_checks = 1; ++SET foreign_key_checks = 1; + + + -- Add "default" field to account/user tables + ALTER TABLE `cloud`.`account` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if account is default'; + ALTER TABLE `cloud`.`user` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if user is default'; + UPDATE `cloud`.`account` SET `cloud`.`account`.`default`=1 WHERE id IN (1,2); + UPDATE `cloud`.`user` SET `cloud`.`user`.`default`=1 WHERE id IN (1,2); + + ALTER VIEW `cloud`.`user_view` AS + select + user.id, + user.uuid, + user.username, + user.password, + user.firstname, + user.lastname, + user.email, + user.state, + user.api_key, + user.secret_key, + user.created, + user.removed, + user.timezone, + user.registration_token, + user.is_registered, + user.incorrect_login_attempts, + user.default, + account.id account_id, + account.uuid account_uuid, + account.account_name account_name, + account.type account_type, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id + from + `cloud`.`user` + inner join + `cloud`.`account` ON user.account_id = account.id + inner join + `cloud`.`domain` ON account.domain_id = domain.id + left join + `cloud`.`async_job` ON async_job.instance_id = user.id + and async_job.instance_type = 'User' + and async_job.job_status = 0; + + + DROP VIEW IF EXISTS `cloud`.`account_view`; + CREATE VIEW `cloud`.`account_view` AS + select + account.id, + account.uuid, + account.account_name, + account.type, + account.state, + account.removed, + account.cleanup_needed, + account.network_domain, + account.default, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path, + data_center.id data_center_id, + data_center.uuid data_center_uuid, + data_center.name data_center_name, + account_netstats_view.bytesReceived, + account_netstats_view.bytesSent, + vmlimit.max vmLimit, + vmcount.count vmTotal, + runningvm.vmcount runningVms, + stoppedvm.vmcount stoppedVms, + iplimit.max ipLimit, + ipcount.count ipTotal, + free_ip_view.free_ip ipFree, + volumelimit.max volumeLimit, + volumecount.count volumeTotal, + snapshotlimit.max snapshotLimit, + snapshotcount.count snapshotTotal, + templatelimit.max templateLimit, + templatecount.count templateTotal, + vpclimit.max vpcLimit, + vpccount.count vpcTotal, + projectlimit.max projectLimit, + projectcount.count projectTotal, + networklimit.max networkLimit, + networkcount.count networkTotal, + cpulimit.max cpuLimit, + cpucount.count cpuTotal, + memorylimit.max memoryLimit, + memorycount.count memoryTotal, + primary_storage_limit.max primaryStorageLimit, + primary_storage_count.count primaryStorageTotal, + secondary_storage_limit.max secondaryStorageLimit, + secondary_storage_count.count secondaryStorageTotal, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id + from + `cloud`.`free_ip_view`, + `cloud`.`account` + inner join + `cloud`.`domain` ON account.domain_id = domain.id + left join + `cloud`.`data_center` ON account.default_zone_id = data_center.id + left join + `cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id + left join + `cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id + and vmlimit.type = 'user_vm' + left join + `cloud`.`resource_count` vmcount ON account.id = vmcount.account_id + and vmcount.type = 'user_vm' + left join + `cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id + and runningvm.state = 'Running' + left join + `cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id + and stoppedvm.state = 'Stopped' + left join + `cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id + and iplimit.type = 'public_ip' + left join + `cloud`.`resource_count` ipcount ON account.id = ipcount.account_id + and ipcount.type = 'public_ip' + left join + `cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id + and volumelimit.type = 'volume' + left join + `cloud`.`resource_count` volumecount ON account.id = volumecount.account_id + and volumecount.type = 'volume' + left join + `cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id + and snapshotlimit.type = 'snapshot' + left join + `cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id + and snapshotcount.type = 'snapshot' + left join + `cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id + and templatelimit.type = 'template' + left join + `cloud`.`resource_count` templatecount ON account.id = templatecount.account_id + and templatecount.type = 'template' + left join + `cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id + and vpclimit.type = 'vpc' + left join + `cloud`.`resource_count` vpccount ON account.id = vpccount.account_id + and vpccount.type = 'vpc' + left join + `cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id + and projectlimit.type = 'project' + left join + `cloud`.`resource_count` projectcount ON account.id = projectcount.account_id + and projectcount.type = 'project' + left join + `cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id + and networklimit.type = 'network' + left join + `cloud`.`resource_count` networkcount ON account.id = networkcount.account_id + and networkcount.type = 'network' + left join + `cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id + and cpulimit.type = 'cpu' + left join + `cloud`.`resource_count` cpucount ON account.id = cpucount.account_id + and cpucount.type = 'cpu' + left join + `cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id + and memorylimit.type = 'memory' + left join + `cloud`.`resource_count` memorycount ON account.id = memorycount.account_id + and memorycount.type = 'memory' + left join + `cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id + and primary_storage_limit.type = 'primary_storage' + left join + `cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id + and primary_storage_count.type = 'primary_storage' + left join + `cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id + and secondary_storage_limit.type = 'secondary_storage' + left join + `cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id + and secondary_storage_count.type = 'secondary_storage' + left join + `cloud`.`async_job` ON async_job.instance_id = account.id + and async_job.instance_type = 'Account' - and async_job.job_status = 0; ++ and async_job.job_status = 0; ++ ++ ++ ++ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address` varchar(40) COMMENT 'source ip address for the load balancer rule'; ++ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address_network_id` bigint unsigned COMMENT 'the id of the network where source ip belongs to'; ++ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `scheme` varchar(40) NOT NULL COMMENT 'load balancer scheme; can be Internal or Public'; ++UPDATE `cloud`.`load_balancing_rules` SET `scheme`='Public'; + + +-- Add role to the domain router view +ALTER VIEW `cloud`.`domain_router_view` AS + select + vm_instance.id id, + vm_instance.name name, + account.id account_id, + account.uuid account_uuid, + account.account_name account_name, + account.type account_type, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path, + projects.id project_id, + projects.uuid project_uuid, + projects.name project_name, + vm_instance.uuid uuid, + vm_instance.created created, + vm_instance.state state, + vm_instance.removed removed, + vm_instance.pod_id pod_id, + vm_instance.instance_name instance_name, + host_pod_ref.uuid pod_uuid, + data_center.id data_center_id, + data_center.uuid data_center_uuid, + data_center.name data_center_name, + data_center.dns1 dns1, + data_center.dns2 dns2, + data_center.ip6_dns1 ip6_dns1, + data_center.ip6_dns2 ip6_dns2, + host.id host_id, + host.uuid host_uuid, + host.name host_name, + vm_template.id template_id, + vm_template.uuid template_uuid, + service_offering.id service_offering_id, + disk_offering.uuid service_offering_uuid, + disk_offering.name service_offering_name, + nics.id nic_id, + nics.uuid nic_uuid, + nics.network_id network_id, + nics.ip4_address ip_address, + nics.ip6_address ip6_address, + nics.ip6_gateway ip6_gateway, + nics.ip6_cidr ip6_cidr, + nics.default_nic is_default_nic, + nics.gateway gateway, + nics.netmask netmask, + nics.mac_address mac_address, + nics.broadcast_uri broadcast_uri, + nics.isolation_uri isolation_uri, + vpc.id vpc_id, + vpc.uuid vpc_uuid, + networks.uuid network_uuid, + networks.name network_name, + networks.network_domain network_domain, + networks.traffic_type traffic_type, + networks.guest_type guest_type, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id, + domain_router.template_version template_version, + domain_router.scripts_version scripts_version, + domain_router.is_redundant_router is_redundant_router, + domain_router.redundant_state redundant_state, + domain_router.stop_pending stop_pending, + domain_router.role role + from + `cloud`.`domain_router` + inner join + `cloud`.`vm_instance` ON vm_instance.id = domain_router.id + inner join + `cloud`.`account` ON vm_instance.account_id = account.id + inner join + `cloud`.`domain` ON vm_instance.domain_id = domain.id + left join + `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id + left join + `cloud`.`projects` ON projects.project_account_id = account.id + left join + `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id + left join + `cloud`.`host` ON vm_instance.host_id = host.id + left join + `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id + left join + `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id + left join + `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id + left join + `cloud`.`volumes` ON vm_instance.id = volumes.instance_id + left join + `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id + left join + `cloud`.`nics` ON vm_instance.id = nics.instance_id + left join + `cloud`.`networks` ON nics.network_id = networks.id + left join + `cloud`.`vpc` ON domain_router.vpc_id = vpc.id + left join + `cloud`.`async_job` ON async_job.instance_id = vm_instance.id + and async_job.instance_type = 'DomainRouter' + and async_job.job_status = 0; + + +-- Add details talbe for the network offering +CREATE TABLE `cloud`.`network_offering_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `network_offering_id` bigint unsigned NOT NULL COMMENT 'network offering id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_network_offering_details__network_offering_id` FOREIGN KEY `fk_network_offering_details__network_offering_id`(`network_offering_id`) REFERENCES `network_offerings`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Change the constraint for the network service map table. Now we support multiple provider for the same service +ALTER TABLE `cloud`.`ntwk_service_map` DROP FOREIGN KEY `fk_ntwk_service_map__network_id`; +ALTER TABLE `cloud`.`ntwk_service_map` DROP INDEX `network_id`; + +ALTER TABLE `cloud`.`ntwk_service_map` ADD UNIQUE `network_id` (`network_id`,`service`,`provider`); +ALTER TABLE `cloud`.`ntwk_service_map` ADD CONSTRAINT `fk_ntwk_service_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks` (`id`) ON DELETE CASCADE; + + +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `internal_lb` int(1) unsigned NOT NULL DEFAULT '0' COMMENT 'true if the network offering supports Internal lb service'; +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `public_lb` int(1) unsigned NOT NULL DEFAULT '0' COMMENT 'true if the network offering supports Public lb service'; +UPDATE `cloud`.`network_offerings` SET public_lb=1 where id IN (SELECT DISTINCT network_offering_id FROM `cloud`.`ntwk_offering_service_map` WHERE service='Lb');