Whamcloud - gitweb
b=2250
authorrread <rread>
Sat, 15 Nov 2003 01:17:53 +0000 (01:17 +0000)
committerrread <rread>
Sat, 15 Nov 2003 01:17:53 +0000 (01:17 +0000)
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
lustre/obdclass/llog_test.c
lustre/obdclass/obd_config.c
lustre/tests/test-framework.sh
lustre/utils/lustre_cfg.c

index 26d6573..a9a278f 100644 (file)
@@ -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;
index d2ec388..cdac552 100644 (file)
@@ -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);
         }
 
index d8e21be..89626c6 100644 (file)
@@ -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)
index bc9b5c4..238be40 100644 (file)
@@ -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() {
index 20972e2..adbc384 100644 (file)
@@ -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;
+}
+