[Ovirt-devel] [PATCH node] The node now passes in the mac address and iface names during identify.

Darryl L. Pierce dpierce at redhat.com
Thu Sep 18 17:47:10 UTC 2008


From: Darryl Pierce <mcpierce at threshold.(none)>

This works with the patch for the server the generates a configuration file
for the node based on the interface names passed in with each mac address.

Additionally, the node will pull down the configuration and process it as a
script. Since the configuration will be composed of two separate parts:

1. a script to load one or more kernel modules
2. a configuration file to pass to augtool

The script is downloaded to a temp directory and then passed to bash. If
either of the two expected files is produced then it is further processed to
configure the node.

Signed-off-by: Darryl Pierce <dpierce at redhat.com>
Signed-off-by: Darryl Pierce <mcpierce at mcpierce-laptop.(none)>
---
 ovirt-identify-node/gather.c |    1 +
 scripts/ovirt-early          |   19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ovirt-identify-node/gather.c b/ovirt-identify-node/gather.c
index 633d16e..9722e19 100644
--- a/ovirt-identify-node/gather.c
+++ b/ovirt-identify-node/gather.c
@@ -210,6 +210,7 @@ get_nic_data(char *nic, nic_info_ptr nic_info_p)
         libhal_device_get_property_string(hal_ctx, nic, "net.interface",
                                           &dbus_error);
     snprintf(nic_info_p->iface_name, BUFFER_LENGTH, "%s", interface);
+
     bzero(&ifr, sizeof(struct ifreq));
 
     sockfd = socket(AF_INET, SOCK_DGRAM, 0);
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index 8024b3b..0379946 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -13,6 +13,12 @@
 # size of the oVirt partition in megabytes
 OVIRT_SIZE=64
 
+get_mac_addresses() {
+    macs=[`/sbin/ifconfig | awk '/HWaddr/ { print $5"="$1 }'`]
+    macs=`echo $macs | sed 's/ /%2C/g'`
+    macs=`echo $macs | sed 's/\:/%3A/g'`
+}
+
 configure_from_network() {
     DEVICE=$1
     if [ -n "$DEVICE" ]; then
@@ -31,12 +37,19 @@ configure_from_network() {
                 if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
                     printf .
                     cfgdb=$(mktemp)
+                    get_mac_addresses
                     wget -q -O $cfgdb \
-                      "http://$SRV_HOST:$SRV_PORT/ovirt/cfgdb/$(hostname)"
+                      "http://$SRV_HOST:$SRV_PORT/ovirt/managed_node/config?host=$(hostname)&$macs"
                     if [ $? -eq 0 ]; then
                         printf .
-                        echo "save" >> $cfgdb
-                        augtool < $cfgdb > /dev/null 2>&1
+                        bash $cfgdb
+                        if [ -f /var/tmp/pre-config-script ]; then
+                            printf "loading kernel modules"
+                            bash /var/tmp/pre-config-script > /dev/null 2>&1
+                        fi
+                        if [ -f /var/tmp/node-augtool ]; then
+                            augtool < /var/tmp/node-augtool > /dev/null 2>&1
+                        fi
                         if [ $? -eq 0 ]; then
                             printf "remote config applied."
                             return
-- 
1.5.5.1




More information about the ovirt-devel mailing list