Whamcloud - gitweb
LU-1581 utils: support for multiple underlying devices
authorAlex Zhuravlev <bzzz@whamcloud.com>
Thu, 7 Jun 2012 07:22:22 +0000 (11:22 +0400)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 4 Jul 2012 22:29:24 +0000 (18:29 -0400)
will be used by zfs backend

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I90c3630d993811d702f81c838aae7344775cc115
Reviewed-on: http://review.whamcloud.com/3224
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Wei <liwei@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/utils/mkfs_lustre.c
lustre/utils/mount_utils.h

index a7f09f9..21f7d19 100644 (file)
@@ -177,6 +177,7 @@ void set_defaults(struct mkfs_opts *mop)
 
         mop->mo_ldd.ldd_svindex = INDEX_UNASSIGNED;
         mop->mo_stripe_count = 1;
+       mop->mo_pool_vdevs = NULL;
 }
 
 static inline void badopt(const char *opt, char *type)
@@ -479,16 +480,20 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
                 }
         }//while
 
-        /* Last arg is device */
-        if (optind != argc - 1) {
-                fatal();
-                fprintf(stderr, "Bad argument: %s\n", argv[optind]);
-                return EINVAL;
-        }
-
-        /* single argument: <device> */
-        if (argc == 2)
-                ++print_only;
+       if (optind == argc) {
+               /* The user didn't specify device name */
+               fatal();
+               fprintf(stderr, "Not enough arguments - device name or "
+                       "pool/dataset name not specified.\n");
+               return EINVAL;
+       } else {
+               /*  The device or pool/filesystem name */
+               strscpy(mop->mo_device, argv[optind], sizeof(mop->mo_device));
+
+               /* Followed by optional vdevs */
+               if (optind < argc - 1)
+                       mop->mo_pool_vdevs = (char **) &argv[optind + 1];
+       }
 
         return 0;
 }
index 8d99255..6033b58 100644 (file)
@@ -59,6 +59,7 @@ extern int failover;
 struct mkfs_opts {
        struct lustre_disk_data mo_ldd; /* to be written in MOUNT_DATA_FILE */
        char    mo_device[128];   /* disk device name */
+       char    **mo_pool_vdevs;  /* list of pool vdevs */
        char    mo_loopdev[128];  /* in case a loop dev is needed */
        char    mo_mkfsopts[512]; /* options to the backing-store mkfs */
        __u64   mo_device_sz;     /* in KB */