diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 99d42cf60a..3f1f16c1ec 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -18,6 +18,9 @@ /* HOST_HISTORY_LENGTH is ignored by server */ var HOST_HISTORY_LENGTH = 40; +/* Hypervisors from where you can import VMs*/ +var HYPERVISORS_CAN_IMPORT_VM = ["vcenter", "ec2"] + var create_host_tmpl = '
\
\ @@ -778,7 +781,10 @@ function updateHostInfo(request,host){ var stripped_host_template = {}; var unshown_values = {}; - if (host_info.TEMPLATE.HYPERVISOR && host_info.TEMPLATE.HYPERVISOR.toLowerCase() != "vcenter") + var hypervisor_name = host_info.TEMPLATE.HYPERVISOR ? host_info.TEMPLATE.HYPERVISOR.toLowerCase() : "-" ; + + + if (!$.inArray(hypervisor_name, HYPERVISORS_CAN_IMPORT_VM)) { stripped_host_template = host_info.TEMPLATE; } @@ -969,7 +975,7 @@ function updateHostInfo(request,host){ \ \ ' + tr("VM name") + '\ - ' + tr("UUID") + '\ + ' + tr("Remote ID") + '\ \ \ \ @@ -1030,8 +1036,13 @@ function updateHostInfo(request,host){ Sunstone.updateInfoPanelTab("host_info_panel","host_monitoring_tab",monitor_tab); Sunstone.updateInfoPanelTab("host_info_panel","host_vms_tab",vms_info_tab); - if (host_info.TEMPLATE.HYPERVISOR == "vcenter") { + hypervisor_name = host_info.TEMPLATE.HYPERVISOR ? host_info.TEMPLATE.HYPERVISOR.toLowerCase() : "-"; + + if (hypervisor_name == "vcenter") { Sunstone.updateInfoPanelTab("host_info_panel","host_esx_tab",esx_info_tab); + } + + if ($.inArray(hypervisor_name, HYPERVISORS_CAN_IMPORT_VM)) { Sunstone.updateInfoPanelTab("host_info_panel","host_wilds_tab",wilds_info_tab); } @@ -1068,7 +1079,9 @@ function updateHostInfo(request,host){ dataTable_esx_hosts.fnAddData(host_list_array); delete host_info.TEMPLATE.HOST; } + } + if ($.inArray(hypervisor_name, HYPERVISORS_CAN_IMPORT_VM)) { // WILDS datatable var dataTable_wilds_hosts = $("#datatable_host_wilds",main_tabs_context).dataTable({ "bSortClasses" : false, @@ -1082,13 +1095,13 @@ function updateHostInfo(request,host){ $.each(wilds, function(){ name = this.VM_NAME; - safe_name = name.replace(/ /g,"_").replace(/./g,"_"); - uuid = this.DEPLOY_ID; + safe_name = name.replace(/ /g,"_").replace(/\./g,"_"); + deploy_id = this.DEPLOY_ID; wilds_list_array.push([ '', name, - uuid + deploy_id ]); dataTable_wilds_hosts.fnAddData(wilds_list_array); diff --git a/src/vmm_mad/remotes/ec2/ec2_driver.conf b/src/vmm_mad/remotes/ec2/ec2_driver.conf index 461447a4c1..55688e8368 100644 --- a/src/vmm_mad/remotes/ec2/ec2_driver.conf +++ b/src/vmm_mad/remotes/ec2/ec2_driver.conf @@ -121,6 +121,9 @@ instance_types: t1.micro: cpu: 1 memory: 0.615 + t2.micro: + cpu: 1 + memory: 1 cg1.4xlarge: cpu: 16 memory: 22.5 diff --git a/src/vmm_mad/remotes/ec2/ec2_driver.rb b/src/vmm_mad/remotes/ec2/ec2_driver.rb index 59d0d98113..2b4897819b 100755 --- a/src/vmm_mad/remotes/ec2/ec2_driver.rb +++ b/src/vmm_mad/remotes/ec2/ec2_driver.rb @@ -340,11 +340,16 @@ class EC2Driver poll_data=parse_poll(i) + vm_template_to_one = vm_to_one(i) + vm_template_to_one = Base64.encode64(vm_template_to_one).gsub("\n","") + one_id = i.tags['ONE_ID'] vms_info << "VM=[\n" vms_info << " ID=#{one_id || -1},\n" vms_info << " DEPLOY_ID=#{i.instance_id},\n" + vms_info << " VM_NAME=#{i.instance_id},\n" + vms_info << " IMPORT_TEMPLATE=\"#{vm_template_to_one}\",\n" vms_info << " POLL=\"#{poll_data}\" ]\n" if one_id @@ -458,10 +463,6 @@ private end } - vm_template_to_one = vm_to_one(instance) - vm_template_to_one = Base64.encode64(vm_template_to_one).gsub("\n","") - info << "IMPORT_TEMPLATE=#{vm_template_to_one}" - info rescue # Unkown state if exception occurs retrieving information from @@ -576,7 +577,7 @@ private def vm_to_one(instance) cpu, mem = instance_type_capacity(instance.instance_type) - str = "NAME = \"Instance from #{instance.image_id}\"\n"\ + str = "NAME = \"Instance from #{instance.id}\"\n"\ "CPU = \"#{cpu}\"\n"\ "vCPU = \"#{cpu}\"\n"\ "MEMORY = \"#{mem}\"\n"\ @@ -585,9 +586,10 @@ private " TYPE =\"ec2\",\n"\ " AMI =\"#{instance.image_id}\"\n"\ "]\n"\ - "IMPORT_VM_ID = \"#{instance.image_id}\"\n"\ + "IMPORT_VM_ID = \"#{instance.id}\"\n"\ "SCHED_REQUIREMENTS=\"NAME=\\\"#{@host}\\\"\"\n"\ - "DESCRIPTION = \"Instance imported from EC2\"\n" + "DESCRIPTION = \"Instance imported from EC2, from instance"\ + " #{instance.id}, AMI #{instance.image_id}\"\n" str end