Whamcloud - gitweb
b=15253 add failover nidlist to proc import
authorNathan Rutman <nathan.rutman@oracle.com>
Wed, 9 Jun 2010 20:44:50 +0000 (13:44 -0700)
committerJohann Lombardi <johann@sun.com>
Wed, 9 Jun 2010 21:38:54 +0000 (23:38 +0200)
i=adilger
i=rread

lustre/obdclass/lprocfs_status.c
lustre/ptlrpc/client.c
lustre/ptlrpc/events.c
lustre/tests/conf-sanity.sh

index 4804834..cdaf4e4 100644 (file)
@@ -772,6 +772,7 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count,
         struct lprocfs_counter ret;
         struct obd_device *obd = (struct obd_device *)data;
         struct obd_import *imp;
+        struct obd_import_conn *conn;
         int i, j, k, rw = 0;
 
         LASSERT(obd != NULL);
@@ -783,12 +784,10 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count,
                      "import:\n"
                      "    name: %s\n"
                      "    target: %s\n"
-                     "    current_connection: %s\n"
                      "    state: %s\n"
                      "    connect_flags: [",
                      obd->obd_name,
                      obd2cli_tgt(obd),
-                     imp->imp_connection->c_remote_uuid.uuid,
                      ptlrpc_import_state_name(imp->imp_state));
         i += obd_connect_flags2str(page + i, count - i,
                                    imp->imp_connect_data.ocd_connect_flags,
@@ -801,9 +800,22 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count,
         i += snprintf(page + i, count - i,
                       "]\n"
                       "    connection:\n"
+                      "       failover_nids: [");
+        spin_lock(&imp->imp_lock);
+        j = 0;
+        list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
+                i += snprintf(page + i, count - i, "%s%s", j ? ", " : "",
+                              libcfs_nid2str(conn->oic_conn->c_peer.nid));
+                j++;
+        }
+        spin_unlock(&imp->imp_lock);
+        i += snprintf(page + i, count - i,
+                      "]\n"
+                      "       current_connection: %s\n"
                       "       connection_attempts: %u\n"
                       "       generation: %u\n"
                       "       in-progress_invalidations: %u\n",
+                      libcfs_nid2str(imp->imp_connection->c_peer.nid),
                       imp->imp_conn_cnt,
                       imp->imp_generation,
                       atomic_read(&imp->imp_inval_count));
index b1222d8..5c58d3a 100644 (file)
@@ -66,7 +66,7 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid)
 
         err = ptlrpc_uuid_to_peer(uuid, &peer, &self);
         if (err != 0) {
-                CERROR("cannot find peer %s!\n", uuid->uuid);
+                CDEBUG(D_NETERROR, "cannot find peer %s!\n", uuid->uuid);
                 return NULL;
         }
 
index a89fe71..194a0e0 100644 (file)
@@ -470,8 +470,6 @@ int ptlrpc_uuid_to_peer (struct obd_uuid *uuid,
         }
 
         CDEBUG(D_NET,"%s->%s\n", uuid->uuid, libcfs_id2str(*peer));
-        if (rc != 0) 
-                CERROR("No NID found for %s\n", uuid->uuid);
         return rc;
 }
 
index 32b00e5..ee329ae 100644 (file)
@@ -1056,7 +1056,7 @@ test_29() {
 }
 run_test 29 "permanently remove an OST"
 
-test_30() {
+test_30a() {
        setup
 
        echo Big config llog
@@ -1069,7 +1069,7 @@ test_30() {
        # make sure client restart still works
        umount_client $MOUNT
        mount_client $MOUNT || return 4
-       [ "$($TEST)" -ne "$i" ] && return 5
+       [ "$($TEST)" -ne "$i" ] && error "Param didn't stick across restart $($TEST) != $i"
        pass
 
        echo Erase parameter setting
@@ -1083,7 +1083,32 @@ test_30() {
 
        cleanup
 }
-run_test 30 "Big config llog and conf_param deletion"
+run_test 30a "Big config llog and conf_param deletion"
+
+test_30b() {
+       setup
+
+       NEW="1.2.3.4@tcp"
+       TEST="lctl get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
+       set_and_check client "$TEST" "$FSNAME-OST0000.failover.node" $NEW || error "didn't add failover nid $NEW"
+       NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+       echo $NIDS
+       NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
+       echo "should have 2 failover nids: $NIDCOUNT"
+       [ $NIDCOUNT -eq 2 ] || error "Failover nid not added"
+       do_facet mgs "$LCTL conf_param -d $FSNAME-OST0000.failover.node" || error "conf_param delete failed"
+       umount_client $MOUNT
+       mount_client $MOUNT || return 3
+
+       NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
+       echo $NIDS
+       NIDCOUNT=$(($(echo "$NIDS" | wc -w) - 1))
+       echo "only 1 final nid should remain: $NIDCOUNT"
+       [ $NIDCOUNT -eq 1 ] || error "Failover nids not removed"
+
+       cleanup
+}
+run_test 30b "Remove failover nids"
 
 test_31() { # bug 10734
         # ipaddr must not exist