File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
app/controllers/mixins/actions/vm_actions Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ def reconfigure(reconfigure_ids = [])
1919
2020 if @reconfigitems . size == 1
2121 vm = @reconfigitems . first
22- @vlan_options = vm . try ( :available_vlans ) || get_vlan_options ( vm . host_id )
22+ # NOTE: available_vlans is ovirt specific vlan lookup
23+ @vlan_options = vm . try ( :available_vlans ) || get_vlan_options ( vm . host )
2324
2425 @avail_adapter_names = vm . try ( :available_adapter_names ) || [ ]
2526 @iso_options = get_iso_options ( vm )
@@ -212,19 +213,10 @@ def reconfigure_calculations(mbsize)
212213 return humansize . to_s , fmt
213214 end
214215
215- def get_vlan_options ( host_id )
216- vlan_options = [ ]
217-
218- # determine available switches for this host...
219- switch_ids = [ ]
220- Rbac . filtered ( HostSwitch . where ( "host_id = ?" , host_id ) ) . each do |host_switch |
221- switch_ids << host_switch . switch_id
222- end
223-
224- Rbac . filtered ( Lan . where ( "switch_id IN (?)" , switch_ids ) ) . each do |lan |
225- vlan_options << lan . name
226- end
227- vlan_options . sort
216+ # determine available switches for this host...
217+ def get_vlan_options ( host )
218+ switch_ids = Rbac . filtered ( host . switches ) . pluck ( :id )
219+ Rbac . filtered ( Lan . where ( :switch_id => switch_ids ) . order ( :name ) ) . pluck ( :name )
228220 end
229221
230222 def get_iso_options ( vm )
You can’t perform that action at this time.
0 commit comments