mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Feature #4620: Show PCI NICs in template instantiate
This commit is contained in:
parent
5df05f624e
commit
3fd36b7160
@ -124,6 +124,8 @@ define(function(require) {
|
||||
}
|
||||
|
||||
function _submitWizard(context) {
|
||||
var that = this;
|
||||
|
||||
if (!this.selected_nodes || this.selected_nodes.length == 0) {
|
||||
Notifier.notifyError(Locale.tr("No template selected"));
|
||||
Sunstone.hideFormPanelLoading(this.tabId);
|
||||
@ -160,11 +162,50 @@ define(function(require) {
|
||||
tmp_json.DISK = disks;
|
||||
}
|
||||
|
||||
var nics = NicsSection.retrieve($(".nicsContext" + template_id, context));
|
||||
var networks = NicsSection.retrieve($(".nicsContext" + template_id, context));
|
||||
|
||||
var nics = [];
|
||||
var pcis = [];
|
||||
|
||||
$.each(networks, function(){
|
||||
if (this.TYPE == "NIC"){
|
||||
pcis.push(this);
|
||||
}else{
|
||||
nics.push(this);
|
||||
}
|
||||
});
|
||||
|
||||
if (nics.length > 0) {
|
||||
tmp_json.NIC = nics;
|
||||
}
|
||||
|
||||
// Replace PCIs of type nic only
|
||||
var original_tmpl = that.template_objects[index].VMTEMPLATE;
|
||||
|
||||
var regular_pcis = [];
|
||||
|
||||
if(original_tmpl.TEMPLATE.PCI != undefined){
|
||||
var original_pcis;
|
||||
|
||||
if ($.isArray(original_tmpl.TEMPLATE.PCI)){
|
||||
original_pcis = original_tmpl.TEMPLATE.PCI;
|
||||
} else if (!$.isEmptyObject(original_tmpl.TEMPLATE.PCI)){
|
||||
original_pcis = [original_tmpl.TEMPLATE.PCI];
|
||||
}
|
||||
|
||||
$.each(original_pcis, function(){
|
||||
if(this.TYPE != "NIC"){
|
||||
regular_pcis.push(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pcis = pcis.concat(regular_pcis);
|
||||
|
||||
if (pcis.length > 0) {
|
||||
tmp_json.PCI = pcis;
|
||||
}
|
||||
|
||||
capacityContext = $(".capacityContext" + template_id, context);
|
||||
$.extend(tmp_json, CapacityInputs.retrieveChanges(capacityContext));
|
||||
|
||||
|
@ -55,11 +55,28 @@ define(function(require) {
|
||||
try {
|
||||
if (OpenNebulaTemplate.isNetworkChangeEnabled(template_json)) {
|
||||
var template_nic = template_json.VMTEMPLATE.TEMPLATE.NIC
|
||||
var nics = []
|
||||
if ($.isArray(template_nic))
|
||||
nics = template_nic
|
||||
else if (!$.isEmptyObject(template_nic))
|
||||
nics = [template_nic]
|
||||
|
||||
var nics = [];
|
||||
|
||||
if ($.isArray(template_nic)){
|
||||
nics = template_nic;
|
||||
} else if (!$.isEmptyObject(template_nic)){
|
||||
nics = [template_nic];
|
||||
}
|
||||
|
||||
var pcis = [];
|
||||
|
||||
if ($.isArray(template_json.VMTEMPLATE.TEMPLATE.PCI)){
|
||||
pcis = template_json.VMTEMPLATE.TEMPLATE.PCI;
|
||||
} else if (!$.isEmptyObject(template_json.VMTEMPLATE.TEMPLATE.PCI)){
|
||||
pcis = [template_json.VMTEMPLATE.TEMPLATE.PCI];
|
||||
}
|
||||
|
||||
$.each(pcis, function(){
|
||||
if(this.TYPE == "NIC"){
|
||||
nics.push(this);
|
||||
}
|
||||
});
|
||||
|
||||
_generate_provision_network_accordion(
|
||||
$(".provision_network_selector", context), options);
|
||||
@ -68,6 +85,8 @@ define(function(require) {
|
||||
var opt = $.extend({}, options);
|
||||
opt.nic = nic;
|
||||
|
||||
opt.pci = (nic.TYPE == "NIC");
|
||||
|
||||
_generate_provision_network_table(
|
||||
$(".provision_nic_accordion", context),
|
||||
opt);
|
||||
@ -160,6 +179,7 @@ define(function(require) {
|
||||
* - management {bool}: true to show the
|
||||
* management checkbox
|
||||
* - securityGroups {bool}: true to select SGs
|
||||
* - pci {bool}: true if this is a PCI interface
|
||||
*/
|
||||
function _generate_provision_network_table(context, options) {
|
||||
context.off();
|
||||
|
@ -2,7 +2,11 @@
|
||||
<a href="#provision_accordion_dd_{{provision_nic_accordion_dd_id}}" class="accordion-title">
|
||||
<i class="only-not-active fa fa-chevron-down"/>
|
||||
<i class="only-active fa fa-chevron-up"/>
|
||||
{{#if options.pci}}
|
||||
{{tr "PCI interface"}}
|
||||
{{else}}
|
||||
{{tr "Interface"}}
|
||||
{{/if}}
|
||||
<span class="selected_network">
|
||||
{{#if options.nic}}
|
||||
{{#if options.nic.NETWORK}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user