[Ovirt-devel] [PATCH node] network-related fixes

Mohammed Morsi mmorsi at redhat.com
Fri Mar 27 20:06:19 UTC 2009


  - only send bridges to server to be configured for now
  - apply default net device config before server retrieved
    config since now only bridges can be configured on server
---
 ovirt-identify-node/gather.c |   28 ++++++++++++++++++----------
 scripts/ovirt-early          |   40 +++++++++++++++++++++-------------------
 2 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/ovirt-identify-node/gather.c b/ovirt-identify-node/gather.c
index c12ed08..04b3399 100644
--- a/ovirt-identify-node/gather.c
+++ b/ovirt-identify-node/gather.c
@@ -296,13 +296,7 @@ get_nic_info(void)
 
         VERBOSE("Starting new NIC.\n");
 
-        if (current != NULL) {
-            last = current;
-            current = create_nic_info();
-            last->next = current;
-        } else {
-            nic_info = current = create_nic_info();
-        }
+        current = create_nic_info();
 
         snprintf(current->mac_address, BUFFER_LENGTH, "%s",
                  libhal_device_get_property_string(hal_ctx, nic,
@@ -310,9 +304,23 @@ get_nic_info(void)
                                                    &dbus_error));
         get_nic_data(nic, current);
 
-        DEBUG("NIC details: MAC:%s, speed:%s, IP:%s\n",
-              nic_info->mac_address, nic_info->bandwidth,
-              nic_info->ip_address);
+        // FIXME currently only retreiving bridges until
+        // the ovirt server can distinguish between
+        // bridges and nics
+        if(current->iface_name[0] == 'b' && current->iface_name[1] == 'r'){
+
+          DEBUG("NIC details: MAC:%s, IFACE_NAME: %s, speed:%s, IP:%s\n",
+                current->mac_address, current->iface_name,
+                current->bandwidth, current->ip_address);
+
+          if (last == NULL){
+              nic_info = last = current;
+          } else {
+              last->next = current;
+              last = current;
+          }
+
+        }
     }
 
     return result;
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index 9ab2981..ffcdff3 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -20,6 +20,26 @@ get_mac_addresses() {
 
 configure_from_network() {
     DEVICE=$1
+
+    # initially setup default oVirt network configuration:
+    # bridge each ethernet device in the system
+    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
+    done
+    log "Default config applied"
+
     if [ -n "$DEVICE" ]; then
         log "Configuring network Using interface $DEVICE"
         # setup temporary interface to retrieve configuration
@@ -46,35 +66,17 @@ configure_from_network() {
                         ovirt-process-config $cfgdb $BONDING_MODCONF_FILE $AUGTOOL_CONFIG
 			if [ $? -eq 0 ]; then
 			    log "Remote configuration retrieved and applied"
+                            rm $cfgdb
 			else
 			    log "Failure to retrieve or apply remote configuration"
 			fi
                     else
                         log "Failed to retrieve configuration bundle"
                     fi
-                    rm $cfgdb
                 fi
             fi
         fi
     fi
-    # default oVirt network configuration:
-    # bridge each ethernet device in the system
-    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
-    done
-    log "Default config applied"
 }
 
 # $(get_live_disk)
-- 
1.6.0.6




More information about the ovirt-devel mailing list