cli: Fix 'status all' xml output when volumes are not started

CLI now only outputs one XML document for 'status all' only containing
those volumes which are started.

BUG: 1004218
Change-Id: Id4130fe59b3b74475d8bd1cc8134ac59a28f1b7e
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5773
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
rpc/rpc-lib: rpcsvc should reply when rpc_err is set

Problem:
When requests are received on a connection before setvolume
is done, creating frame from the requests fail because there is
no association of the transport with the conn(i.e. xl_private).
xl_private is set only on set_volume. In such cases error response
is not sent from server xlator to that request because of which
operations on mount point are hanging.

Fix:
Set actor return value to RPCSVC_ACTOR_ERROR so that response is sent
even in these cases.

Change-Id: I74d7bc6849fde6c734008d67c1f4bc9d9f7a84f9
BUG: 1006367
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/5892
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
doc: Steps to recover from split-brain

BUG: 1006776
Change-Id: I6f4bffe992758b2889df9ebfe117834dabe5c1cf
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/4216
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
mgmt/glusterd: Update sub_count on remove brick

Change-Id: I7c17de39da03c6b2764790581e097936da406695
BUG: 1002556
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-on: http://review.gluster.org/5893
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli: Add statusStr xml tag to task list and rebalance/remove brick status

New xml tag statusStr added to following gluster cli commands
gluster volume status all --xml (For Task status)
gluster volume rebalance <VOLNAME> status --xml
gluster volume remove-brick <VOLNAME> <BRICK1..> status --xml

Example(volume status all):
<task>
    <type>Rebalance</type>
    <id>82d8d122-8738-4144-8507-d93fc98b61df</id>
    <status>3</status>
    <statusStr>completed</statusStr>
</task>

Example(volume rebalance <VOL> status)
<node>
    <nodeName>localhost</nodeName>
    <files>0</files>
    <size>0</size>
    <lookups>0</lookups>
    <failures>0</failures>
    <status>3</status>
    <statusStr>completed</statusStr>
</node>

Also modified task status as string instead of showing number
in gluster volume status all

Example:
Status of volume: gv1
Gluster process                                         Port    Online  Pid
------------------------------------------------------------------------------
Brick sumne.sumne:/gfs/b1                               49154   Y       15489
Brick sumne.sumne:/gfs/b2                               49155   Y       15493
NFS Server on localhost                                 N/A     N       15913

           Task                                      ID         Status
           ----                                      --         ------
      Rebalance    82d8d122-8738-4144-8507-d93fc98b61df      completed

BUG: 1003521
Change-Id: Ib283016af4c18132fb13fb33d44075782d77823c
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/5739
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
tests/basic/rpm.t: run mock builds inside the current working directory

When running multiple mock builds at the same time, the space
requirements under /var/tmp increases as well. Not all systems (like
build.gluster.org) have enough free space in /var/tmp to host two
mock-roots, which causes building to fail randomly.

Change-Id: Iff1064d01893fb35ef59650d4373105068b5d3f7
BUG: 1006269
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/5899
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
qemu-block: fix building from distribution tarball when glib2-devel is installed

Building RPMs from a 'make dist' tarball fails when qemu-block is
enabled. Enabling is done automatically when the glib2 development files
are available (enabled by ./configure).

Manual building with:

  $ ./autogen.sh && ./configure && make dist && rpmbuild -ta *.tar.gz

Building in mock works fine, glib2-devel is not installed by default so
the qemu-block xlator gets disabled. This change also adds glib2-devel
to the BuildRequires in the glusterfs.spec file, causing the qemu-block
xlator to be built by default, and included in the glusterfs RPM.

Change-Id: Ibb73628772586d9e07bbfde7a8ff2fc973489086
BUG: 986775
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/5896
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli,glusterd: Task parameters in xml output

This patch introduces task parameters for the asynchronus task shown in
volume status. The parameters are only given for xml output. The
parameters shown currently are,
- source and destination bricks for replace-brick tasks
  ......
        <tasks>
          <task>
            <type>Replace brick</type>
            <id>3d1a1005-9d2e-4ae0-bd62-577bc1d333a3</id>
            <status>1</status>
            <params>
              <srcBrick>archm:/export/test4</srcBrick>
              <dstBrick>archm:/export/test-replace1</dstBrick>
            </params>
          </task>
        </tasks>
  ......
- list of bricks being removed for remove-brick tasks
  ......
        <tasks>
          <task>
            <type>Remove brick</type>
            <id>901c20ca-0da2-41de-8669-5f0caca6b846</id>
            <status>1</status>
            <params>
              <brick>archm:/export/test2</brick>
              <brick>archm:/export/test3</brick>
            </params>
          </task>
        </tasks>
  ......

The changes for non-xml output will be done in a subsequent patch.

Change-Id: I322afe2f83ed8adeddb99f7962c25911204dc204
BUG: 916577
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5771
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
mount/fuse: Implement forget in cbks for fuse.

With the introduction of inode_ctx_set in fuse as part of  2991503d014,
forget cbk gets called for fuse xlator. Though nothing needs to be done
inf forget_cbk, excessive log messages of the following kind are observed:

[2013-09-16 06:09:50.758063] W [defaults.c:1331:default_forget]
(-->/usr/local/lib/glusterfs/3git/xlator/mount/fuse.so(+0xa1f2) [0x7f51432781f2]
(-->/usr/local/lib/libglusterfs.so.0(inode_unref+0x3c) [0x7f5144e5
816c] (-->/usr/local/lib/libglusterfs.so.0(+0x2d061) [0x7f5144e58061]))) 0-fuse:
xlator does not implement forget_cbk

