|
15 | 15 | -- specific language governing permissions and limitations |
16 | 16 | -- under the License. |
17 | 17 |
|
18 | | --- cloud.affinity_group_view source |
| 18 | +-- VIEW `cloud`.`domain_view`; |
19 | 19 |
|
| 20 | +DROP VIEW IF EXISTS `cloud`.`domain_view`; |
20 | 21 |
|
21 | | -DROP VIEW IF EXISTS `cloud`.`affinity_group_view`; |
22 | | - |
23 | | -CREATE VIEW `cloud`.`affinity_group_view` AS |
| 22 | +CREATE VIEW `cloud`.`domain_view` AS |
24 | 23 | select |
25 | | - `affinity_group`.`id` AS `id`, |
26 | | - `affinity_group`.`name` AS `name`, |
27 | | - `affinity_group`.`type` AS `type`, |
28 | | - `affinity_group`.`description` AS `description`, |
29 | | - `affinity_group`.`uuid` AS `uuid`, |
30 | | - `affinity_group`.`acl_type` AS `acl_type`, |
31 | | - `account`.`id` AS `account_id`, |
32 | | - `account`.`uuid` AS `account_uuid`, |
33 | | - `account`.`account_name` AS `account_name`, |
34 | | - `account`.`type` AS `account_type`, |
35 | | - `domain`.`id` AS `domain_id`, |
36 | | - `domain`.`uuid` AS `domain_uuid`, |
37 | | - `domain`.`name` AS `domain_name`, |
38 | | - `domain`.`path` AS `domain_path`, |
39 | | - `projects`.`id` AS `project_id`, |
40 | | - `projects`.`uuid` AS `project_uuid`, |
41 | | - `projects`.`name` AS `project_name`, |
42 | | - `vm_instance`.`id` AS `vm_id`, |
43 | | - `vm_instance`.`uuid` AS `vm_uuid`, |
44 | | - `vm_instance`.`name` AS `vm_name`, |
45 | | - `vm_instance`.`state` AS `vm_state`, |
46 | | - `user_vm`.`display_name` AS `vm_display_name` |
| 24 | + `domain`.`id` AS `id`, |
| 25 | + `domain`.`parent` AS `parent`, |
| 26 | + `domain`.`name` AS `name`, |
| 27 | + `domain`.`uuid` AS `uuid`, |
| 28 | + `domain`.`owner` AS `owner`, |
| 29 | + `domain`.`path` AS `path`, |
| 30 | + `domain`.`level` AS `level`, |
| 31 | + `domain`.`child_count` AS `child_count`, |
| 32 | + `domain`.`next_child_seq` AS `next_child_seq`, |
| 33 | + `domain`.`created` AS `created`, |
| 34 | + `domain`.`removed` AS `removed`, |
| 35 | + `domain`.`state` AS `state`, |
| 36 | + `domain`.`network_domain` AS `network_domain`, |
| 37 | + `domain`.`type` AS `type`, |
| 38 | + `vmlimit`.`max` AS `vmLimit`, |
| 39 | + `vmcount`.`count` AS `vmTotal`, |
| 40 | + `iplimit`.`max` AS `ipLimit`, |
| 41 | + `ipcount`.`count` AS `ipTotal`, |
| 42 | + `volumelimit`.`max` AS `volumeLimit`, |
| 43 | + `volumecount`.`count` AS `volumeTotal`, |
| 44 | + `snapshotlimit`.`max` AS `snapshotLimit`, |
| 45 | + `snapshotcount`.`count` AS `snapshotTotal`, |
| 46 | + `templatelimit`.`max` AS `templateLimit`, |
| 47 | + `templatecount`.`count` AS `templateTotal`, |
| 48 | + `vpclimit`.`max` AS `vpcLimit`, |
| 49 | + `vpccount`.`count` AS `vpcTotal`, |
| 50 | + `projectlimit`.`max` AS `projectLimit`, |
| 51 | + `projectcount`.`count` AS `projectTotal`, |
| 52 | + `networklimit`.`max` AS `networkLimit`, |
| 53 | + `networkcount`.`count` AS `networkTotal`, |
| 54 | + `cpulimit`.`max` AS `cpuLimit`, |
| 55 | + `cpucount`.`count` AS `cpuTotal`, |
| 56 | + `memorylimit`.`max` AS `memoryLimit`, |
| 57 | + `memorycount`.`count` AS `memoryTotal`, |
| 58 | + `primary_storage_limit`.`max` AS `primaryStorageLimit`, |
| 59 | + `primary_storage_count`.`count` AS `primaryStorageTotal`, |
| 60 | + `secondary_storage_limit`.`max` AS `secondaryStorageLimit`, |
| 61 | + `secondary_storage_count`.`count` AS `secondaryStorageTotal` |
47 | 62 | from |
48 | | - ((((((`affinity_group` |
49 | | -join `account` on |
50 | | - ((`affinity_group`.`account_id` = `account`.`id`))) |
51 | | -join `domain` on |
52 | | - ((`affinity_group`.`domain_id` = `domain`.`id`))) |
53 | | -left join `projects` on |
54 | | - ((`projects`.`project_account_id` = `account`.`id`))) |
55 | | -left join `affinity_group_vm_map` on |
56 | | - ((`affinity_group`.`id` = `affinity_group_vm_map`.`affinity_group_id`))) |
57 | | -left join `vm_instance` on |
58 | | - ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) |
59 | | -left join `user_vm` on |
60 | | - ((`user_vm`.`id` = `vm_instance`.`id`))); |
| 63 | + `cloud`.`domain` |
| 64 | + left join |
| 65 | + `cloud`.`resource_limit` vmlimit ON domain.id = vmlimit.domain_id |
| 66 | + and vmlimit.type = 'user_vm' |
| 67 | + left join |
| 68 | + `cloud`.`resource_count` vmcount ON domain.id = vmcount.domain_id |
| 69 | + and vmcount.type = 'user_vm' |
| 70 | + left join |
| 71 | + `cloud`.`resource_limit` iplimit ON domain.id = iplimit.domain_id |
| 72 | + and iplimit.type = 'public_ip' |
| 73 | + left join |
| 74 | + `cloud`.`resource_count` ipcount ON domain.id = ipcount.domain_id |
| 75 | + and ipcount.type = 'public_ip' |
| 76 | + left join |
| 77 | + `cloud`.`resource_limit` volumelimit ON domain.id = volumelimit.domain_id |
| 78 | + and volumelimit.type = 'volume' |
| 79 | + left join |
| 80 | + `cloud`.`resource_count` volumecount ON domain.id = volumecount.domain_id |
| 81 | + and volumecount.type = 'volume' |
| 82 | + left join |
| 83 | + `cloud`.`resource_limit` snapshotlimit ON domain.id = snapshotlimit.domain_id |
| 84 | + and snapshotlimit.type = 'snapshot' |
| 85 | + left join |
| 86 | + `cloud`.`resource_count` snapshotcount ON domain.id = snapshotcount.domain_id |
| 87 | + and snapshotcount.type = 'snapshot' |
| 88 | + left join |
| 89 | + `cloud`.`resource_limit` templatelimit ON domain.id = templatelimit.domain_id |
| 90 | + and templatelimit.type = 'template' |
| 91 | + left join |
| 92 | + `cloud`.`resource_count` templatecount ON domain.id = templatecount.domain_id |
| 93 | + and templatecount.type = 'template' |
| 94 | + left join |
| 95 | + `cloud`.`resource_limit` vpclimit ON domain.id = vpclimit.domain_id |
| 96 | + and vpclimit.type = 'vpc' |
| 97 | + left join |
| 98 | + `cloud`.`resource_count` vpccount ON domain.id = vpccount.domain_id |
| 99 | + and vpccount.type = 'vpc' |
| 100 | + left join |
| 101 | + `cloud`.`resource_limit` projectlimit ON domain.id = projectlimit.domain_id |
| 102 | + and projectlimit.type = 'project' |
| 103 | + left join |
| 104 | + `cloud`.`resource_count` projectcount ON domain.id = projectcount.domain_id |
| 105 | + and projectcount.type = 'project' |
| 106 | + left join |
| 107 | + `cloud`.`resource_limit` networklimit ON domain.id = networklimit.domain_id |
| 108 | + and networklimit.type = 'network' |
| 109 | + left join |
| 110 | + `cloud`.`resource_count` networkcount ON domain.id = networkcount.domain_id |
| 111 | + and networkcount.type = 'network' |
| 112 | + left join |
| 113 | + `cloud`.`resource_limit` cpulimit ON domain.id = cpulimit.domain_id |
| 114 | + and cpulimit.type = 'cpu' |
| 115 | + left join |
| 116 | + `cloud`.`resource_count` cpucount ON domain.id = cpucount.domain_id |
| 117 | + and cpucount.type = 'cpu' |
| 118 | + left join |
| 119 | + `cloud`.`resource_limit` memorylimit ON domain.id = memorylimit.domain_id |
| 120 | + and memorylimit.type = 'memory' |
| 121 | + left join |
| 122 | + `cloud`.`resource_count` memorycount ON domain.id = memorycount.domain_id |
| 123 | + and memorycount.type = 'memory' |
| 124 | + left join |
| 125 | + `cloud`.`resource_limit` primary_storage_limit ON domain.id = primary_storage_limit.domain_id |
| 126 | + and primary_storage_limit.type = 'primary_storage' |
| 127 | + left join |
| 128 | + `cloud`.`resource_count` primary_storage_count ON domain.id = primary_storage_count.domain_id |
| 129 | + and primary_storage_count.type = 'primary_storage' |
| 130 | + left join |
| 131 | + `cloud`.`resource_limit` secondary_storage_limit ON domain.id = secondary_storage_limit.domain_id |
| 132 | + and secondary_storage_limit.type = 'secondary_storage' |
| 133 | + left join |
| 134 | + `cloud`.`resource_count` secondary_storage_count ON domain.id = secondary_storage_count.domain_id |
| 135 | + and secondary_storage_count.type = 'secondary_storage'; |
0 commit comments