[Ovirt-devel] [PATCH node] Report on physical network devices when identifying the node.
Mohammed Morsi
mmorsi at redhat.com
Wed Apr 1 23:51:32 UTC 2009
This functionally works but I believe it doesn't satisfy the requirements
Here the default config is only applied when the node fails to make a
valid request to the server's managed_node_controller. Regardless of
whether this request succeeds or not we need to configure the boot
network device, as that config won't be retrieved from the server. As
it is now, when a valid response comes back from the server, the
boot-nic doesn't get configured and bridges.
I'm not sure if a default config should be applied to the other non-boot
nics should the request fail though.
-Mo
Darryl L. Pierce wrote:
> The default interface configuration is only applied if a configuration
> was not retrieved from the server for some reason.
>
> When ovirt-identify-node collects NIC details to send back to the
> server, it only collects for physical devices that support the net.80203
> capability as reported by HAL.
>
> Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
> ---
> ovirt-identify-node/gather.c | 4 ++--
> scripts/ovirt-early | 31 +++++++++++++++++++------------
> 2 files changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/ovirt-identify-node/gather.c b/ovirt-identify-node/gather.c
> index c12ed08..d0d9250 100644
> --- a/ovirt-identify-node/gather.c
> +++ b/ovirt-identify-node/gather.c
> @@ -286,7 +286,7 @@ get_nic_info(void)
>
> int i;
>
> - nics = libhal_find_device_by_capability(hal_ctx, "net",
> + nics = libhal_find_device_by_capability(hal_ctx, "net.80203",
> &num_results, &dbus_error);
>
> DEBUG("Found %d NICs\n", num_results);
> @@ -294,7 +294,7 @@ get_nic_info(void)
> for (i = 0; i < num_results; i++) {
> char *nic = nics[i];
>
> - VERBOSE("Starting new NIC.\n");
> + DEBUG("Starting new NIC; %s.\n", nic);
>
> if (current != NULL) {
> last = current;
> diff --git a/scripts/ovirt-early b/scripts/ovirt-early
> index 1260900..02b949b 100755
> --- a/scripts/ovirt-early
> +++ b/scripts/ovirt-early
> @@ -30,6 +30,7 @@ get_mac_addresses() {
>
> configure_from_network() {
> DEVICE=$1
> +
> if [ -n "$DEVICE" ]; then
> log "Configuring network Using interface $DEVICE"
> # setup temporary interface to retrieve configuration
> @@ -56,13 +57,14 @@ configure_from_network() {
> ovirt-process-config $cfgdb $BONDING_MODCONF_FILE $AUGTOOL_CONFIG
> if [ $? -eq 0 ]; then
> log "Remote configuration retrieved and applied"
> + rm $cfgdb
> + return
> else
> log "Failure to retrieve or apply remote configuration"
> fi
> else
> log "Failed to retrieve configuration bundle"
> fi
> - rm $cfgdb
> fi
> fi
> fi
> @@ -72,17 +74,22 @@ configure_from_network() {
> ETHDEVS=$(cd /sys/class/net && ls -d eth*)
> for eth in $ETHDEVS; do
> BRIDGE=br$eth
> - log "Applying default configuration to $eth and $BRIDGE"
> - printf '%s\n' "DEVICE=$eth" ONBOOT=yes "BRIDGE=$BRIDGE" \
> - > /etc/sysconfig/network-scripts/ifcfg-$eth
> - if [ -z "$DEVICE" -o "$DEVICE" = "$eth" ]; then
> - dhcp="BOOTPROTO=dhcp"
> - else
> - dhcp=""
> - fi
> - printf '%s\n' "DEVICE=$BRIDGE" "$dhcp" \
> - ONBOOT=yes TYPE=Bridge PEERNTP=yes DELAY=0 \
> - > /etc/sysconfig/network-scripts/ifcfg-$BRIDGE
> + local ifcfg=/etc/sysconfig/network-scripts/ifcfg-$BRIDGE
> +
> + # only write a default file if one does not exist
> + if [ ! -f $ifcfg ]; then
> + log "Applying default configuration to $eth and $BRIDGE"
> + printf '%s\n' "DEVICE=$eth" ONBOOT=yes "BRIDGE=$BRIDGE" \
> + > /etc/sysconfig/network-scripts/ifcfg-$eth
> + if [ -z "$DEVICE" -o "$DEVICE" = "$eth" ]; then
> + dhcp="BOOTPROTO=dhcp"
> + else
> + dhcp=""
> + fi
> + printf '%s\n' "DEVICE=$BRIDGE" "$dhcp" \
> + ONBOOT=yes TYPE=Bridge PEERNTP=yes DELAY=0 \
> + > /etc/sysconfig/network-scripts/ifcfg-$BRIDGE
> + fi
> done
> log "Default config applied"
> }
>
More information about the ovirt-devel
mailing list