diff --git a/ui/scripts/cloud.core.zone.js b/ui/scripts/cloud.core.zone.js index ae2ccc71621..f8645e03daa 100644 --- a/ui/scripts/cloud.core.zone.js +++ b/ui/scripts/cloud.core.zone.js @@ -803,18 +803,28 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) { } function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) { - $button.show(); - - var $dialogAddPool = $("#dialog_add_pool_in_zone_page"); + var $dialogAddPool = $("#dialog_add_pool_in_zone_page"); + $dialogAddPool.find("#zone_name").text(zoneName); - // if hypervisor is KVM, limit the server option to NFS for now - // TODO: Fix this to use the hypervisor from the cluster - //if (getHypervisorType() == 'kvm') - // $dialogAddPool.find("#add_pool_protocol").empty().html(''); bindEventHandlerToDialogAddPool($dialogAddPool); - - var $podSelect = $dialogAddPool.find("#pod_dropdown"); + + var $podSelect = $dialogAddPool.find("#pod_dropdown"); + $.ajax({ + data: createURL("command=listPods&zoneid="+zoneId), + dataType: "json", + async: false, + success: function(json) { + var pods = json.listpodsresponse.pod; + $podSelect.empty(); + if(pods != null && pods.length > 0) { + for(var i=0; i" + fromdb(pods[i].name) + ""); + } + } + }); + var mapClusters = {}; + $podSelect.unbind("change").bind("change", function(event) { var podId = $(this).val(); if(podId == null || podId.length == 0) @@ -856,6 +866,7 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) { if(objCluster.hypervisortype == "KVM") { $protocolSelector.empty(); $protocolSelector.append(''); + $protocolSelector.append(''); } else if(objCluster.hypervisortype == "XenServer") { $protocolSelector.empty(); $protocolSelector.append(''); @@ -867,29 +878,12 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) { } $protocolSelector.change(); - }).change(); + }); - - $button.unbind("click").bind("click", function(event) { - $dialogAddPool.find("#zone_name").text(zoneName); - $dialogAddPool.find("#zone_dropdown").change(); //refresh cluster dropdown (do it here to avoid race condition) + $button.unbind("click").bind("click", function(event) { $dialogAddPool.find("#info_container").hide(); - - $.ajax({ - data: createURL("command=listPods&zoneid="+zoneId), - dataType: "json", - async: false, - success: function(json) { - var pods = json.listpodsresponse.pod; - $podSelect.empty(); - if(pods != null && pods.length > 0) { - for(var i=0; i" + fromdb(pods[i].name) + ""); - } - $podSelect.change(); - } - }); - + $podSelect.change(); + $("#dialog_add_pool_in_zone_page") .dialog('option', 'buttons', { "Add": function() { @@ -945,13 +939,21 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) { if(path.substring(0,1)!="/") path = "/" + path; url = nfsURL(server, path); - } else if (protocol == "vmfs") { + } + else if (protocol == "sharedMountPoint") { + var path = trim($thisDialog.find("#add_pool_path").val()); + if(path.substring(0,1)!="/") + path = "/" + path; + url = sharedMountPointURL(server, path); + } + else if (protocol == "vmfs") { var path = trim($thisDialog.find("#add_pool_vmfs_dc").val()); if(path.substring(0,1)!="/") path = "/" + path; path += "/" + trim($thisDialog.find("#add_pool_vmfs_ds").val()) url = vmfsURL("dummy", path); - } else { + } + else { var iqn = trim($thisDialog.find("#add_pool_iqn").val()); if(iqn.substring(0,1)!="/") iqn = "/" + iqn;