Revision 47990639
Added by Tomáš Strachota over 8 years ago
app/services/interface_merge.rb | ||
---|---|---|
class InterfaceMerge
|
||
def run(interfaces, compute_attrs)
|
||
def run(host, compute_attrs)
|
||
return if compute_attrs.nil?
|
||
|
||
vm_interfaces = compute_attrs.vm_interfaces
|
||
|
||
# merge with existing
|
||
interfaces.select(&:physical?).each do |nic|
|
||
host.interfaces.select(&:physical?).each do |nic|
|
||
vm_nic = vm_interfaces.shift
|
||
return if vm_nic.nil?
|
||
merge(nic, vm_nic, compute_attrs)
|
||
... | ... | |
|
||
# create additional if there are some attributes left
|
||
vm_interfaces.each do |vm_nic|
|
||
interfaces << merge(Nic::Managed.new, vm_nic, compute_attrs)
|
||
host.interfaces << merge(Nic::Managed.new, vm_nic, compute_attrs)
|
||
end
|
||
end
|
||
|
Also available in: Unified diff
Fixes #6342 - merge compute profile when attributes in api host#create
API v2 host#craete call now merges user specified compute attributes
with compute profile. UI functionality remains untouched.