@@ -890,3 +890,203 @@ ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `speed`;
890890INSERT IGNORE INTO ` cloud` .` hypervisor_capabilities` (uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported, vm_snapshot_enabled) VALUES (UUID(), ' VMware' , ' 5.5' , 128 , 0 , 13 , 32 , 1 , 1 );
891891
892892ALTER TABLE ` cloud` .` network_acl_item` modify ` cidr` varchar (2048 );
893+
894+ DROP VIEW IF EXISTS ` cloud` .` user_vm_view` ;
895+ CREATE VIEW `cloud `.` user_vm_view` AS
896+ select
897+ vm_instance .id id,
898+ vm_instance .name name,
899+ user_vm .display_name display_name,
900+ user_vm .user_data user_data,
901+ account .id account_id,
902+ account .uuid account_uuid,
903+ account .account_name account_name,
904+ account .type account_type,
905+ domain .id domain_id,
906+ domain .uuid domain_uuid,
907+ domain .name domain_name,
908+ domain .path domain_path,
909+ projects .id project_id,
910+ projects .uuid project_uuid,
911+ projects .name project_name,
912+ instance_group .id instance_group_id,
913+ instance_group .uuid instance_group_uuid,
914+ instance_group .name instance_group_name,
915+ vm_instance .uuid uuid,
916+ vm_instance .last_host_id last_host_id,
917+ vm_instance .vm_type type,
918+ vm_instance .limit_cpu_use limit_cpu_use,
919+ vm_instance .created created,
920+ vm_instance .state state,
921+ vm_instance .removed removed,
922+ vm_instance .ha_enabled ha_enabled,
923+ vm_instance .hypervisor_type hypervisor_type,
924+ vm_instance .instance_name instance_name,
925+ vm_instance .guest_os_id guest_os_id,
926+ vm_instance .display_vm display_vm,
927+ guest_os .uuid guest_os_uuid,
928+ vm_instance .pod_id pod_id,
929+ host_pod_ref .uuid pod_uuid,
930+ vm_instance .private_ip_address private_ip_address,
931+ vm_instance .private_mac_address private_mac_address,
932+ vm_instance .vm_type vm_type,
933+ data_center .id data_center_id,
934+ data_center .uuid data_center_uuid,
935+ data_center .name data_center_name,
936+ data_center .is_security_group_enabled security_group_enabled,
937+ data_center .networktype data_center_type,
938+ host .id host_id,
939+ host .uuid host_uuid,
940+ host .name host_name,
941+ vm_template .id template_id,
942+ vm_template .uuid template_uuid,
943+ vm_template .name template_name,
944+ vm_template .display_text template_display_text,
945+ vm_template .enable_password password_enabled,
946+ iso .id iso_id,
947+ iso .uuid iso_uuid,
948+ iso .name iso_name,
949+ iso .display_text iso_display_text,
950+ service_offering .id service_offering_id,
951+ disk_offering .uuid service_offering_uuid,
952+ Case
953+ When (` cloud` .` service_offering` .` cpu` is null ) then (` custom_cpu` .` value` )
954+ Else ( ` cloud` .` service_offering` .` cpu` )
955+ End as ` cpu` ,
956+ Case
957+ When (` cloud` .` service_offering` .` speed` is null ) then (` custom_speed` .` value` )
958+ Else ( ` cloud` .` service_offering` .` speed` )
959+ End as ` speed` ,
960+ Case
961+ When (` cloud` .` service_offering` .` ram_size` is null ) then (` custom_ram_size` .` value` )
962+ Else ( ` cloud` .` service_offering` .` ram_size` )
963+ END as ` ram_size` ,
964+ disk_offering .name service_offering_name,
965+ storage_pool .id pool_id,
966+ storage_pool .uuid pool_uuid,
967+ storage_pool .pool_type pool_type,
968+ volumes .id volume_id,
969+ volumes .uuid volume_uuid,
970+ volumes .device_id volume_device_id,
971+ volumes .volume_type volume_type,
972+ security_group .id security_group_id,
973+ security_group .uuid security_group_uuid,
974+ security_group .name security_group_name,
975+ security_group .description security_group_description,
976+ nics .id nic_id,
977+ nics .uuid nic_uuid,
978+ nics .network_id network_id,
979+ nics .ip4_address ip_address,
980+ nics .ip6_address ip6_address,
981+ nics .ip6_gateway ip6_gateway,
982+ nics .ip6_cidr ip6_cidr,
983+ nics .default_nic is_default_nic,
984+ nics .gateway gateway,
985+ nics .netmask netmask,
986+ nics .mac_address mac_address,
987+ nics .broadcast_uri broadcast_uri,
988+ nics .isolation_uri isolation_uri,
989+ vpc .id vpc_id,
990+ vpc .uuid vpc_uuid,
991+ networks .uuid network_uuid,
992+ networks .name network_name,
993+ networks .traffic_type traffic_type,
994+ networks .guest_type guest_type,
995+ user_ip_address .id public_ip_id,
996+ user_ip_address .uuid public_ip_uuid,
997+ user_ip_address .public_ip_address public_ip_address,
998+ ssh_keypairs .keypair_name keypair_name,
999+ resource_tags .id tag_id,
1000+ resource_tags .uuid tag_uuid,
1001+ resource_tags .key tag_key,
1002+ resource_tags .value tag_value,
1003+ resource_tags .domain_id tag_domain_id,
1004+ resource_tags .account_id tag_account_id,
1005+ resource_tags .resource_id tag_resource_id,
1006+ resource_tags .resource_uuid tag_resource_uuid,
1007+ resource_tags .resource_type tag_resource_type,
1008+ resource_tags .customer tag_customer,
1009+ async_job .id job_id,
1010+ async_job .uuid job_uuid,
1011+ async_job .job_status job_status,
1012+ async_job .account_id job_account_id,
1013+ affinity_group .id affinity_group_id,
1014+ affinity_group .uuid affinity_group_uuid,
1015+ affinity_group .name affinity_group_name,
1016+ affinity_group .description affinity_group_description,
1017+ vm_instance .dynamically_scalable dynamically_scalable,
1018+ all_details .name detail_name,
1019+ all_details .value detail_value
1020+ from
1021+ ` cloud` .` user_vm`
1022+ inner join
1023+ ` cloud` .` vm_instance` ON vm_instance .id = user_vm .id
1024+ and vm_instance .removed is NULL
1025+ inner join
1026+ ` cloud` .` account` ON vm_instance .account_id = account .id
1027+ inner join
1028+ ` cloud` .` domain` ON vm_instance .domain_id = domain .id
1029+ left join
1030+ ` cloud` .` guest_os` ON vm_instance .guest_os_id = guest_os .id
1031+ left join
1032+ ` cloud` .` host_pod_ref` ON vm_instance .pod_id = host_pod_ref .id
1033+ left join
1034+ ` cloud` .` projects` ON projects .project_account_id = account .id
1035+ left join
1036+ ` cloud` .` instance_group_vm_map` ON vm_instance .id = instance_group_vm_map .instance_id
1037+ left join
1038+ ` cloud` .` instance_group` ON instance_group_vm_map .group_id = instance_group .id
1039+ left join
1040+ ` cloud` .` data_center` ON vm_instance .data_center_id = data_center .id
1041+ left join
1042+ ` cloud` .` host` ON vm_instance .host_id = host .id
1043+ left join
1044+ ` cloud` .` vm_template` ON vm_instance .vm_template_id = vm_template .id
1045+ left join
1046+ ` cloud` .` vm_template` iso ON iso .id = user_vm .iso_id
1047+ left join
1048+ ` cloud` .` service_offering` ON vm_instance .service_offering_id = service_offering .id
1049+ left join
1050+ ` cloud` .` disk_offering` ON vm_instance .service_offering_id = disk_offering .id
1051+ left join
1052+ ` cloud` .` volumes` ON vm_instance .id = volumes .instance_id
1053+ left join
1054+ ` cloud` .` storage_pool` ON volumes .pool_id = storage_pool .id
1055+ left join
1056+ ` cloud` .` security_group_vm_map` ON vm_instance .id = security_group_vm_map .instance_id
1057+ left join
1058+ ` cloud` .` security_group` ON security_group_vm_map .security_group_id = security_group .id
1059+ left join
1060+ ` cloud` .` nics` ON vm_instance .id = nics .instance_id and nics .removed is null
1061+ left join
1062+ ` cloud` .` networks` ON nics .network_id = networks .id
1063+ left join
1064+ ` cloud` .` vpc` ON networks .vpc_id = vpc .id and vpc .removed is null
1065+ left join
1066+ ` cloud` .` user_ip_address` ON user_ip_address .vm_id = vm_instance .id
1067+ left join
1068+ ` cloud` .` user_vm_details` as ssh_details ON ssh_details .vm_id = vm_instance .id
1069+ and ssh_details .name = ' SSH.PublicKey'
1070+ left join
1071+ ` cloud` .` ssh_keypairs` ON ssh_keypairs .public_key = ssh_details .value
1072+ left join
1073+ ` cloud` .` resource_tags` ON resource_tags .resource_id = vm_instance .id
1074+ and resource_tags .resource_type = ' UserVm'
1075+ left join
1076+ ` cloud` .` async_job` ON async_job .instance_id = vm_instance .id
1077+ and async_job .instance_type = ' VirtualMachine'
1078+ and async_job .job_status = 0
1079+ left join
1080+ ` cloud` .` affinity_group_vm_map` ON vm_instance .id = affinity_group_vm_map .instance_id
1081+ left join
1082+ ` cloud` .` affinity_group` ON affinity_group_vm_map .affinity_group_id = affinity_group .id
1083+ left join
1084+ ` cloud` .` user_vm_details` as all_details ON all_details .vm_id = vm_instance .id
1085+ left join
1086+ ` cloud` .` user_vm_details` ` custom_cpu` ON (((` custom_cpu` .` vm_id` = ` cloud` .` vm_instance` .` id` ) and (` custom_cpu` .` name` = ' CpuNumber' )))
1087+ left join
1088+ ` cloud` .` user_vm_details` ` custom_speed` ON (((` custom_speed` .` vm_id` = ` cloud` .` vm_instance` .` id` ) and (` custom_speed` .` name` = ' CpuSpeed' )))
1089+ left join
1090+ ` cloud` .` user_vm_details` ` custom_ram_size` ON (((` custom_ram_size` .` vm_id` = ` cloud` .` vm_instance` .` id` ) and (` custom_ram_size` .` name` = ' memory' )));
1091+
1092+
0 commit comments