mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[opennebula] identify the network by id or name within a flavor
This commit is contained in:
parent
3fa1f6a9c1
commit
9fcb2a7894
1 changed files with 8 additions and 4 deletions
|
@ -63,9 +63,14 @@ module Fog
|
||||||
h["NIC"] = [] # reset nics to a array
|
h["NIC"] = [] # reset nics to a array
|
||||||
if nics.is_a? Array
|
if nics.is_a? Array
|
||||||
nics.each do |n|
|
nics.each do |n|
|
||||||
n["model"] = "virtio" if n["model"].nil?
|
if n["NETWORK_ID"]
|
||||||
n["uuid"] = "0" if n["uuid"].nil? # is it better is to remove this NIC?
|
vnet = networks.get(n["NETWORK_ID"].to_s)
|
||||||
h["NIC"] << interfaces.new({ :vnet => networks.get(n["uuid"]), :model => n["model"]})
|
elsif n["NETWORK"]
|
||||||
|
vnet = networks.get_by_name(n["NETWORK"].to_s)
|
||||||
|
else
|
||||||
|
next
|
||||||
|
end
|
||||||
|
h["NIC"] << interfaces.new({ :vnet => vnet, :model => n["MODEL"] || "virtio" })
|
||||||
end
|
end
|
||||||
elsif nics.is_a? Hash
|
elsif nics.is_a? Hash
|
||||||
nics["model"] = "virtio" if nics["model"].nil?
|
nics["model"] = "virtio" if nics["model"].nil?
|
||||||
|
@ -83,7 +88,6 @@ module Fog
|
||||||
# should i break?
|
# should i break?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# every key should be lowercase
|
# every key should be lowercase
|
||||||
ret_hash = {}
|
ret_hash = {}
|
||||||
h.each_pair do |k,v|
|
h.each_pair do |k,v|
|
||||||
|
|
Loading…
Reference in a new issue