This patch prevents such log messages from being seen.
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
BUG: 979910
Change-Id: Ie5874138f46822b10ff4213bd1134d78330ec460
Reviewed-on: http://review.gluster.org/5932
Reviewed-by: Anand Avati <avati@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
geo-rep: retry in case of ENOENT errors in entry creations

Change-Id: I8961633a7371c941a3feee44c949d5c934eca998
Original-Author: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 847839
Reviewed-on: http://review.gluster.org/5933
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
glusterd : Blocking invalid values for geo-rep config options

Change-Id: Ia9ee44763a9c2798b26d3225bf03a974d7ece21f
BUG: 998962
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/5666
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
qemu-block: support readdirp

Support the readdirp fop in qemu-block to ensure that image files
are handled correctly when readdirp is enabled. E.g., without
readdirp support, incorrect stat data for formatted files can be
reported back (and cached) via the client.

BUG: 986775
Change-Id: Ibc4bd0b42548953ebe30832f3d853bb68095f0ac
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-on: http://review.gluster.org/5946
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gfapi: use native STACK_WIND for read _async() calls

There is little value in using synctask wrappers for async IO
requests, as STACK_WIND is asynchronous by nature already.

Skip going through synctask for read/write async calls.

Change-Id: Ifde331d7c97e0f33426da6ef4377c5ba70dddc06
BUG: 1009134
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/5897
gfapi: implement a minimial glfs_fini()

At the very least, we should PARENT_DOWN on the currently active
graph and disconnect ourselves from glusterd.

Further cleanups underway.

Change-Id: I9276686a84b0975b5ce272b4cbec1b80920d5c5c
BUG: 1004519
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/5788
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
rpcsvc: allocate large auxgid list on demand

For rpc requests having large aux group list, allocate large list
on demand. Else use small static array by default.

Without this patch, glusterfsd allocates 140+MB of resident memory
just to get started and initialized.

Change-Id: I3a07212b0076079cff67cdde18926e8f3b196258
Signed-off-by: Anand Avati <avati@redhat.com>
BUG: 953694
Reviewed-on: http://review.gluster.org/5927
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
fuse-bridge: enable --fopen-keep-cache based on FUSE_AUTO_INVAL_DATA.

If kernel supports FUSE_AUTO_INVAL_DATA then it is safe(r) to turn on
--fopen-keep-cache mode by default. Users report significant improvement
in perf by enabling the mode.

Change-Id: Icf9df4b7b43950d7e25302d9c2a1a7d14571a9a9
BUG: 990744
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/5770
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
cluster/distribute: Rebalance should also verify free inodes

Currently during `MIGRATE_DATA` we never verified about the total
inode usage among new and old bricks. Such checks are available for
disk space usage but it is also needed for inodes during data
migration. Such a check leads to uniform outcome of file distribution
upon rebalance.

Patch provides:

- Check dst_inodes < src_inodes, a friendly `warning` message to
  indicate we have to ignore such an attempt
- Rename __dht_check_free_space() --> __dht_check_free_space_and_inodes()

Change-Id: I7bc4dd8b507883f0fb836300e99f0bb083493f5f
BUG: 982919
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/5948
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Revert "cluster/distribute: Rebalance should also verify free inodes"

This reverts commit 215fea41a96479312a5ab8783c13b30ab9fe00fa

Realized soon after merging, that this patch is actually useless.
Checking for inode utilization on dst relative to src is of no use
because dst is already storing linkfile and inode is already consumed
no matter what. We might as well perform the rebalance and save on an
inode on the src node.

Change-Id: I7b8b8d35d9063a710e1bee1c7c6c7739fcc45ad4
Reviewed-on: http://review.gluster.org/5960
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Anand Avati <avati@redhat.com>
build: AM_PATH_XML2 needs proactive check

AM_PATH_XML2 needs check for its existence using
aclocal macros - to avoid problems like below when
libxml2 development libraries are not installed

--------------------------------------------------

... GlusterFS autogen ...

Generate gf-error-codes.h ...
`gf-error-codes.h' -> `libglusterfs/src/gf-error-codes.h'
Running aclocal...
configure.ac:524: warning: macro `AM_PATH_XML2' not found in library
Running autoheader...
Running libtoolize...
Running autoconf...
configure.ac:524: error: possibly undefined macro: AM_PATH_XML2
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Running automake...
--------------------------------------------------

Change-Id: Ife463c34c45babc1c4c0ed6e8128b5c43419b9b9
BUG: 947226
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Reviewed-on: http://review.gluster.org/5962
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
glusterd: Don't reset rebalance status on add-brick

The rebalance status was being reset to 'Not started' when add-brick was
performed. This would lead to odd cases where a 'rebalance status' on a
volume would show status as 'not started' but would also include the
rebalance statistics. This also affected the showing of asynchronus task
status in 'volume status' command.

By not resetting the status prevent the above issues from happening.
Since we use the running/not-running of the rebalance process as the
check when performing other operations we can safely leave the rebalance
stats collected on an add-brick.

Change-Id: I4c69d9c789d081c6de7e7a81dd0d4eba2e83ec17
BUG: 1006247
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5895
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>