[Ovirt-devel] Re: [PATCH server] network integration into ovirt server db and wui
Alan Pevec
apevec at redhat.com
Sat Nov 1 21:38:58 UTC 2008
Scott Seago wrote:
> Mohammed Morsi wrote:
>>> 1) ManagedNodeConfiguration bit -- I'm not sure about this one -- but
>>> my concern is without this fix networking will be completely broken on the nodes/VMs
> So 1) is the big question -- if this isn't required for release, then
> ACK. I suspect, though, that it will break things.
Yeah, Darryl's NAK was about 1)
Here's my naive fix (just takes first ip_address and assumes IPv4),
please review it:
diff --git a/src/lib/managed_node_configuration.rb b/src/lib/managed_node_configuration.rb
index 101be9f..d0642d1 100644
--- a/src/lib/managed_node_configuration.rb
+++ b/src/lib/managed_node_configuration.rb
@@ -67,10 +67,11 @@ class ManagedNodeConfiguration
host.bondings.each do |bonding|
entry = "ifcfg=none|#{bonding.interface_name}|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} miimon=100\""
- if bonding.ip_addr == nil || bonding.ip_addr.empty?
+ if bonding.ip_addresses.empty?
entry += "|BOOTPROTO=dhcp"
else
- entry += "|BOOTPROTO=static|IPADDR=#{bonding.ip_addr}|NETMASK=#{bonding.netmask}|BROADCAST=#{bonding.broadcast}"
+ ip = bonding.ip_addresses[0]
+ entry += "|BOOTPROTO=static|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}"
end
result.puts "#{entry}|ONBOOT=yes"
@@ -111,7 +112,10 @@ class ManagedNodeConfiguration
entry += "|MASTER=#{bonding.interface_name}|SLAVE=yes"
else
entry += "|BOOTPROTO=#{nic.boot_type.proto}"
- entry += "|IPADDR=#{nic.ip_addr}|NETMASK=#{nic.netmask}|BROADCAST=#{nic.broadcast}" if nic.boot_type.proto == 'static'
+ if nic.boot_type.proto == 'static'
+ ip = nic.ip_addresses[0]
+ entry += "|IPADDR=#{ip.address}|NETMASK=#{ip.netmask}|BROADCAST=#{ip.broadcast}"
+ end
entry += "|BRIDGE=#{nic.bridge}" if nic.bridge && !is_bridge
entry += "|BRIDGE=ovirtbr0" if !nic.bridge && !is_bridge
entry += "|TYPE=bridge" if is_bridge
More information about the ovirt-devel
mailing list