All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben England <bengland@redhat.com>
To: fio@vger.kernel.org
Subject: suggested patch to let fio accept client ips from a file
Date: Sun, 15 Feb 2015 17:30:55 -0500 (EST)	[thread overview]
Message-ID: <968967006.10478476.1424039455959.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1797629778.10331443.1423937244266.JavaMail.zimbra@redhat.com>

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

           reply	other threads:[~2015-02-15 22:30 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1797629778.10331443.1423937244266.JavaMail.zimbra@redhat.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=968967006.10478476.1424039455959.JavaMail.zimbra@redhat.com \
    --to=bengland@redhat.com \
    --cc=fio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.