cli: Fix time_t conversions

BUG: 828058
Change-Id: I2511a0473d9310d3a51d0994f415a5d319bfc98b
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3550
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
mgmt/glusterd: fix the infinite loop in lazy uuid generation

* This is how the lazy uuid generation leads to infinite loop of function calls.
 MY_UUID -> glusterd_uuid_init -> glusterd_retrieve_uuid -> MY_UUID

* Also while starting glusterd if valgrind option is not given in the volfile,
  then reset the ret variable to 0.

Change-Id: Ief719f436d8a264a591ee6aefc6da3c0f6c75e8f
BUG: 811493
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3564
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
geo-rep: checkpointing

- gluster vol geo-rep M S conf checkpoint <LABEL|now>

  sets a checkpoint with LABEL (the keyword "now" is special,
  it's rendered to the label "as of <timestamp of current time>")
  that's used to refer to the checkpoint in the sequel.

  (Technically, gsyncd makes a note of the xtime of master's root
  as of setting the checkpoint, called the "checkpoint target".)

- gluster vol geo-rep M S conf \!checkpoint

  deletes the checkpoint.

- gluster vol geo-rep M S stat

  if status is OK, and there is a checkpoint configured, the checkpoint
  info is appended to status (either "not yet reached", or
  "completed at <timestamp of completion>").

  (Technically, the worker runs a thread that monitors / serializes /
  verifies checkpoint status, and answers checkpoint status requests
  through a UNIX socket; monitoring boils down to querying the xtime
  of slave's root and comparing with the target.)

- gluster vol geo-rep M S conf log-file | xargs grep checkpoint

  displays the checkpoint history. Set, delete and completion events
  are logged properly.

Change-Id: I4398e0819f1504e6e496b4209e91a0e156e1a0f8
BUG: 826512
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3491
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
gsyncd / geo-rep : failover/failback

This commit is based on Venky Shankar <vshankar@>'s
original implementation. Let us first quote Venky's
description, then we summarize changes to his work.

------
First version of failover/failback.

Failback mechanism uses two exclusive modes:
  * blind-sync
    This mode works with xtime pairs (both master and slave) to
    identify candidated to sync the original master from the slave

  * wrapup-sync
    This mode is similar to the normal working of gsyncd except
    that orphaned entities in the gluster volume are not assigned
    xtimes. This prevents un-necessary transfer of data for such
    entities.

Modes can be enabled via:

  gluster volume geo-replication M S config special_sync_mode blind
  gluster volume geo-replication M S config special_sync_mode wrapup

To turn off the special modes (i.e. to revert to normal gsyncd behaviour) use:

  gluster volume geo-replication colon-d0 192.168.1.2::colon-d config \!special_sync_mode
------

Code has been refactored to meet following goals:

- make checkpointing work with special sync modes
- move out sync mode related conditionals from the crawl
  loop and make all decisions to be made at startup
  time
- be intrusive to the crawl loop to smallest possible degree
  (we will have to change/revisit it for other reasons,
  and the complexity of that should not increase)

So, xtime parsing/updating/evaluation that's specific to
the certain special modes are represented as mixin classes;
basic operation logic is in an abstract base class.
On startup, special-sync-mode tunable is dynamically dispatched
to the corresponding mixin and the actual master class is
derived from the chosen mixin and the ABS.

Change-Id: Ic9b8448f31ad4239a8200dc689f7d713662a67de
BUG: 830497
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3541
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
debug/io-stats: do not store the string allocated from stack into dict

* Unlock if some error happens after the lock is held

* White space cleanup

Change-Id: If90d9a9ae91c485bb21b1ad222af445981edb77b
BUG: 769826
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3565
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
rpc-transport/rdma: decode and handle RDMA_ERROR msgs.

RDMA_ERROR msgs are resulted as part of failure to decode requests
or failure to send reply (for eg., reply being bigger than a msg
that can be sent inline, but client has not provided any write-chunks
to rdma-write into).

Change-Id: I0184cfb5ff8f49ed892767345e32e6c7b01c49e7
BUG: 822337
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Reviewed-on: http://review.gluster.com/3474
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cli: Change cli output for heal commands

Change-Id: I05011ba7c1fe79867e151672622e9d8669884dd2
BUG: 826406
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3544
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Treat EEXIST as success in hardlink

BUG: 831151
Change-Id: I6ecc099cf5f3ae58b19dfb00ed0b3f9959e711e5
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3571
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
debug/io-stats: if some dict operation fails then goto out instead of proceeding

Change-Id: I9c6d9b48c6162f6be2b405bacfc97605909c4e5e
BUG: 769826
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3569
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
cluster/afr: Don't reset split-brain when data-self-heal is off

BUG: 804606
Change-Id: I8cefcb6efa687fac4ad412403c085b3767218f72
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.com/3586
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>