suggested patch to let fio accept client ips from a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following patch will allow fio to accept server IPs from a file.  This is particularly useful when you have large numbers of fio servers (example: virtual machine guests) that participate in a test.  To use this, simply use the --client option but instead of specifying a host name or IP, provide a pathname for a file containing a list of host names/addresses, one host per line.

--- init.c.sav	2015-02-08 05:39:33.507493776 -0500
+++ init.c	2015-02-08 06:00:14.479913391 -0500
@@ -2226,6 +2226,27 @@
 				exit_val = 1;
 				break;
 			}
+                        if (0 == access(optarg, R_OK)) {
+                                /* this is really a file containing a list of host addrs or names */
+                                char hostaddr[257] = {0};
+                                FILE * hostf = fopen(optarg, "r");
+                                if (!hostf) {
+                                        log_err("fio: could not open client list file %s for read\n", optarg);
+                                        do_exit++;
+                                        exit_val = 1;
+                                        break;
+                                }
+                                while (fscanf(hostf, "%s", hostaddr) == 1) {
+                                        if (fio_client_add(&fio_client_ops, hostaddr, &cur_client)) {
+                                                log_err("fio: failed adding client %s from file %s\n", hostaddr, optarg);
+                                                do_exit++;
+                                                exit_val = 1;
+                                                break;
+                                        }
+                                }
+                                fclose(hostf);
+                                break; /* no possibility of job file for "this client only" */
+                        }
 			if (fio_client_add(&fio_client_ops, optarg, &cur_client)) {
 				log_err("fio: failed adding client %s\n", optarg);
 				do_exit++;
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux