mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
[NSX] Fix database views (#8325)
This commit is contained in:
parent
ed48d94e59
commit
c42c6168bd
@ -138,75 +138,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings','nsx_mode', 'varc
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','for_nsx', 'int(1) unsigned DEFAULT "0" COMMENT "is nsx enabled for the resource"');
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vpc_offerings','nsx_mode', 'varchar(32) COMMENT "mode in which the network would route traffic"');
|
||||
|
||||
-- Network offering with NSX related columns
|
||||
DROP VIEW IF EXISTS `cloud`.`network_offering_view`;
|
||||
CREATE VIEW `cloud`.`network_offering_view` AS
|
||||
SELECT
|
||||
`network_offerings`.`id` AS `id`,
|
||||
`network_offerings`.`uuid` AS `uuid`,
|
||||
`network_offerings`.`name` AS `name`,
|
||||
`network_offerings`.`unique_name` AS `unique_name`,
|
||||
`network_offerings`.`display_text` AS `display_text`,
|
||||
`network_offerings`.`nw_rate` AS `nw_rate`,
|
||||
`network_offerings`.`mc_rate` AS `mc_rate`,
|
||||
`network_offerings`.`traffic_type` AS `traffic_type`,
|
||||
`network_offerings`.`tags` AS `tags`,
|
||||
`network_offerings`.`system_only` AS `system_only`,
|
||||
`network_offerings`.`specify_vlan` AS `specify_vlan`,
|
||||
`network_offerings`.`service_offering_id` AS `service_offering_id`,
|
||||
`network_offerings`.`conserve_mode` AS `conserve_mode`,
|
||||
`network_offerings`.`created` AS `created`,
|
||||
`network_offerings`.`removed` AS `removed`,
|
||||
`network_offerings`.`default` AS `default`,
|
||||
`network_offerings`.`availability` AS `availability`,
|
||||
`network_offerings`.`dedicated_lb_service` AS `dedicated_lb_service`,
|
||||
`network_offerings`.`shared_source_nat_service` AS `shared_source_nat_service`,
|
||||
`network_offerings`.`sort_key` AS `sort_key`,
|
||||
`network_offerings`.`redundant_router_service` AS `redundant_router_service`,
|
||||
`network_offerings`.`state` AS `state`,
|
||||
`network_offerings`.`guest_type` AS `guest_type`,
|
||||
`network_offerings`.`elastic_ip_service` AS `elastic_ip_service`,
|
||||
`network_offerings`.`eip_associate_public_ip` AS `eip_associate_public_ip`,
|
||||
`network_offerings`.`elastic_lb_service` AS `elastic_lb_service`,
|
||||
`network_offerings`.`specify_ip_ranges` AS `specify_ip_ranges`,
|
||||
`network_offerings`.`inline` AS `inline`,
|
||||
`network_offerings`.`is_persistent` AS `is_persistent`,
|
||||
`network_offerings`.`internal_lb` AS `internal_lb`,
|
||||
`network_offerings`.`public_lb` AS `public_lb`,
|
||||
`network_offerings`.`egress_default_policy` AS `egress_default_policy`,
|
||||
`network_offerings`.`concurrent_connections` AS `concurrent_connections`,
|
||||
`network_offerings`.`keep_alive_enabled` AS `keep_alive_enabled`,
|
||||
`network_offerings`.`supports_streched_l2` AS `supports_streched_l2`,
|
||||
`network_offerings`.`supports_public_access` AS `supports_public_access`,
|
||||
`network_offerings`.`supports_vm_autoscaling` AS `supports_vm_autoscaling`,
|
||||
`network_offerings`.`for_vpc` AS `for_vpc`,
|
||||
`network_offerings`.`for_tungsten` AS `for_tungsten`,
|
||||
`network_offerings`.`for_nsx` AS `for_nsx`,
|
||||
`network_offerings`.`nsx_mode` AS `nsx_mode`,
|
||||
`network_offerings`.`service_package_id` AS `service_package_id`,
|
||||
GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id,
|
||||
GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid,
|
||||
GROUP_CONCAT(DISTINCT(domain.name)) AS domain_name,
|
||||
GROUP_CONCAT(DISTINCT(domain.path)) AS domain_path,
|
||||
GROUP_CONCAT(DISTINCT(zone.id)) AS zone_id,
|
||||
GROUP_CONCAT(DISTINCT(zone.uuid)) AS zone_uuid,
|
||||
GROUP_CONCAT(DISTINCT(zone.name)) AS zone_name,
|
||||
`offering_details`.value AS internet_protocol
|
||||
FROM
|
||||
`cloud`.`network_offerings`
|
||||
LEFT JOIN
|
||||
`cloud`.`network_offering_details` AS `domain_details` ON `domain_details`.`network_offering_id` = `network_offerings`.`id` AND `domain_details`.`name`='domainid'
|
||||
LEFT JOIN
|
||||
`cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`)
|
||||
LEFT JOIN
|
||||
`cloud`.`network_offering_details` AS `zone_details` ON `zone_details`.`network_offering_id` = `network_offerings`.`id` AND `zone_details`.`name`='zoneid'
|
||||
LEFT JOIN
|
||||
`cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`)
|
||||
LEFT JOIN
|
||||
`cloud`.`network_offering_details` AS `offering_details` ON `offering_details`.`network_offering_id` = `network_offerings`.`id` AND `offering_details`.`name`='internetProtocol'
|
||||
GROUP BY
|
||||
`network_offerings`.`id`;
|
||||
|
||||
-- Add indexes for data store browser
|
||||
ALTER TABLE `cloud`.`template_spool_ref` ADD INDEX `i_template_spool_ref__install_path`(`install_path`);
|
||||
ALTER TABLE `cloud`.`volumes` ADD INDEX `i_volumes__path`(`path`);
|
||||
@ -318,138 +249,6 @@ ALTER TABLE `cloud`.`snapshot_store_ref`
|
||||
ADD COLUMN `local_path` varchar(255) DEFAULT NULL COMMENT 'the path of the snapshot download' AFTER `error_str`,
|
||||
ADD COLUMN `display` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '1 implies store reference is available for listing' AFTER `error_str`;
|
||||
|
||||
-- Create snapshot_view
|
||||
DROP VIEW IF EXISTS `cloud`.`snapshot_view`;
|
||||
CREATE VIEW `cloud`.`snapshot_view` AS
|
||||
SELECT
|
||||
`snapshots`.`id` AS `id`,
|
||||
`snapshots`.`uuid` AS `uuid`,
|
||||
`snapshots`.`name` AS `name`,
|
||||
`snapshots`.`status` AS `status`,
|
||||
`snapshots`.`disk_offering_id` AS `disk_offering_id`,
|
||||
`snapshots`.`snapshot_type` AS `snapshot_type`,
|
||||
`snapshots`.`type_description` AS `type_description`,
|
||||
`snapshots`.`size` AS `size`,
|
||||
`snapshots`.`created` AS `created`,
|
||||
`snapshots`.`removed` AS `removed`,
|
||||
`snapshots`.`location_type` AS `location_type`,
|
||||
`snapshots`.`hypervisor_type` AS `hypervisor_type`,
|
||||
`account`.`id` AS `account_id`,
|
||||
`account`.`uuid` AS `account_uuid`,
|
||||
`account`.`account_name` AS `account_name`,
|
||||
`account`.`type` AS `account_type`,
|
||||
`domain`.`id` AS `domain_id`,
|
||||
`domain`.`uuid` AS `domain_uuid`,
|
||||
`domain`.`name` AS `domain_name`,
|
||||
`domain`.`path` AS `domain_path`,
|
||||
`projects`.`id` AS `project_id`,
|
||||
`projects`.`uuid` AS `project_uuid`,
|
||||
`projects`.`name` AS `project_name`,
|
||||
`volumes`.`id` AS `volume_id`,
|
||||
`volumes`.`uuid` AS `volume_uuid`,
|
||||
`volumes`.`name` AS `volume_name`,
|
||||
`volumes`.`volume_type` AS `volume_type`,
|
||||
`volumes`.`size` AS `volume_size`,
|
||||
`data_center`.`id` AS `data_center_id`,
|
||||
`data_center`.`uuid` AS `data_center_uuid`,
|
||||
`data_center`.`name` AS `data_center_name`,
|
||||
`snapshot_store_ref`.`store_id` AS `store_id`,
|
||||
IFNULL(`image_store`.`uuid`, `storage_pool`.`uuid`) AS `store_uuid`,
|
||||
IFNULL(`image_store`.`name`, `storage_pool`.`name`) AS `store_name`,
|
||||
`snapshot_store_ref`.`store_role` AS `store_role`,
|
||||
`snapshot_store_ref`.`state` AS `store_state`,
|
||||
`snapshot_store_ref`.`download_state` AS `download_state`,
|
||||
`snapshot_store_ref`.`download_pct` AS `download_pct`,
|
||||
`snapshot_store_ref`.`error_str` AS `error_str`,
|
||||
`snapshot_store_ref`.`size` AS `store_size`,
|
||||
`snapshot_store_ref`.`created` AS `created_on_store`,
|
||||
`resource_tags`.`id` AS `tag_id`,
|
||||
`resource_tags`.`uuid` AS `tag_uuid`,
|
||||
`resource_tags`.`key` AS `tag_key`,
|
||||
`resource_tags`.`value` AS `tag_value`,
|
||||
`resource_tags`.`domain_id` AS `tag_domain_id`,
|
||||
`domain`.`uuid` AS `tag_domain_uuid`,
|
||||
`domain`.`name` AS `tag_domain_name`,
|
||||
`resource_tags`.`account_id` AS `tag_account_id`,
|
||||
`account`.`account_name` AS `tag_account_name`,
|
||||
`resource_tags`.`resource_id` AS `tag_resource_id`,
|
||||
`resource_tags`.`resource_uuid` AS `tag_resource_uuid`,
|
||||
`resource_tags`.`resource_type` AS `tag_resource_type`,
|
||||
`resource_tags`.`customer` AS `tag_customer`,
|
||||
CONCAT(`snapshots`.`id`,
|
||||
'_',
|
||||
IFNULL(`snapshot_store_ref`.`store_role`, 'UNKNOWN'),
|
||||
'_',
|
||||
IFNULL(`snapshot_store_ref`.`store_id`, 0)) AS `snapshot_store_pair`
|
||||
FROM
|
||||
((((((((((`snapshots`
|
||||
JOIN `account` ON ((`account`.`id` = `snapshots`.`account_id`)))
|
||||
JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`)))
|
||||
LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`)))
|
||||
LEFT JOIN `volumes` ON ((`volumes`.`id` = `snapshots`.`volume_id`)))
|
||||
LEFT JOIN `snapshot_store_ref` ON (((`snapshot_store_ref`.`snapshot_id` = `snapshots`.`id`)
|
||||
AND (`snapshot_store_ref`.`state` != 'Destroyed')
|
||||
AND (`snapshot_store_ref`.`display` = 1))))
|
||||
LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`)
|
||||
AND (`snapshot_store_ref`.`store_role` = 'Image')
|
||||
AND (`snapshot_store_ref`.`store_id` IS NOT NULL)
|
||||
AND (`image_store`.`id` = `snapshot_store_ref`.`store_id`))))
|
||||
LEFT JOIN `storage_pool` ON ((ISNULL(`storage_pool`.`removed`)
|
||||
AND (`snapshot_store_ref`.`store_role` = 'Primary')
|
||||
AND (`snapshot_store_ref`.`store_id` IS NOT NULL)
|
||||
AND (`storage_pool`.`id` = `snapshot_store_ref`.`store_id`))))
|
||||
LEFT JOIN `snapshot_zone_ref` ON (((`snapshot_zone_ref`.`snapshot_id` = `snapshots`.`id`)
|
||||
AND ISNULL(`snapshot_store_ref`.`store_id`)
|
||||
AND ISNULL(`snapshot_zone_ref`.`removed`))))
|
||||
LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`)
|
||||
OR (`storage_pool`.`data_center_id` = `data_center`.`id`)
|
||||
OR (`snapshot_zone_ref`.`zone_id` = `data_center`.`id`))))
|
||||
LEFT JOIN `resource_tags` ON ((`resource_tags`.`resource_id` = `snapshots`.`id`)
|
||||
AND (`resource_tags`.`resource_type` = 'Snapshot')));
|
||||
|
||||
-- VPC offering with NSX related columns
|
||||
DROP VIEW IF EXISTS `cloud`.`vpc_offering_view`;
|
||||
CREATE VIEW `cloud`.`vpc_offering_view` AS
|
||||
SELECT
|
||||
`vpc_offerings`.`id` AS `id`,
|
||||
`vpc_offerings`.`uuid` AS `uuid`,
|
||||
`vpc_offerings`.`name` AS `name`,
|
||||
`vpc_offerings`.`unique_name` AS `unique_name`,
|
||||
`vpc_offerings`.`display_text` AS `display_text`,
|
||||
`vpc_offerings`.`state` AS `state`,
|
||||
`vpc_offerings`.`default` AS `default`,
|
||||
`vpc_offerings`.`for_nsx` AS `for_nsx`,
|
||||
`vpc_offerings`.`nsx_mode` AS `nsx_mode`,
|
||||
`vpc_offerings`.`created` AS `created`,
|
||||
`vpc_offerings`.`removed` AS `removed`,
|
||||
`vpc_offerings`.`service_offering_id` AS `service_offering_id`,
|
||||
`vpc_offerings`.`supports_distributed_router` AS `supports_distributed_router`,
|
||||
`vpc_offerings`.`supports_region_level_vpc` AS `supports_region_level_vpc`,
|
||||
`vpc_offerings`.`redundant_router_service` AS `redundant_router_service`,
|
||||
`vpc_offerings`.`sort_key` AS `sort_key`,
|
||||
GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id,
|
||||
GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid,
|
||||
GROUP_CONCAT(DISTINCT(domain.name)) AS domain_name,
|
||||
GROUP_CONCAT(DISTINCT(domain.path)) AS domain_path,
|
||||
GROUP_CONCAT(DISTINCT(zone.id)) AS zone_id,
|
||||
GROUP_CONCAT(DISTINCT(zone.uuid)) AS zone_uuid,
|
||||
GROUP_CONCAT(DISTINCT(zone.name)) AS zone_name,
|
||||
`offering_details`.value AS internet_protocol
|
||||
FROM
|
||||
`cloud`.`vpc_offerings`
|
||||
LEFT JOIN
|
||||
`cloud`.`vpc_offering_details` AS `domain_details` ON `domain_details`.`offering_id` = `vpc_offerings`.`id` AND `domain_details`.`name`='domainid'
|
||||
LEFT JOIN
|
||||
`cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`)
|
||||
LEFT JOIN
|
||||
`cloud`.`vpc_offering_details` AS `zone_details` ON `zone_details`.`offering_id` = `vpc_offerings`.`id` AND `zone_details`.`name`='zoneid'
|
||||
LEFT JOIN
|
||||
`cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`)
|
||||
LEFT JOIN
|
||||
`cloud`.`vpc_offering_details` AS `offering_details` ON `offering_details`.`offering_id` = `vpc_offerings`.`id` AND `offering_details`.`name`='internetprotocol'
|
||||
GROUP BY
|
||||
`vpc_offerings`.`id`;
|
||||
|
||||
UPDATE `cloud`.`configuration` SET
|
||||
`options` = concat(`options`, ',OAUTH2'),
|
||||
`default_value` = concat(`default_value`, ',OAUTH2'),
|
||||
|
||||
@ -60,6 +60,8 @@ SELECT
|
||||
`network_offerings`.`supports_vm_autoscaling` AS `supports_vm_autoscaling`,
|
||||
`network_offerings`.`for_vpc` AS `for_vpc`,
|
||||
`network_offerings`.`for_tungsten` AS `for_tungsten`,
|
||||
`network_offerings`.`for_nsx` AS `for_nsx`,
|
||||
`network_offerings`.`nsx_mode` AS `nsx_mode`,
|
||||
`network_offerings`.`service_package_id` AS `service_package_id`,
|
||||
GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id,
|
||||
GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid,
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
-- 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.
|
||||
|
||||
-- VIEW `cloud`.`vpc_offering_view`;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`vpc_offering_view`;
|
||||
|
||||
CREATE VIEW `cloud`.`vpc_offering_view` AS
|
||||
SELECT
|
||||
`vpc_offerings`.`id` AS `id`,
|
||||
`vpc_offerings`.`uuid` AS `uuid`,
|
||||
`vpc_offerings`.`name` AS `name`,
|
||||
`vpc_offerings`.`unique_name` AS `unique_name`,
|
||||
`vpc_offerings`.`display_text` AS `display_text`,
|
||||
`vpc_offerings`.`state` AS `state`,
|
||||
`vpc_offerings`.`default` AS `default`,
|
||||
`vpc_offerings`.`for_nsx` AS `for_nsx`,
|
||||
`vpc_offerings`.`nsx_mode` AS `nsx_mode`,
|
||||
`vpc_offerings`.`created` AS `created`,
|
||||
`vpc_offerings`.`removed` AS `removed`,
|
||||
`vpc_offerings`.`service_offering_id` AS `service_offering_id`,
|
||||
`vpc_offerings`.`supports_distributed_router` AS `supports_distributed_router`,
|
||||
`vpc_offerings`.`supports_region_level_vpc` AS `supports_region_level_vpc`,
|
||||
`vpc_offerings`.`redundant_router_service` AS `redundant_router_service`,
|
||||
`vpc_offerings`.`sort_key` AS `sort_key`,
|
||||
GROUP_CONCAT(DISTINCT(domain.id)) AS domain_id,
|
||||
GROUP_CONCAT(DISTINCT(domain.uuid)) AS domain_uuid,
|
||||
GROUP_CONCAT(DISTINCT(domain.name)) AS domain_name,
|
||||
GROUP_CONCAT(DISTINCT(domain.path)) AS domain_path,
|
||||
GROUP_CONCAT(DISTINCT(zone.id)) AS zone_id,
|
||||
GROUP_CONCAT(DISTINCT(zone.uuid)) AS zone_uuid,
|
||||
GROUP_CONCAT(DISTINCT(zone.name)) AS zone_name,
|
||||
`offering_details`.value AS internet_protocol
|
||||
FROM
|
||||
`cloud`.`vpc_offerings`
|
||||
LEFT JOIN
|
||||
`cloud`.`vpc_offering_details` AS `domain_details` ON `domain_details`.`offering_id` = `vpc_offerings`.`id` AND `domain_details`.`name`='domainid'
|
||||
LEFT JOIN
|
||||
`cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`)
|
||||
LEFT JOIN
|
||||
`cloud`.`vpc_offering_details` AS `zone_details` ON `zone_details`.`offering_id` = `vpc_offerings`.`id` AND `zone_details`.`name`='zoneid'
|
||||
LEFT JOIN
|
||||
`cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`)
|
||||
LEFT JOIN
|
||||
`cloud`.`vpc_offering_details` AS `offering_details` ON `offering_details`.`offering_id` = `vpc_offerings`.`id` AND `offering_details`.`name`='internetprotocol'
|
||||
GROUP BY
|
||||
`vpc_offerings`.`id`;
|
||||
Loading…
x
Reference in New Issue
Block a user