[Ovirt-devel] [PATCH node] Changes how macs are collected by ovirt-early.

Darryl L. Pierce dpierce at redhat.com
Mon Mar 30 20:05:44 UTC 2009


Instead of checking for those devices that are currently active, it
instead uses the list of network devices reported by sysfs. It then
iterates over that list and gets the mac address.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-early |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index 9ab2981..b7e5c61 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -14,8 +14,14 @@ BONDING_MODCONF_FILE=/etc/modprobe.d/bonding
 AUGTOOL_CONFIG=/var/tmp/augtool-config
 
 get_mac_addresses() {
-    macs=$(ifconfig | awk '/HWaddr/ { print $5"="$1 }' \
-                    | tr '\n' ' ' | sed 's/ /%2C/g;s/:/%3A/g')
+    macs=""
+    devices=$(ls -b /sys/class/net/)
+    for device in $devices; do
+	mac=$(cat /sys/class/net/$device/address)
+	iface=$device
+	macs="${macs}${mac}=${iface} "
+    done
+    macs=$(echo $macs | sed 's/ /%2C/g;s/:/%3A/g;s/=/%3D/g')
 }
 
 configure_from_network() {
-- 
1.6.0.6




More information about the ovirt-devel mailing list