tests: make _EXPECT handle more cases

First issue is that _EXPECT wasn't handling args with spaces correctly. This
was fixed by enclosing the entire expected-value expression in double quotes
with a simple backslash escape for the end-of-line dollar sign.

Second issue is that we were throwing away potentially useful debug
information. Fixed by using egrep's -q option to suppress output, and
eliminating redirections so that we can see any stderr output related to a
script error.

Change-Id: Ide3f49558dcece55bd90cad50b1ffc572592f11c
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4126
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
debug/error-gen: add the short write pseudo-error

Add a separate enum for pseudo-errors in the debug/error-gen
translator and include a short write error. The short write error
causes writev requests to return with some non-error value less
than the size of the write request.

BUG: 853690
Change-Id: I50b7d328386a8b78d03ce91b4c2ec83e0d32c9aa
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4148
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
storage/posix: Make rchecksum O_DIRECT friendly

Problem:
When posix-aio is enabled to perform aio fd is set with O_DIRECT
whenever possible in read, writev fops. Rchecksum does not take
this into account. If either offset/size/memory-buf passed to
pread in rchecksum fop is not aligned, pread fails with EINVAL.

Fix:
Before doing pread necessary O_DIRECT manipulation is done when
aio is enabled. Memory buffer passed to pread is now page-aligned.

Test:
1) Create replica volume with aio enabled.
2) dd if=/dev/urandom of=a bs=1M count=1
3) kill one of the bricks in the replica pair
4) dd if=/dev/urandom of=a bs=1M count=1
5) bring back the brick. Self-heal succeeds after the change.

The test above checks both rchecksum, writev fops that were
changed in this patch.

Change-Id: I186099a2854d4864c5b48086ab7bc5f1a7b27313
BUG: 866459
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4134
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
posix: Fix volume will not start if brick has no volume-id attribute

Problem:
If the extended attribute (trusted.glusterfs.volume-id) of a brick  is
absent and <gluster volume start volume-name> command is executed then
curretly volume-id from the volume file will be set as an extended attribute of
the brick and volume will get started.
But if setup is such that brick is used as a mount point and before
executing the <gluster volume start volume-name> command, nothing is mounted on
the brick then all the file operations will take place at the brick but actual
intention of the brick is to be used as mount point only.

FIX:
Do not start the volume if extended attribute (trusted.glusterfs.volume-id)
is set absent.

Change-Id: Id2462d87d6087e97e0b8831512fdbc3595f7078b
BUG: 860297
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4202
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Put _check_key_is_zero_filled outside _xattrop_index_action

Change-Id: Ifb89a3a911213b2816a540a104558e7c3c13e23a
BUG: 874498
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/4182
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
libglusterfs: implement gf_strndup

Change-Id: Ifb7bf22e8cf4ad1faccf7999c36919693912093f
BUG: 808400
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.org/4135
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cluster/afr: check transaction type for eager-lock after it is set

Problem:
Eager locking lk-owner decision is taken before transaction
type is set. Default transaction type is DATA so all transactions
are treated as DATA transactions at the time of eager-locking
decision.

Fix:
Move the code that takes lk-owner decision after the transaction
type is set.

Test:
Checked that the transaction type is set properly in gdb at
the time of the lk-owner decision.

Change-Id: I7607c7ff4f88c7ced5416a1cddb6586cf45d88f9
BUG: 861335
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4220
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
perf/io-threads: least-rate-limit least priority throttling

The 'least-rate-limit' io-threads translator option enables
throttling of least priority operations. This is initially intended
as a debug/diagnostic tool for users who might experience
overloaded servers via background activity (i.e., self-heal).

least-rate-limit defines the maximum number of least priority
operations the io-threads translator will dequeue in one second.
If the specified rate limit is met, the worker threads sleep for
the minimal amount of time before the next least priority operation
becomes available (or until a new request arrives).

The requests/second metric is generic and relative to a variety of
factors involved with a background operation (server, storage,
etc.). The most recent measured rate ("cached least rate") is added
to the io-threads state dump content (kill -USR1) to serve as a
reference point to throttle background activity under particular
conditions.

Change-Id: I80f2282992137d57b1becaa5c6ae3858c066862a
BUG: 853680
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/4119
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Don't ignore all files that match (*o|*la|*lo)

This has been hiding files in my tree, in particular, new directories that end
with an "o". I am guessing here that these are really trying to just ignore
.o, .la and .lo files.

Change-Id: Ic438ca5c43188a63e9840512825f9ba05c359eeb
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4195
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pete Zaitcev <zaitcev@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
object-storage: del 1.4.8 ref from dir hierarchy

Remove the "swift/1.4.8" directory from the hierarchy, replacing it with "ufo".

Change-Id: I60ba171182d7402a2193616c1c95c90cd2ead5bc
BUG: 870589
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4200
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pete Zaitcev <zaitcev@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gsyncd / geo-rep: include hostname in status cmd

Including hostname of the node where geo-rep start was
initiated from. This helps any consumers of the status
command to identify and possibly issue commands on those
node(s).

Change-Id: I005083878a3a4794da3b7f3f7d2cc9d28f004e3f
BUG: 858218
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/4218
Reviewed-by: Csaba Henk <csaba@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
object-storage: Add a sorted list comparison to test

After the commit b0cb7aaf for bz#870589, which adds 2 tarballs
with layout patterns, Swift tests sometimes fail (depending on the
kind of filesystem they are running at and the phase of the moon).

As pattern tarball is unpacked, the underlying filesystem is free
to return directory listings in any order, and straightforward use
of '==' operator fails. As it turns out, one of the two comparisons
had set() applied to the list already. So, add it to the other one.

BUG: 874390
Change-Id: I02de99593b9567a13076113d58e242b079fde002
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Reviewed-on: http://review.gluster.org/4165
Reviewed-by: Peter Portante <pportant@redhat.com>
Tested-by: Peter Portante <pportant@redhat.com>
Use more portable mkstemp() instead fo mkostemp()

mkostemp() with O_CREAT|O_EXCL|O_RDWR|O_TRUNC|O_APPEND is mkstemp()
and mkstemp() is available on more systems than mkostemp()

NULL-commit to cause jankins ro rebuild

BUG: 764655
Change-Id: I6ee0f635d3699bd70b0963b24af07bd7d5c2dc58
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/4152
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cli: XML output for "geo-replication <VOL> {start|stop}"

Change-Id: I8d2213cc00deb458fb765b848d0e3452574cc98f
BUG: 864499
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4217
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
socket: fix double-free when ssl_setup_connection fails

Change-Id: I893b166da28f4c21e582ed477399c4bc0c1d20e1
BUG: 877903
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4208
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: brick path availability check only for local bricks

Change-Id: Ica50fb92608f5fd75f8887e0718177faf29d31c4
BUG: 877522
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4203
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: fix use of undefined realpath(3) result

Change-Id: Ic50ae192c99cece25cd63f2277fb440fca5f0b04
BUG: 877522
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4201
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
libglusterfs: Implement float percentage

Change-Id: Ia7ea63471f0bbd74686873f5f6f183475880f1a0
BUG: 839595
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.org/4162
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
mgmt/glusterd: Implementation of server-side quorum

Feature-page:
http://www.gluster.org/community/documentation/index.php/Features/Server-quorum

Change-Id: I747b222519e71022462343d2c1bcd3626e1f9c86
BUG: 839595
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.org/3811
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
tests: Add volume utils in a new file

Change-Id: Ie78d24ca466d4bddc5c0727ed8ed51707e1f2a34
BUG: 839595
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4228
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>