[Ovirt-devel] [PATCH node] Ignores the management interface when identifying hardware.

Darryl L. Pierce dpierce at redhat.com
Wed Apr 1 20:33:50 UTC 2009


On the commandline the argument "-m [device name]" can be used to
identify the management interface. If such a device is identified, then
during the communications phase that device is not reported to the
server.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 ovirt-identify-node/main.c                |    8 +++++++-
 ovirt-identify-node/ovirt-identify-node.h |    1 +
 ovirt-identify-node/protocol.c            |   16 ++++++++++------
 scripts/ovirt-post                        |    6 +++++-
 4 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/ovirt-identify-node/main.c b/ovirt-identify-node/main.c
index 039a878..400ea54 100644
--- a/ovirt-identify-node/main.c
+++ b/ovirt-identify-node/main.c
@@ -42,6 +42,8 @@ char *hostname;
 
 int hostport = -1;
 
+char *management_interface;
+
 int socketfd;
 
 cpu_info_ptr cpu_info;
@@ -108,7 +110,7 @@ config(int argc, char **argv)
 
     int option;
 
-    while ((option = getopt(argc, argv, "s:p:dvth")) != -1) {
+    while ((option = getopt(argc, argv, "s:p:m:dvth")) != -1) {
         DEBUG("Processing argument: %c (optarg:%s)\n", option, optarg);
 
         switch (option) {
@@ -118,6 +120,9 @@ config(int argc, char **argv)
             case 'p':
                 hostport = atoi(optarg);
                 break;
+            case 'm':
+                management_interface = optarg;
+                break;
             case 't':
                 testing = 1;
                 break;
@@ -159,6 +164,7 @@ usage()
     fprintf(stdout, "\n");
     fprintf(stdout, "\t-s [server]\t\tThe remote server's hostname.\n");
     fprintf(stdout, "\t-p [port]\t\tThe remote server's port.\n");
+    fprintf(stdout, "\t-m [iface]\t\tThe management interface.\n");
     fprintf(stdout,
             "\t-d\t\tDisplays debug information during execution.\n");
     fprintf(stdout,
diff --git a/ovirt-identify-node/ovirt-identify-node.h b/ovirt-identify-node/ovirt-identify-node.h
index 405ca4b..e608051 100644
--- a/ovirt-identify-node/ovirt-identify-node.h
+++ b/ovirt-identify-node/ovirt-identify-node.h
@@ -122,6 +122,7 @@ extern char numcpus[BUFFER_LENGTH];
 extern char cpuspeed[BUFFER_LENGTH];
 extern char *hostname;
 extern int  hostport;
+extern char *management_interface;
 extern int  socketfd;
 extern cpu_info_ptr cpu_info;
 extern nic_info_ptr nic_info;
diff --git a/ovirt-identify-node/protocol.c b/ovirt-identify-node/protocol.c
index 261773d..0382dac 100644
--- a/ovirt-identify-node/protocol.c
+++ b/ovirt-identify-node/protocol.c
@@ -177,20 +177,24 @@ send_nic_details(void)
     nic_info_ptr current = nic_info;
 
     while (current != NULL) {
-        send_text("NIC");
+      if((!management_interface) || (strcmp(management_interface, current->iface_name))) {
+	send_text("NIC");
 
-        if (!(get_text("NICINFO?")) &&
-            (!send_value("MAC", current->mac_address)) &&
-            (!send_value("BANDWIDTH", current->bandwidth)) &&
+	if (!(get_text("NICINFO?")) &&
+	    (!send_value("MAC", current->mac_address)) &&
+	    (!send_value("BANDWIDTH", current->bandwidth)) &&
             (!send_value("IFACE_NAME", current->iface_name)) &&
             (!send_value("IP_ADDRESS", current->ip_address)) &&
             (!send_value("NETMASK", current->netmask)) &&
             (!send_value("BROADCAST", current->broadcast))) {
-            send_text("ENDNIC");
-            result = get_text("ACK NIC");
+	  send_text("ENDNIC");
+	  result = get_text("ACK NIC");
         }
 
         current = current->next;
+      } else {
+	current = current->next;
+      }
     }
 
     return result;
diff --git a/scripts/ovirt-post b/scripts/ovirt-post
index faec023..647b049 100755
--- a/scripts/ovirt-post
+++ b/scripts/ovirt-post
@@ -61,7 +61,11 @@ start() {
 
     find_srv identify tcp
     if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
-        ovirt-identify-node -s $SRV_HOST -p $SRV_PORT
+	if [ -n "$OVIRT_BOOTIF" ]; then
+            ovirt-identify-node -s $SRV_HOST -p $SRV_PORT -m $OVIRT_BOOTIF
+	else
+	    ovirt-identify-node -s $SRV_HOST -p $SRV_PORT
+	fi
     else
         log "skipping ovirt-identify-node, oVirt registration service not available"
     fi
-- 
1.6.0.6




More information about the ovirt-devel mailing list