Add support for --remote-config
[fio.git] / init.c
diff --git a/init.c b/init.c
index 861b1f5fd0f466d35dfd9a12ed606b80f98e0b1d..a2377dc95e33c1499340037cae86b3b436ad2db6 100644 (file)
--- a/init.c
+++ b/init.c
@@ -216,6 +216,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
                .has_arg        = required_argument,
                .val            = 'C',
        },
+       {
+               .name           = (char *) "remote-config",
+               .has_arg        = required_argument,
+               .val            = 'R',
+       },
        {
                .name           = (char *) "cpuclock-test",
                .has_arg        = no_argument,
@@ -1424,7 +1429,10 @@ int __parse_jobs_ini(struct thread_data *td,
                        f = fopen(file, "r");
 
                if (!f) {
-                       perror("fopen job file");
+                       int __err = errno;
+
+                       log_err("fio: unable to open '%s' job file\n", file);
+                       td_verror(td, __err, "job file open");
                        return 1;
                }
        }
@@ -1683,6 +1691,7 @@ static void usage(const char *name)
        printf("  --server=args\t\tStart a backend fio server\n");
        printf("  --daemonize=pidfile\tBackground fio server, write pid to file\n");
        printf("  --client=hostname\tTalk to remote backend fio server at hostname\n");
+       printf("  --remote-config=file\tTell fio server to load this local job file\n");
        printf("  --idle-prof=option\tReport cpu idleness on a system or percpu basis\n"
                "\t\t\t(option=system,percpu) or run unit work\n"
                "\t\t\tcalibration only (option=calibrate)\n");
@@ -2174,10 +2183,18 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                                    !strncmp(argv[optind], "-", 1))
                                        break;
 
-                               fio_client_add_ini_file(cur_client, argv[optind]);
+                               if (fio_client_add_ini_file(cur_client, argv[optind], 0))
+                                       break;
                                optind++;
                        }
                        break;
+               case 'R':
+                       did_arg = 1;
+                       if (fio_client_add_ini_file(cur_client, optarg, 1)) {
+                               do_exit++;
+                               exit_val = 1;
+                       }
+                       break;
                case 'T':
                        did_arg = 1;
                        do_exit++;