Flexible I/O Tester development
 help / color / mirror / Atom feed
* suggested patch to let fio accept client ips from a file
       [not found] <1797629778.10331443.1423937244266.JavaMail.zimbra@redhat.com>
@ 2015-02-15 22:30 ` Ben England
  0 siblings, 0 replies; only message in thread
From: Ben England @ 2015-02-15 22:30 UTC (permalink / raw)
  To: fio

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++;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-15 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1797629778.10331443.1423937244266.JavaMail.zimbra@redhat.com>
2015-02-15 22:30 ` suggested patch to let fio accept client ips from a file Ben England

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox