@@ -543,6 +543,198 @@ CREATE VIEW `cloud`.`domain_router_view` AS
543543 and async_job .instance_type = ' DomainRouter'
544544 and async_job .job_status = 0 ;
545545
546+ DROP VIEW IF EXISTS ` cloud` .` user_vm_view` ;
547+ CREATE VIEW `cloud `.` user_vm_view` AS
548+ select
549+ vm_instance .id id,
550+ vm_instance .name name,
551+ user_vm .display_name display_name,
552+ user_vm .user_data user_data,
553+ account .id account_id,
554+ account .uuid account_uuid,
555+ account .account_name account_name,
556+ account .type account_type,
557+ domain .id domain_id,
558+ domain .uuid domain_uuid,
559+ domain .name domain_name,
560+ domain .path domain_path,
561+ projects .id project_id,
562+ projects .uuid project_uuid,
563+ projects .name project_name,
564+ instance_group .id instance_group_id,
565+ instance_group .uuid instance_group_uuid,
566+ instance_group .name instance_group_name,
567+ vm_instance .uuid uuid,
568+ vm_instance .last_host_id last_host_id,
569+ vm_instance .vm_type type,
570+ vm_instance .vnc_password vnc_password,
571+ vm_instance .limit_cpu_use limit_cpu_use,
572+ vm_instance .created created,
573+ vm_instance .state state,
574+ vm_instance .removed removed,
575+ vm_instance .ha_enabled ha_enabled,
576+ vm_instance .hypervisor_type hypervisor_type,
577+ vm_instance .instance_name instance_name,
578+ vm_instance .guest_os_id guest_os_id,
579+ vm_instance .display_vm display_vm,
580+ guest_os .uuid guest_os_uuid,
581+ vm_instance .pod_id pod_id,
582+ host_pod_ref .uuid pod_uuid,
583+ vm_instance .private_ip_address private_ip_address,
584+ vm_instance .private_mac_address private_mac_address,
585+ vm_instance .vm_type vm_type,
586+ data_center .id data_center_id,
587+ data_center .uuid data_center_uuid,
588+ data_center .name data_center_name,
589+ data_center .is_security_group_enabled security_group_enabled,
590+ data_center .networktype data_center_type,
591+ host .id host_id,
592+ host .uuid host_uuid,
593+ host .name host_name,
594+ vm_template .id template_id,
595+ vm_template .uuid template_uuid,
596+ vm_template .name template_name,
597+ vm_template .display_text template_display_text,
598+ vm_template .enable_password password_enabled,
599+ iso .id iso_id,
600+ iso .uuid iso_uuid,
601+ iso .name iso_name,
602+ iso .display_text iso_display_text,
603+ service_offering .id service_offering_id,
604+ svc_disk_offering .uuid service_offering_uuid,
605+ disk_offering .uuid disk_offering_uuid,
606+ disk_offering .id disk_offering_id,
607+ Case
608+ When (` cloud` .` service_offering` .` cpu` is null ) then (` custom_cpu` .` value` )
609+ Else ( ` cloud` .` service_offering` .` cpu` )
610+ End as ` cpu` ,
611+ Case
612+ When (` cloud` .` service_offering` .` speed` is null ) then (` custom_speed` .` value` )
613+ Else ( ` cloud` .` service_offering` .` speed` )
614+ End as ` speed` ,
615+ Case
616+ When (` cloud` .` service_offering` .` ram_size` is null ) then (` custom_ram_size` .` value` )
617+ Else ( ` cloud` .` service_offering` .` ram_size` )
618+ END as ` ram_size` ,
619+ svc_disk_offering .name service_offering_name,
620+ disk_offering .name disk_offering_name,
621+ storage_pool .id pool_id,
622+ storage_pool .uuid pool_uuid,
623+ storage_pool .pool_type pool_type,
624+ volumes .id volume_id,
625+ volumes .uuid volume_uuid,
626+ volumes .device_id volume_device_id,
627+ volumes .volume_type volume_type,
628+ security_group .id security_group_id,
629+ security_group .uuid security_group_uuid,
630+ security_group .name security_group_name,
631+ security_group .description security_group_description,
632+ nics .id nic_id,
633+ nics .uuid nic_uuid,
634+ nics .network_id network_id,
635+ nics .ip4_address ip_address,
636+ nics .ip6_address ip6_address,
637+ nics .ip6_gateway ip6_gateway,
638+ nics .ip6_cidr ip6_cidr,
639+ nics .default_nic is_default_nic,
640+ nics .gateway gateway,
641+ nics .netmask netmask,
642+ nics .mac_address mac_address,
643+ nics .broadcast_uri broadcast_uri,
644+ nics .isolation_uri isolation_uri,
645+ vpc .id vpc_id,
646+ vpc .uuid vpc_uuid,
647+ networks .uuid network_uuid,
648+ networks .name network_name,
649+ networks .traffic_type traffic_type,
650+ networks .guest_type guest_type,
651+ user_ip_address .id public_ip_id,
652+ user_ip_address .uuid public_ip_uuid,
653+ user_ip_address .public_ip_address public_ip_address,
654+ ssh_keypairs .keypair_name keypair_name,
655+ resource_tags .id tag_id,
656+ async_job .id job_id,
657+ async_job .uuid job_uuid,
658+ async_job .job_status job_status,
659+ async_job .account_id job_account_id,
660+ affinity_group .id affinity_group_id,
661+ affinity_group .uuid affinity_group_uuid,
662+ affinity_group .name affinity_group_name,
663+ affinity_group .description affinity_group_description,
664+ vm_instance .dynamically_scalable dynamically_scalable
665+
666+ from
667+ ` cloud` .` user_vm`
668+ inner join
669+ ` cloud` .` vm_instance` ON vm_instance .id = user_vm .id
670+ and vm_instance .removed is NULL
671+ inner join
672+ ` cloud` .` account` ON vm_instance .account_id = account .id
673+ inner join
674+ ` cloud` .` domain` ON vm_instance .domain_id = domain .id
675+ left join
676+ ` cloud` .` guest_os` ON vm_instance .guest_os_id = guest_os .id
677+ left join
678+ ` cloud` .` host_pod_ref` ON vm_instance .pod_id = host_pod_ref .id
679+ left join
680+ ` cloud` .` projects` ON projects .project_account_id = account .id
681+ left join
682+ ` cloud` .` instance_group_vm_map` ON vm_instance .id = instance_group_vm_map .instance_id
683+ left join
684+ ` cloud` .` instance_group` ON instance_group_vm_map .group_id = instance_group .id
685+ left join
686+ ` cloud` .` data_center` ON vm_instance .data_center_id = data_center .id
687+ left join
688+ ` cloud` .` host` ON vm_instance .host_id = host .id
689+ left join
690+ ` cloud` .` vm_template` ON vm_instance .vm_template_id = vm_template .id
691+ left join
692+ ` cloud` .` vm_template` iso ON iso .id = user_vm .iso_id
693+ left join
694+ ` cloud` .` service_offering` ON vm_instance .service_offering_id = service_offering .id
695+ left join
696+ ` cloud` .` disk_offering` svc_disk_offering ON vm_instance .service_offering_id = svc_disk_offering .id
697+ left join
698+ ` cloud` .` disk_offering` ON vm_instance .disk_offering_id = disk_offering .id
699+ left join
700+ ` cloud` .` volumes` ON vm_instance .id = volumes .instance_id
701+ left join
702+ ` cloud` .` storage_pool` ON volumes .pool_id = storage_pool .id
703+ left join
704+ ` cloud` .` security_group_vm_map` ON vm_instance .id = security_group_vm_map .instance_id
705+ left join
706+ ` cloud` .` security_group` ON security_group_vm_map .security_group_id = security_group .id
707+ left join
708+ ` cloud` .` nics` ON vm_instance .id = nics .instance_id and nics .removed is null
709+ left join
710+ ` cloud` .` networks` ON nics .network_id = networks .id
711+ left join
712+ ` cloud` .` vpc` ON networks .vpc_id = vpc .id and vpc .removed is null
713+ left join
714+ ` cloud` .` user_ip_address` ON user_ip_address .vm_id = vm_instance .id
715+ left join
716+ ` cloud` .` user_vm_details` as ssh_details ON ssh_details .vm_id = vm_instance .id
717+ and ssh_details .name = ' SSH.PublicKey'
718+ left join
719+ ` cloud` .` ssh_keypairs` ON ssh_keypairs .public_key = ssh_details .value
720+ left join
721+ ` cloud` .` resource_tags` ON resource_tags .resource_id = vm_instance .id
722+ and resource_tags .resource_type = ' UserVm'
723+ left join
724+ ` cloud` .` async_job` ON async_job .instance_id = vm_instance .id
725+ and async_job .instance_type = ' VirtualMachine'
726+ and async_job .job_status = 0
727+ left join
728+ ` cloud` .` affinity_group_vm_map` ON vm_instance .id = affinity_group_vm_map .instance_id
729+ left join
730+ ` cloud` .` affinity_group` ON affinity_group_vm_map .affinity_group_id = affinity_group .id
731+ left join
732+ ` cloud` .` user_vm_details` ` custom_cpu` ON (((` custom_cpu` .` vm_id` = ` cloud` .` vm_instance` .` id` ) and (` custom_cpu` .` name` = ' CpuNumber' )))
733+ left join
734+ ` cloud` .` user_vm_details` ` custom_speed` ON (((` custom_speed` .` vm_id` = ` cloud` .` vm_instance` .` id` ) and (` custom_speed` .` name` = ' CpuSpeed' )))
735+ left join
736+ ` cloud` .` user_vm_details` ` custom_ram_size` ON (((` custom_ram_size` .` vm_id` = ` cloud` .` vm_instance` .` id` ) and (` custom_ram_size` .` name` = ' memory' )));
737+
546738
547739INSERT IGNORE INTO ` cloud` .` guest_os` (id, uuid, category_id, display_name, created) VALUES (231 , UUID(), 1 , ' CentOS 5 (32-bit)' , utc_timestamp());
548740INSERT IGNORE INTO ` cloud` .` guest_os` (id, uuid, category_id, display_name, created) VALUES (232 , UUID(), 1 , ' CentOS 5 (64-bit)' , utc_timestamp());
0 commit comments