From ef3912940cf7274181eaf4ed5e24b5483f3e6ef5 Mon Sep 17 00:00:00 2001 From: rread Date: Sat, 15 Nov 2003 01:17:53 +0000 Subject: [PATCH] b=2250 create lctl commands set_lustre_upcall and set_timeout, so they can be saved as part of the 0conf log. --- lustre/include/linux/lustre_cfg.h | 4 +++- lustre/obdclass/llog_test.c | 4 ++-- lustre/obdclass/obd_config.c | 18 ++++++++++++++++ lustre/tests/test-framework.sh | 3 --- lustre/utils/lustre_cfg.c | 45 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 6 deletions(-) diff --git a/lustre/include/linux/lustre_cfg.h b/lustre/include/linux/lustre_cfg.h index 26d6573..a9a278f 100644 --- a/lustre/include/linux/lustre_cfg.h +++ b/lustre/include/linux/lustre_cfg.h @@ -34,13 +34,15 @@ enum lcfg_command_type { LCFG_DEL_UUID = 0x00cf006, LCFG_MOUNTOPT = 0x00cf007, LCFG_DEL_MOUNTOPT = 0x00cf008, + LCFG_SET_TIMEOUT = 0x00cf009, + LCFG_SET_UPCALL = 0x00cf010, }; struct lustre_cfg { uint32_t lcfg_version; uint32_t lcfg_command; - uint32_t lcfg_dev; + uint32_t lcfg_num; uint32_t lcfg_flags; uint64_t lcfg_nid; uint32_t lcfg_nal; diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index d2ec388..cdac552 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -589,8 +589,8 @@ static int llog_test_setup(struct obd_device *obd, obd_count len, void *buf) tgt = class_name2obd(lcfg->lcfg_inlbuf1); if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) { - CERROR("target device not attached or not set up (%d/%s)\n", - lcfg->lcfg_dev, lcfg->lcfg_inlbuf1); + CERROR("target device not attached or not set up (%s)\n", + lcfg->lcfg_inlbuf1); RETURN(-EINVAL); } diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index d8e21be..89626c6 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -483,6 +483,22 @@ int class_process_config(struct lustre_cfg *lcfg) class_del_profile(lcfg->lcfg_inlbuf1); GOTO(out, err = 0); } + case LCFG_SET_TIMEOUT: { + CDEBUG(D_IOCTL, "changing lustre timeout from %d to %d\n", + obd_timeout, + lcfg->lcfg_num); + obd_timeout = lcfg->lcfg_num; + GOTO(out, err = 0); + } + case LCFG_SET_UPCALL: { + CDEBUG(D_IOCTL, "setting lustre ucpall to: %s\n", + lcfg->lcfg_inlbuf1); + if (lcfg->lcfg_inllen1 > sizeof obd_lustre_upcall) + GOTO(out, err = -EINVAL); + memcpy(obd_lustre_upcall, lcfg->lcfg_inlbuf1, + lcfg->lcfg_inllen1); + GOTO(out, err = 0); + } } @@ -638,6 +654,8 @@ static int class_config_dump_handler(struct llog_handle * handle, lcfg->lcfg_nid); if (lcfg->lcfg_nal) CDEBUG(D_INFO, " nal: %x\n", lcfg->lcfg_nal); + if (lcfg->lcfg_num) + CDEBUG(D_INFO, " nal: %x\n", lcfg->lcfg_num); if (lcfg->lcfg_inlbuf1) CDEBUG(D_INFO, " inlbuf1: %s\n",lcfg->lcfg_inlbuf1); if (lcfg->lcfg_inlbuf2) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index bc9b5c4..238be40 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -60,9 +60,6 @@ zconf_mount() { fi [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname` - - echo $TIMEOUT > /proc/sys/lustre/timeout - echo $UPCALL > /proc/sys/lustre/upcall } zconf_umount() { diff --git a/lustre/utils/lustre_cfg.c b/lustre/utils/lustre_cfg.c index 20972e2..adbc384 100644 --- a/lustre/utils/lustre_cfg.c +++ b/lustre/utils/lustre_cfg.c @@ -489,3 +489,48 @@ int jt_lcfg_del_mount_option(int argc, char **argv) return rc; } +int jt_lcfg_set_timeout(int argc, char **argv) +{ + int rc; + struct lustre_cfg lcfg; + + LCFG_INIT(lcfg, LCFG_SET_TIMEOUT, lcfg_devname); + + if (argc != 2) + return CMD_HELP; + + lcfg.lcfg_num = atoi(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; +} + + +int jt_lcfg_set_lustre_upcall(int argc, char **argv) +{ + int rc; + struct lustre_cfg lcfg; + + LCFG_INIT(lcfg, LCFG_SET_UPCALL, lcfg_devname); + + if (argc != 2) + return CMD_HELP; + + /* profile name */ + 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; +} + -- 1.8.3.1