Skip to content

Commit 3aad2ba

Browse files
committed
Add DB host view into fresh install schema and upgrade schema.
1 parent e7fa1a8 commit 3aad2ba

2 files changed

Lines changed: 112 additions & 0 deletions

File tree

‎setup/db/create-schema.sql‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,3 +2971,60 @@ from project_invitations
29712971
left join account on project_invitations.account_id = account.id
29722972
left join domain on project_invitations.domain_id=domain.id
29732973
left join projects on projects.id = project_invitations.project_id;
2974+
2975+
DROP VIEW IF EXISTS `cloud`.`host_view`;
2976+
CREATE VIEW host_view AS
2977+
select
2978+
host.id,
2979+
host.uuid,
2980+
host.name,
2981+
host.status,
2982+
host.disconnected,
2983+
host.type,
2984+
host.private_ip_address,
2985+
host.version,
2986+
host.hypervisor_type,
2987+
host.hypervisor_version,
2988+
host.capabilities,
2989+
host.last_ping,
2990+
host.created,
2991+
host.removed,
2992+
host.resource_state,
2993+
host.mgmt_server_id,
2994+
host.cpus,
2995+
host.speed,
2996+
host.ram,
2997+
cluster.id cluster_id,
2998+
cluster.uuid cluster_uuid,
2999+
cluster.name cluster_name,
3000+
cluster.cluster_type,
3001+
data_center.id data_center_id,
3002+
data_center.uuid data_center_uuid,
3003+
data_center.name data_center_name,
3004+
host_pod_ref.id pod_id,
3005+
host_pod_ref.uuid pod_uuid,
3006+
host_pod_ref.name pod_name,
3007+
host_tags.tag,
3008+
guest_os_category.id guest_os_category_id,
3009+
guest_os_category.uuid guest_os_category_uuid,
3010+
guest_os_category.name guest_os_category_name,
3011+
mem_caps.used_capacity memory_used_capacity,
3012+
mem_caps.reserved_capacity memory_reserved_capacity,
3013+
cpu_caps.used_capacity cpu_used_capacity,
3014+
cpu_caps.reserved_capacity cpu_reserved_capacity,
3015+
async_job.id job_id,
3016+
async_job.uuid job_uuid,
3017+
async_job.job_status job_status,
3018+
async_job.account_id job_account_id
3019+
from host
3020+
left join cluster on host.cluster_id = cluster.id
3021+
left join data_center on host.data_center_id = data_center.id
3022+
left join host_pod_ref on host.pod_id = host_pod_ref.id
3023+
left join host_details on host.id = host_details.id and host_details.name = "guest.os.category.id"
3024+
left join guest_os_category on guest_os_category.id = CONVERT( host_details.value, UNSIGNED )
3025+
left join host_tags on host_tags.host_id = host.id
3026+
left join op_host_capacity mem_caps on host.id = mem_caps.host_id and mem_caps.capacity_type = 0
3027+
left join op_host_capacity cpu_caps on host.id = cpu_caps.host_id and cpu_caps.capacity_type = 1
3028+
left join async_job on async_job.instance_id = host.id and async_job.instance_type = "Host" and async_job.job_status = 0;
3029+
3030+

‎setup/db/db/schema-40to410.sql‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,3 +583,58 @@ left join account on project_invitations.account_id = account.id
583583
left join domain on project_invitations.domain_id=domain.id
584584
left join projects on projects.id = project_invitations.project_id;
585585

586+
DROP VIEW IF EXISTS `cloud`.`host_view`;
587+
CREATE VIEW host_view AS
588+
select
589+
host.id,
590+
host.uuid,
591+
host.name,
592+
host.status,
593+
host.disconnected,
594+
host.type,
595+
host.private_ip_address,
596+
host.version,
597+
host.hypervisor_type,
598+
host.hypervisor_version,
599+
host.capabilities,
600+
host.last_ping,
601+
host.created,
602+
host.removed,
603+
host.resource_state,
604+
host.mgmt_server_id,
605+
host.cpus,
606+
host.speed,
607+
host.ram,
608+
cluster.id cluster_id,
609+
cluster.uuid cluster_uuid,
610+
cluster.name cluster_name,
611+
cluster.cluster_type,
612+
data_center.id data_center_id,
613+
data_center.uuid data_center_uuid,
614+
data_center.name data_center_name,
615+
host_pod_ref.id pod_id,
616+
host_pod_ref.uuid pod_uuid,
617+
host_pod_ref.name pod_name,
618+
host_tags.tag,
619+
guest_os_category.id guest_os_category_id,
620+
guest_os_category.uuid guest_os_category_uuid,
621+
guest_os_category.name guest_os_category_name,
622+
mem_caps.used_capacity memory_used_capacity,
623+
mem_caps.reserved_capacity memory_reserved_capacity,
624+
cpu_caps.used_capacity cpu_used_capacity,
625+
cpu_caps.reserved_capacity cpu_reserved_capacity,
626+
async_job.id job_id,
627+
async_job.uuid job_uuid,
628+
async_job.job_status job_status,
629+
async_job.account_id job_account_id
630+
from host
631+
left join cluster on host.cluster_id = cluster.id
632+
left join data_center on host.data_center_id = data_center.id
633+
left join host_pod_ref on host.pod_id = host_pod_ref.id
634+
left join host_details on host.id = host_details.id and host_details.name = "guest.os.category.id"
635+
left join guest_os_category on guest_os_category.id = CONVERT( host_details.value, UNSIGNED )
636+
left join host_tags on host_tags.host_id = host.id
637+
left join op_host_capacity mem_caps on host.id = mem_caps.host_id and mem_caps.capacity_type = 0
638+
left join op_host_capacity cpu_caps on host.id = cpu_caps.host_id and cpu_caps.capacity_type = 1
639+
left join async_job on async_job.instance_id = host.id and async_job.instance_type = "Host" and async_job.job_status = 0;
640+

0 commit comments

Comments
 (0)