From 213a2460acc753c344a649be8b551c8b08e6b1e9 Mon Sep 17 00:00:00 2001 From: "klaus.freitas.scclouds" Date: Mon, 15 Jul 2024 15:05:45 -0300 Subject: [PATCH 1/2] refactoring views out of upgrade db schema scripts --- .../META-INF/db/schema-41000to41100.sql | 352 -------- .../META-INF/db/schema-41120to41200.sql | 98 --- .../META-INF/db/schema-41200to41300.sql | 297 ------- .../META-INF/db/schema-41310to41400.sql | 182 ---- .../META-INF/db/schema-41400to41500.sql | 432 ---------- .../META-INF/db/schema-41520to41600.sql | 629 -------------- .../META-INF/db/schema-41610to41700.sql | 756 ---------------- .../META-INF/db/schema-41700to41710.sql | 105 --- .../META-INF/db/schema-41720to41800.sql | 808 +----------------- .../META-INF/db/schema-4930to41000.sql | 71 -- .../META-INF/db/views/cloud.host_view.sql | 9 +- 11 files changed, 9 insertions(+), 3730 deletions(-) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql index 6148ee11bcf..0d153077d45 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql @@ -133,118 +133,6 @@ CREATE TABLE IF NOT EXISTS `cloud`.`annotations` ( KEY `i_entity` (`entity_uuid`, `entity_type`, `created`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -DROP VIEW IF EXISTS `cloud`.`last_annotation_view`; -CREATE VIEW `cloud`.`last_annotation_view` AS - SELECT - `annotations`.`uuid` AS `uuid`, - `annotations`.`annotation` AS `annotation`, - `annotations`.`entity_uuid` AS `entity_uuid`, - `annotations`.`entity_type` AS `entity_type`, - `annotations`.`user_uuid` AS `user_uuid`, - `annotations`.`created` AS `created`, - `annotations`.`removed` AS `removed` - FROM - `annotations` - WHERE - `annotations`.`created` IN (SELECT - MAX(`annotations`.`created`) - FROM - `annotations` - WHERE - `annotations`.`removed` IS NULL - GROUP BY `annotations`.`entity_uuid`); - --- Host HA changes: -DROP VIEW IF EXISTS `cloud`.`host_view`; -CREATE VIEW `cloud`.`host_view` AS - SELECT - host.id, - host.uuid, - host.name, - host.status, - host.disconnected, - host.type, - host.private_ip_address, - host.version, - host.hypervisor_type, - host.hypervisor_version, - host.capabilities, - host.last_ping, - host.created, - host.removed, - host.resource_state, - host.mgmt_server_id, - host.cpu_sockets, - host.cpus, - host.speed, - host.ram, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - host_tags.tag, - guest_os_category.id guest_os_category_id, - guest_os_category.uuid guest_os_category_uuid, - guest_os_category.name guest_os_category_name, - mem_caps.used_capacity memory_used_capacity, - mem_caps.reserved_capacity memory_reserved_capacity, - cpu_caps.used_capacity cpu_used_capacity, - cpu_caps.reserved_capacity cpu_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - oobm.enabled AS `oobm_enabled`, - oobm.power_state AS `oobm_power_state`, - ha_config.enabled AS `ha_enabled`, - ha_config.ha_state AS `ha_state`, - ha_config.provider AS `ha_provider`, - `last_annotation_view`.`annotation` AS `annotation`, - `last_annotation_view`.`created` AS `last_annotated`, - `user`.`username` AS `username` - FROM - `cloud`.`host` - LEFT JOIN - `cloud`.`cluster` ON host.cluster_id = cluster.id - LEFT JOIN - `cloud`.`data_center` ON host.data_center_id = data_center.id - LEFT JOIN - `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id - LEFT JOIN - `cloud`.`host_details` ON host.id = host_details.host_id - AND host_details.name = 'guest.os.category.id' - LEFT JOIN - `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT ( host_details.value, UNSIGNED ) - LEFT JOIN - `cloud`.`host_tags` ON host_tags.host_id = host.id - LEFT JOIN - `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id - AND mem_caps.capacity_type = 0 - LEFT JOIN - `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id - AND cpu_caps.capacity_type = 1 - LEFT JOIN - `cloud`.`async_job` ON async_job.instance_id = host.id - AND async_job.instance_type = 'Host' - AND async_job.job_status = 0 - LEFT JOIN - `cloud`.`oobm` ON oobm.host_id = host.id - left join - `cloud`.`ha_config` ON ha_config.resource_id=host.id - and ha_config.resource_type='Host' - LEFT JOIN - `cloud`.`last_annotation_view` ON `last_annotation_view`.`entity_uuid` = `host`.`uuid` - LEFT JOIN - `cloud`.`user` ON `user`.`uuid` = `last_annotation_view`.`user_uuid`; --- End Of Annotations specific changes - -- Out-of-band management driver for nested-cloudstack ALTER TABLE `cloud`.`oobm` MODIFY COLUMN port VARCHAR(255); @@ -257,140 +145,6 @@ delete from `cloud`.`configuration` where name in ('midonet.apiserver.address', -- CLOUDSTACK-9972: Enhance listVolumes API INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Premium', 'DEFAULT', 'management-server', 'volume.stats.interval', '600000', 'Interval (in seconds) to report volume statistics', '600000', now(), NULL, NULL); -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - SELECT - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.provisioning_type, - volumes.size, - volumes.min_iops, - volumes.max_iops, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.display_volume, - volumes.format, - volumes.path, - volumes.chain_info, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_store_ref.size volume_store_size, - volume_store_ref.download_pct, - volume_store_ref.download_state, - volume_store_ref.error_str, - volume_store_ref.created created_on_store, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.id cluster_id, - cluster.name cluster_name, - cluster.uuid cluster_uuid, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - vm_template.name template_name, - vm_template.display_text template_display_text, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - resource_tag_account.account_name tag_account_name, - resource_tag_domain.uuid tag_domain_uuid, - resource_tag_domain.name tag_domain_name - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = volumes.iso_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0 - left join - `cloud`.`account` resource_tag_account ON resource_tag_account.id = resource_tags.account_id - left join - `cloud`.`domain` resource_tag_domain ON resource_tag_domain.id = resource_tags.domain_id; - -- Extra Dhcp Options CREATE TABLE IF NOT EXISTS `cloud`.`nic_extra_dhcp_options` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', @@ -463,112 +217,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_template','parent_template_id', ' -- CLOUDSTACK-10146: Bypass Secondary Storage for KVM templates CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_template','direct_download', 'TINYINT(1) DEFAULT 0 COMMENT ''Indicates if Secondary Storage is bypassed and template is downloaded to Primary Storage'' '); --- Changes to template_view for both multidisk OVA and bypass secondary storage for KVM templates -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE VIEW `cloud`.`template_view` AS - SELECT - `vm_template`.`id` AS `id`, - `vm_template`.`uuid` AS `uuid`, - `vm_template`.`unique_name` AS `unique_name`, - `vm_template`.`name` AS `name`, - `vm_template`.`public` AS `public`, - `vm_template`.`featured` AS `featured`, - `vm_template`.`type` AS `type`, - `vm_template`.`hvm` AS `hvm`, - `vm_template`.`bits` AS `bits`, - `vm_template`.`url` AS `url`, - `vm_template`.`format` AS `format`, - `vm_template`.`created` AS `created`, - `vm_template`.`checksum` AS `checksum`, - `vm_template`.`display_text` AS `display_text`, - `vm_template`.`enable_password` AS `enable_password`, - `vm_template`.`dynamically_scalable` AS `dynamically_scalable`, - `vm_template`.`state` AS `template_state`, - `vm_template`.`guest_os_id` AS `guest_os_id`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `guest_os`.`display_name` AS `guest_os_name`, - `vm_template`.`bootable` AS `bootable`, - `vm_template`.`prepopulate` AS `prepopulate`, - `vm_template`.`cross_zones` AS `cross_zones`, - `vm_template`.`hypervisor_type` AS `hypervisor_type`, - `vm_template`.`extractable` AS `extractable`, - `vm_template`.`template_tag` AS `template_tag`, - `vm_template`.`sort_key` AS `sort_key`, - `vm_template`.`removed` AS `removed`, - `vm_template`.`enable_sshkey` AS `enable_sshkey`, - `parent_template`.`id` AS `parent_template_id`, - `parent_template`.`uuid` AS `parent_template_uuid`, - `source_template`.`id` AS `source_template_id`, - `source_template`.`uuid` AS `source_template_uuid`, - `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`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `launch_permission`.`account_id` AS `lp_account_id`, - `template_store_ref`.`store_id` AS `store_id`, - `image_store`.`scope` AS `store_scope`, - `template_store_ref`.`state` AS `state`, - `template_store_ref`.`download_state` AS `download_state`, - `template_store_ref`.`download_pct` AS `download_pct`, - `template_store_ref`.`error_str` AS `error_str`, - `template_store_ref`.`size` AS `size`, - `template_store_ref`.physical_size AS `physical_size`, - `template_store_ref`.`destroyed` AS `destroyed`, - `template_store_ref`.`created` AS `created_on_store`, - `vm_template_details`.`name` AS `detail_name`, - `vm_template_details`.`value` AS `detail_value`, - `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(`vm_template`.`id`, - '_', - IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`, - `vm_template`.`direct_download` AS `direct_download` - FROM - (((((((((((((`vm_template` - JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`))) - JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`))) - JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `vm_template_details` ON ((`vm_template_details`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id` = `vm_template`.`source_template_id`))) - LEFT JOIN `template_store_ref` ON (((`template_store_ref`.`template_id` = `vm_template`.`id`) - AND (`template_store_ref`.`store_role` = 'Image') - AND (`template_store_ref`.`destroyed` = 0)))) - LEFT JOIN `vm_template` `parent_template` ON ((`parent_template`.`id` = `vm_template`.`parent_template_id`))) - LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`) - AND (`template_store_ref`.`store_id` IS NOT NULL) - AND (`image_store`.`id` = `template_store_ref`.`store_id`)))) - LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id` = `vm_template`.`id`) - AND ISNULL(`template_store_ref`.`store_id`) - AND ISNULL(`template_zone_ref`.`removed`)))) - LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`) - OR (`template_zone_ref`.`zone_id` = `data_center`.`id`)))) - LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`) - AND ((`resource_tags`.`resource_type` = 'Template') - OR (`resource_tags`.`resource_type` = 'ISO'))))); - -- CLOUDSTACK-10109: Enable dedication of public IPs to SSVM and CPVM CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_ip_address','forsystemvms', 'TINYINT(1) NOT NULL DEFAULT 0 COMMENT ''true if IP is set to system vms, false if not'' '); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41120to41200.sql b/engine/schema/src/main/resources/META-INF/db/schema-41120to41200.sql index b52f4d004ea..42faccfc7f8 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41120to41200.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41120to41200.sql @@ -60,103 +60,5 @@ alter table `cloud`.`disk_offering` add `iops_read_rate_max_length` bigint(20) d alter table `cloud`.`disk_offering` add `iops_write_rate_max` bigint(20) default null after `iops_write_rate`; alter table `cloud`.`disk_offering` add `iops_write_rate_max_length` bigint(20) default null after `iops_write_rate_max`; -CREATE OR REPLACE VIEW `cloud`.`disk_offering_view` AS - SELECT - `disk_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`disk_size` AS `disk_size`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`customized` AS `customized`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`sort_key` AS `sort_key`, - `disk_offering`.`type` AS `type`, - `disk_offering`.`display_offering` AS `display_offering`, - `domain`.`id` AS `domain_id`, - `domain`.`uuid` AS `domain_uuid`, - `domain`.`name` AS `domain_name`, - `domain`.`path` AS `domain_path` - FROM - (`disk_offering` - LEFT JOIN `domain` ON ((`disk_offering`.`domain_id` = `domain`.`id`))) - WHERE - (`disk_offering`.`state` = 'ACTIVE'); - - -CREATE OR REPLACE VIEW `cloud`.`service_offering_view` AS - SELECT - `service_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `service_offering`.`cpu` AS `cpu`, - `service_offering`.`speed` AS `speed`, - `service_offering`.`ram_size` AS `ram_size`, - `service_offering`.`nw_rate` AS `nw_rate`, - `service_offering`.`mc_rate` AS `mc_rate`, - `service_offering`.`ha_enabled` AS `ha_enabled`, - `service_offering`.`limit_cpu_use` AS `limit_cpu_use`, - `service_offering`.`host_tag` AS `host_tag`, - `service_offering`.`default_use` AS `default_use`, - `service_offering`.`vm_type` AS `vm_type`, - `service_offering`.`sort_key` AS `sort_key`, - `service_offering`.`is_volatile` AS `is_volatile`, - `service_offering`.`deployment_planner` AS `deployment_planner`, - `domain`.`id` AS `domain_id`, - `domain`.`uuid` AS `domain_uuid`, - `domain`.`name` AS `domain_name`, - `domain`.`path` AS `domain_path` - FROM - ((`service_offering` - JOIN `disk_offering` ON ((`service_offering`.`id` = `disk_offering`.`id`))) - LEFT JOIN `domain` ON ((`disk_offering`.`domain_id` = `domain`.`id`))) - WHERE - (`disk_offering`.`state` = 'Active'); - -- PR#2578 New column for listManagementServers API call ALTER TABLE `mshost` ADD COLUMN `uuid` varchar(40) AFTER `name`; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41200to41300.sql b/engine/schema/src/main/resources/META-INF/db/schema-41200to41300.sql index 0b368eb310d..3eef9375973 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41200to41300.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41200to41300.sql @@ -183,198 +183,9 @@ ALTER TABLE `cloud`.`disk_offering` DROP COLUMN `domain_id`; ALTER TABLE `cloud`.`service_offering_details` DROP FOREIGN KEY `fk_service_offering_details__service_offering_id`, DROP KEY `uk_service_offering_id_name`; ALTER TABLE `cloud`.`service_offering_details` ADD CONSTRAINT `fk_service_offering_details__service_offering_id` FOREIGN KEY (`service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE; --- Disk offering with multi-domains and multi-zones -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - SELECT - `disk_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`disk_size` AS `disk_size`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`customized` AS `customized`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`sort_key` AS `sort_key`, - `disk_offering`.`type` AS `type`, - `disk_offering`.`display_offering` AS `display_offering`, - `disk_offering`.`state` AS `state`, - 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 - FROM - `cloud`.`disk_offering` - LEFT JOIN - `cloud`.`disk_offering_details` AS `domain_details` ON `domain_details`.`offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`disk_offering_details` AS `zone_details` ON `zone_details`.`offering_id` = `disk_offering`.`id` AND `zone_details`.`name`='zoneid' - LEFT JOIN - `cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`) - WHERE - `disk_offering`.`state`='Active' - GROUP BY - `disk_offering`.`id`; - --- Service offering with multi-domains and multi-zones -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - SELECT - `service_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `service_offering`.`cpu` AS `cpu`, - `service_offering`.`speed` AS `speed`, - `service_offering`.`ram_size` AS `ram_size`, - `service_offering`.`nw_rate` AS `nw_rate`, - `service_offering`.`mc_rate` AS `mc_rate`, - `service_offering`.`ha_enabled` AS `ha_enabled`, - `service_offering`.`limit_cpu_use` AS `limit_cpu_use`, - `service_offering`.`host_tag` AS `host_tag`, - `service_offering`.`default_use` AS `default_use`, - `service_offering`.`vm_type` AS `vm_type`, - `service_offering`.`sort_key` AS `sort_key`, - `service_offering`.`is_volatile` AS `is_volatile`, - `service_offering`.`deployment_planner` AS `deployment_planner`, - 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 - FROM - `cloud`.`service_offering` - INNER JOIN - `cloud`.`disk_offering_view` AS `disk_offering` ON service_offering.id = disk_offering.id - LEFT JOIN - `cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`service_offering_details` AS `zone_details` ON `zone_details`.`service_offering_id` = `disk_offering`.`id` AND `zone_details`.`name`='zoneid' - LEFT JOIN - `cloud`.`data_center` AS `zone` ON FIND_IN_SET(`zone`.`id`, `zone_details`.`value`) - WHERE - `disk_offering`.`state`='Active' - GROUP BY - `service_offering`.`id`; - -- Add display column for network offering details table ALTER TABLE `cloud`.`network_offering_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the detail can be displayed to the end user'; --- Network offering with multi-domains and multi-zones -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`.`for_vpc` AS `for_vpc`, - `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 - 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`) - GROUP BY - `network_offerings`.`id`; - -- Create VPC offering details table CREATE TABLE `vpc_offering_details` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, @@ -387,114 +198,6 @@ CREATE TABLE `vpc_offering_details` ( CONSTRAINT `fk_vpc_offering_details__vpc_offering_id` FOREIGN KEY (`offering_id`) REFERENCES `vpc_offerings` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- VPC offering with multi-domains and multi-zones -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`.`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 - 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`) - GROUP BY - `vpc_offerings`.`id`; - --- Recreate data_center_view -DROP VIEW IF EXISTS `cloud`.`data_center_view`; -CREATE VIEW `cloud`.`data_center_view` AS - select - data_center.id, - data_center.uuid, - data_center.name, - data_center.is_security_group_enabled, - data_center.is_local_storage_enabled, - data_center.description, - data_center.dns1, - data_center.dns2, - data_center.ip6_dns1, - data_center.ip6_dns2, - data_center.internal_dns1, - data_center.internal_dns2, - data_center.guest_network_cidr, - data_center.domain, - data_center.networktype, - data_center.allocation_state, - data_center.zone_token, - data_center.dhcp_provider, - data_center.removed, - data_center.sort_key, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - dedicated_resources.affinity_group_id, - dedicated_resources.account_id, - affinity_group.uuid affinity_group_uuid - from - `cloud`.`data_center` - left join - `cloud`.`domain` ON data_center.domain_id = domain.id - left join - `cloud`.`dedicated_resources` ON data_center.id = dedicated_resources.data_center_id - left join - `cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id; - --- Remove key/value tags from project_view -DROP VIEW IF EXISTS `cloud`.`project_view`; -CREATE VIEW `cloud`.`project_view` AS - select - projects.id, - projects.uuid, - projects.name, - projects.display_text, - projects.state, - projects.removed, - projects.created, - projects.project_account_id, - account.account_name owner, - pacct.account_id, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`projects` - inner join - `cloud`.`domain` ON projects.domain_id = domain.id - inner join - `cloud`.`project_account` ON projects.id = project_account.project_id - and project_account.account_role = 'Admin' - inner join - `cloud`.`account` ON account.id = project_account.account_id - left join - `cloud`.`project_account` pacct ON projects.id = pacct.project_id; - -- KVM: Add background task to upload certificates for direct download CREATE TABLE `cloud`.`direct_download_certificate` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql b/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql index 603e7712ebc..c9bcb26f5e7 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql @@ -100,188 +100,6 @@ CREATE TABLE IF NOT EXISTS `cloud_usage`.`usage_backup` ( INDEX `i_usage_backup` (`zone_id`,`account_id`,`vm_id`,`created`) ) ENGINE=InnoDB CHARSET=utf8; -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE -VIEW `user_vm_view` AS - SELECT - `vm_instance`.`id` AS `id`, - `vm_instance`.`name` AS `name`, - `user_vm`.`display_name` AS `display_name`, - `user_vm`.`user_data` AS `user_data`, - `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`, - `instance_group`.`id` AS `instance_group_id`, - `instance_group`.`uuid` AS `instance_group_uuid`, - `instance_group`.`name` AS `instance_group_name`, - `vm_instance`.`uuid` AS `uuid`, - `vm_instance`.`user_id` AS `user_id`, - `vm_instance`.`last_host_id` AS `last_host_id`, - `vm_instance`.`vm_type` AS `type`, - `vm_instance`.`limit_cpu_use` AS `limit_cpu_use`, - `vm_instance`.`created` AS `created`, - `vm_instance`.`state` AS `state`, - `vm_instance`.`removed` AS `removed`, - `vm_instance`.`ha_enabled` AS `ha_enabled`, - `vm_instance`.`hypervisor_type` AS `hypervisor_type`, - `vm_instance`.`instance_name` AS `instance_name`, - `vm_instance`.`guest_os_id` AS `guest_os_id`, - `vm_instance`.`display_vm` AS `display_vm`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `vm_instance`.`pod_id` AS `pod_id`, - `host_pod_ref`.`uuid` AS `pod_uuid`, - `vm_instance`.`private_ip_address` AS `private_ip_address`, - `vm_instance`.`private_mac_address` AS `private_mac_address`, - `vm_instance`.`vm_type` AS `vm_type`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`is_security_group_enabled` AS `security_group_enabled`, - `data_center`.`networktype` AS `data_center_type`, - `host`.`id` AS `host_id`, - `host`.`uuid` AS `host_uuid`, - `host`.`name` AS `host_name`, - `vm_template`.`id` AS `template_id`, - `vm_template`.`uuid` AS `template_uuid`, - `vm_template`.`name` AS `template_name`, - `vm_template`.`display_text` AS `template_display_text`, - `vm_template`.`enable_password` AS `password_enabled`, - `iso`.`id` AS `iso_id`, - `iso`.`uuid` AS `iso_uuid`, - `iso`.`name` AS `iso_name`, - `iso`.`display_text` AS `iso_display_text`, - `service_offering`.`id` AS `service_offering_id`, - `svc_disk_offering`.`uuid` AS `service_offering_uuid`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`id` AS `disk_offering_id`, - (CASE - WHEN ISNULL(`service_offering`.`cpu`) THEN `custom_cpu`.`value` - ELSE `service_offering`.`cpu` - END) AS `cpu`, - (CASE - WHEN ISNULL(`service_offering`.`speed`) THEN `custom_speed`.`value` - ELSE `service_offering`.`speed` - END) AS `speed`, - (CASE - WHEN ISNULL(`service_offering`.`ram_size`) THEN `custom_ram_size`.`value` - ELSE `service_offering`.`ram_size` - END) AS `ram_size`, - `backup_offering`.`uuid` AS `backup_offering_uuid`, - `backup_offering`.`id` AS `backup_offering_id`, - `svc_disk_offering`.`name` AS `service_offering_name`, - `disk_offering`.`name` AS `disk_offering_name`, - `backup_offering`.`name` AS `backup_offering_name`, - `storage_pool`.`id` AS `pool_id`, - `storage_pool`.`uuid` AS `pool_uuid`, - `storage_pool`.`pool_type` AS `pool_type`, - `volumes`.`id` AS `volume_id`, - `volumes`.`uuid` AS `volume_uuid`, - `volumes`.`device_id` AS `volume_device_id`, - `volumes`.`volume_type` AS `volume_type`, - `security_group`.`id` AS `security_group_id`, - `security_group`.`uuid` AS `security_group_uuid`, - `security_group`.`name` AS `security_group_name`, - `security_group`.`description` AS `security_group_description`, - `nics`.`id` AS `nic_id`, - `nics`.`uuid` AS `nic_uuid`, - `nics`.`network_id` AS `network_id`, - `nics`.`ip4_address` AS `ip_address`, - `nics`.`ip6_address` AS `ip6_address`, - `nics`.`ip6_gateway` AS `ip6_gateway`, - `nics`.`ip6_cidr` AS `ip6_cidr`, - `nics`.`default_nic` AS `is_default_nic`, - `nics`.`gateway` AS `gateway`, - `nics`.`netmask` AS `netmask`, - `nics`.`mac_address` AS `mac_address`, - `nics`.`broadcast_uri` AS `broadcast_uri`, - `nics`.`isolation_uri` AS `isolation_uri`, - `vpc`.`id` AS `vpc_id`, - `vpc`.`uuid` AS `vpc_uuid`, - `networks`.`uuid` AS `network_uuid`, - `networks`.`name` AS `network_name`, - `networks`.`traffic_type` AS `traffic_type`, - `networks`.`guest_type` AS `guest_type`, - `user_ip_address`.`id` AS `public_ip_id`, - `user_ip_address`.`uuid` AS `public_ip_uuid`, - `user_ip_address`.`public_ip_address` AS `public_ip_address`, - `ssh_keypairs`.`keypair_name` AS `keypair_name`, - `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`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id`, - `affinity_group`.`id` AS `affinity_group_id`, - `affinity_group`.`uuid` AS `affinity_group_uuid`, - `affinity_group`.`name` AS `affinity_group_name`, - `affinity_group`.`description` AS `affinity_group_description`, - `vm_instance`.`dynamically_scalable` AS `dynamically_scalable` - FROM - (((((((((((((((((((((((((((((((((`user_vm` - JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) - AND ISNULL(`vm_instance`.`removed`)))) - JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) - JOIN `domain` ON ((`vm_instance`.`domain_id` = `domain`.`id`))) - LEFT JOIN `guest_os` ON ((`vm_instance`.`guest_os_id` = `guest_os`.`id`))) - LEFT JOIN `host_pod_ref` ON ((`vm_instance`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `instance_group_vm_map` ON ((`vm_instance`.`id` = `instance_group_vm_map`.`instance_id`))) - LEFT JOIN `instance_group` ON ((`instance_group_vm_map`.`group_id` = `instance_group`.`id`))) - LEFT JOIN `data_center` ON ((`vm_instance`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `host` ON ((`vm_instance`.`host_id` = `host`.`id`))) - LEFT JOIN `vm_template` ON ((`vm_instance`.`vm_template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `iso` ON ((`iso`.`id` = `user_vm`.`iso_id`))) - LEFT JOIN `service_offering` ON ((`vm_instance`.`service_offering_id` = `service_offering`.`id`))) - LEFT JOIN `disk_offering` `svc_disk_offering` ON ((`vm_instance`.`service_offering_id` = `svc_disk_offering`.`id`))) - LEFT JOIN `disk_offering` ON ((`vm_instance`.`disk_offering_id` = `disk_offering`.`id`))) - LEFT JOIN `backup_offering` ON ((`vm_instance`.`backup_offering_id` = `backup_offering`.`id`))) - LEFT JOIN `volumes` ON ((`vm_instance`.`id` = `volumes`.`instance_id`))) - LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) - LEFT JOIN `security_group_vm_map` ON ((`vm_instance`.`id` = `security_group_vm_map`.`instance_id`))) - LEFT JOIN `security_group` ON ((`security_group_vm_map`.`security_group_id` = `security_group`.`id`))) - LEFT JOIN `nics` ON (((`vm_instance`.`id` = `nics`.`instance_id`) - AND ISNULL(`nics`.`removed`)))) - LEFT JOIN `networks` ON ((`nics`.`network_id` = `networks`.`id`))) - LEFT JOIN `vpc` ON (((`networks`.`vpc_id` = `vpc`.`id`) - AND ISNULL(`vpc`.`removed`)))) - LEFT JOIN `user_ip_address` ON ((`user_ip_address`.`vm_id` = `vm_instance`.`id`))) - LEFT JOIN `user_vm_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) - AND (`ssh_details`.`name` = 'SSH.PublicKey')))) - LEFT JOIN `ssh_keypairs` ON (((`ssh_keypairs`.`public_key` = `ssh_details`.`value`) - AND (`ssh_keypairs`.`account_id` = `account`.`id`)))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_instance`.`id`) - AND (`resource_tags`.`resource_type` = 'UserVm')))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `vm_instance`.`id`) - AND (`async_job`.`instance_type` = 'VirtualMachine') - AND (`async_job`.`job_status` = 0)))) - LEFT JOIN `affinity_group_vm_map` ON ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) - LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) - LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) - AND (`custom_cpu`.`name` = 'CpuNumber')))) - LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) - AND (`custom_speed`.`name` = 'CpuSpeed')))) - LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) - AND (`custom_ram_size`.`name` = 'memory')))); - -- Fix OS category for some Ubuntu and RedHat OS-es UPDATE `cloud`.`guest_os` SET `category_id`='10' WHERE `id`=277 AND display_name="Ubuntu 17.04"; UPDATE `cloud`.`guest_os` SET `category_id`='10' WHERE `id`=278 AND display_name="Ubuntu 17.10"; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql b/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql index a2db61b3f2d..a964d0e67d3 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql @@ -74,105 +74,6 @@ ALTER TABLE `cloud`.`project_invitations` DROP INDEX `project_id`, ADD CONSTRAINT `uc_project_invitations__project_id_account_id_user_id` UNIQUE (`project_id`, `account_id`,`user_id`); --- Alter project_invitation_view to incorporate user_id as a field -DROP VIEW IF EXISTS `cloud`.`project_invitation_view`; -CREATE VIEW `cloud`.`project_invitation_view` AS - select - project_invitations.id, - project_invitations.uuid, - project_invitations.email, - project_invitations.created, - project_invitations.state, - project_invitations.project_role_id, - projects.id project_id, - projects.uuid project_uuid, - projects.name project_name, - account.id account_id, - account.uuid account_uuid, - account.account_name, - account.type account_type, - user.id user_id, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`project_invitations` - left join - `cloud`.`account` ON project_invitations.account_id = account.id - left join - `cloud`.`domain` ON project_invitations.domain_id = domain.id - left join - `cloud`.`projects` ON projects.id = project_invitations.project_id - left join - `cloud`.`user` ON project_invitations.user_id = user.id; - --- Alter project_account_view to incorporate user id -DROP VIEW IF EXISTS `cloud`.`project_account_view`; -CREATE VIEW `cloud`.`project_account_view` AS - select - project_account.id, - account.id account_id, - account.uuid account_uuid, - account.account_name, - account.type account_type, - user.id user_id, - user.uuid user_uuid, - user.username user_name, - project_account.account_role, - project_role.id project_role_id, - project_role.uuid project_role_uuid, - projects.id project_id, - projects.uuid project_uuid, - projects.name project_name, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`project_account` - inner join - `cloud`.`account` ON project_account.account_id = account.id - inner join - `cloud`.`domain` ON account.domain_id = domain.id - inner join - `cloud`.`projects` ON projects.id = project_account.project_id - left join - `cloud`.`project_role` ON project_account.project_role_id = project_role.id - left join - `cloud`.`user` ON (project_account.user_id = user.id); - --- Alter project_view to incorporate user id -DROP VIEW IF EXISTS `cloud`.`project_view`; -CREATE VIEW `cloud`.`project_view` AS - select - projects.id, - projects.uuid, - projects.name, - projects.display_text, - projects.state, - projects.removed, - projects.created, - projects.project_account_id, - account.account_name owner, - pacct.account_id, - pacct.user_id, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`projects` - inner join - `cloud`.`domain` ON projects.domain_id = domain.id - inner join - `cloud`.`project_account` ON projects.id = project_account.project_id - and project_account.account_role = 'Admin' - inner join - `cloud`.`account` ON account.id = project_account.account_id - left join - `cloud`.`project_account` pacct ON projects.id = pacct.project_id; - -- Fix Debian 10 32-bit hypervisor mappings on VMware, debian10-32bit OS ID in guest_os table is 292, not 282 UPDATE `cloud`.`guest_os_hypervisor` SET guest_os_id=292 WHERE guest_os_id=282 AND hypervisor_type="VMware" AND guest_os_name="debian10Guest"; -- Fix CentOS 32-bit mapping for VMware 5.5 which does not have a centos6Guest but only centosGuest and centos64Guest @@ -216,317 +117,9 @@ CREATE TABLE IF NOT EXISTS `cloud`.`vsphere_storage_policy` ( ALTER TABLE `cloud`.`storage_pool` ADD COLUMN `parent` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'ID of the Datastore cluster (storage pool) if this is a child in that Datastore cluster'; --- Added parent column to support datastore clusters in vmware vsphere -DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; -CREATE VIEW `cloud`.`storage_pool_view` AS - SELECT - `storage_pool`.`id` AS `id`, - `storage_pool`.`uuid` AS `uuid`, - `storage_pool`.`name` AS `name`, - `storage_pool`.`status` AS `status`, - `storage_pool`.`path` AS `path`, - `storage_pool`.`pool_type` AS `pool_type`, - `storage_pool`.`host_address` AS `host_address`, - `storage_pool`.`created` AS `created`, - `storage_pool`.`removed` AS `removed`, - `storage_pool`.`capacity_bytes` AS `capacity_bytes`, - `storage_pool`.`capacity_iops` AS `capacity_iops`, - `storage_pool`.`scope` AS `scope`, - `storage_pool`.`hypervisor` AS `hypervisor`, - `storage_pool`.`storage_provider_name` AS `storage_provider_name`, - `storage_pool`.`parent` AS `parent`, - `cluster`.`id` AS `cluster_id`, - `cluster`.`uuid` AS `cluster_uuid`, - `cluster`.`name` AS `cluster_name`, - `cluster`.`cluster_type` AS `cluster_type`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`networktype` AS `data_center_type`, - `host_pod_ref`.`id` AS `pod_id`, - `host_pod_ref`.`uuid` AS `pod_uuid`, - `host_pod_ref`.`name` AS `pod_name`, - `storage_pool_tags`.`tag` AS `tag`, - `op_host_capacity`.`used_capacity` AS `disk_used_capacity`, - `op_host_capacity`.`reserved_capacity` AS `disk_reserved_capacity`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id` - FROM - ((((((`storage_pool` - LEFT JOIN `cluster` ON ((`storage_pool`.`cluster_id` = `cluster`.`id`))) - LEFT JOIN `data_center` ON ((`storage_pool`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `host_pod_ref` ON ((`storage_pool`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `storage_pool_tags` ON (((`storage_pool_tags`.`pool_id` = `storage_pool`.`id`)))) - LEFT JOIN `op_host_capacity` ON (((`storage_pool`.`id` = `op_host_capacity`.`host_id`) - AND (`op_host_capacity`.`capacity_type` IN (3 , 9))))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `storage_pool`.`id`) - AND (`async_job`.`instance_type` = 'StoragePool') - AND (`async_job`.`job_status` = 0)))); - -- Add passthrough instruction for appliance deployments ALTER TABLE `cloud`.`vm_template` ADD COLUMN `deploy_as_is` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the template should be deployed with disks and networks as defined by OVF'; --- Changes to template_view for both deploying multidisk OVA/vApp as is -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE VIEW `cloud`.`template_view` AS - SELECT - `vm_template`.`id` AS `id`, - `vm_template`.`uuid` AS `uuid`, - `vm_template`.`unique_name` AS `unique_name`, - `vm_template`.`name` AS `name`, - `vm_template`.`public` AS `public`, - `vm_template`.`featured` AS `featured`, - `vm_template`.`type` AS `type`, - `vm_template`.`hvm` AS `hvm`, - `vm_template`.`bits` AS `bits`, - `vm_template`.`url` AS `url`, - `vm_template`.`format` AS `format`, - `vm_template`.`created` AS `created`, - `vm_template`.`checksum` AS `checksum`, - `vm_template`.`display_text` AS `display_text`, - `vm_template`.`enable_password` AS `enable_password`, - `vm_template`.`dynamically_scalable` AS `dynamically_scalable`, - `vm_template`.`state` AS `template_state`, - `vm_template`.`guest_os_id` AS `guest_os_id`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `guest_os`.`display_name` AS `guest_os_name`, - `vm_template`.`bootable` AS `bootable`, - `vm_template`.`prepopulate` AS `prepopulate`, - `vm_template`.`cross_zones` AS `cross_zones`, - `vm_template`.`hypervisor_type` AS `hypervisor_type`, - `vm_template`.`extractable` AS `extractable`, - `vm_template`.`template_tag` AS `template_tag`, - `vm_template`.`sort_key` AS `sort_key`, - `vm_template`.`removed` AS `removed`, - `vm_template`.`enable_sshkey` AS `enable_sshkey`, - `parent_template`.`id` AS `parent_template_id`, - `parent_template`.`uuid` AS `parent_template_uuid`, - `source_template`.`id` AS `source_template_id`, - `source_template`.`uuid` AS `source_template_uuid`, - `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`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `launch_permission`.`account_id` AS `lp_account_id`, - `template_store_ref`.`store_id` AS `store_id`, - `image_store`.`scope` AS `store_scope`, - `template_store_ref`.`state` AS `state`, - `template_store_ref`.`download_state` AS `download_state`, - `template_store_ref`.`download_pct` AS `download_pct`, - `template_store_ref`.`error_str` AS `error_str`, - `template_store_ref`.`size` AS `size`, - `template_store_ref`.physical_size AS `physical_size`, - `template_store_ref`.`destroyed` AS `destroyed`, - `template_store_ref`.`created` AS `created_on_store`, - `vm_template_details`.`name` AS `detail_name`, - `vm_template_details`.`value` AS `detail_value`, - `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(`vm_template`.`id`, - '_', - IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`, - `vm_template`.`direct_download` AS `direct_download`, - `vm_template`.`deploy_as_is` AS `deploy_as_is` - FROM - (((((((((((((`vm_template` - JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`))) - JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`))) - JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `vm_template_details` ON ((`vm_template_details`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id` = `vm_template`.`source_template_id`))) - LEFT JOIN `template_store_ref` ON (((`template_store_ref`.`template_id` = `vm_template`.`id`) - AND (`template_store_ref`.`store_role` = 'Image') - AND (`template_store_ref`.`destroyed` = 0)))) - LEFT JOIN `vm_template` `parent_template` ON ((`parent_template`.`id` = `vm_template`.`parent_template_id`))) - LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`) - AND (`template_store_ref`.`store_id` IS NOT NULL) - AND (`image_store`.`id` = `template_store_ref`.`store_id`)))) - LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id` = `vm_template`.`id`) - AND ISNULL(`template_store_ref`.`store_id`) - AND ISNULL(`template_zone_ref`.`removed`)))) - LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`) - OR (`template_zone_ref`.`zone_id` = `data_center`.`id`)))) - LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`) - AND ((`resource_tags`.`resource_type` = 'Template') - OR (`resource_tags`.`resource_type` = 'ISO'))))); - --- Add mincpu, maxcpu, minmemory and maxmemory to the view supporting constrained offerings -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - SELECT - `service_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`disk_size` AS `root_disk_size`, - `service_offering`.`cpu` AS `cpu`, - `service_offering`.`speed` AS `speed`, - `service_offering`.`ram_size` AS `ram_size`, - `service_offering`.`nw_rate` AS `nw_rate`, - `service_offering`.`mc_rate` AS `mc_rate`, - `service_offering`.`ha_enabled` AS `ha_enabled`, - `service_offering`.`limit_cpu_use` AS `limit_cpu_use`, - `service_offering`.`host_tag` AS `host_tag`, - `service_offering`.`default_use` AS `default_use`, - `service_offering`.`vm_type` AS `vm_type`, - `service_offering`.`sort_key` AS `sort_key`, - `service_offering`.`is_volatile` AS `is_volatile`, - `service_offering`.`deployment_planner` AS `deployment_planner`, - `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, - 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, - IFNULL(`min_compute_details`.`value`, `cpu`) AS min_cpu, - IFNULL(`max_compute_details`.`value`, `cpu`) AS max_cpu, - IFNULL(`min_memory_details`.`value`, `ram_size`) AS min_memory, - IFNULL(`max_memory_details`.`value`, `ram_size`) AS max_memory - FROM - `cloud`.`service_offering` - INNER JOIN - `cloud`.`disk_offering_view` AS `disk_offering` ON service_offering.id = disk_offering.id - LEFT JOIN - `cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`service_offering_details` AS `zone_details` ON `zone_details`.`service_offering_id` = `disk_offering`.`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`.`service_offering_details` AS `min_compute_details` ON `min_compute_details`.`service_offering_id` = `disk_offering`.`id` - AND `min_compute_details`.`name` = 'mincpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_compute_details` ON `max_compute_details`.`service_offering_id` = `disk_offering`.`id` - AND `max_compute_details`.`name` = 'maxcpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `min_memory_details` ON `min_memory_details`.`service_offering_id` = `disk_offering`.`id` - AND `min_memory_details`.`name` = 'minmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_memory_details` ON `max_memory_details`.`service_offering_id` = `disk_offering`.`id` - AND `max_memory_details`.`name` = 'maxmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`service_offering_id` = `disk_offering`.`id` - AND `vsphere_storage_policy`.`name` = 'storagepolicy' - WHERE - `disk_offering`.`state`='Active' - GROUP BY - `service_offering`.`id`; - -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - SELECT - `disk_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`disk_size` AS `disk_size`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`customized` AS `customized`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`sort_key` AS `sort_key`, - `disk_offering`.`type` AS `type`, - `disk_offering`.`display_offering` AS `display_offering`, - `disk_offering`.`state` AS `state`, - `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, - 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 - FROM - `cloud`.`disk_offering` - LEFT JOIN - `cloud`.`disk_offering_details` AS `domain_details` ON `domain_details`.`offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`disk_offering_details` AS `zone_details` ON `zone_details`.`offering_id` = `disk_offering`.`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`.`disk_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`offering_id` = `disk_offering`.`id` - AND `vsphere_storage_policy`.`name` = 'storagepolicy' - - WHERE - `disk_offering`.`state`='Active' - GROUP BY - `disk_offering`.`id`; - ALTER TABLE `cloud`.`template_spool_ref` DROP FOREIGN KEY `fk_template_spool_ref__template_id`; @@ -563,31 +156,6 @@ CREATE TABLE `cloud`.`user_vm_deploy_as_is_details` ( ALTER TABLE `cloud`.`image_store` ADD COLUMN `readonly` boolean DEFAULT false COMMENT 'defines status of image store'; -DROP VIEW IF EXISTS `cloud`.`image_store_view`; -CREATE VIEW `cloud`.`image_store_view` AS - select - image_store.id, - image_store.uuid, - image_store.name, - image_store.image_provider_name, - image_store.protocol, - image_store.url, - image_store.scope, - image_store.role, - image_store.readonly, - image_store.removed, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - image_store_details.name detail_name, - image_store_details.value detail_value - from - `cloud`.`image_store` - left join - `cloud`.`data_center` ON image_store.data_center_id = data_center.id - left join - `cloud`.`image_store_details` ON image_store_details.store_id = image_store.id; - -- Fix OS category for Guest OS 'Other PV Virtio-SCSI (64-bit)' UPDATE `cloud`.`guest_os` SET category_id = 7 WHERE id = 275 AND display_name = 'Other PV Virtio-SCSI (64-bit)'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41520to41600.sql b/engine/schema/src/main/resources/META-INF/db/schema-41520to41600.sql index a414f244b08..4237c74a7c2 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41520to41600.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41520to41600.sql @@ -34,94 +34,6 @@ ALTER TABLE `cloud`.`kubernetes_cluster_vm_map` ADD COLUMN `control_node` tinyin -- Adding dynamic scalable flag for service offering table ALTER TABLE `cloud`.`service_offering` ADD COLUMN `dynamic_scaling_enabled` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT 'true(1) if VM needs to be dynamically scalable of cpu or memory'; -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - SELECT - `service_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`disk_size` AS `root_disk_size`, - `service_offering`.`cpu` AS `cpu`, - `service_offering`.`speed` AS `speed`, - `service_offering`.`ram_size` AS `ram_size`, - `service_offering`.`nw_rate` AS `nw_rate`, - `service_offering`.`mc_rate` AS `mc_rate`, - `service_offering`.`ha_enabled` AS `ha_enabled`, - `service_offering`.`limit_cpu_use` AS `limit_cpu_use`, - `service_offering`.`host_tag` AS `host_tag`, - `service_offering`.`default_use` AS `default_use`, - `service_offering`.`vm_type` AS `vm_type`, - `service_offering`.`sort_key` AS `sort_key`, - `service_offering`.`is_volatile` AS `is_volatile`, - `service_offering`.`deployment_planner` AS `deployment_planner`, - `service_offering`.`dynamic_scaling_enabled` AS `dynamic_scaling_enabled`, - `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, - 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, - IFNULL(`min_compute_details`.`value`, `cpu`) AS min_cpu, - IFNULL(`max_compute_details`.`value`, `cpu`) AS max_cpu, - IFNULL(`min_memory_details`.`value`, `ram_size`) AS min_memory, - IFNULL(`max_memory_details`.`value`, `ram_size`) AS max_memory - FROM - `cloud`.`service_offering` - INNER JOIN - `cloud`.`disk_offering_view` AS `disk_offering` ON service_offering.id = disk_offering.id - LEFT JOIN - `cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`service_offering_details` AS `zone_details` ON `zone_details`.`service_offering_id` = `disk_offering`.`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`.`service_offering_details` AS `min_compute_details` ON `min_compute_details`.`service_offering_id` = `disk_offering`.`id` - AND `min_compute_details`.`name` = 'mincpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_compute_details` ON `max_compute_details`.`service_offering_id` = `disk_offering`.`id` - AND `max_compute_details`.`name` = 'maxcpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `min_memory_details` ON `min_memory_details`.`service_offering_id` = `disk_offering`.`id` - AND `min_memory_details`.`name` = 'minmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_memory_details` ON `max_memory_details`.`service_offering_id` = `disk_offering`.`id` - AND `max_memory_details`.`name` = 'maxmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`service_offering_id` = `disk_offering`.`id` - AND `vsphere_storage_policy`.`name` = 'storagepolicy' - WHERE - `disk_offering`.`state`='Active' - GROUP BY - `service_offering`.`id`; --; -- Stored procedure to do idempotent column add; @@ -142,455 +54,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.account','created', 'datetime DEFAUL CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.domain','created', 'datetime DEFAULT NULL COMMENT ''date created'' AFTER `next_child_seq` '); CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.account','created', 'datetime DEFAULT NULL COMMENT ''date created'' AFTER `state` '); -DROP VIEW IF EXISTS `cloud`.`account_view`; -CREATE VIEW `cloud`.`account_view` AS -select - `account`.`id` AS `id`, - `account`.`uuid` AS `uuid`, - `account`.`account_name` AS `account_name`, - `account`.`type` AS `type`, - `account`.`role_id` AS `role_id`, - `account`.`state` AS `state`, - `account`.`created` AS `created`, - `account`.`removed` AS `removed`, - `account`.`cleanup_needed` AS `cleanup_needed`, - `account`.`network_domain` AS `network_domain` , - `account`.`default` AS `default`, - `domain`.`id` AS `domain_id`, - `domain`.`uuid` AS `domain_uuid`, - `domain`.`name` AS `domain_name`, - `domain`.`path` AS `domain_path`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `account_netstats_view`.`bytesReceived` AS `bytesReceived`, - `account_netstats_view`.`bytesSent` AS `bytesSent`, - `vmlimit`.`max` AS `vmLimit`, - `vmcount`.`count` AS `vmTotal`, - `runningvm`.`vmcount` AS `runningVms`, - `stoppedvm`.`vmcount` AS `stoppedVms`, - `iplimit`.`max` AS `ipLimit`, - `ipcount`.`count` AS `ipTotal`, - `free_ip_view`.`free_ip` AS `ipFree`, - `volumelimit`.`max` AS `volumeLimit`, - `volumecount`.`count` AS `volumeTotal`, - `snapshotlimit`.`max` AS `snapshotLimit`, - `snapshotcount`.`count` AS `snapshotTotal`, - `templatelimit`.`max` AS `templateLimit`, - `templatecount`.`count` AS `templateTotal`, - `vpclimit`.`max` AS `vpcLimit`, - `vpccount`.`count` AS `vpcTotal`, - `projectlimit`.`max` AS `projectLimit`, - `projectcount`.`count` AS `projectTotal`, - `networklimit`.`max` AS `networkLimit`, - `networkcount`.`count` AS `networkTotal`, - `cpulimit`.`max` AS `cpuLimit`, - `cpucount`.`count` AS `cpuTotal`, - `memorylimit`.`max` AS `memoryLimit`, - `memorycount`.`count` AS `memoryTotal`, - `primary_storage_limit`.`max` AS `primaryStorageLimit`, - `primary_storage_count`.`count` AS `primaryStorageTotal`, - `secondary_storage_limit`.`max` AS `secondaryStorageLimit`, - `secondary_storage_count`.`count` AS `secondaryStorageTotal`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `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; - - -DROP VIEW IF EXISTS `cloud`.`domain_view`; -CREATE VIEW `cloud`.`domain_view` AS -select - `domain`.`id` AS `id`, - `domain`.`parent` AS `parent`, - `domain`.`name` AS `name`, - `domain`.`uuid` AS `uuid`, - `domain`.`owner` AS `owner`, - `domain`.`path` AS `path`, - `domain`.`level` AS `level`, - `domain`.`child_count` AS `child_count`, - `domain`.`next_child_seq` AS `next_child_seq`, - `domain`.`created` AS `created`, - `domain`.`removed` AS `removed`, - `domain`.`state` AS `state`, - `domain`.`network_domain` AS `network_domain`, - `domain`.`type` AS `type`, - `vmlimit`.`max` AS `vmLimit`, - `vmcount`.`count` AS `vmTotal`, - `iplimit`.`max` AS `ipLimit`, - `ipcount`.`count` AS `ipTotal`, - `volumelimit`.`max` AS `volumeLimit`, - `volumecount`.`count` AS `volumeTotal`, - `snapshotlimit`.`max` AS `snapshotLimit`, - `snapshotcount`.`count` AS `snapshotTotal`, - `templatelimit`.`max` AS `templateLimit`, - `templatecount`.`count` AS `templateTotal`, - `vpclimit`.`max` AS `vpcLimit`, - `vpccount`.`count` AS `vpcTotal`, - `projectlimit`.`max` AS `projectLimit`, - `projectcount`.`count` AS `projectTotal`, - `networklimit`.`max` AS `networkLimit`, - `networkcount`.`count` AS `networkTotal`, - `cpulimit`.`max` AS `cpuLimit`, - `cpucount`.`count` AS `cpuTotal`, - `memorylimit`.`max` AS `memoryLimit`, - `memorycount`.`count` AS `memoryTotal`, - `primary_storage_limit`.`max` AS `primaryStorageLimit`, - `primary_storage_count`.`count` AS `primaryStorageTotal`, - `secondary_storage_limit`.`max` AS `secondaryStorageLimit`, - `secondary_storage_count`.`count` AS `secondaryStorageTotal` -from - `cloud`.`domain` - left join - `cloud`.`resource_limit` vmlimit ON domain.id = vmlimit.domain_id - and vmlimit.type = 'user_vm' - left join - `cloud`.`resource_count` vmcount ON domain.id = vmcount.domain_id - and vmcount.type = 'user_vm' - left join - `cloud`.`resource_limit` iplimit ON domain.id = iplimit.domain_id - and iplimit.type = 'public_ip' - left join - `cloud`.`resource_count` ipcount ON domain.id = ipcount.domain_id - and ipcount.type = 'public_ip' - left join - `cloud`.`resource_limit` volumelimit ON domain.id = volumelimit.domain_id - and volumelimit.type = 'volume' - left join - `cloud`.`resource_count` volumecount ON domain.id = volumecount.domain_id - and volumecount.type = 'volume' - left join - `cloud`.`resource_limit` snapshotlimit ON domain.id = snapshotlimit.domain_id - and snapshotlimit.type = 'snapshot' - left join - `cloud`.`resource_count` snapshotcount ON domain.id = snapshotcount.domain_id - and snapshotcount.type = 'snapshot' - left join - `cloud`.`resource_limit` templatelimit ON domain.id = templatelimit.domain_id - and templatelimit.type = 'template' - left join - `cloud`.`resource_count` templatecount ON domain.id = templatecount.domain_id - and templatecount.type = 'template' - left join - `cloud`.`resource_limit` vpclimit ON domain.id = vpclimit.domain_id - and vpclimit.type = 'vpc' - left join - `cloud`.`resource_count` vpccount ON domain.id = vpccount.domain_id - and vpccount.type = 'vpc' - left join - `cloud`.`resource_limit` projectlimit ON domain.id = projectlimit.domain_id - and projectlimit.type = 'project' - left join - `cloud`.`resource_count` projectcount ON domain.id = projectcount.domain_id - and projectcount.type = 'project' - left join - `cloud`.`resource_limit` networklimit ON domain.id = networklimit.domain_id - and networklimit.type = 'network' - left join - `cloud`.`resource_count` networkcount ON domain.id = networkcount.domain_id - and networkcount.type = 'network' - left join - `cloud`.`resource_limit` cpulimit ON domain.id = cpulimit.domain_id - and cpulimit.type = 'cpu' - left join - `cloud`.`resource_count` cpucount ON domain.id = cpucount.domain_id - and cpucount.type = 'cpu' - left join - `cloud`.`resource_limit` memorylimit ON domain.id = memorylimit.domain_id - and memorylimit.type = 'memory' - left join - `cloud`.`resource_count` memorycount ON domain.id = memorycount.domain_id - and memorycount.type = 'memory' - left join - `cloud`.`resource_limit` primary_storage_limit ON domain.id = primary_storage_limit.domain_id - and primary_storage_limit.type = 'primary_storage' - left join - `cloud`.`resource_count` primary_storage_count ON domain.id = primary_storage_count.domain_id - and primary_storage_count.type = 'primary_storage' - left join - `cloud`.`resource_limit` secondary_storage_limit ON domain.id = secondary_storage_limit.domain_id - and secondary_storage_limit.type = 'secondary_storage' - left join - `cloud`.`resource_count` secondary_storage_count ON domain.id = secondary_storage_count.domain_id - and secondary_storage_count.type = 'secondary_storage'; - - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE - VIEW `user_vm_view` AS -SELECT - `vm_instance`.`id` AS `id`, - `vm_instance`.`name` AS `name`, - `user_vm`.`display_name` AS `display_name`, - `user_vm`.`user_data` AS `user_data`, - `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`, - `instance_group`.`id` AS `instance_group_id`, - `instance_group`.`uuid` AS `instance_group_uuid`, - `instance_group`.`name` AS `instance_group_name`, - `vm_instance`.`uuid` AS `uuid`, - `vm_instance`.`user_id` AS `user_id`, - `vm_instance`.`last_host_id` AS `last_host_id`, - `vm_instance`.`vm_type` AS `type`, - `vm_instance`.`limit_cpu_use` AS `limit_cpu_use`, - `vm_instance`.`created` AS `created`, - `vm_instance`.`state` AS `state`, - `vm_instance`.`update_time` AS `update_time`, - `vm_instance`.`removed` AS `removed`, - `vm_instance`.`ha_enabled` AS `ha_enabled`, - `vm_instance`.`hypervisor_type` AS `hypervisor_type`, - `vm_instance`.`instance_name` AS `instance_name`, - `vm_instance`.`guest_os_id` AS `guest_os_id`, - `vm_instance`.`display_vm` AS `display_vm`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `vm_instance`.`pod_id` AS `pod_id`, - `host_pod_ref`.`uuid` AS `pod_uuid`, - `vm_instance`.`private_ip_address` AS `private_ip_address`, - `vm_instance`.`private_mac_address` AS `private_mac_address`, - `vm_instance`.`vm_type` AS `vm_type`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`is_security_group_enabled` AS `security_group_enabled`, - `data_center`.`networktype` AS `data_center_type`, - `host`.`id` AS `host_id`, - `host`.`uuid` AS `host_uuid`, - `host`.`name` AS `host_name`, - `host`.`cluster_id` AS `cluster_id`, - `vm_template`.`id` AS `template_id`, - `vm_template`.`uuid` AS `template_uuid`, - `vm_template`.`name` AS `template_name`, - `vm_template`.`display_text` AS `template_display_text`, - `vm_template`.`enable_password` AS `password_enabled`, - `iso`.`id` AS `iso_id`, - `iso`.`uuid` AS `iso_uuid`, - `iso`.`name` AS `iso_name`, - `iso`.`display_text` AS `iso_display_text`, - `service_offering`.`id` AS `service_offering_id`, - `svc_disk_offering`.`uuid` AS `service_offering_uuid`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`id` AS `disk_offering_id`, - (CASE - WHEN ISNULL(`service_offering`.`cpu`) THEN `custom_cpu`.`value` - ELSE `service_offering`.`cpu` - END) AS `cpu`, - (CASE - WHEN ISNULL(`service_offering`.`speed`) THEN `custom_speed`.`value` - ELSE `service_offering`.`speed` - END) AS `speed`, - (CASE - WHEN ISNULL(`service_offering`.`ram_size`) THEN `custom_ram_size`.`value` - ELSE `service_offering`.`ram_size` - END) AS `ram_size`, - `backup_offering`.`uuid` AS `backup_offering_uuid`, - `backup_offering`.`id` AS `backup_offering_id`, - `svc_disk_offering`.`name` AS `service_offering_name`, - `disk_offering`.`name` AS `disk_offering_name`, - `backup_offering`.`name` AS `backup_offering_name`, - `storage_pool`.`id` AS `pool_id`, - `storage_pool`.`uuid` AS `pool_uuid`, - `storage_pool`.`pool_type` AS `pool_type`, - `volumes`.`id` AS `volume_id`, - `volumes`.`uuid` AS `volume_uuid`, - `volumes`.`device_id` AS `volume_device_id`, - `volumes`.`volume_type` AS `volume_type`, - `security_group`.`id` AS `security_group_id`, - `security_group`.`uuid` AS `security_group_uuid`, - `security_group`.`name` AS `security_group_name`, - `security_group`.`description` AS `security_group_description`, - `nics`.`id` AS `nic_id`, - `nics`.`uuid` AS `nic_uuid`, - `nics`.`device_id` AS `nic_device_id`, - `nics`.`network_id` AS `network_id`, - `nics`.`ip4_address` AS `ip_address`, - `nics`.`ip6_address` AS `ip6_address`, - `nics`.`ip6_gateway` AS `ip6_gateway`, - `nics`.`ip6_cidr` AS `ip6_cidr`, - `nics`.`default_nic` AS `is_default_nic`, - `nics`.`gateway` AS `gateway`, - `nics`.`netmask` AS `netmask`, - `nics`.`mac_address` AS `mac_address`, - `nics`.`broadcast_uri` AS `broadcast_uri`, - `nics`.`isolation_uri` AS `isolation_uri`, - `vpc`.`id` AS `vpc_id`, - `vpc`.`uuid` AS `vpc_uuid`, - `networks`.`uuid` AS `network_uuid`, - `networks`.`name` AS `network_name`, - `networks`.`traffic_type` AS `traffic_type`, - `networks`.`guest_type` AS `guest_type`, - `user_ip_address`.`id` AS `public_ip_id`, - `user_ip_address`.`uuid` AS `public_ip_uuid`, - `user_ip_address`.`public_ip_address` AS `public_ip_address`, - `ssh_keypairs`.`keypair_name` AS `keypair_name`, - `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`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id`, - `affinity_group`.`id` AS `affinity_group_id`, - `affinity_group`.`uuid` AS `affinity_group_uuid`, - `affinity_group`.`name` AS `affinity_group_name`, - `affinity_group`.`description` AS `affinity_group_description`, - `vm_instance`.`dynamically_scalable` AS `dynamically_scalable` -FROM - (((((((((((((((((((((((((((((((((`user_vm` - JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) - AND ISNULL(`vm_instance`.`removed`)))) - JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) - JOIN `domain` ON ((`vm_instance`.`domain_id` = `domain`.`id`))) - LEFT JOIN `guest_os` ON ((`vm_instance`.`guest_os_id` = `guest_os`.`id`))) - LEFT JOIN `host_pod_ref` ON ((`vm_instance`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `instance_group_vm_map` ON ((`vm_instance`.`id` = `instance_group_vm_map`.`instance_id`))) - LEFT JOIN `instance_group` ON ((`instance_group_vm_map`.`group_id` = `instance_group`.`id`))) - LEFT JOIN `data_center` ON ((`vm_instance`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `host` ON ((`vm_instance`.`host_id` = `host`.`id`))) - LEFT JOIN `vm_template` ON ((`vm_instance`.`vm_template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `iso` ON ((`iso`.`id` = `user_vm`.`iso_id`))) - LEFT JOIN `service_offering` ON ((`vm_instance`.`service_offering_id` = `service_offering`.`id`))) - LEFT JOIN `disk_offering` `svc_disk_offering` ON ((`vm_instance`.`service_offering_id` = `svc_disk_offering`.`id`))) - LEFT JOIN `disk_offering` ON ((`vm_instance`.`disk_offering_id` = `disk_offering`.`id`))) - LEFT JOIN `backup_offering` ON ((`vm_instance`.`backup_offering_id` = `backup_offering`.`id`))) - LEFT JOIN `volumes` ON ((`vm_instance`.`id` = `volumes`.`instance_id`))) - LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) - LEFT JOIN `security_group_vm_map` ON ((`vm_instance`.`id` = `security_group_vm_map`.`instance_id`))) - LEFT JOIN `security_group` ON ((`security_group_vm_map`.`security_group_id` = `security_group`.`id`))) - LEFT JOIN `nics` ON (((`vm_instance`.`id` = `nics`.`instance_id`) - AND ISNULL(`nics`.`removed`)))) - LEFT JOIN `networks` ON ((`nics`.`network_id` = `networks`.`id`))) - LEFT JOIN `vpc` ON (((`networks`.`vpc_id` = `vpc`.`id`) - AND ISNULL(`vpc`.`removed`)))) - LEFT JOIN `user_ip_address` ON ((`user_ip_address`.`vm_id` = `vm_instance`.`id`))) - LEFT JOIN `user_vm_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) - AND (`ssh_details`.`name` = 'SSH.PublicKey')))) - LEFT JOIN `ssh_keypairs` ON (((`ssh_keypairs`.`public_key` = `ssh_details`.`value`) - AND (`ssh_keypairs`.`account_id` = `account`.`id`)))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_instance`.`id`) - AND (`resource_tags`.`resource_type` = 'UserVm')))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `vm_instance`.`id`) - AND (`async_job`.`instance_type` = 'VirtualMachine') - AND (`async_job`.`job_status` = 0)))) - LEFT JOIN `affinity_group_vm_map` ON ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) - LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) - LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) - AND (`custom_cpu`.`name` = 'CpuNumber')))) - LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) - AND (`custom_speed`.`name` = 'CpuSpeed')))) - LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) - AND (`custom_ram_size`.`name` = 'memory')))); - -- Update name for global configuration user.vm.readonly.ui.details Update configuration set name='user.vm.readonly.details' where name='user.vm.readonly.ui.details'; @@ -619,98 +82,6 @@ ALTER TABLE `cloud`.`snapshots` DROP FOREIGN KEY `fk_snapshots__s3_id` ; ALTER TABLE `cloud`.`snapshots` DROP COLUMN `s3_id` ; DROP TABLE IF EXISTS `cloud`.`s3`; --- Re-create host view to prevent multiple entries for hosts with multiple tags -DROP VIEW IF EXISTS `cloud`.`host_view`; -CREATE VIEW `cloud`.`host_view` AS - SELECT - host.id, - host.uuid, - host.name, - host.status, - host.disconnected, - host.type, - host.private_ip_address, - host.version, - host.hypervisor_type, - host.hypervisor_version, - host.capabilities, - host.last_ping, - host.created, - host.removed, - host.resource_state, - host.mgmt_server_id, - host.cpu_sockets, - host.cpus, - host.speed, - host.ram, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - GROUP_CONCAT(DISTINCT(host_tags.tag)) AS tag, - guest_os_category.id guest_os_category_id, - guest_os_category.uuid guest_os_category_uuid, - guest_os_category.name guest_os_category_name, - mem_caps.used_capacity memory_used_capacity, - mem_caps.reserved_capacity memory_reserved_capacity, - cpu_caps.used_capacity cpu_used_capacity, - cpu_caps.reserved_capacity cpu_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - oobm.enabled AS `oobm_enabled`, - oobm.power_state AS `oobm_power_state`, - ha_config.enabled AS `ha_enabled`, - ha_config.ha_state AS `ha_state`, - ha_config.provider AS `ha_provider`, - `last_annotation_view`.`annotation` AS `annotation`, - `last_annotation_view`.`created` AS `last_annotated`, - `user`.`username` AS `username` - FROM - `cloud`.`host` - LEFT JOIN - `cloud`.`cluster` ON host.cluster_id = cluster.id - LEFT JOIN - `cloud`.`data_center` ON host.data_center_id = data_center.id - LEFT JOIN - `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id - LEFT JOIN - `cloud`.`host_details` ON host.id = host_details.host_id - AND host_details.name = 'guest.os.category.id' - LEFT JOIN - `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT ( host_details.value, UNSIGNED ) - LEFT JOIN - `cloud`.`host_tags` ON host_tags.host_id = host.id - LEFT JOIN - `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id - AND mem_caps.capacity_type = 0 - LEFT JOIN - `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id - AND cpu_caps.capacity_type = 1 - LEFT JOIN - `cloud`.`async_job` ON async_job.instance_id = host.id - AND async_job.instance_type = 'Host' - AND async_job.job_status = 0 - LEFT JOIN - `cloud`.`oobm` ON oobm.host_id = host.id - left join - `cloud`.`ha_config` ON ha_config.resource_id=host.id - and ha_config.resource_type='Host' - LEFT JOIN - `cloud`.`last_annotation_view` ON `last_annotation_view`.`entity_uuid` = `host`.`uuid` - LEFT JOIN - `cloud`.`user` ON `user`.`uuid` = `last_annotation_view`.`user_uuid` - GROUP BY - `host`.`id`; - CREATE TABLE `cloud`.`resource_icon` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', `uuid` varchar(40), diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41610to41700.sql b/engine/schema/src/main/resources/META-INF/db/schema-41610to41700.sql index 8417ec29640..2bed6729872 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41610to41700.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41610to41700.sql @@ -62,163 +62,6 @@ UPDATE `cloud`.`disk_offering` SET `disk_size_strictness` = 1 WHERE `compute_onl ALTER TABLE `cloud`.`disk_offering` DROP COLUMN `type`; ALTER TABLE `cloud`.`disk_offering` DROP COLUMN `system_use`; -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - SELECT - `disk_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`disk_size` AS `disk_size`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`customized` AS `customized`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`sort_key` AS `sort_key`, - `disk_offering`.`compute_only` AS `compute_only`, - `disk_offering`.`display_offering` AS `display_offering`, - `disk_offering`.`state` AS `state`, - `disk_offering`.`disk_size_strictness` AS `disk_size_strictness`, - `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, - 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 - FROM - `cloud`.`disk_offering` - LEFT JOIN - `cloud`.`disk_offering_details` AS `domain_details` ON `domain_details`.`offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`disk_offering_details` AS `zone_details` ON `zone_details`.`offering_id` = `disk_offering`.`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`.`disk_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`offering_id` = `disk_offering`.`id` - AND `vsphere_storage_policy`.`name` = 'storagepolicy' - WHERE - `disk_offering`.`state`='Active' - GROUP BY - `disk_offering`.`id`; - -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - SELECT - `service_offering`.`id` AS `id`, - `service_offering`.`uuid` AS `uuid`, - `service_offering`.`name` AS `name`, - `service_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `service_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `service_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `service_offering`.`system_use` AS `system_use`, - `disk_offering`.`id` AS `disk_offering_id`, - `disk_offering`.`name` AS `disk_offering_name`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`display_text` AS `disk_offering_display_text`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`disk_size` AS `root_disk_size`, - `service_offering`.`cpu` AS `cpu`, - `service_offering`.`speed` AS `speed`, - `service_offering`.`ram_size` AS `ram_size`, - `service_offering`.`nw_rate` AS `nw_rate`, - `service_offering`.`mc_rate` AS `mc_rate`, - `service_offering`.`ha_enabled` AS `ha_enabled`, - `service_offering`.`limit_cpu_use` AS `limit_cpu_use`, - `service_offering`.`host_tag` AS `host_tag`, - `service_offering`.`default_use` AS `default_use`, - `service_offering`.`vm_type` AS `vm_type`, - `service_offering`.`sort_key` AS `sort_key`, - `service_offering`.`is_volatile` AS `is_volatile`, - `service_offering`.`deployment_planner` AS `deployment_planner`, - `service_offering`.`dynamic_scaling_enabled` AS `dynamic_scaling_enabled`, - `service_offering`.`disk_offering_strictness` AS `disk_offering_strictness`, - `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, - 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, - IFNULL(`min_compute_details`.`value`, `cpu`) AS min_cpu, - IFNULL(`max_compute_details`.`value`, `cpu`) AS max_cpu, - IFNULL(`min_memory_details`.`value`, `ram_size`) AS min_memory, - IFNULL(`max_memory_details`.`value`, `ram_size`) AS max_memory - FROM - `cloud`.`service_offering` - INNER JOIN - `cloud`.`disk_offering_view` AS `disk_offering` ON service_offering.disk_offering_id = disk_offering.id - LEFT JOIN - `cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `service_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`service_offering_details` AS `zone_details` ON `zone_details`.`service_offering_id` = `service_offering`.`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`.`service_offering_details` AS `min_compute_details` ON `min_compute_details`.`service_offering_id` = `service_offering`.`id` - AND `min_compute_details`.`name` = 'mincpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_compute_details` ON `max_compute_details`.`service_offering_id` = `service_offering`.`id` - AND `max_compute_details`.`name` = 'maxcpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `min_memory_details` ON `min_memory_details`.`service_offering_id` = `service_offering`.`id` - AND `min_memory_details`.`name` = 'minmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_memory_details` ON `max_memory_details`.`service_offering_id` = `service_offering`.`id` - AND `max_memory_details`.`name` = 'maxmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`service_offering_id` = `service_offering`.`id` - AND `vsphere_storage_policy`.`name` = 'storagepolicy' - WHERE - `service_offering`.`state`='Active' - GROUP BY - `service_offering`.`id`; - - --; -- Stored procedure to do idempotent column add; -- This is copied from schema-41000to41100.sql @@ -236,326 +79,6 @@ BEGIN CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes','external_uuid', 'VARCHAR(40) DEFAULT null '); -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - SELECT - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.provisioning_type, - volumes.size, - volumes.min_iops, - volumes.max_iops, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.display_volume, - volumes.format, - volumes.path, - volumes.chain_info, - volumes.external_uuid, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_store_ref.size volume_store_size, - volume_store_ref.download_pct, - volume_store_ref.download_state, - volume_store_ref.error_str, - volume_store_ref.created created_on_store, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - service_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.id cluster_id, - cluster.name cluster_name, - cluster.uuid cluster_uuid, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - vm_template.name template_name, - vm_template.display_text template_display_text, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - resource_tag_account.account_name tag_account_name, - resource_tag_domain.uuid tag_domain_uuid, - resource_tag_domain.name tag_domain_name - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = volumes.iso_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0 - left join - `cloud`.`account` resource_tag_account ON resource_tag_account.id = resource_tags.account_id - left join - `cloud`.`domain` resource_tag_domain ON resource_tag_domain.id = resource_tags.domain_id; - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE - VIEW `user_vm_view` AS -SELECT - `vm_instance`.`id` AS `id`, - `vm_instance`.`name` AS `name`, - `user_vm`.`display_name` AS `display_name`, - `user_vm`.`user_data` AS `user_data`, - `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`, - `instance_group`.`id` AS `instance_group_id`, - `instance_group`.`uuid` AS `instance_group_uuid`, - `instance_group`.`name` AS `instance_group_name`, - `vm_instance`.`uuid` AS `uuid`, - `vm_instance`.`user_id` AS `user_id`, - `vm_instance`.`last_host_id` AS `last_host_id`, - `vm_instance`.`vm_type` AS `type`, - `vm_instance`.`limit_cpu_use` AS `limit_cpu_use`, - `vm_instance`.`created` AS `created`, - `vm_instance`.`state` AS `state`, - `vm_instance`.`update_time` AS `update_time`, - `vm_instance`.`removed` AS `removed`, - `vm_instance`.`ha_enabled` AS `ha_enabled`, - `vm_instance`.`hypervisor_type` AS `hypervisor_type`, - `vm_instance`.`instance_name` AS `instance_name`, - `vm_instance`.`guest_os_id` AS `guest_os_id`, - `vm_instance`.`display_vm` AS `display_vm`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `vm_instance`.`pod_id` AS `pod_id`, - `host_pod_ref`.`uuid` AS `pod_uuid`, - `vm_instance`.`private_ip_address` AS `private_ip_address`, - `vm_instance`.`private_mac_address` AS `private_mac_address`, - `vm_instance`.`vm_type` AS `vm_type`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`is_security_group_enabled` AS `security_group_enabled`, - `data_center`.`networktype` AS `data_center_type`, - `host`.`id` AS `host_id`, - `host`.`uuid` AS `host_uuid`, - `host`.`name` AS `host_name`, - `host`.`cluster_id` AS `cluster_id`, - `vm_template`.`id` AS `template_id`, - `vm_template`.`uuid` AS `template_uuid`, - `vm_template`.`name` AS `template_name`, - `vm_template`.`display_text` AS `template_display_text`, - `vm_template`.`enable_password` AS `password_enabled`, - `iso`.`id` AS `iso_id`, - `iso`.`uuid` AS `iso_uuid`, - `iso`.`name` AS `iso_name`, - `iso`.`display_text` AS `iso_display_text`, - `service_offering`.`id` AS `service_offering_id`, - `service_offering`.`uuid` AS `service_offering_uuid`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`id` AS `disk_offering_id`, - (CASE - WHEN ISNULL(`service_offering`.`cpu`) THEN `custom_cpu`.`value` - ELSE `service_offering`.`cpu` - END) AS `cpu`, - (CASE - WHEN ISNULL(`service_offering`.`speed`) THEN `custom_speed`.`value` - ELSE `service_offering`.`speed` - END) AS `speed`, - (CASE - WHEN ISNULL(`service_offering`.`ram_size`) THEN `custom_ram_size`.`value` - ELSE `service_offering`.`ram_size` - END) AS `ram_size`, - `backup_offering`.`uuid` AS `backup_offering_uuid`, - `backup_offering`.`id` AS `backup_offering_id`, - `service_offering`.`name` AS `service_offering_name`, - `disk_offering`.`name` AS `disk_offering_name`, - `backup_offering`.`name` AS `backup_offering_name`, - `storage_pool`.`id` AS `pool_id`, - `storage_pool`.`uuid` AS `pool_uuid`, - `storage_pool`.`pool_type` AS `pool_type`, - `volumes`.`id` AS `volume_id`, - `volumes`.`uuid` AS `volume_uuid`, - `volumes`.`device_id` AS `volume_device_id`, - `volumes`.`volume_type` AS `volume_type`, - `security_group`.`id` AS `security_group_id`, - `security_group`.`uuid` AS `security_group_uuid`, - `security_group`.`name` AS `security_group_name`, - `security_group`.`description` AS `security_group_description`, - `nics`.`id` AS `nic_id`, - `nics`.`uuid` AS `nic_uuid`, - `nics`.`device_id` AS `nic_device_id`, - `nics`.`network_id` AS `network_id`, - `nics`.`ip4_address` AS `ip_address`, - `nics`.`ip6_address` AS `ip6_address`, - `nics`.`ip6_gateway` AS `ip6_gateway`, - `nics`.`ip6_cidr` AS `ip6_cidr`, - `nics`.`default_nic` AS `is_default_nic`, - `nics`.`gateway` AS `gateway`, - `nics`.`netmask` AS `netmask`, - `nics`.`mac_address` AS `mac_address`, - `nics`.`broadcast_uri` AS `broadcast_uri`, - `nics`.`isolation_uri` AS `isolation_uri`, - `vpc`.`id` AS `vpc_id`, - `vpc`.`uuid` AS `vpc_uuid`, - `networks`.`uuid` AS `network_uuid`, - `networks`.`name` AS `network_name`, - `networks`.`traffic_type` AS `traffic_type`, - `networks`.`guest_type` AS `guest_type`, - `user_ip_address`.`id` AS `public_ip_id`, - `user_ip_address`.`uuid` AS `public_ip_uuid`, - `user_ip_address`.`public_ip_address` AS `public_ip_address`, - `ssh_details`.`value` AS `keypair_names`, - `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`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id`, - `affinity_group`.`id` AS `affinity_group_id`, - `affinity_group`.`uuid` AS `affinity_group_uuid`, - `affinity_group`.`name` AS `affinity_group_name`, - `affinity_group`.`description` AS `affinity_group_description`, - `vm_instance`.`dynamically_scalable` AS `dynamically_scalable` -FROM - ((((((((((((((((((((((((((((((((`user_vm` - JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) - AND ISNULL(`vm_instance`.`removed`)))) - JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) - JOIN `domain` ON ((`vm_instance`.`domain_id` = `domain`.`id`))) - LEFT JOIN `guest_os` ON ((`vm_instance`.`guest_os_id` = `guest_os`.`id`))) - LEFT JOIN `host_pod_ref` ON ((`vm_instance`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `instance_group_vm_map` ON ((`vm_instance`.`id` = `instance_group_vm_map`.`instance_id`))) - LEFT JOIN `instance_group` ON ((`instance_group_vm_map`.`group_id` = `instance_group`.`id`))) - LEFT JOIN `data_center` ON ((`vm_instance`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `host` ON ((`vm_instance`.`host_id` = `host`.`id`))) - LEFT JOIN `vm_template` ON ((`vm_instance`.`vm_template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `iso` ON ((`iso`.`id` = `user_vm`.`iso_id`))) - LEFT JOIN `volumes` ON ((`vm_instance`.`id` = `volumes`.`instance_id`))) - LEFT JOIN `service_offering` ON ((`vm_instance`.`service_offering_id` = `service_offering`.`id`))) - LEFT JOIN `disk_offering` `svc_disk_offering` ON ((`volumes`.`disk_offering_id` = `svc_disk_offering`.`id`))) - LEFT JOIN `disk_offering` ON ((`volumes`.`disk_offering_id` = `disk_offering`.`id`))) - LEFT JOIN `backup_offering` ON ((`vm_instance`.`backup_offering_id` = `backup_offering`.`id`))) - LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) - LEFT JOIN `security_group_vm_map` ON ((`vm_instance`.`id` = `security_group_vm_map`.`instance_id`))) - LEFT JOIN `security_group` ON ((`security_group_vm_map`.`security_group_id` = `security_group`.`id`))) - LEFT JOIN `nics` ON (((`vm_instance`.`id` = `nics`.`instance_id`) - AND ISNULL(`nics`.`removed`)))) - LEFT JOIN `networks` ON ((`nics`.`network_id` = `networks`.`id`))) - LEFT JOIN `vpc` ON (((`networks`.`vpc_id` = `vpc`.`id`) - AND ISNULL(`vpc`.`removed`)))) - LEFT JOIN `user_ip_address` ON ((`user_ip_address`.`vm_id` = `vm_instance`.`id`))) - LEFT JOIN `user_vm_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) - AND (`ssh_details`.`name` = 'SSH.KeyPairNames')))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_instance`.`id`) - AND (`resource_tags`.`resource_type` = 'UserVm')))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `vm_instance`.`id`) - AND (`async_job`.`instance_type` = 'VirtualMachine') - AND (`async_job`.`job_status` = 0)))) - LEFT JOIN `affinity_group_vm_map` ON ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) - LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) - LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) - AND (`custom_cpu`.`name` = 'CpuNumber')))) - LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) - AND (`custom_speed`.`name` = 'CpuSpeed')))) - LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) - AND (`custom_ram_size`.`name` = 'memory')))); - INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) SELECT UUID(), 3, 'listConfigurations', 'ALLOW', (SELECT MAX(`sort_order`)+1 FROM `cloud`.`role_permissions`) ON DUPLICATE KEY UPDATE rule=rule; INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) SELECT UUID(), 3, 'updateConfiguration', 'ALLOW', (SELECT MAX(`sort_order`)+1 FROM `cloud`.`role_permissions`) ON DUPLICATE KEY UPDATE rule=rule; @@ -594,110 +117,6 @@ UPDATE `cloud`.`configuration` SET name = 'vm.stats.increment.metrics' WHERE nam ALTER TABLE `cloud`.`domain_router` ADD COLUMN `software_version` varchar(100) COMMENT 'Software version'; -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE 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.networktype data_center_type, - 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, - host.hypervisor_type, - host.cluster_id cluster_id, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - service_offering.uuid service_offering_uuid, - service_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, - vpc.name vpc_name, - 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, - domain_router.software_version software_version - 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`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null - 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; - -- For IPv6 guest prefixes. CREATE TABLE `cloud`.`dc_ip6_guest_prefix` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', @@ -727,112 +146,6 @@ CREATE TABLE `cloud`.`ip6_guest_prefix_subnet_network_map` ( CONSTRAINT `uc_ip6_guest_prefix_subnet_network_map__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- Network offering with internet protocol -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`.`for_vpc` AS `for_vpc`, - `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`; - --- VPC offering with multi-domains and multi-zones -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`.`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`; - -- Allow storing IPv6 CIDRs ALTER TABLE `cloud`.`firewall_rules_cidrs` MODIFY COLUMN `source_cidr` varchar(43) DEFAULT NULL; ALTER TABLE `cloud`.`firewall_rules_dcidrs` MODIFY COLUMN `destination_cidr` varchar(43) DEFAULT NULL; @@ -858,79 +171,10 @@ CREATE TABLE `cloud`.`mshost_status` ( CONSTRAINT `mshost_status_FK` FOREIGN KEY (`ms_id`) REFERENCES `mshost` (`uuid`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3; -DROP VIEW IF EXISTS `cloud`.`mshost_view`; -CREATE VIEW `cloud`.`mshost_view` AS -select - `cloud`.`mshost`.`id` AS `id`, - `cloud`.`mshost`.`msid` AS `msid`, - `cloud`.`mshost`.`runid` AS `runid`, - `cloud`.`mshost`.`name` AS `name`, - `cloud`.`mshost`.`uuid` AS `uuid`, - `cloud`.`mshost`.`state` AS `state`, - `cloud`.`mshost`.`version` AS `version`, - `cloud`.`mshost`.`service_ip` AS `service_ip`, - `cloud`.`mshost`.`service_port` AS `service_port`, - `cloud`.`mshost`.`last_update` AS `last_update`, - `cloud`.`mshost`.`removed` AS `removed`, - `cloud`.`mshost`.`alert_count` AS `alert_count`, - `cloud`.`mshost_status`.`last_jvm_start` AS `last_jvm_start`, - `cloud`.`mshost_status`.`last_jvm_stop` AS `last_jvm_stop`, - `cloud`.`mshost_status`.`last_system_boot` AS `last_system_boot`, - `cloud`.`mshost_status`.`os_distribution` AS `os_distribution`, - `cloud`.`mshost_status`.`java_name` AS `java_name`, - `cloud`.`mshost_status`.`java_version` AS `java_version` -from - (`cloud`.`mshost` -left join `cloud`.`mshost_status` on - ((`cloud`.`mshost`.`uuid` = `cloud`.`mshost_status`.`ms_id`))); - -- Alter event table to add resource_id and resource_type CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.event','resource_id', 'bigint unsigned COMMENT "ID of the resource associated with the event" AFTER `domain_id`'); CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.event','resource_type', 'VARCHAR(32) COMMENT "Type of the resource associated with the event" AFTER `resource_id`'); -DROP VIEW IF EXISTS `cloud`.`event_view`; -CREATE VIEW `cloud`.`event_view` AS - SELECT - event.id, - event.uuid, - event.type, - event.state, - event.description, - event.resource_id, - event.resource_type, - event.created, - event.level, - event.parameters, - event.start_id, - eve.uuid start_uuid, - event.user_id, - event.archived, - event.display, - user.username user_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 - FROM - `cloud`.`event` - INNER JOIN - `cloud`.`account` ON event.account_id = account.id - INNER JOIN - `cloud`.`domain` ON event.domain_id = domain.id - INNER JOIN - `cloud`.`user` ON event.user_id = user.id - LEFT JOIN - `cloud`.`projects` ON projects.project_account_id = event.account_id - LEFT JOIN - `cloud`.`event` eve ON event.start_id = eve.id; - -- Add XenServer 8.2.1 hypervisor capabilities INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported) VALUES (UUID(), 'XenServer', '8.2.1', 1000, 253, 64, 1); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41700to41710.sql b/engine/schema/src/main/resources/META-INF/db/schema-41700to41710.sql index 2ccd4a8e524..f9472cd828b 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41700to41710.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41700to41710.sql @@ -22,110 +22,5 @@ UPDATE `cloud`.`configuration` SET `value` = 'false' WHERE `name` = 'network.disable.rpfilter' AND `value` != 'true'; UPDATE `cloud`.`configuration` SET `value` = 'false' WHERE `name` = 'consoleproxy.disable.rpfilter' AND `value` != 'true'; --- Retrieve the hypervisor_type from vm_instance -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE 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, - vm_instance.hypervisor_type, - 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.networktype data_center_type, - 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, - host.cluster_id cluster_id, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - service_offering.uuid service_offering_uuid, - service_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, - vpc.name vpc_name, - 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, - domain_router.software_version software_version - 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`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null - 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; - -- PR #6080 Change column `value` size from 255 to 4096 characters, matching the API "updateConfiguration" "value" size ALTER TABLE `cloud`.`account_details` MODIFY `value` VARCHAR(4096) NOT NULL; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql index c51d5a43045..4f2a3420b2c 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql @@ -66,154 +66,6 @@ UPDATE `cloud`.`nics` SET mtu = 1500 WHERE vm_type='DomainRouter' AND removed IS -- Add type column to data_center table CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.data_center', 'type', 'varchar(32) DEFAULT ''Core'' COMMENT ''the type of the zone'' '); --- Recreate data_center_view -DROP VIEW IF EXISTS `cloud`.`data_center_view`; -CREATE VIEW `cloud`.`data_center_view` AS - select - data_center.id, - data_center.uuid, - data_center.name, - data_center.is_security_group_enabled, - data_center.is_local_storage_enabled, - data_center.description, - data_center.dns1, - data_center.dns2, - data_center.ip6_dns1, - data_center.ip6_dns2, - data_center.internal_dns1, - data_center.internal_dns2, - data_center.guest_network_cidr, - data_center.domain, - data_center.networktype, - data_center.allocation_state, - data_center.zone_token, - data_center.dhcp_provider, - data_center.type, - data_center.removed, - data_center.sort_key, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - dedicated_resources.affinity_group_id, - dedicated_resources.account_id, - affinity_group.uuid affinity_group_uuid - from - `cloud`.`data_center` - left join - `cloud`.`domain` ON data_center.domain_id = domain.id - left join - `cloud`.`dedicated_resources` ON data_center.id = dedicated_resources.data_center_id - left join - `cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id; - -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE 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.networktype data_center_network_type, - 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, - host.hypervisor_type, - host.cluster_id cluster_id, - host.status host_status, - host.resource_state host_resource_state, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - service_offering.uuid service_offering_uuid, - service_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, - nics.mtu mtu, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - vpc.name vpc_name, - 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, - domain_router.software_version software_version - 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`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null - 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; - -- Idempotent ADD COLUMN DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_COLUMN`; CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_COLUMN` ( @@ -238,166 +90,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'encrypt_format', 'varchar -- Add encrypt column to disk_offering CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.disk_offering', 'encrypt', 'tinyint(1) DEFAULT 0 COMMENT "volume encrypt requested" '); --- add encryption support to disk offering view -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS -SELECT - `disk_offering`.`id` AS `id`, - `disk_offering`.`uuid` AS `uuid`, - `disk_offering`.`name` AS `name`, - `disk_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `disk_offering`.`disk_size` AS `disk_size`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `disk_offering`.`customized` AS `customized`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`sort_key` AS `sort_key`, - `disk_offering`.`compute_only` AS `compute_only`, - `disk_offering`.`display_offering` AS `display_offering`, - `disk_offering`.`state` AS `state`, - `disk_offering`.`disk_size_strictness` AS `disk_size_strictness`, - `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, - `disk_offering`.`encrypt` AS `encrypt`, - 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 -FROM - `cloud`.`disk_offering` - LEFT JOIN - `cloud`.`disk_offering_details` AS `domain_details` ON `domain_details`.`offering_id` = `disk_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`disk_offering_details` AS `zone_details` ON `zone_details`.`offering_id` = `disk_offering`.`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`.`disk_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`offering_id` = `disk_offering`.`id` - AND `vsphere_storage_policy`.`name` = 'storagepolicy' -WHERE - `disk_offering`.`state`='Active' -GROUP BY - `disk_offering`.`id`; - --- add encryption support to service offering view -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS -SELECT - `service_offering`.`id` AS `id`, - `service_offering`.`uuid` AS `uuid`, - `service_offering`.`name` AS `name`, - `service_offering`.`display_text` AS `display_text`, - `disk_offering`.`provisioning_type` AS `provisioning_type`, - `service_offering`.`created` AS `created`, - `disk_offering`.`tags` AS `tags`, - `service_offering`.`removed` AS `removed`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `service_offering`.`system_use` AS `system_use`, - `disk_offering`.`id` AS `disk_offering_id`, - `disk_offering`.`name` AS `disk_offering_name`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`display_text` AS `disk_offering_display_text`, - `disk_offering`.`customized_iops` AS `customized_iops`, - `disk_offering`.`min_iops` AS `min_iops`, - `disk_offering`.`max_iops` AS `max_iops`, - `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`, - `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`, - `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`, - `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`, - `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `disk_offering`.`disk_size` AS `root_disk_size`, - `disk_offering`.`encrypt` AS `encrypt_root`, - `service_offering`.`cpu` AS `cpu`, - `service_offering`.`speed` AS `speed`, - `service_offering`.`ram_size` AS `ram_size`, - `service_offering`.`nw_rate` AS `nw_rate`, - `service_offering`.`mc_rate` AS `mc_rate`, - `service_offering`.`ha_enabled` AS `ha_enabled`, - `service_offering`.`limit_cpu_use` AS `limit_cpu_use`, - `service_offering`.`host_tag` AS `host_tag`, - `service_offering`.`default_use` AS `default_use`, - `service_offering`.`vm_type` AS `vm_type`, - `service_offering`.`sort_key` AS `sort_key`, - `service_offering`.`is_volatile` AS `is_volatile`, - `service_offering`.`deployment_planner` AS `deployment_planner`, - `service_offering`.`dynamic_scaling_enabled` AS `dynamic_scaling_enabled`, - `service_offering`.`disk_offering_strictness` AS `disk_offering_strictness`, - `vsphere_storage_policy`.`value` AS `vsphere_storage_policy`, - 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, - IFNULL(`min_compute_details`.`value`, `cpu`) AS min_cpu, - IFNULL(`max_compute_details`.`value`, `cpu`) AS max_cpu, - IFNULL(`min_memory_details`.`value`, `ram_size`) AS min_memory, - IFNULL(`max_memory_details`.`value`, `ram_size`) AS max_memory -FROM - `cloud`.`service_offering` - INNER JOIN - `cloud`.`disk_offering_view` AS `disk_offering` ON service_offering.disk_offering_id = disk_offering.id - LEFT JOIN - `cloud`.`service_offering_details` AS `domain_details` ON `domain_details`.`service_offering_id` = `service_offering`.`id` AND `domain_details`.`name`='domainid' - LEFT JOIN - `cloud`.`domain` AS `domain` ON FIND_IN_SET(`domain`.`id`, `domain_details`.`value`) - LEFT JOIN - `cloud`.`service_offering_details` AS `zone_details` ON `zone_details`.`service_offering_id` = `service_offering`.`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`.`service_offering_details` AS `min_compute_details` ON `min_compute_details`.`service_offering_id` = `service_offering`.`id` - AND `min_compute_details`.`name` = 'mincpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_compute_details` ON `max_compute_details`.`service_offering_id` = `service_offering`.`id` - AND `max_compute_details`.`name` = 'maxcpunumber' - LEFT JOIN - `cloud`.`service_offering_details` AS `min_memory_details` ON `min_memory_details`.`service_offering_id` = `service_offering`.`id` - AND `min_memory_details`.`name` = 'minmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `max_memory_details` ON `max_memory_details`.`service_offering_id` = `service_offering`.`id` - AND `max_memory_details`.`name` = 'maxmemory' - LEFT JOIN - `cloud`.`service_offering_details` AS `vsphere_storage_policy` ON `vsphere_storage_policy`.`service_offering_id` = `service_offering`.`id` - AND `vsphere_storage_policy`.`name` = 'storagepolicy' -WHERE - `service_offering`.`state`='Active' -GROUP BY - `service_offering`.`id`; - -- Add cidr_list column to load_balancing_rules ALTER TABLE `cloud`.`load_balancing_rules` ADD cidr_list VARCHAR(4096); @@ -548,82 +240,18 @@ CREATE TABLE IF NOT EXISTS `cloud`.`autoscale_vmgroup_statistics` ( INDEX `i_autoscale_vmgroup_statistics__counter_id`(`counter_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - --- Update Network offering view with supports_vm_autoscaling -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`.`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`; - -- Update column 'supports_vm_autoscaling' to 1 if network offerings support Lb UPDATE `cloud`.`network_offerings` JOIN `cloud`.`ntwk_offering_service_map` ON network_offerings.id = ntwk_offering_service_map.network_offering_id +JOIN ( + SELECT COUNT(id) AS count FROM `cloud`.`network_offerings` WHERE supports_vm_autoscaling = 1 +) AS cnt SET network_offerings.supports_vm_autoscaling = 1 WHERE ntwk_offering_service_map.service = 'Lb' AND ntwk_offering_service_map.provider IN ('VirtualRouter', 'VpcVirtualRouter', 'Netscaler') AND network_offerings.removed IS NULL - AND (SELECT COUNT(id) AS count FROM `network_offering_view` WHERE supports_vm_autoscaling = 1) = 0; + AND cnt.count = 0; -- UserData as first class resource (PR #6202) CREATE TABLE IF NOT EXISTS `cloud`.`user_data` ( @@ -646,315 +274,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_vm', 'user_data_details', 'medi CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_template', 'user_data_id', 'bigint unsigned DEFAULT NULL COMMENT "id of the user data"'); CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_template', 'user_data_link_policy', 'varchar(255) DEFAULT NULL COMMENT "user data link policy with template"'); --- Added userdata details to template -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE VIEW `cloud`.`template_view` AS - SELECT - `vm_template`.`id` AS `id`, - `vm_template`.`uuid` AS `uuid`, - `vm_template`.`unique_name` AS `unique_name`, - `vm_template`.`name` AS `name`, - `vm_template`.`public` AS `public`, - `vm_template`.`featured` AS `featured`, - `vm_template`.`type` AS `type`, - `vm_template`.`hvm` AS `hvm`, - `vm_template`.`bits` AS `bits`, - `vm_template`.`url` AS `url`, - `vm_template`.`format` AS `format`, - `vm_template`.`created` AS `created`, - `vm_template`.`checksum` AS `checksum`, - `vm_template`.`display_text` AS `display_text`, - `vm_template`.`enable_password` AS `enable_password`, - `vm_template`.`dynamically_scalable` AS `dynamically_scalable`, - `vm_template`.`state` AS `template_state`, - `vm_template`.`guest_os_id` AS `guest_os_id`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `guest_os`.`display_name` AS `guest_os_name`, - `vm_template`.`bootable` AS `bootable`, - `vm_template`.`prepopulate` AS `prepopulate`, - `vm_template`.`cross_zones` AS `cross_zones`, - `vm_template`.`hypervisor_type` AS `hypervisor_type`, - `vm_template`.`extractable` AS `extractable`, - `vm_template`.`template_tag` AS `template_tag`, - `vm_template`.`sort_key` AS `sort_key`, - `vm_template`.`removed` AS `removed`, - `vm_template`.`enable_sshkey` AS `enable_sshkey`, - `parent_template`.`id` AS `parent_template_id`, - `parent_template`.`uuid` AS `parent_template_uuid`, - `source_template`.`id` AS `source_template_id`, - `source_template`.`uuid` AS `source_template_uuid`, - `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`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `launch_permission`.`account_id` AS `lp_account_id`, - `template_store_ref`.`store_id` AS `store_id`, - `image_store`.`scope` AS `store_scope`, - `template_store_ref`.`state` AS `state`, - `template_store_ref`.`download_state` AS `download_state`, - `template_store_ref`.`download_pct` AS `download_pct`, - `template_store_ref`.`error_str` AS `error_str`, - `template_store_ref`.`size` AS `size`, - `template_store_ref`.physical_size AS `physical_size`, - `template_store_ref`.`destroyed` AS `destroyed`, - `template_store_ref`.`created` AS `created_on_store`, - `vm_template_details`.`name` AS `detail_name`, - `vm_template_details`.`value` AS `detail_value`, - `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(`vm_template`.`id`, - '_', - IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`, - `vm_template`.`direct_download` AS `direct_download`, - `vm_template`.`deploy_as_is` AS `deploy_as_is`, - `user_data`.`id` AS `user_data_id`, - `user_data`.`uuid` AS `user_data_uuid`, - `user_data`.`name` AS `user_data_name`, - `user_data`.`params` AS `user_data_params`, - `vm_template`.`user_data_link_policy` AS `user_data_policy` - FROM - (((((((((((((`vm_template` - JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`))) - JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`))) - JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `vm_template_details` ON ((`vm_template_details`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id` = `vm_template`.`source_template_id`))) - LEFT JOIN `template_store_ref` ON (((`template_store_ref`.`template_id` = `vm_template`.`id`) - AND (`template_store_ref`.`store_role` = 'Image') - AND (`template_store_ref`.`destroyed` = 0)))) - LEFT JOIN `vm_template` `parent_template` ON ((`parent_template`.`id` = `vm_template`.`parent_template_id`))) - LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`) - AND (`template_store_ref`.`store_id` IS NOT NULL) - AND (`image_store`.`id` = `template_store_ref`.`store_id`)))) - LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id` = `vm_template`.`id`) - AND ISNULL(`template_store_ref`.`store_id`) - AND ISNULL(`template_zone_ref`.`removed`)))) - LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`) - OR (`template_zone_ref`.`zone_id` = `data_center`.`id`)))) - LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `user_data` ON ((`user_data`.`id` = `vm_template`.`user_data_id`)) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`) - AND ((`resource_tags`.`resource_type` = 'Template') - OR (`resource_tags`.`resource_type` = 'ISO'))))); - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE - VIEW `user_vm_view` AS -SELECT - `vm_instance`.`id` AS `id`, - `vm_instance`.`name` AS `name`, - `user_vm`.`display_name` AS `display_name`, - `user_vm`.`user_data` AS `user_data`, - `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`, - `instance_group`.`id` AS `instance_group_id`, - `instance_group`.`uuid` AS `instance_group_uuid`, - `instance_group`.`name` AS `instance_group_name`, - `vm_instance`.`uuid` AS `uuid`, - `vm_instance`.`user_id` AS `user_id`, - `vm_instance`.`last_host_id` AS `last_host_id`, - `vm_instance`.`vm_type` AS `type`, - `vm_instance`.`limit_cpu_use` AS `limit_cpu_use`, - `vm_instance`.`created` AS `created`, - `vm_instance`.`state` AS `state`, - `vm_instance`.`update_time` AS `update_time`, - `vm_instance`.`removed` AS `removed`, - `vm_instance`.`ha_enabled` AS `ha_enabled`, - `vm_instance`.`hypervisor_type` AS `hypervisor_type`, - `vm_instance`.`instance_name` AS `instance_name`, - `vm_instance`.`guest_os_id` AS `guest_os_id`, - `vm_instance`.`display_vm` AS `display_vm`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `vm_instance`.`pod_id` AS `pod_id`, - `host_pod_ref`.`uuid` AS `pod_uuid`, - `vm_instance`.`private_ip_address` AS `private_ip_address`, - `vm_instance`.`private_mac_address` AS `private_mac_address`, - `vm_instance`.`vm_type` AS `vm_type`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`is_security_group_enabled` AS `security_group_enabled`, - `data_center`.`networktype` AS `data_center_network_type`, - `host`.`id` AS `host_id`, - `host`.`uuid` AS `host_uuid`, - `host`.`name` AS `host_name`, - `host`.`cluster_id` AS `cluster_id`, - `host`.`status` AS `host_status`, - `host`.`resource_state` AS `host_resource_state`, - `vm_template`.`id` AS `template_id`, - `vm_template`.`uuid` AS `template_uuid`, - `vm_template`.`name` AS `template_name`, - `vm_template`.`display_text` AS `template_display_text`, - `vm_template`.`enable_password` AS `password_enabled`, - `iso`.`id` AS `iso_id`, - `iso`.`uuid` AS `iso_uuid`, - `iso`.`name` AS `iso_name`, - `iso`.`display_text` AS `iso_display_text`, - `service_offering`.`id` AS `service_offering_id`, - `service_offering`.`uuid` AS `service_offering_uuid`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`id` AS `disk_offering_id`, - (CASE - WHEN ISNULL(`service_offering`.`cpu`) THEN `custom_cpu`.`value` - ELSE `service_offering`.`cpu` - END) AS `cpu`, - (CASE - WHEN ISNULL(`service_offering`.`speed`) THEN `custom_speed`.`value` - ELSE `service_offering`.`speed` - END) AS `speed`, - (CASE - WHEN ISNULL(`service_offering`.`ram_size`) THEN `custom_ram_size`.`value` - ELSE `service_offering`.`ram_size` - END) AS `ram_size`, - `backup_offering`.`uuid` AS `backup_offering_uuid`, - `backup_offering`.`id` AS `backup_offering_id`, - `service_offering`.`name` AS `service_offering_name`, - `disk_offering`.`name` AS `disk_offering_name`, - `backup_offering`.`name` AS `backup_offering_name`, - `storage_pool`.`id` AS `pool_id`, - `storage_pool`.`uuid` AS `pool_uuid`, - `storage_pool`.`pool_type` AS `pool_type`, - `volumes`.`id` AS `volume_id`, - `volumes`.`uuid` AS `volume_uuid`, - `volumes`.`device_id` AS `volume_device_id`, - `volumes`.`volume_type` AS `volume_type`, - `security_group`.`id` AS `security_group_id`, - `security_group`.`uuid` AS `security_group_uuid`, - `security_group`.`name` AS `security_group_name`, - `security_group`.`description` AS `security_group_description`, - `nics`.`id` AS `nic_id`, - `nics`.`uuid` AS `nic_uuid`, - `nics`.`device_id` AS `nic_device_id`, - `nics`.`network_id` AS `network_id`, - `nics`.`ip4_address` AS `ip_address`, - `nics`.`ip6_address` AS `ip6_address`, - `nics`.`ip6_gateway` AS `ip6_gateway`, - `nics`.`ip6_cidr` AS `ip6_cidr`, - `nics`.`default_nic` AS `is_default_nic`, - `nics`.`gateway` AS `gateway`, - `nics`.`netmask` AS `netmask`, - `nics`.`mac_address` AS `mac_address`, - `nics`.`broadcast_uri` AS `broadcast_uri`, - `nics`.`isolation_uri` AS `isolation_uri`, - `vpc`.`id` AS `vpc_id`, - `vpc`.`uuid` AS `vpc_uuid`, - `networks`.`uuid` AS `network_uuid`, - `networks`.`name` AS `network_name`, - `networks`.`traffic_type` AS `traffic_type`, - `networks`.`guest_type` AS `guest_type`, - `user_ip_address`.`id` AS `public_ip_id`, - `user_ip_address`.`uuid` AS `public_ip_uuid`, - `user_ip_address`.`public_ip_address` AS `public_ip_address`, - `ssh_details`.`value` AS `keypair_names`, - `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`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id`, - `affinity_group`.`id` AS `affinity_group_id`, - `affinity_group`.`uuid` AS `affinity_group_uuid`, - `affinity_group`.`name` AS `affinity_group_name`, - `affinity_group`.`description` AS `affinity_group_description`, - `autoscale_vmgroups`.`id` AS `autoscale_vmgroup_id`, - `autoscale_vmgroups`.`uuid` AS `autoscale_vmgroup_uuid`, - `autoscale_vmgroups`.`name` AS `autoscale_vmgroup_name`, - `vm_instance`.`dynamically_scalable` AS `dynamically_scalable`, - `user_data`.`id` AS `user_data_id`, - `user_data`.`uuid` AS `user_data_uuid`, - `user_data`.`name` AS `user_data_name`, - `user_vm`.`user_data_details` AS `user_data_details`, - `vm_template`.`user_data_link_policy` AS `user_data_policy` -FROM - (((((((((((((((((((((((((((((((((((`user_vm` - JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) - AND ISNULL(`vm_instance`.`removed`)))) - JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) - JOIN `domain` ON ((`vm_instance`.`domain_id` = `domain`.`id`))) - LEFT JOIN `guest_os` ON ((`vm_instance`.`guest_os_id` = `guest_os`.`id`))) - LEFT JOIN `host_pod_ref` ON ((`vm_instance`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `instance_group_vm_map` ON ((`vm_instance`.`id` = `instance_group_vm_map`.`instance_id`))) - LEFT JOIN `instance_group` ON ((`instance_group_vm_map`.`group_id` = `instance_group`.`id`))) - LEFT JOIN `data_center` ON ((`vm_instance`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `host` ON ((`vm_instance`.`host_id` = `host`.`id`))) - LEFT JOIN `vm_template` ON ((`vm_instance`.`vm_template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `iso` ON ((`iso`.`id` = `user_vm`.`iso_id`))) - LEFT JOIN `volumes` ON ((`vm_instance`.`id` = `volumes`.`instance_id`))) - LEFT JOIN `service_offering` ON ((`vm_instance`.`service_offering_id` = `service_offering`.`id`))) - LEFT JOIN `disk_offering` `svc_disk_offering` ON ((`volumes`.`disk_offering_id` = `svc_disk_offering`.`id`))) - LEFT JOIN `disk_offering` ON ((`volumes`.`disk_offering_id` = `disk_offering`.`id`))) - LEFT JOIN `backup_offering` ON ((`vm_instance`.`backup_offering_id` = `backup_offering`.`id`))) - LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) - LEFT JOIN `security_group_vm_map` ON ((`vm_instance`.`id` = `security_group_vm_map`.`instance_id`))) - LEFT JOIN `security_group` ON ((`security_group_vm_map`.`security_group_id` = `security_group`.`id`))) - LEFT JOIN `user_data` ON ((`user_data`.`id` = `user_vm`.`user_data_id`))) - LEFT JOIN `nics` ON (((`vm_instance`.`id` = `nics`.`instance_id`) - AND ISNULL(`nics`.`removed`)))) - LEFT JOIN `networks` ON ((`nics`.`network_id` = `networks`.`id`))) - LEFT JOIN `vpc` ON (((`networks`.`vpc_id` = `vpc`.`id`) - AND ISNULL(`vpc`.`removed`)))) - LEFT JOIN `user_ip_address` ON ((`user_ip_address`.`vm_id` = `vm_instance`.`id`))) - LEFT JOIN `user_vm_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) - AND (`ssh_details`.`name` = 'SSH.KeyPairNames')))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_instance`.`id`) - AND (`resource_tags`.`resource_type` = 'UserVm')))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `vm_instance`.`id`) - AND (`async_job`.`instance_type` = 'VirtualMachine') - AND (`async_job`.`job_status` = 0)))) - LEFT JOIN `affinity_group_vm_map` ON ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) - LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) - LEFT JOIN `autoscale_vmgroup_vm_map` ON ((`autoscale_vmgroup_vm_map`.`instance_id` = `vm_instance`.`id`))) - LEFT JOIN `autoscale_vmgroups` ON ((`autoscale_vmgroup_vm_map`.`vmgroup_id` = `autoscale_vmgroups`.`id`))) - LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) - AND (`custom_cpu`.`name` = 'CpuNumber')))) - LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) - AND (`custom_speed`.`name` = 'CpuSpeed')))) - LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) - AND (`custom_ram_size`.`name` = 'memory')))); - -- Improve alert.email.addresses description #6806. UPDATE cloud.configuration SET description = 'Comma separated list of email addresses which are going to receive alert emails.' @@ -1062,74 +381,6 @@ DELETE FROM `cloud`.`configuration` WHERE name='task.cleanup.retry.interval'; -- Tungsten Fabric Plugin -- CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings','for_tungsten', 'int(1) unsigned DEFAULT "0" COMMENT "is tungsten enabled for the resource"'); --- Network offering with multi-domains and multi-zones -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`.`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`; - - CREATE TABLE IF NOT EXISTS `cloud`.`tungsten_providers` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', `zone_id` bigint unsigned NOT NULL COMMENT 'Zone ID', @@ -1511,57 +762,6 @@ ALTER TABLE `cloud`.`user` ADD COLUMN `is_user_2fa_enabled` tinyint NOT NULL DEF ALTER TABLE `cloud`.`user` ADD COLUMN `key_for_2fa` varchar(255) default NULL; ALTER TABLE `cloud`.`user` ADD COLUMN `user_2fa_provider` varchar(255) default NULL; -DROP VIEW IF EXISTS `cloud`.`user_view`; -CREATE 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.source, - user.default, - account.id account_id, - account.uuid account_uuid, - account.account_name account_name, - account.type account_type, - account.role_id account_role_id, - 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, - user.is_user_2fa_enabled is_user_2fa_enabled - 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; - --- Remove snapshot references if primary storage pool has been removed, see github issue #7093 -DELETE FROM `cloud`.`snapshot_store_ref` -WHERE store_role = "Primary" AND store_id IN (SELECT id FROM storage_pool WHERE removed IS NOT NULL); - - -- Change usage of VM_DISK_IO_WRITE to use right usage_type UPDATE `cloud_usage`.`cloud_usage` diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql b/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql index 23670757247..2cbc6864272 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql @@ -150,74 +150,6 @@ CREATE TABLE IF NOT EXISTS `cloud`.`storage_pool_tags` ( INSERT INTO `cloud`.`storage_pool_tags` (pool_id, tag) SELECT pool_id, name FROM `cloud`.`storage_pool_details` WHERE value = 'true'; --- Alter view storage_pool_view -CREATE OR REPLACE -VIEW `storage_pool_view` AS - SELECT - `storage_pool`.`id` AS `id`, - `storage_pool`.`uuid` AS `uuid`, - `storage_pool`.`name` AS `name`, - `storage_pool`.`status` AS `status`, - `storage_pool`.`path` AS `path`, - `storage_pool`.`pool_type` AS `pool_type`, - `storage_pool`.`host_address` AS `host_address`, - `storage_pool`.`created` AS `created`, - `storage_pool`.`removed` AS `removed`, - `storage_pool`.`capacity_bytes` AS `capacity_bytes`, - `storage_pool`.`capacity_iops` AS `capacity_iops`, - `storage_pool`.`scope` AS `scope`, - `storage_pool`.`hypervisor` AS `hypervisor`, - `storage_pool`.`storage_provider_name` AS `storage_provider_name`, - `cluster`.`id` AS `cluster_id`, - `cluster`.`uuid` AS `cluster_uuid`, - `cluster`.`name` AS `cluster_name`, - `cluster`.`cluster_type` AS `cluster_type`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`networktype` AS `data_center_type`, - `host_pod_ref`.`id` AS `pod_id`, - `host_pod_ref`.`uuid` AS `pod_uuid`, - `host_pod_ref`.`name` AS `pod_name`, - `storage_pool_tags`.`tag` AS `tag`, - `op_host_capacity`.`used_capacity` AS `disk_used_capacity`, - `op_host_capacity`.`reserved_capacity` AS `disk_reserved_capacity`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id` - FROM - ((((((`storage_pool` - LEFT JOIN `cluster` ON ((`storage_pool`.`cluster_id` = `cluster`.`id`))) - LEFT JOIN `data_center` ON ((`storage_pool`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `host_pod_ref` ON ((`storage_pool`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `storage_pool_tags` ON (((`storage_pool_tags`.`pool_id` = `storage_pool`.`id`)))) - LEFT JOIN `op_host_capacity` ON (((`storage_pool`.`id` = `op_host_capacity`.`host_id`) - AND (`op_host_capacity`.`capacity_type` IN (3 , 9))))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `storage_pool`.`id`) - AND (`async_job`.`instance_type` = 'StoragePool') - AND (`async_job`.`job_status` = 0)))); - --- Alter view image_store_view -CREATE OR REPLACE -VIEW `image_store_view` AS - SELECT - `image_store`.`id` AS `id`, - `image_store`.`uuid` AS `uuid`, - `image_store`.`name` AS `name`, - `image_store`.`image_provider_name` AS `image_provider_name`, - `image_store`.`protocol` AS `protocol`, - `image_store`.`url` AS `url`, - `image_store`.`scope` AS `scope`, - `image_store`.`role` AS `role`, - `image_store`.`removed` AS `removed`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name` - FROM - (`image_store` - LEFT JOIN `data_center` ON ((`image_store`.`data_center_id` = `data_center`.`id`))); - -- Add service_offering_id column to vm_snapshots table ALTER TABLE `cloud`.`vm_snapshots` ADD COLUMN `service_offering_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '' AFTER `domain_id`; UPDATE `cloud`.`vm_snapshots` s JOIN `cloud`.`vm_instance` v ON v.id = s.vm_id SET s.service_offering_id = v.service_offering_id; @@ -232,9 +164,6 @@ JOIN `cloud`.`vm_snapshots` s ON (s.service_offering_id = o.id AND s.vm_id = v.i WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size IS NULL) AND (d.name = 'cpuNumber' OR d.name = 'cpuSpeed' OR d.name = 'memory'); --- CLOUDSTACK-9827: Storage tags stored in multiple places -DROP VIEW IF EXISTS `cloud`.`storage_tag_view`; - CREATE TABLE IF NOT EXISTS `cloud`.`guest_os_details` ( `id` bigint unsigned NOT NULL auto_increment, `guest_os_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql index 7bd4b3cc4a9..576cb419415 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.host_view.sql @@ -72,8 +72,8 @@ SELECT ha_config.enabled AS `ha_enabled`, ha_config.ha_state AS `ha_state`, ha_config.provider AS `ha_provider`, - `last_annotation_view`.`annotation` AS `annotation`, - `last_annotation_view`.`created` AS `last_annotated`, + last_annotated.annotation AS `annotation`, + last_annotated.created AS `last_annotated`, `user`.`username` AS `username` FROM `cloud`.`host` @@ -110,8 +110,9 @@ FROM `cloud`.`ha_config` ON ha_config.resource_id=host.id and ha_config.resource_type='Host' LEFT JOIN - `cloud`.`last_annotation_view` ON `last_annotation_view`.`entity_uuid` = `host`.`uuid` + (SELECT `annotations`.`entity_uuid`, `annotations`.`user_uuid`, MAX(`annotations`.`created`) AS created, `annotations`.`annotation` + FROM `cloud`.`annotations` WHERE `annotations`.`removed` IS NULL GROUP BY `annotations`.`entity_uuid`) AS last_annotated ON last_annotated.entity_uuid = host.uuid LEFT JOIN - `cloud`.`user` ON `user`.`uuid` = `last_annotation_view`.`user_uuid` + `cloud`.`user` ON `user`.`uuid` = last_annotated.user_uuid GROUP BY `host`.`id`; From 69942d473d75864b8d54801e8aa8db52bf88a915 Mon Sep 17 00:00:00 2001 From: "klaus.freitas.scclouds" Date: Wed, 17 Jul 2024 09:57:52 -0300 Subject: [PATCH 2/2] keeping storage_tag_view view drop --- .../src/main/resources/META-INF/db/schema-4930to41000.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql b/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql index 2cbc6864272..d01ebf4c7e4 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql @@ -164,6 +164,9 @@ JOIN `cloud`.`vm_snapshots` s ON (s.service_offering_id = o.id AND s.vm_id = v.i WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size IS NULL) AND (d.name = 'cpuNumber' OR d.name = 'cpuSpeed' OR d.name = 'memory'); +-- CLOUDSTACK-9827: Storage tags stored in multiple places +DROP VIEW IF EXISTS `cloud`.`storage_tag_view`; + CREATE TABLE IF NOT EXISTS `cloud`.`guest_os_details` ( `id` bigint unsigned NOT NULL auto_increment, `guest_os_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',