summaryrefslogtreecommitdiffstats
path: root/cli/src
Commit message (Collapse)AuthorAgeFilesLines
* All: run codespell on the code and fix issues.Yaniv Kaul2018-07-224-6/+6
| | | | | | | | | | | | Please review, it's not always just the comments that were fixed. I've had to revert of course all calls to creat() that were changed to create() ... Only compile-tested! Change-Id: I7d02e82d9766e272a7fd9cc68e51901d69e5aab5 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* Fix compile warningsXavi Hernandez2018-07-101-5/+5
| | | | | | | | | | | This patch fixes compile warnings that appear with newer compilers. The solution applied is only to remove the warnings, but it doesn't always solve the problem in the best way. It assumes that the problem will never happen, as the previous code assumed. Change-Id: I6e8470d6c2e2dbd3bd7d324b5fd2f92ffdc3d6ec updates: bz#1193929 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* cli: change volume create syntax of arbiter volumeAmar Tumballi2018-07-031-25/+31
| | | | | | | fixes: bz#1596524 updates: gluster/glusterd2#515 Change-Id: I8a46fa2fd1fd2b0e9fbcecd3bb18d348aed9c6a9 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* glusterd: glusterd is releasing the locks before timeoutSanju Rakonde2018-05-281-0/+22
| | | | | | | | | | | | | | | | | | | Problem: We introduced lock timer in mgmt v3, which will realease the lock after 3 minutes from command execution. Some commands related to heal/profile will take more time to execute. For these comands timeout is set to 10 minutes. As the lock timer is set to 3 minutes glusterd is releasing the lock after 3 minutes. That means locks are released before the command is completed its execution. Solution: Pass a timeout parameter from cli to glusterd, when there is a change in default timeout value(i.e, default timeout value can be changed through command line or for the commands related to profile/heal we will change the default timeout value to 10 minutes.) glusterd will set the lock timer timeout according to the timeout value passed. Change-Id: I7b7a9a4f95ed44aca39ef9d9907f546bca99c69d fixes: bz#1577731 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* cli: Fix for gluster volume info --xmlSanju Rakonde2018-05-151-2/+2
| | | | | | | | | | | | Problem: gluster volume info --xml is showing same uuid to all the bricks of a tier volume. Solution: While iterating over hot/cold bricks of a tier volume, use correct iterator. Fixes: bz#1577627 Change-Id: Icf6a9c2a10b9da453abc262a57b7884d6638e3ed Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* cli/snapshot: ignore errors for snapshot status for ALL/VOLThomas Hindoe Paaboel Andersen2018-05-041-1/+1
| | | | | | | | | | | | | | | | | Currently errors are reported for snapshot status of type ALL and VOL. The intention was to ignore those, but the code gets it wrong. The original condition for ignoring ALL/VOL was removed in Bug 1096610 Change-Id Ifc0ac31d2a9f91e136e87f3b51a629df7dba94e8 And the current logic introduced in Bug 789278 Change-Id I985cea1ef787d239b2632d5a7f467070846f92e4 Change-Id: Ic02ea98fb23b1149264e91b41f2fc2ca916d405f Fixes: bz#1574259 Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
* cli/glusterd: Add warning message in cli for user to checkSusant Palai2018-05-033-8/+26
| | | | | | | | | | | | | | | | | | | | force-migration config for remove-brick operation. The cli will take input from the user before starting "remove-brick" start operation. The message/confirmation looks like the following: <Running remove-brick with cluster.force-migration enabled can result in data corruption. It is safer to disable this option so that files that receive writes during migration are not migrated. Files that are not migrated can then be manually copied after the remove-brick commit operation. Do you want to continue with your current cluster.force-migration settings? (y/n)> And also question for COMMIT_FORCE is changed. Fixes: bz#1572586 Change-Id: Ifdb6b108a646f50339dd196d6e65962864635139 Signed-off-by: Susant Palai <spalai@redhat.com>
* Make glusterfsd binary print statedump & xlator dirPrashanth Pai2018-04-192-7/+0
| | | | | | | | | | | | | | | | | | | | | | | The glusterd2 needs following options, some of which are provided by gluster CLI today: --print-xlatordir --print-statedumpdir --print-logdir However, the CLI package need not be present on the machine running glusterd2. This change adds the above CLI options to glusterfsd binary which glusterd2 depends on. Reverts 9a1ae47c8d60836ae0628a04a153f28c1085c0e8 Related changes: https://review.gluster.org/#/c/19882/ https://github.com/gluster/glusterd2/pull/663 Updates: bz#1193929 Change-Id: I18c123b0d3350d2bd4f2400783e3b94e402a4e29 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Add CLI option to print XLATORDIRPrashanth Pai2018-04-182-0/+7
| | | | | | | | | | | | | | | | | | glusterfs gets the path to xlator dir from a compile time flag named XLATORDIR which gets passed through a -D flag to GCC. This path is used to find and load xlator shared objects. The XLATORDIR path isn't easily accessible to glusterd2. Glusterd2 currently uses the following command (hack) to get value of XLATORDIR: $ strings -d `which glusterfsd` | awk '/glusterfs/*/xlator$/' This change introduces "print-xlatordir" CLI option to expose XLATORDIR. The option is intentionally not documented. Updates: bz#1193929 Change-Id: Ic7247457600f11cd8d68eb3d0ad2526fdfda0b02 Signed-off-by: Prashanth Pai <ppai@redhat.com>
* glusterd: TLS verification fails while using intermediate CAMohit Agrawal2018-03-191-0/+1
| | | | | | | | | | | | | | | | | | | | | Problem: TLS verification fails while using intermediate CA if mgmt SSL is enabled. Solution: There are two main issue of TLS verification failing 1) not calling ssl_api to set cert_depth 2) The current code does not allow to set certificate depth while MGMT SSL is enabled. After apply this patch to set certificate depth user need to set parameter option transport.socket.ssl-cert-depth <depth> in /var/lib/glusterd/secure_acccess instead to set in /etc/glusterfs/glusterd.vol. At the time of set secure_mgmt in ctx we will check the value of cert-depth and save the value of cert-depth in ctx.If user does not provide any value in cert-depth in that case it will consider default value is 1 BUG: 1555154 Change-Id: I89e9a9e1026e37efb5c20f9ec62b1989ef644f35 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* build: add --without-server optionNiels de Vos2018-02-191-0/+2
| | | | | | | | | | | | | | | | With Gluster 4.0 we will not provide the server components for EL6 and older. At one point Gluster 4.x will get GlusterD2, which requires Golang tools in the distribution. EL6 does not contain these at the moment. With this change, it is possible to `./configure --without-server` which prevents building glusterd and the xlators for the bricks. Building RPMs can pass `--without server` and the glusterfs-server sub-package will not be created. Change-Id: I97f5ccf9f2c76e60d9af83915fc59fae57ad6d25 BUG: 1074947 Signed-off-by: Niels de Vos <ndevos@redhat.com>
* bitrot : improved cli report after bitrot operatoinSunny Kumar2018-02-011-0/+57
| | | | | | | | | | Improved cli report post bitrot opertaion as previously it was showing output "volume bitrot: success" for all the sucessfull bitrot operations (enable, disable or scrub options). Change-Id: I0857e99f3956221a51cfd1b29a90e1038b90570f BUG: 1539166 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* cli: Fixed a use_after_freeN Balachandran2018-01-041-1/+2
| | | | | | | | | gf_event in cli_cmd_volume_create_cbk was accessing memory that had already been freed. Change-Id: I447c939fa9b31e18819a62c3b356c14cca390787 BUG: 1530910 Signed-off-by: N Balachandran <nbalacha@redhat.com>
* cli: Fixed coverity issue in cli-cmd-system.cXavier Hernandez2017-12-201-1/+22
| | | | | | | | | | | This patch adds a missing check of the return value of strtok_r() and returns an error if it's NULL. It also fixes a couple of leaks. Change-Id: Ib15d6f843516e44c3bd8790a2e3ad936e357f6d4 BUG: 789278 Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
* libglusterfs: specify ctx in gf_log_set_loglevelZhang Huan2017-12-061-2/+2
| | | | | | | | | specify ctx in gf_log_set_loglevel, instead of getting it from a thread specific variable. Change-Id: I498f826e8e32231235a6b0005026a27c327727fd BUG: 1521213 Signed-off-by: Zhang Huan <zhanghuan@open-fs.com>
* cli: Fix coverity errors for cli-rpc-ops.cKaushal M2017-11-211-34/+106
| | | | | | | | | | | | | Fixes issues 147, 168, 169, 219, 715, 718, 766, 768, 772, 774, 776, 782, 790 from the report at [1]. Also, fixed some other possible static checker errors as well. [1]: https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ BUG: 789278 Change-Id: I985cea1ef787d239b2632d5a7f467070846f92e4 Signed-off-by: Kaushal M <kaushal@redhat.com>
* cli: Fix coverity issues in cli.cMohammed Rafi KC2017-11-081-1/+0
| | | | | | | | This patch fixes coverity issue 536 BUG: 789278 Change-Id: I9fe7b324a3ab1f16b4ee4e63818f93ef71d3405a Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* cli: Fix several coverity issues in cli-cmd-parser.cXavier Hernandez2017-11-071-99/+173
| | | | | | | | | | | | | | This patch fixes coverity issues 115, 191, 274, 462, 463, 508, 588, 612, 614, 618 and 698 from [1]. Also removed the need for some relatively big arrays as local variables of some functions. [1] https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ Change-Id: I4f435dbdbedc1b6de067084cce3050b620b28391 BUG: 789278 Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
* cli: correct rebalance status elapsed checkN Balachandran2017-11-071-1/+5
| | | | | | | | | Check that elapsed time has crossed 10 mins for at least one rebalance process before displaying the estimates. Change-Id: Ib357a6f0d0125a178e94ede1e31514fdc6ce3593 BUG: 1479528 Signed-off-by: N Balachandran <nbalacha@redhat.com>
* cli: Fix several coverity issues in cli-cmd-volume.cXavier Hernandez2017-11-031-5/+4
| | | | | | | | | | This patch fixes issues 133, 486, 487 and 691 from [1] [1] https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ Change-Id: I1a6ca4870ac105ea4c634fc18293229a56ab8596 BUG: 789278 Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
* cli: Fixed coverity issue in cli-cmd-snapshot.cXavier Hernandez2017-11-021-4/+0
| | | | | | | | | | This patch fixes issue 132 from [1]. [1] https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ Change-Id: I50952614e7edb6dbb1ec70383f1dc58ce1738c2f BUG: 789278 Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
* cli: gluster help changesN Balachandran2017-11-027-76/+387
| | | | | | | | | | gluster cli help now shows only the top level help commands. gluster <component> help will now show help commands for <component>. Change-Id: I263f53a0870d80ef4cfaad455fdaa47e2ac4423b BUG: 1474768 Signed-off-by: N Balachandran <nbalacha@redhat.com>
* gluster: IPv6 single stack supportKevin Vigor2017-10-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: - This diff changes all locations in the code to prefer inet6 family instead of inet. This will allow change GlusterFS to operate via IPv6 instead of IPv4 for all internal operations while still being able to serve (FUSE or NFS) clients via IPv4. - The changes apply to NFS as well. - This diff ports D1892990, D1897341 & D1896522 to the 3.8 branch. Test Plan: Prove tests! Reviewers: dph, rwareing Signed-off-by: Shreyas Siravara <sshreyas@fb.com> Change-Id: I34fdaaeb33c194782255625e00616faf75d60c33 BUG: 1406898 Reviewed-on-3.8-fb: http://review.gluster.org/16059 Reviewed-by: Shreyas Siravara <sshreyas@fb.com> Tested-by: Shreyas Siravara <sshreyas@fb.com>
* geo-rep/scheduler: Add validation for session existenceKotresh HR2017-10-061-1/+1
| | | | | | | | | Added validation to check for session existence to give out proper error message out. Change-Id: I13c5f6ef29c1395cff092a14e1bd2c197a39f058 BUG: 1499159 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* cli/afr: gluster volume heal info "healed" command output is not appropriateMohit Agrawal2017-10-043-17/+8
| | | | | | | | | | | | | | | | | | | | | | | | Problem: "gluster volume heal info [healed] [heal-failed]" command output on terminal is not appropriate in case of down any volume. Solution: To make message more appropriate change the condition in function "gd_syncop_mgmt_brick_op". Test : To verify the fix followed below procedure 1) Create 2*3 distribute replicate volume 2) set self-heal daemon off 3) kill two bricks (3, 6) 4) create some file on mount point 5) bring brick 3,6 up 6) kill other two brick (2 and 4) 7) make self heal daemon on 8) run "gluster v heal <vol-name>" Note: After apply the patch options (healed | heal-failed) will deprecate from command line. BUG: 1388509 Change-Id: I229c320c9caeb2525c76b78b44a53a64b088545a Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* cli: fix Coverity warning DEADCODE in gf_cli_attach_tier()Mohammed Azhar Padariyakam2017-09-291-3/+0
| | | | | | | | | | | | | | | Issue : At condition "ret", the value of "ret" must be equal to 0. The condition "ret" cannot be true since the value is always 0. Hence, the execution cannot reach the statement "goto out" Solution : The never-true if-condition and its body has to be removed Fix : The always false if-condition and the dead code under this if-condition was removed. Change-Id: I5c038b8ec9abf9b2f06dcfd981904b9dca1a0094 BUG: 789278 Signed-off-by: Mohammed Azhar Padariyakam <mpadariy@redhat.com>
* stack.h:PW.INCLUDE_RECURSIONSanju Rakonde2017-09-291-1/+0
| | | | | | | | | | | | | | | | | | | The headerfile globals.h is recursively adding itself. ( globals.h -> xlator.h -> stack.h -> globals.h). We are finding the source files which are including the header file globals.h and removing the inclusion line. I used git grep -l stack.h | xargs git grep globals.h -- to find out the files and removed the header file from all files except libglusterfs/src/xlator.h and libglusterfs/src/Makefile.am When I try to remove header file from libglusterfs/src/xlator.h I'm getting some errors. In libglusterfs/src/Makefile.am it is required for building RPMs. Change-Id: I537218c09ade6d7ea51717768b26563a247daf60 BUG: 789278 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* cli: Bypass the confirmation question creating replica 2 volume with forcekarthik-us2017-09-211-13/+17
| | | | | | | | | | | When a replica 2 volume is created with the force option, remove the warning message with the confirmation question, whether they want to continue or not and Succeed the volume creation. Change-Id: I4f3306659fa4cbf53dd8d45269a32d19ce86ac88 BUG: 1493893 Signed-off-by: karthik-us <ksubrahm@redhat.com>
* events : Add brick list in EVENT_VOLUME_CREATEAtin Mukherjee2017-09-183-5/+8
| | | | | | | | | | | Change-Id: Ibf87ae5ca57f9d27c036f329a30c8f81b51c52bf BUG: 1492109 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/18306 Reviewed-by: Prashanth Pai <ppai@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* heal: New feature heal info summary to list the status of brick and count of ↵Mohamed Ashiq Liyazudeen2017-09-153-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | entries to be healed Command output: Brick 192.168.2.8:/brick/1 Status: Connected Total Number of entries: 363 Number of entries in heal pending: 362 Number of entries in split-brain: 0 Number of entries possibly healing: 1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <cliOutput> <healInfo> <bricks> <brick hostUuid="9105dd4b-eca8-4fdb-85b2-b81cdf77eda3"> <name>192.168.2.8:/brick/1</name> <status>Connected</status> <totalNumberOfEntries>363</numberOfEntries> <numberOfEntriesInHealPending>362</numberOfEntriesInHealPending> <numberOfEntriesInSplitBrain>0</numberOfEntriesInSplitBrain> <numberOfEntriesPossiblyHealing>1</numberOfEntriesPossiblyHealing> </brick> </bricks> </healInfo> <opRet>0</opRet> <opErrno>0</opErrno> <opErrstr/> </cliOutput> Change-Id: I40cb6f77a14131c9e41b292f4901b41a228863d7 BUG: 1261463 Signed-off-by: Mohamed Ashiq Liyazudeen <mliyazud@redhat.com> Reviewed-on: https://review.gluster.org/12154 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: Karthik U S <ksubrahm@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* Use the new URL for the docsMichael Scherer2017-09-071-1/+1
| | | | | | | | | | | | | Change-Id: I0ef5c3980aed24a9fa2dda673f8293771ce81808 BUG: 1487644 Signed-off-by: Michael Scherer <misc@redhat.com> Reviewed-on: https://review.gluster.org/18182 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Nigel Babu <nigelb@redhat.com> Tested-by: Nigel Babu <nigelb@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Tested-by: Michael Scherer <misc@fedoraproject.org> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* Command to identify client processhari gowtham2017-09-063-2/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | command: gluster volume status <volname/all> client-list output: Client connections for volume v1 Name count ----- ------ fuse 2 tierd 1 total clients for volume v1 : 3 ----------------------------------------------------------------- Client connections for volume v2 Name count ----- ------ tierd 1 fuse.gsync 1 total clients for volume v2 : 2 ----------------------------------------------------------------- Updates: #178 Change-Id: I0ff2579d6adf57cc0d3bd0161a2ec6ac6c4747c0 Signed-off-by: hari gowtham <hgowtham@redhat.com> Reviewed-on: https://review.gluster.org/18095 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: hari gowtham <hari.gowtham005@gmail.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* glusterd: Add geo-replication session details to get-state outputSamikshan Bairagya2017-08-041-33/+0
| | | | | | | | | | | | | | | This commit adds support to the get-state CLI to capture details on geo-replication session as obtained in `gluster volume geo-replication status detail` in its output. Fixes: #291 Change-Id: I2fbcba70bfdaf439522637234805545194777ed4 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: https://review.gluster.org/17941 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* tier: separation of attach-tier from add-brickhari gowtham2017-08-012-3/+89
| | | | | | | | | | | | | | | | | | PROBLEM: Both attach tier and add brick have the same RPC and set of code. This becomes a hurdle while tring to implement add brick on a tiered volume. FIX: This patch separates the add brick and attach tier giving them separate RPCs. Change-Id: Iec57e972be968a9ff00b15b507e56a4f6dc398a2 BUG: 1376326 Signed-off-by: hari gowtham <hgowtham@redhat.com> Reviewed-on: https://review.gluster.org/15503 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: hari gowtham <hari.gowtham005@gmail.com> Reviewed-by: Samikshan Bairagya <samikshan@gmail.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* cli: error out incomplete CLI commandsAtin Mukherjee2017-07-263-8/+21
| | | | | | | | | | | | | | | | cli_cmd_bricks_parse () & cli_cmd_volume_remove_brick_parse () were not handling the the error cases where the command is incomplete with missing brick details which could lead to glusterd crashes. Credit : george.lian@nokia.com Change-Id: Ia6303457a2aa279465aa75d4e1cfcc948893d5de BUG: 1396327 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17870 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
* cluster/dht: Fix negative rebalance estimatesN Balachandran2017-07-261-27/+59
| | | | | | | | | | | | | | | | The calculation of the rebalance estimates will start after the rebalance operation has been running for 10 minutes. This patch also changes the cli rebalance status code to use unsigned variables for the time calculations. Change-Id: Ic76f517c59ad938a407f1cf5e3b9add571690a6c BUG: 1457985 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: https://review.gluster.org/17863 Reviewed-by: Amar Tumballi <amarts@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* glusterd: Add option to get all volume options through get-state CLISamikshan Bairagya2017-07-252-9/+21
| | | | | | | | | | | | | | | | | | | | This commit makes the get-state CLI capable to returning the values for all volume options for all volumes. This is similar to what you get when you issue a `gluster volume get <volname> all` command. This is the new usage for the get-state CLI: # gluster get-state [<daemon>] [[odir </path/to/output/dir/>] \ [file <filename>]] [detail|volumeoptions] Fixes: #277 Change-Id: Ice52d936a5a389c6fa0ba5ab32416a65cdfde46d Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: https://review.gluster.org/17858 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Gaurav Yadav <gyadav@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org>
* mem-pool: initialize pthread_key_t pool_key in mem_pool_init_early()Niels de Vos2017-07-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is not possible to call pthread_key_delete for the pool_key that is intialized in the constructor for the memory pools. This makes it difficult to do a full cleanup of all the resources in mem_pools_fini(). For this, the initialization of pool_key should be moved to mem_pool_init(). However, the glusterfsd binary has a rather complex initialization procedure. The memory pools need to get initialized partially to get mem_get() functionality working. But, the pool_sweeper thread can get killed in case it is started before glusterfsd deamonizes. In order to solve this, mem_pools_init() is split into two pieces: 1. mem_pools_init_early() for initializing the basic structures 2. mem_pools_init_late() to start the pool_sweeper thread With the split of mem_pools_init(), and placing the pthread_key_create() in mem_pools_init_early(), it is now possible to correctly cleanup the pool_key with pthread_key_delete() in mem_pools_fini(). It seems that there was no memory pool initialization in the CLI. This has been added as well now. Without it, the CLI will not be able to call mem_get() successfully which results in a hang of the process. Change-Id: I1de0153dfe600fd79eac7468cc070e4bd35e71dd BUG: 1470170 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: https://review.gluster.org/17779 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
* cli/xml: fix return handlingAtin Mukherjee2017-07-061-40/+52
| | | | | | | | | | | | | | | | | | | | The return code of xmlTextWriter* APIs says it returns either the bytes written (may be 0 because of buffering) or -1 in case of error. Now if the volume of the xml data payload is not huge then most of the time the data to be written gets buffered, however when this grows sometimes this APIs will return the total number of bytes written and then it becomes absolutely mandatory that every such call is followed by XML_RET_CHECK_AND_GOTO otherwise we may end up returning a non zero ret code which would result into the overall xml generation to fail. Change-Id: I02ee7076e1d8c26cf654d3dc3e77b1eb17cbdab0 BUG: 1467841 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17702 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Gaurav Yadav <gyadav@redhat.com>
* cli: add 'all' option in gluster v get cli usageAtin Mukherjee2017-06-061-1/+3
| | | | | | | | | | | Change-Id: If216b13b7f9072f875eb2c5019d3b50b8bf3313e BUG: 1458582 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17460 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
* Tier/cli: detach status xml outputhari gowtham2017-05-171-28/+29
| | | | | | | | | | | | | | | | | | | | Problem: detach status xml output was broken because of the wrong argument. The status_op sent to verify whether it is a tier status command was as false. Fix: the argument being passed was changed from false to true. Change-Id: I8cdd4dd972d6bfbb61c1182cbf4097767f83c7c5 BUG: 1446362 Signed-off-by: hari gowtham <hgowtham@redhat.com> Reviewed-on: https://review.gluster.org/17131 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: hari gowtham <hari.gowtham005@gmail.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: N Balachandran <nbalacha@redhat.com>
* event/epoll: Add back socket for polling of events immediately afterRaghavendra G2017-05-121-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | reading the entire rpc message from the wire Currently socket is added back for future events after higher layers (rpc, xlators etc) have processed the message. If message processing involves signficant delay (as in writev replies processed by Erasure Coding), performance takes hit. Hence this patch modifies transport/socket to add back the socket for polling of events immediately after reading the entire rpc message, but before notification to higher layers. credits: Thanks to "Kotresh Hiremath Ravishankar" <khiremat@redhat.com> for assitance in fixing a regression in bitrot caused by this patch. Change-Id: I04b6b9d0b51a1cfb86ecac3c3d87a5f388cf5800 BUG: 1448364 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: https://review.gluster.org/15036 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* glusterd: Make reset-brick work correctly if brick-mux is onSamikshan Bairagya2017-05-103-4/+20
| | | | | | | | | | | | | | | | | | | Reset brick currently kills of the corresponding brick process. However, with brick multiplexing enabled, stopping the brick process would render all bricks attached to it unavailable. To handle this correctly, we need to make sure that the brick process is terminated only if brick-multiplexing is disabled. Otherwise, we should send the GLUSTERD_BRICK_TERMINATE rpc to the respective brick process to detach the brick that is to be reset. Change-Id: I69002d66ffe6ec36ef48af09b66c522c6d35ac58 BUG: 1446172 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: https://review.gluster.org/17128 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* Fix 'flush' type, coverity warningMichael Scherer2017-05-101-1/+1
| | | | | | | | | | | | | | | | | | | As getchar returna a int, (which is 4 bytes on most common platforms, and at least 2 bytes), and char being often 1 byte, the conversion would lose information, hence the warning. Change-Id: I5b0b39c636ff49ef5c15d51a7f798e21635eca06 BUG: 789278 Signed-off-by: Michael Scherer <misc@redhat.com> Reviewed-on: https://review.gluster.org/17193 Tested-by: Michael Scherer <misc@fedoraproject.org> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Zhou Zhengping <johnzzpcrystal@gmail.com> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
* dht:Spacing issue in fix-layout o/pAnkitRaj2017-05-091-3/+3
| | | | | | | | | | | | | | | | There is a spacing issue in the status output of the rebalance fix-layout operations. If the local host name is big then we will have spacing issue. Change-Id: I2fcc4fd382723fb7e93cb4d4dad03dae682cc1a8 BUG: 1437748 Signed-off-by: AnkitRaj <anraj@redhat.com> Reviewed-on: https://review.gluster.org/17203 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: ankitraj NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
* cli: fix build error with --disable-xml-outputKinglong Mee2017-05-083-20/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ./configure --disable-xml-output --disable-georeplication make Making all in src CC cli.o In file included from cli.c:42:0: cli.h:440:24: error: unknown type name ‘xmlTextWriterPtr’ cli_xml_output_common (xmlTextWriterPtr writer, int op_ret, int op_errno, ^ cli.h:443:26: error: unknown type name ‘xmlTextWriterPtr’ cli_xml_snapshot_delete (xmlTextWriterPtr writer, xmlDocPtr doc, dict_t *dict, ^ cli.h:443:51: error: unknown type name ‘xmlDocPtr’ cli_xml_snapshot_delete (xmlTextWriterPtr writer, xmlDocPtr doc, dict_t *dict, ^ make[1]: *** [cli.o] Error 1 make: *** [all-recursive] Error 1 Change-Id: I36c2dfc11f89d774b62dfe6f50b156826bed5b66 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com> Reviewed-on: https://review.gluster.org/17136 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Prashanth Pai <ppai@redhat.com> Tested-by: Prashanth Pai <ppai@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* Fixes quota aux mount failureSanoj Unnikrishnan2017-05-082-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aux mount is created on the first limit/remove_limit/list command and it remains until volume is stopped / deleted / (quota is disabled) , where we do a lazy unmount. If the process is uncleanly terminated, then the mount entry remains and we get (Transport disconnected) error on subsequent attempts to run quota list/limit-usage/remove commands. Second issue, There is also a risk of inadvertent rm -rf on the /var/run/gluster causing data loss for the user. Ideally, /var/run is a temp path for application use and should not cause any data loss to persistent storage. Solution: 1) unmount the aux mount after each use. 2) clean stale mount before mounting, if any. One caveat with doing mount/unmount on each command is that we cannot use same mount point for both list and limit commands. The reason for this is that list command needs mount to be accessible in cli after response from glusterd, So it could be unmounted by a limit command if executed in parallel (had we used same mount point) Hence we use separate mount points for list and limit commands. Change-Id: I4f9e39da2ac2b65941399bffb6440db8a6ba59d0 BUG: 1433906 Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com> Reviewed-on: https://review.gluster.org/16938 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Manikandan Selvaganesh <manikandancs333@gmail.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* rpc: Remove accidental IPV6 changesKaushal M2017-05-051-4/+0
| | | | | | | | | | | | | | They snuck in with the HALO patch (07cc8679c) Change-Id: I8ced6cbb0b49554fc9d348c453d4d5da00f981f6 BUG: 1447953 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: https://review.gluster.org/17174 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* Halo Replication feature for AFR translatorKevin Vigor2017-05-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Halo Geo-replication is a feature which allows Gluster or NFS clients to write locally to their region (as defined by a latency "halo" or threshold if you like), and have their writes asynchronously propagate from their origin to the rest of the cluster. Clients can also write synchronously to the cluster simply by specifying a halo-latency which is very large (e.g. 10seconds) which will include all bricks. In other words, it allows clients to decide at mount time if they desire synchronous or asynchronous IO into a cluster and the cluster can support both of these modes to any number of clients simultaneously. There are a few new volume options due to this feature: halo-shd-latency: The threshold below which self-heal daemons will consider children (bricks) connected. halo-nfsd-latency: The threshold below which NFS daemons will consider children (bricks) connected. halo-latency: The threshold below which all other clients will consider children (bricks) connected. halo-min-replicas: The minimum number of replicas which are to be enforced regardless of latency specified in the above 3 options. If the number of children falls below this threshold the next best (chosen by latency) shall be swapped in. New FUSE mount options: halo-latency & halo-min-replicas: As descripted above. This feature combined with multi-threaded SHD support (D1271745) results in some pretty cool geo-replication possibilities. Operational Notes: - Global consistency is gaurenteed for synchronous clients, this is provided by the existing entry-locking mechanism. - Asynchronous clients on the other hand and merely consistent to their region. Writes & deletes will be protected via entry-locks as usual preventing concurrent writes into files which are undergoing replication. Read operations on the other hand should never block. - Writes are allowed from _any_ region and propagated from the origin to all other regions. The take away from this is care should be taken to ensure multiple writers do not write the same files resulting in a gfid split-brain which will require resolution via split-brain policies (majority, mtime & size). Recommended method for preventing this is using the nfs-auth feature to define which region for each share has RW permissions, tiers not in the origin region should have RO perms. TODO: - Synchronous clients (including the SHD) should choose clients from their own region as preferred sources for reads. Most of the plumbing is in place for this via the child_latency array. - Better GFID split brain handling & better dent type split brain handling (i.e. create a trash can and move the offending files into it). - Tagging in addition to latency as a means of defining which children you wish to synchronously write to Test Plan: - The usual suspects, clang, gcc w/ address sanitizer & valgrind - Prove tests Reviewers: jackl, dph, cjh, meyering Reviewed By: meyering Subscribers: ethanr Differential Revision: https://phabricator.fb.com/D1272053 Tasks: 4117827 Change-Id: I694a9ab429722da538da171ec528406e77b5e6d1 BUG: 1428061 Signed-off-by: Kevin Vigor <kvigor@fb.com> Reviewed-on: http://review.gluster.org/16099 Reviewed-on: https://review.gluster.org/16177 Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
* cli: Adding warning message while creating a replica 2 volumekarthik-us2017-04-251-0/+18
| | | | | | | | | | | | | | | | | Warn the CLI about ending up in split-brain situation with a replica 2 volume. Display arbiter and replica 3 are recommended option to avoid this and point to the document on split-brain and ways to deal with it. Change-Id: I7f31f3c74818d440a684b3130bc5ccdc72258f01 BUG: 1431963 Signed-off-by: karthik-us <ksubrahm@redhat.com> Reviewed-on: https://review.gluster.org/16899 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>