1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

F #4913 Added resource pool list in import cluster (#247)

* 32 characters max in switch name

* Added resource pool list in import cluster

* Added VCENTER_RESOURCE_POOL in cluster template
This commit is contained in:
Abel Coronado 2017-04-07 11:07:47 +02:00 committed by Tino Vázquez
parent 01ab436718
commit ac0a67e2b4
2 changed files with 31 additions and 9 deletions

View File

@ -93,6 +93,7 @@ define(function(require) {
columns : [
'<input type="checkbox" class="check_all"/>',
Locale.tr("Name"),
Locale.tr("Resource Pool"),
""
]
});
@ -102,7 +103,14 @@ define(function(require) {
$.each(elements, function(id, cluster) {
var cluster_name = cluster.cluster_name;
var opts = { name: cluster_name };
var rp_list = '<select class="select_rp"><option></option>';
if(cluster.rp_list.length > 0){
for(var i = 0; i < cluster.rp_list.length; i++){
rp_list += '<option>' + cluster.rp_list[i].name + '</option>';
}
}
rp_list += '</select>';
var opts = { name: cluster_name , rp: rp_list};
var trow = $(RowTemplate(opts)).appendTo(tbody);
$(".check_item", trow).data("cluster", cluster);
@ -164,6 +172,8 @@ define(function(require) {
VCenterCommon.importLoading({context : row_context});
var rp = $('.select_rp option:selected', row_context).val();
var host_json = {
"host": {
"name": $(this).data("cluster").cluster_name,
@ -173,7 +183,7 @@ define(function(require) {
"cluster_id": cluster_id
}
};
var cluster_ref = $(this).data("cluster").cluster_ref;
var vcenter_uuid = $(this).data("cluster").vcenter_uuid;
var vcenter_version = $(this).data("cluster").vcenter_version;
@ -187,13 +197,24 @@ define(function(require) {
message : Locale.tr("Host created successfully. ID: %1$s", response.HOST.ID)
});
var template_raw =
"VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" +
"VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" +
"VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n" +
"VCENTER_INSTANCE_ID=\"" + vcenter_uuid + "\"\n" +
"VCENTER_CCR_REF=\"" + cluster_ref + "\"\n" +
"VCENTER_VERSION=\"" + vcenter_version + "\"\n";
if(rp != ""){
var template_raw =
"VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" +
"VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" +
"VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n" +
"VCENTER_INSTANCE_ID=\"" + vcenter_uuid + "\"\n" +
"VCENTER_CCR_REF=\"" + cluster_ref + "\"\n" +
"VCENTER_VERSION=\"" + vcenter_version + "\"\n" +
"VCENTER_RESOURCE_POOL=\"" + rp + "\"\n";
} else {
var template_raw =
"VCENTER_USER=\"" + that.opts.vcenter_user + "\"\n" +
"VCENTER_PASSWORD=\"" + that.opts.vcenter_password + "\"\n" +
"VCENTER_HOST=\"" + that.opts.vcenter_host + "\"\n" +
"VCENTER_INSTANCE_ID=\"" + vcenter_uuid + "\"\n" +
"VCENTER_CCR_REF=\"" + cluster_ref + "\"\n" +
"VCENTER_VERSION=\"" + vcenter_version + "\"\n";
}
Sunstone.runAction("Host.update_template", response.HOST.ID, template_raw);
},

View File

@ -19,6 +19,7 @@
<input type="checkbox" class="check_item"/>
</td>
<td>{{name}}</td>
<td>{{{rp}}}</td>
<td>
<span class="vcenter_import_result">
</span>&nbsp;