Skip to content

Commit

Permalink
ovirt-networking: using profiles
Browse files Browse the repository at this point in the history
This patch fixes some issues in oVirt vm provision network tab.
1. Changing the 'vLan' label to 'Network'
2. Displaying the vnic profiles instead of the host/hosts networks (only
profiles configured in the cluster).
3. Using OvirtSDK4.

Changes relevant to version 4 only.
  • Loading branch information
AlonaKaplan committed Jun 6, 2017
1 parent d07a5ef commit 7049afa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
22 changes: 19 additions & 3 deletions app/models/miq_provision_virt_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ def update_field_read_only(options = {})

def allowed_hosts_obj(options = {})
all_hosts = super
filter_allowed_hosts(all_hosts)
end

def filter_allowed_hosts(all_hosts)
filter_hosts_by_vlan_name(all_hosts)
end

def filter_hosts_by_vlan_name(all_hosts)
vlan_name = get_value(@values[:vlan])
return all_hosts unless vlan_name

Expand Down Expand Up @@ -225,15 +233,23 @@ def available_vlans_and_hosts(options = {})
rails_logger('allowed_vlans', 0)
# TODO: Use Active Record to preload this data?
MiqPreloader.preload(hosts, :switches => :lans)
hosts.each do |h|
h.lans.each { |l| vlans[l.name] = l.name unless l.switch.shared? }
end
load_allowed_vlans(hosts, vlans)
rails_logger('allowed_vlans', 1)
end

return vlans, hosts
end

def load_allowed_vlans(hosts, vlans)
load_hosts_vlans(hosts, vlans)
end

def load_hosts_vlans(hosts, vlans)
hosts.each do |h|
h.lans.each { |l| vlans[l.name] = l.name unless l.switch.shared? }
end
end

def filter_by_tags(target, options)
opt_filters = options[:tag_filters]
return target if opt_filters.blank?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@
:dvs: true
:vlans: true
:method: :allowed_vlans
:description: vLan
:required: true
:description: Network
:required: false
:display: :edit
:data_type: :string
:mac_address:
Expand Down

0 comments on commit 7049afa

Please sign in to comment.