From 95edc0dd8eab493f35b18aa1d0b66f32e1bcbf2d Mon Sep 17 00:00:00 2001 From: Nathan Rutman Date: Fri, 4 Jun 2010 15:53:53 -0700 Subject: [PATCH] b=15253 add failover nidlist to proc import i=adilger i=rread --- lustre/obdclass/lprocfs_status.c | 18 +++++++++++++++--- lustre/ptlrpc/client.c | 2 +- lustre/ptlrpc/events.c | 2 -- lustre/tests/conf-sanity.sh | 26 +++++++++++++++++++++++--- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 33fa27e..bb85e8e 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -794,6 +794,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); @@ -805,12 +806,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, @@ -823,9 +822,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: ["); + cfs_spin_lock(&imp->imp_lock); + j = 0; + cfs_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++; + } + cfs_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, cfs_atomic_read(&imp->imp_inval_count)); @@ -1803,7 +1815,7 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid) GOTO(destroy_new, rc = -ENOMEM); memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE); - new_stat->nid_proc = lprocfs_register(buffer, + new_stat->nid_proc = lprocfs_register(buffer, obd->obd_proc_exports_entry, NULL, NULL); OBD_FREE(buffer, LNET_NIDSTR_SIZE); diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 10287a5..993ecda 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -75,7 +75,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; } diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index 73aa87b..fbfee412 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -473,8 +473,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; } diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 17f8ec01..9c25930 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -926,7 +926,7 @@ test_29() { } run_test 29 "permanently remove an OST" -test_30() { +test_30a() { setup echo Big config llog @@ -939,7 +939,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 @@ -953,7 +953,27 @@ 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-????????*/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" + 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-????????*/import | grep failover_nids) + NIDCOUNT=$(echo "$NIDS" | wc -w) + echo "only 1 final nid should remain: $NIDS" + [ $NIDCOUNT -eq 2 ] || fail "Failover nids not removed" + pass + + cleanup +} +run_test 30b "Remove failover nids" test_31() { # bug 10734 # ipaddr must not exist -- 1.8.3.1