Project

General

Profile

« Previous | Next » 

Revision 8c678130

Added by Tomáš Strachota about 9 years ago

Fixes #9480 - multiple NICs integration with compute profiles

From users point of view:
- interfaces setup in compute profiles is back
- interface related compute attrs get merged into host NICs upon compute
profile selection
- NIC overview table displays details in the column "Type"
- UI for direct creation of VMs fixed
- fixed removing interfaces and volumes from compute profiles

From technical point of view:
- NIC overview table is always built by js
- templates for compute resources got more structure (split to partials
"base", "interface", "volume")
- compute resources can provide custom implementation of
'providerSpecificNICInfo' function

(cherry picked from commit 6d05514ad02676067389f44c4ba1d3daf357884b)

View differences:

app/views/compute_resources_vms/form/libvirt/_network.html.erb
<div class="fields">
<div class="form-group">
<% nat = compute_resource.networks %>
<% bridge = compute_resource.interfaces %>
<%= f.fields_for 'compute_attributes', OpenStruct.new(f.object.compute_attributes) do |f| %>
<% nat = compute_resource.networks %>
<% bridge = compute_resource.interfaces %>
<%=
selectable_f f, :type, libvirt_networks(compute_resource), {},
{ :label => _('Network type'),
:disabled => disabled,
:onchange => 'libvirt_network_selected(this)' } %>
<%= selectable_f f, :type, libvirt_networks(compute_resource), {},
{ :label => _('Network type'),
:disabled => !new_host,
:onchange => 'libvirt_network_selected(this)',
:class => 'libvirt_network'
} %>
<div id='nat' class='<%= 'hide' if f.object.type != 'network' %>'>
<%= selectable_f f, :network, nat.map(&:name),
{ :include_blank => nat.any? ? false : _("No networks") },
{ :class => "col-md-2", :label => _("Network"), :disabled => (f.object.type != 'network' || disabled) } %>
</div>
<div id='bridge' class='<%= 'hide' if f.object.type && (f.object.type != 'bridge') %>'>
<% if bridge.any? %>
<%= selectable_f f, :bridge, bridge.map(&:name),
{ :include_blank => bridge.any? ? false : _("No bridges") },
{ :class => "col-md-2", :label => _("Network"), :disabled => ((f.object.type && (f.object.type != 'bridge')) || disabled) } %>
<% else %>
<%= text_f f, :bridge, :class => "col-md-2", :label => _("Network"), :help_block => _("your libvirt host does not support interface listing, please enter here the bridge name (e.g. br0)"), :disabled => disabled %>
<% end %>
</div>
<div id='nat' class='<%= 'hide' if f.object.type != 'network' %>'>
<%= selectable_f f, :network, nat.map(&:name),
{ :include_blank => nat.any? ? false : _("No networks") },
{ :class => "col-md-2 libvirt_nat", :label => _("Network"), :disabled => (f.object.type != 'network' || !new_host) } %>
</div>
<%= selectable_f f, :model, %w(virtio rtl8139 ne2k_pci pcnet e1000), {},
{ :label => _('NIC type'), :class => 'col-md-2', :disabled => disabled } %>
<div id='bridge' class='<%= 'hide' if f.object.type && (f.object.type != 'bridge') %>'>
<% if bridge.any? %>
<%= selectable_f f, :bridge, bridge.map(&:name),
{ :include_blank => bridge.any? ? false : _("No bridges") },
{ :class => "col-md-2 libvirt_bridge", :label => _("Network"), :disabled => ((f.object.type && (f.object.type != 'bridge')) || !new_host) } %>
<% else %>
<%= text_f f, :bridge, :class => "col-md-2 libvirt_bridge", :label => _("Network"), :help_block => _("your libvirt host does not support interface listing, please enter here the bridge name (e.g. br0)"), :disabled => !new_host %>
<% end %>
</div>
</div>
<%= selectable_f f, :model, %w(virtio rtl8139 ne2k_pci pcnet e1000), {},
{ :label => _('NIC type'), :class => 'col-md-2', :disabled => !new_host } %>

Also available in: Unified diff