[Ovirt-devel] [PATCH server] Fixes to the managed_node_configuration code.
Mohammed Morsi
mmorsi at redhat.com
Thu Apr 2 16:12:47 UTC 2009
Still two issues left.
> diff --git a/src/app/models/nic.rb b/src/app/models/nic.rb
> ...
> +
> + # Returns the netmask for the nic if networking is defined.
> + def netmask
> + return physical_network.ip_addresses.first.netmask if networking? && !ip_addresses.empty?
> + return nil
> + end
> +
> + # Returns the broadcast address for the nic if networking is defined.
> + def broadcast
> + return physical_network.ip_addresses.first.broadcast if networking? && !ip_addresses.empty?
> + return nil
> + end
> +
> + # Returns the gateway address fo rthe nic if networking is defined.
> + def gateway
> + return physical_network.ip_addresses.first.gateway if networking? && !ip_addresses.empty?
> + return nil
> + end
>
These three methods still need to be changed to check
physical_network.ip_addresses.empty? and not just ip_addresses.empty?
Also the following code block should be changed from this:
> + if bonding.networking?
> + entry = "ifcfg=none|#{bonding.interface_name}"
> + entry += "|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} miimon=100\""
> + entry += "|BRIDGE=br#{bonding.interface_name}"
> + entry += "|ONBOOT=yes"
> + result.puts entry
> +
> + add_bridge(result,"none",bonding.interface_name,
> + bonding.boot_protocol, bonding.ip_address,
> + bonding.netmask, bonding.broadcast,
> + bonding.gateway)
> end
>
>
To this:
+ entry = "ifcfg=none|#{bonding.interface_name}"
+ entry += "|BONDING_OPTS=\"mode=#{bonding.bonding_type.mode} miimon=100\""
+ entry += "|BRIDGE=br#{bonding.interface_name}" if bonding.networking? # <--- don't forget this conditional as well
+ entry += "|ONBOOT=yes"
+ result.puts entry
+ if bonding.networking? # <-- move this conditional here
+ add_bridge(result,"none",bonding.interface_name,
+ bonding.boot_protocol, bonding.ip_address,
+ bonding.netmask, bonding.broadcast,
+ bonding.gateway)
end
eg the placing of if bonding.networking? should be moved to just
surround the call to add_bridge. The additions to the entry string (save
the 'BRIDGE=brfoo' addition) should still take place regardless to the
call to bonding.networking? else the bonding will not get created.
-Mo
More information about the ovirt-devel
mailing list