From: ericm Date: Sun, 25 Jul 2004 18:03:01 +0000 (+0000) Subject: land b_bug3262 onto b1_4. X-Git-Tag: v1_7_70~2^33~5 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9479a0b145d66efeca450c9aa4c65abf9f175b74;p=fs%2Flustre-release.git land b_bug3262 onto b1_4. b=3262, r=Robert for client obd device, we could freely add/delete connections to possible targets. if one connection out of work (timeout, etc) we'll try the backup connections round robinly, so client recovery could be no upcalls. but it also compatible to original upcalls for special need. --- diff --git a/lustre/utils/lustre_cfg.c b/lustre/utils/lustre_cfg.c index 3629d0a..a5a708a 100644 --- a/lustre/utils/lustre_cfg.c +++ b/lustre/utils/lustre_cfg.c @@ -535,3 +535,69 @@ int jt_lcfg_set_lustre_upcall(int argc, char **argv) return rc; } +int jt_lcfg_add_conn(int argc, char **argv) +{ + struct lustre_cfg lcfg; + int priority; + int rc; + + if (argc == 2) + priority = 0; + else if (argc == 3) + priority = 1; + else + return CMD_HELP; + + if (lcfg_devname == NULL) { + fprintf(stderr, "%s: please use 'cfg_device name' to set the " + "device name for config commands.\n", + jt_cmdname(argv[0])); + return -EINVAL; + } + + LCFG_INIT(lcfg, LCFG_ADD_CONN, lcfg_devname); + + /* connection uuid */ + lcfg.lcfg_inllen1 = strlen(argv[1]) + 1; + lcfg.lcfg_inlbuf1 = argv[1]; + lcfg.lcfg_inllen2 = sizeof(int); + lcfg.lcfg_inlbuf2 = (char*) &priority; + + rc = lcfg_ioctl(argv[0], OBD_DEV_ID, &lcfg); + if (rc < 0) { + fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]), + strerror(rc = errno)); + } + + return rc; +} + +int jt_lcfg_del_conn(int argc, char **argv) +{ + struct lustre_cfg lcfg; + int rc; + + if (argc != 2) + return CMD_HELP; + + if (lcfg_devname == NULL) { + fprintf(stderr, "%s: please use 'cfg_device name' to set the " + "device name for config commands.\n", + jt_cmdname(argv[0])); + return -EINVAL; + } + + LCFG_INIT(lcfg, LCFG_DEL_CONN, lcfg_devname); + + /* connection uuid */ + lcfg.lcfg_inllen1 = strlen(argv[1]) + 1; + lcfg.lcfg_inlbuf1 = argv[1]; + + rc = lcfg_ioctl(argv[0], OBD_DEV_ID, &lcfg); + if (rc < 0) { + fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]), + strerror(rc = errno)); + } + + return rc; +}