mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Bug 7709: let addPrimaryStorage be aware of hypervisors and do it smartly
This commit is contained in:
parent
a5cd2ea0c2
commit
0445358321
@ -496,34 +496,48 @@
|
||||
<option value="vmfs">VMFS</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label for="add_pool_nfs_server">
|
||||
<li id="add_pool_server_container">
|
||||
<label for="add_pool_nfs_server" >
|
||||
Server:</label>
|
||||
<input class="text" type="text" name="add_pool_nfs_server" id="add_pool_nfs_server" />
|
||||
<div id="add_pool_nfs_server_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_path_container">
|
||||
<li id="add_pool_path_container" input_group="nfs">
|
||||
<label for="add_pool_path">
|
||||
Path:</label>
|
||||
<input class="text" type="text" name="add_pool_path" id="add_pool_path" />
|
||||
<div id="add_pool_path_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_iqn_container" style="display: none">
|
||||
<li id="add_pool_iqn_container" style="display: none" input_group="iscsi">
|
||||
<label for="add_pool_iqn">
|
||||
Target IQN:</label>
|
||||
<input class="text" type="text" name="add_pool_iqn" id="add_pool_iqn" />
|
||||
<div id="add_pool_iqn_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_lun_container" style="display: none">
|
||||
<li id="add_pool_lun_container" style="display: none" input_group="iscsi">
|
||||
<label for="add_pool_lun">
|
||||
LUN #:</label>
|
||||
<input class="text" type="text" name="add_pool_lun" id="add_pool_lun" />
|
||||
<div id="add_pool_lun_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li input_group="vmfs">
|
||||
<label for="add_pool_vmfs_dc">
|
||||
vCenter Datacenter:</label>
|
||||
<input class="text" type="text" name="add_pool_vmfs_dc" id="add_pool_vmfs_dc" />
|
||||
<div id="add_pool_vmfs_dc_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li input_group="vmfs">
|
||||
<label for="add_pool_vmfs_ds">
|
||||
vCenter Datastore:</label>
|
||||
<input class="text" type="text" name="add_pool_vmfs_ds" id="add_pool_vmfs_ds" />
|
||||
<div id="add_pool_vmfs_ds_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_tags_container">
|
||||
<label for="add_pool_tags">
|
||||
Tags:</label>
|
||||
|
||||
@ -724,27 +724,41 @@
|
||||
<div id="add_pool_nfs_server_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_path_container">
|
||||
<li id="add_pool_path_container" input_group="nfs">
|
||||
<label for="add_pool_path">
|
||||
Path:</label>
|
||||
<input class="text" type="text" name="add_pool_path" id="add_pool_path" />
|
||||
<div id="add_pool_path_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_iqn_container" style="display: none">
|
||||
<li id="add_pool_iqn_container" style="display: none" input_group="iscsi">
|
||||
<label for="add_pool_iqn">
|
||||
Target IQN:</label>
|
||||
<input class="text" type="text" name="add_pool_iqn" id="add_pool_iqn" />
|
||||
<div id="add_pool_iqn_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_lun_container" style="display: none">
|
||||
<li id="add_pool_lun_container" style="display: none" input_group="iscsi">
|
||||
<label for="add_pool_lun">
|
||||
LUN #:</label>
|
||||
<input class="text" type="text" name="add_pool_lun" id="add_pool_lun" />
|
||||
<div id="add_pool_lun_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li input_group="vmfs">
|
||||
<label for="add_pool_vmfs_dc">
|
||||
vCenter Datacenter:</label>
|
||||
<input class="text" type="text" name="add_pool_vmfs_dc" id="add_pool_vmfs_dc" />
|
||||
<div id="add_pool_vmfs_dc_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li input_group="vmfs">
|
||||
<label for="add_pool_vmfs_ds">
|
||||
vCenter Datastore:</label>
|
||||
<input class="text" type="text" name="add_pool_vmfs_ds" id="add_pool_vmfs_ds" />
|
||||
<div id="add_pool_vmfs_ds_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_tags_container">
|
||||
<label for="add_pool_tags">
|
||||
Tags:</label>
|
||||
|
||||
@ -832,27 +832,41 @@
|
||||
<div id="add_pool_nfs_server_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_path_container">
|
||||
<li id="add_pool_path_container" input_group="nfs">
|
||||
<label for="add_pool_path">
|
||||
Path:</label>
|
||||
<input class="text" type="text" name="add_pool_path" id="add_pool_path" />
|
||||
<div id="add_pool_path_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_iqn_container" style="display: none">
|
||||
<li id="add_pool_iqn_container" style="display: none" input_group="iscsi">
|
||||
<label for="add_pool_iqn">
|
||||
Target IQN:</label>
|
||||
<input class="text" type="text" name="add_pool_iqn" id="add_pool_iqn" />
|
||||
<div id="add_pool_iqn_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_lun_container" style="display: none">
|
||||
<li id="add_pool_lun_container" style="display: none" input_group="iscsi">
|
||||
<label for="add_pool_lun">
|
||||
LUN #:</label>
|
||||
<input class="text" type="text" name="add_pool_lun" id="add_pool_lun" />
|
||||
<div id="add_pool_lun_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li input_group="vmfs">
|
||||
<label for="add_pool_vmfs_dc">
|
||||
vCenter Datacenter:</label>
|
||||
<input class="text" type="text" name="add_pool_vmfs_dc" id="add_pool_vmfs_dc" />
|
||||
<div id="add_pool_vmfs_dc_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li input_group="vmfs">
|
||||
<label for="add_pool_vmfs_ds">
|
||||
vCenter Datastore:</label>
|
||||
<input class="text" type="text" name="add_pool_vmfs_ds" id="add_pool_vmfs_ds" />
|
||||
<div id="add_pool_vmfs_ds_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||
</div>
|
||||
</li>
|
||||
<li id="add_pool_tags_container">
|
||||
<label for="add_pool_tags">
|
||||
Tags:</label>
|
||||
|
||||
@ -628,23 +628,53 @@ function bindAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenu
|
||||
dialogAddPool.find("#pod_name").text(fromdb(primarystorageObj.podname));
|
||||
}
|
||||
|
||||
var clusterSelect = $("#dialog_add_pool").find("#pool_cluster").empty();
|
||||
var clusterSelect = $("#dialog_add_pool").find("#pool_cluster").empty();
|
||||
var mapClusters = {};
|
||||
$.ajax({
|
||||
data: createURL("command=listClusters&podid=" + podId),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var items = json.listclustersresponse.cluster;
|
||||
if(items != null && items.length > 0) {
|
||||
for(var i=0; i<items.length; i++) {
|
||||
var items = json.listclustersresponse.cluster;
|
||||
if(items != null && items.length > 0) {
|
||||
mapClusters = {};
|
||||
for(var i=0; i<items.length; i++) {
|
||||
mapClusters["cluster_"+items[i].id] = items[i];
|
||||
if(sourceClusterId != null && items[i].id == sourceClusterId)
|
||||
clusterSelect.append("<option value='" + items[i].id + "' selected>" + fromdb(items[i].name) + "</option>");
|
||||
else
|
||||
clusterSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
}
|
||||
}
|
||||
if(!clusterSelect.val())
|
||||
$("option", clusterSelect)[0].attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$("#pool_cluster", dialogAddPool).change(function() {
|
||||
var curOption = $(this).val();
|
||||
if(!curOption)
|
||||
return false;
|
||||
|
||||
var $protocolSelector = $("#add_pool_protocol", dialogAddPool);
|
||||
var objCluster = mapClusters['cluster_'+curOption];
|
||||
|
||||
if(objCluster.hypervisortype == "KVM") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
} else if(objCluster.hypervisortype == "XenServer") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
$protocolSelector.append('<option value="iscsi">ISCSI</option>');
|
||||
} else if(objCluster.hypervisortype == "VmWare") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
$protocolSelector.append('<option value="vmfs">VMFS datastore</option>');
|
||||
}
|
||||
|
||||
$protocolSelector.change();
|
||||
}).change();
|
||||
|
||||
$("#dialog_add_pool")
|
||||
.dialog('option', 'buttons', {
|
||||
"Add": function() {
|
||||
@ -657,11 +687,14 @@ function bindAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenu
|
||||
isValid &= validateDropDownBox("Cluster", $thisDialog.find("#pool_cluster"), $thisDialog.find("#pool_cluster_errormsg"), false); //required, reset error text
|
||||
isValid &= validateString("Name", $thisDialog.find("#add_pool_name"), $thisDialog.find("#add_pool_name_errormsg"));
|
||||
isValid &= validateString("Server", $thisDialog.find("#add_pool_nfs_server"), $thisDialog.find("#add_pool_nfs_server_errormsg"));
|
||||
if (protocol == "nfs" || protocol == "vmfs") {
|
||||
if (protocol == "nfs") {
|
||||
isValid &= validateString("Path", $thisDialog.find("#add_pool_path"), $thisDialog.find("#add_pool_path_errormsg"));
|
||||
} else {
|
||||
} else if(protocol == "iscsi") {
|
||||
isValid &= validateString("Target IQN", $thisDialog.find("#add_pool_iqn"), $thisDialog.find("#add_pool_iqn_errormsg"));
|
||||
isValid &= validateString("LUN #", $thisDialog.find("#add_pool_lun"), $thisDialog.find("#add_pool_lun_errormsg"));
|
||||
} else if(protocol == "vmfs") {
|
||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#add_pool_vmfs_dc"), $thisDialog.find("#add_pool_vmfs_dc_errormsg"));
|
||||
isValid &= validateString("vCenter Datastore", $thisDialog.find("#add_pool_vmfs_ds"), $thisDialog.find("#add_pool_vmfs_ds_errormsg"));
|
||||
}
|
||||
isValid &= validateString("Tags", $thisDialog.find("#add_pool_tags"), $thisDialog.find("#add_pool_tags_errormsg"), true); //optional
|
||||
if (!isValid)
|
||||
@ -688,10 +721,11 @@ function bindAddPrimaryStorageButton($button, currentPageInRightPanel, $leftmenu
|
||||
path = "/" + path;
|
||||
url = nfsURL(server, path);
|
||||
} else if (protocol == "vmfs") {
|
||||
var path = trim($thisDialog.find("#add_pool_path").val());
|
||||
var path = trim($thisDialog.find("#add_pool_vmfs_dc").val());
|
||||
if(path.substring(0,1)!="/")
|
||||
path = "/" + path;
|
||||
url = vmfsURL(server, path);
|
||||
path += "/" + trim($thisDialog.find("#add_pool_vmfs_ds").val())
|
||||
url = vmfsURL("dummy", path);
|
||||
} else {
|
||||
var iqn = trim($thisDialog.find("#add_pool_iqn").val());
|
||||
if(iqn.substring(0,1)!="/")
|
||||
@ -837,7 +871,25 @@ function iscsiURL(server, iqn, lun) {
|
||||
}
|
||||
|
||||
function bindEventHandlerToDialogAddPool($dialogAddPool) {
|
||||
$dialogAddPool.find("#add_pool_protocol").change(function(event) {
|
||||
$dialogAddPool.find("#add_pool_protocol").change(function(event) {
|
||||
if($(this).val() == "nfs") {
|
||||
$("#add_pool_server_container", $dialogAddPool).show();
|
||||
$('li[input_group="nfs"]', $dialogAddPool).show();
|
||||
$('li[input_group="iscsi"]', $dialogAddPool).hide();
|
||||
$('li[input_group="vmfs"]', $dialogAddPool).hide();
|
||||
} else if($(this).val() == "iscsi") {
|
||||
$("#add_pool_server_container", $dialogAddPool).show();
|
||||
$('li[input_group="nfs"]', $dialogAddPool).hide();
|
||||
$('li[input_group="iscsi"]', $dialogAddPool).show();
|
||||
$('li[input_group="vmfs"]', $dialogAddPool).hide();
|
||||
} else if($(this).val() == "vmfs") {
|
||||
$("#add_pool_server_container", $dialogAddPool).hide();
|
||||
$('li[input_group="nfs"]', $dialogAddPool).hide();
|
||||
$('li[input_group="iscsi"]', $dialogAddPool).hide();
|
||||
$('li[input_group="vmfs"]', $dialogAddPool).show();
|
||||
}
|
||||
|
||||
/*
|
||||
if ($(this).val() == "iscsi") {
|
||||
$dialogAddPool.find("#add_pool_path_container").hide();
|
||||
$dialogAddPool.find("#add_pool_iqn_container,#add_pool_lun_container").show();
|
||||
@ -850,6 +902,7 @@ function bindEventHandlerToDialogAddPool($dialogAddPool) {
|
||||
$dialogAddPool.find("#add_pool_path_container").show();
|
||||
$dialogAddPool.find("#add_pool_iqn_container,#add_pool_lun_container").hide();
|
||||
}
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1132,7 +1132,8 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var mapClusters = {};
|
||||
$dialogAddPool.find("#pod_dropdown").bind("change", function(event) {
|
||||
var podId = $(this).val();
|
||||
if(podId == null || podId.length == 0)
|
||||
@ -1141,11 +1142,19 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel
|
||||
$.ajax({
|
||||
data: createURL("command=listClusters&podid=" + podId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
async: false,
|
||||
success: function(json) {
|
||||
mapClusters = {};
|
||||
var items = json.listclustersresponse.cluster;
|
||||
if(items != null && items.length > 0) {
|
||||
for(var i=0; i<items.length; i++)
|
||||
$clusterSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
for(var i=0; i<items.length; i++) {
|
||||
mapClusters["cluster_"+items[i].id] = items[i];
|
||||
$clusterSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
}
|
||||
|
||||
if(!$clusterSelect.val())
|
||||
$("option", $clusterSelect)[0].attr("selected", "selected");
|
||||
|
||||
$dialogAddPool.find("input[value=existing_cluster_radio]").attr("checked", true);
|
||||
}
|
||||
else {
|
||||
@ -1155,6 +1164,30 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$dialogAddPool.find("#cluster_select").change(function() {
|
||||
var curOption = $(this).val();
|
||||
if(!curOption)
|
||||
return false;
|
||||
|
||||
var $protocolSelector = $("#add_pool_protocol", $dialogAddPool);
|
||||
var objCluster = mapClusters['cluster_'+curOption];
|
||||
|
||||
if(objCluster.hypervisortype == "KVM") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
} else if(objCluster.hypervisortype == "XenServer") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
$protocolSelector.append('<option value="iscsi">ISCSI</option>');
|
||||
} else if(objCluster.hypervisortype == "VmWare") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
$protocolSelector.append('<option value="vmfs">VMFS datastore</option>');
|
||||
}
|
||||
|
||||
$protocolSelector.change();
|
||||
}).change();
|
||||
|
||||
|
||||
$("#add_primarystorage_shortcut").unbind("click").bind("click", function(event) {
|
||||
@ -1175,11 +1208,14 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel
|
||||
isValid &= validateDropDownBox("Cluster", $thisDialog.find("#cluster_select"), $thisDialog.find("#cluster_select_errormsg"), false); //required, reset error text
|
||||
isValid &= validateString("Name", $thisDialog.find("#add_pool_name"), $thisDialog.find("#add_pool_name_errormsg"));
|
||||
isValid &= validateString("Server", $thisDialog.find("#add_pool_nfs_server"), $thisDialog.find("#add_pool_nfs_server_errormsg"));
|
||||
if (protocol == "nfs" || protocol == "vmfs") {
|
||||
if (protocol == "nfs") {
|
||||
isValid &= validateString("Path", $thisDialog.find("#add_pool_path"), $thisDialog.find("#add_pool_path_errormsg"));
|
||||
} else {
|
||||
isValid &= validateString("Target IQN", $thisDialog.find("#add_pool_iqn"), $thisDialog.find("#add_pool_iqn_errormsg"));
|
||||
isValid &= validateString("LUN #", $thisDialog.find("#add_pool_lun"), $thisDialog.find("#add_pool_lun_errormsg"));
|
||||
} else if(protocol == "iscsi") {
|
||||
isValid &= validateString("Target IQN", $thisDialog.find("#add_pool_iqn"), $thisDialog.find("#add_pool_iqn_errormsg"));
|
||||
isValid &= validateString("LUN #", $thisDialog.find("#add_pool_lun"), $thisDialog.find("#add_pool_lun_errormsg"));
|
||||
} else if(protocol == "vmfs") {
|
||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#add_pool_vmfs_dc"), $thisDialog.find("#add_pool_vmfs_dc_errormsg"));
|
||||
isValid &= validateString("vCenter Datastore", $thisDialog.find("#add_pool_vmfs_ds"), $thisDialog.find("#add_pool_vmfs_ds_errormsg"));
|
||||
}
|
||||
isValid &= validateString("Tags", $thisDialog.find("#add_pool_tags"), $thisDialog.find("#add_pool_tags_errormsg"), true); //optional
|
||||
if (!isValid)
|
||||
@ -1215,10 +1251,11 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel
|
||||
path = "/" + path;
|
||||
url = nfsURL(server, path);
|
||||
} else if(protocol == "vmfs") {
|
||||
var path = trim($thisDialog.find("#add_pool_path").val());
|
||||
var path = trim($thisDialog.find("#add_pool_vmfs_dc").val());
|
||||
if(path.substring(0,1)!="/")
|
||||
path = "/" + path;
|
||||
url = vmfsURL(server, path);
|
||||
path += "/" + trim($thisDialog.find("#add_pool_vmfs_ds").val())
|
||||
url = vmfsURL("dummy", path);
|
||||
} else {
|
||||
var iqn = trim($thisDialog.find("#add_pool_iqn").val());
|
||||
if(iqn.substring(0,1)!="/")
|
||||
|
||||
@ -1360,6 +1360,7 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) {
|
||||
bindEventHandlerToDialogAddPool($dialogAddPool);
|
||||
|
||||
var $podSelect = $dialogAddPool.find("#pod_dropdown");
|
||||
var mapClusters = {};
|
||||
|
||||
$podSelect.bind("change", function(event) {
|
||||
var podId = $(this).val();
|
||||
@ -1369,11 +1370,19 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) {
|
||||
$.ajax({
|
||||
data: createURL("command=listClusters&podid=" + podId),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var items = json.listclustersresponse.cluster;
|
||||
if(items != null && items.length > 0) {
|
||||
for(var i=0; i<items.length; i++)
|
||||
$clusterSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
if(items != null && items.length > 0) {
|
||||
mapClusters = {};
|
||||
for(var i=0; i<items.length; i++) {
|
||||
mapClusters["cluster_"+items[i].id] = items[i];
|
||||
$clusterSelect.append("<option value='" + items[i].id + "'>" + fromdb(items[i].name) + "</option>");
|
||||
}
|
||||
|
||||
if(!$clusterSelect.val())
|
||||
$("option", $clusterSelect)[0].attr("selected", "selected");
|
||||
|
||||
$dialogAddPool.find("input[value=existing_cluster_radio]").attr("checked", true);
|
||||
}
|
||||
else {
|
||||
@ -1382,7 +1391,33 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#cluster_select", $dialogAddPool).change(function() {
|
||||
|
||||
var curOption = $(this).val();
|
||||
if(!curOption)
|
||||
return false;
|
||||
|
||||
var $protocolSelector = $("#add_pool_protocol", $dialogAddPool);
|
||||
var objCluster = mapClusters['cluster_'+curOption];
|
||||
|
||||
if(objCluster.hypervisortype == "KVM") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
} else if(objCluster.hypervisortype == "XenServer") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
$protocolSelector.append('<option value="iscsi">ISCSI</option>');
|
||||
} else if(objCluster.hypervisortype == "VmWare") {
|
||||
$protocolSelector.empty();
|
||||
$protocolSelector.append('<option value="nfs">NFS</option>');
|
||||
$protocolSelector.append('<option value="vmfs">VMFS datastore</option>');
|
||||
}
|
||||
|
||||
$protocolSelector.change();
|
||||
}).change();
|
||||
|
||||
|
||||
$button.unbind("click").bind("click", function(event) {
|
||||
$dialogAddPool.find("#zone_name").text(zoneName);
|
||||
@ -1417,11 +1452,14 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) {
|
||||
isValid &= validateDropDownBox("Cluster", $thisDialog.find("#cluster_select"), $thisDialog.find("#cluster_select_errormsg"), false); //required, reset error text
|
||||
isValid &= validateString("Name", $thisDialog.find("#add_pool_name"), $thisDialog.find("#add_pool_name_errormsg"));
|
||||
isValid &= validateString("Server", $thisDialog.find("#add_pool_nfs_server"), $thisDialog.find("#add_pool_nfs_server_errormsg"));
|
||||
if (protocol == "nfs" || protocol == "vmfs") {
|
||||
if (protocol == "nfs") {
|
||||
isValid &= validateString("Path", $thisDialog.find("#add_pool_path"), $thisDialog.find("#add_pool_path_errormsg"));
|
||||
} else {
|
||||
isValid &= validateString("Target IQN", $thisDialog.find("#add_pool_iqn"), $thisDialog.find("#add_pool_iqn_errormsg"));
|
||||
isValid &= validateString("LUN #", $thisDialog.find("#add_pool_lun"), $thisDialog.find("#add_pool_lun_errormsg"));
|
||||
} else if(protocol == "iscsi") {
|
||||
isValid &= validateString("Target IQN", $thisDialog.find("#add_pool_iqn"), $thisDialog.find("#add_pool_iqn_errormsg"));
|
||||
isValid &= validateString("LUN #", $thisDialog.find("#add_pool_lun"), $thisDialog.find("#add_pool_lun_errormsg"));
|
||||
} else if(protocol == "vmfs") {
|
||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#add_pool_vmfs_dc"), $thisDialog.find("#add_pool_vmfs_dc_errormsg"));
|
||||
isValid &= validateString("vCenter Datastore", $thisDialog.find("#add_pool_vmfs_ds"), $thisDialog.find("#add_pool_vmfs_ds_errormsg"));
|
||||
}
|
||||
isValid &= validateString("Tags", $thisDialog.find("#add_pool_tags"), $thisDialog.find("#add_pool_tags_errormsg"), true); //optional
|
||||
if (!isValid)
|
||||
@ -1456,10 +1494,11 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) {
|
||||
path = "/" + path;
|
||||
url = nfsURL(server, path);
|
||||
} else if (protocol == "vmfs") {
|
||||
var path = trim($thisDialog.find("#add_pool_path").val());
|
||||
var path = trim($thisDialog.find("#add_pool_vmfs_dc").val());
|
||||
if(path.substring(0,1)!="/")
|
||||
path = "/" + path;
|
||||
url = vmfsURL(server, path);
|
||||
path += "/" + trim($thisDialog.find("#add_pool_vmfs_ds").val())
|
||||
url = vmfsURL("dummy", path);
|
||||
} else {
|
||||
var iqn = trim($thisDialog.find("#add_pool_iqn").val());
|
||||
if(iqn.substring(0,1)!="/")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user