Darryl L. Pierce
2009-Mar-30 19:35 UTC
[Ovirt-devel] [PATCH node] Changes how macs are collected by ovirt-early.
Instead of checking for those devices that are currently active, it
instead uses the list of network devices reported by hal. Specifically,
those devices that support the net.80203 capability.
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..d4278a2 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=$(hal-find-by-capability --capability net.80203)
+ for device in $devices; do
+ mac=$(hal-get-property --udi $device --key net.address)
+ iface=$(hal-get-property --udi $device --key net.interface)
+ 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
Darryl L. Pierce
2009-Mar-30 20:05 UTC
[Ovirt-devel] [PATCH node] Changes how macs are collected by ovirt-early.
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
Darryl L. Pierce
2009-Mar-31 16:11 UTC
[Ovirt-devel] [PATCH node] Changes how macs are collected by ovirt-early.
NOTE: this patch incorporates feedback from apevec to filter out both
the admin NIC and the loopback NIC, along with any NIC that returns
an invalid mac address of "00:00:00:00:00:00".
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 | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index 9ab2981..6421192 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -14,8 +14,20 @@ 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')
+ local DEVICE=$1
+
+ macs=""
+ devices=$(ls -b /sys/class/net/)
+ for device in $devices; do
+ if [ "$device" != "$DEVICE" ]; then
+ mac=$(cat /sys/class/net/$device/address)
+ if [ -n "$mac" -a "$mac" !=
"00:00:00:00:00:00" ]; then
+ iface=$device
+ macs="${macs}${mac}=${iface} "
+ fi
+ fi
+ done
+ macs=$(echo $macs | sed 's/ /%2C/g;s/:/%3A/g;s/=/%3D/g')
}
configure_from_network() {
@@ -37,7 +49,7 @@ configure_from_network() {
if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ];
then
log "oVirt Server found at: $SRV_HOST:$SRV_PORT"
cfgdb=$(mktemp)
- get_mac_addresses
+ get_mac_addresses $DEVICE
log "MACs to use: $macs"
wget -O $cfgdb --no-check-certificate \
"http://$SRV_HOST:$SRV_PORT/ovirt/managed_node/config?host=$(hostname)&macs=$macs"
--
1.6.0.6