summaryrefslogtreecommitdiffstats
path: root/cli/src
Commit message (Collapse)AuthorAgeFilesLines
* cli: Increased spacing in cli for option table (#2322)Nikhil Ladha2021-04-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | * cli: Increased spacing in cli for option table Issue: Some options have name larger than length 40, due to which the output of command `gluster vol get <volname> all` mixes up the option, value for long option names. Fix: Increased the spacing in cli for `gluster vol get <volname> all` output to 50. Fixes: #2313 Change-Id: I841730ced074547a81171a4432d15ec9c35f39cd Signed-off-by: nik-redhat <nladha@redhat.com> * Added separator Change-Id: I210877c89bc468ed6a3090cd14fde7ecee1d33b6 Signed-off-by: nik-redhat <nladha@redhat.com> * Removed separator and added space Change-Id: Ic0eb9c9bc39a354465aabd939f72bc65be738f6c Signed-off-by: nik-redhat <nladha@redhat.com>
* Removal of force option in snapshot create (#2110)nishith-vihar2021-04-062-6/+11
| | | | | | | | | | | | The force option does fail for snapshot create command even though the quorum is satisfied and is redundant. The change deprecates the force option for snapshot create command and checks if all bricks are online instead of checking for quorum for creating a snapshot. Fixes: #2099 Change-Id: I45d866e67052fef982a60aebe8dec069e78015bd Signed-off-by: Nishith Vihar Sakinala <nsakinal@redhat.com>
* cluster/dht: use readdir for fix-layout in rebalance (#2243)Pranith Kumar Karampuri2021-03-221-4/+4
| | | | | | | | | | | | | | | | | | | | Problem: On a cluster with 15 million files, when fix-layout was started, it was not progressing at all. So we tried to do a os.walk() + os.stat() on the backend filesystem directly. It took 2.5 days. We removed os.stat() and re-ran it on another brick with similar data-set. It took 15 minutes. We realized that readdirp is extremely costly compared to readdir if the stat is not useful. fix-layout operation only needs to know that the entry is a directory so that fix-layout operation can be triggered on it. Most of the modern filesystems provide this information in readdir operation. We don't need readdirp i.e. readdir+stat. Fix: Use readdir operation in fix-layout. Do readdir+stat/lookup for filesystems that don't provide d_type in readdir operation. fixes: #2241 Change-Id: I5fe2ecea25a399ad58e31a2e322caf69fc7f49eb Signed-off-by: Pranith Kumar K <pranith.karampuri@phonepe.com>
* cli: syntax check for arbiter volume creation (#2207)Ravishankar N2021-03-051-1/+2
| | | | | | | | | | | commit 8e7bfd6a58b444b26cb50fb98870e77302f3b9eb changed the syntax for arbiter volume creation to 'replica 2 arbiter 1', while still allowing the old syntax of 'replica 3 arbiter 1'. But while doing so, it also removed a conditional check, thereby allowing replica count > 3. This patch fixes it. Fixes: #2192 Change-Id: Ie109325adb6d78e287e658fd5f59c26ad002e2d3 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* glusterd-volgen: Add functionality to accept any custom xlator (#1974)Ryo Furuhashi2021-02-051-31/+119
| | | | | | | | | | | | | | | | | | | | | * glusterd-volgen: Add functionality to accept any custom xlator Add new function which allow users to insert any custom xlators. It makes to provide a way to add any processing into file operations. Users can deploy the plugin(xlator shared object) and integrate it to glusterfsd. If users want to enable a custom xlator, do the follows: 1. put xlator object(.so file) into "XLATOR_DIR/user/" 2. set the option user.xlator.<xlator> to the existing xlator-name to specify of the position in graph 3. restart gluster volume Options for custom xlator are able to set in "user.xlator.<xlator>.<optkey>". Fixes: #1943 Signed-off-by:Ryo Furuhashi <ryo.furuhashi.nh@hitachi.com> Co-authored-by: Yaniv Kaul <ykaul@redhat.com> Co-authored-by: Xavi Hernandez <xhernandez@users.noreply.github.com>
* tests: ./tests/bugs/replicate/bug-921231.t is continuously failing (#2006)mohit842021-01-131-1/+1
| | | | | | | | | | | | The test case (./tests/bugs/replicate/bug-921231.t ) is continuously failing.The test case is failing because inodelk_max_latency is showing wrong value in profile. The value is not correct because recently the profile timestamp is changed from microsec to nanosec from the patch #1833. Fixes: #2005 Change-Id: Ieb683836938d986b56f70b2380103efe95657821 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* stripe cleanup: Remove the option from create and add-brick cmds (#1812)Sheetal Pamecha2021-01-054-74/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stripe cleanup: Remove the option from create and add-brick cmds This patch aims to remove the code for stripe option instead of keeping a default values of stripe/stripe-count variables and setting and getting dict options and similar redundant operations. Also removing tests for stripe volumes that have been already marked bad. Updates: #1000 Change-Id: Ic2b3cabd671f0c8dc0521384b164c3078f7ca7c6 Signed-off-by: Sheetal Pamecha <spamecha@redhat.com> * Fix regression error tests/000-flaky/basic_changelog_changelog-snapshot.t was failing due to 0 return value Change-Id: I8ea0443669c63768760526db5aa1f205978e1dbb Signed-off-by: Sheetal Pamecha <spamecha@redhat.com> * add constant stripe_count value for upgrade scenerios Change-Id: I49f3da4f106c55f9da20d0b0a299275a19daf4ba * Fix clang-format warning Change-Id: I83bae85d10c8c5b3c66f56c9f8de1ec81d0bbc95
* Fixing the split-brain link where going for a 2 replicated volume. (#1964)Mohammed Ashour2020-12-311-7/+6
| | | | | | | | | Fixes in functions: - cli_cmd_volume_create_parse() - cli_cmd_volume_add_brick_parse() - cli_cmd_volume_remove_brick_parse() Fixes: #1959 Signed-off-by: Mohammed Ali Ashour <m.aly.ashour@gmail.com>
* cli/glusterd: conscious language changes for geo-repRavishankar N2020-12-304-126/+129
| | | | | | | | | | | | | | Replace master and slave terminology in geo-replication with primary and secondary respectively. All instances are replaced in cli and glusterd. Changes to other parts of the code to follow in separate patches. tests/00-geo-rep/* are passing thus far. Updates: #1415 Change-Id: Ifb12b7f5ce927a4a61bda1e953c1eb0fdfc8a7c5 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* glusterd/cli: enhance rebalance-status after replace/reset-brick (#1869)Tamar Shacked2020-12-081-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * glusterd/cli: enhance rebalance-status after replace/reset-brick Rebalance status is being reset during replace/reset-brick operations. This cause 'volume status' to shows rebalance as "not started". Fix: change rebalance-status to "reset due to (replace|reset)-brick" Change-Id: I6e3372d67355eb76c5965984a23f073289d4ff23 Signed-off-by: Tamar Shacked <tshacked@redhat.com> * glusterd/cli: enhance rebalance-status after replace/reset-brick Rebalance status is being reset during replace/reset-brick operations. This cause 'volume status' to shows rebalance as "not started". Fix: change rebalance-status to "reset due to (replace|reset)-brick" Fixes: #1717 Signed-off-by: Tamar Shacked <tshacked@redhat.com> Change-Id: I1e3e373ca3b2007b5b7005b6c757fb43801fde33 * cli: changing rebal task ID to "None" in case status is being reset Rebalance status is being reset during replace/reset-brick operations. This cause 'volume status' to shows rebalance as "not started". Fix: change rebalance-status to "reset due to (replace|reset)-brick" Fixes: #1717 Change-Id: Ia73a8bea3dcd8e51acf4faa6434c3cb0d09856d0 Signed-off-by: Tamar Shacked <tshacked@redhat.com>
* CLI: added an error message in case of timeoutnik-redhat2020-11-051-1/+4
| | | | | | | | | Added an error message in CLI when there are volumes present in cluster but timeout happens on fetching them. This PR fixes #1738 Signed-off-by: nik-redhat <nladha@redhat.com>
* cli-rpc: conditional init of global quota rpc (#1578)schaffung2020-11-022-3/+15
| | | | | | | | | | | | | | | | | | | | Issue: It is seem that the initialization of rpc to connect with quotad is done in every glusterfs cli command, irrespective of whether the quota feature is enabled or disabled. This seems to be an overkill. Code change: The file /var/run/quotad/quotad.pid is present signals that quotad is enabled. Hence we can put a conditional check for seeing when this file exists and if it doesn't we just skip over the initialization of the global quotad rpc. This will go on to reduce the extra rpc calls and operations being performed in the kernel space. Fixes: #1577 Change-Id: Icb69d35330f76ce95626f59af75a12726eb620ff Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> Co-authored-by: srijan-sivakumar <ssivakumar@redhat.com>
* cli: type mismatch global_quotad_rpc in cli-quotad-client.cKaleb S. KEITHLEY2020-07-0610-26/+8
| | | | | | | | | | | | | | | | | | | | | | | | | ... [ 236s] (.text+0x0): multiple definition of `cli_default_conn_timeout'; cli.o (symbol from plugin):(.text+0x0): first defined here [ 236s] cli-quotad-client.c:13:24: warning: type of 'global_quotad_rpc' does not match original declaration [-Wlto-type-mismatch] [ 236s] 13 | extern struct rpc_clnt global_quotad_rpc; [ 236s] | ^ [ 236s] cli.c:80:18: note: 'global_quotad_rpc' was previously declared here [ 236s] 80 | struct rpc_clnt *global_quotad_rpc; [ 236s] | ^ [ 236s] cli.c:80:18: note: code may be misoptimized unless '-fno-strict-aliasing' is used [ 239s] collect2: error: ld returned 1 exit status ... move several global extern decls to cli.h. Found on SUSE Tumbleweed w/ gcc-10 and LTO. This bug goes back at least as far as release-6. Curiously this only popped up as an error when building 6.9, not 7.4 or 8.0. And not when building 8.0 on Fedora rawhide/33. Change-Id: I765642cea77b524a36368a7ff1a2976ef049dd0f Fixes: #1356 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* cli: fix data race when handling connection statusDmitry Antipov2020-06-164-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found with GCC ThreadSanitizer: WARNING: ThreadSanitizer: data race (pid=287943) Write of size 4 at 0x00000047dfa0 by thread T4: #0 cli_rpc_notify /path/to/glusterfs/cli/src/cli.c:313 (gluster+0x40a6df) #1 rpc_clnt_handle_disconnect /path/to/glusterfs/rpc/rpc-lib/src/rpc-clnt.c:821 (libgfrpc.so.0+0x13f04) #2 rpc_clnt_notify /path/to/glusterfs/rpc/rpc-lib/src/rpc-clnt.c:882 (libgfrpc.so.0+0x13f04) #3 rpc_transport_notify /path/to/glusterfs/rpc/rpc-lib/src/rpc-transport.c:520 (libgfrpc.so.0+0xf070) #4 socket_event_poll_err /path/to/glusterfs/rpc/rpc-transport/socket/src/socket.c:1364 (socket.so+0x812c) #5 socket_event_handler /path/to/glusterfs/rpc/rpc-transport/socket/src/socket.c:2958 (socket.so+0xc453) #6 socket_event_handler /path/to/glusterfs/rpc/rpc-transport/socket/src/socket.c:2854 (socket.so+0xc453) #7 event_dispatch_epoll_handler /path/to/glusterfs/libglusterfs/src/event-epoll.c:640 (libglusterfs.so.0+0xcaf23) #8 event_dispatch_epoll_worker /path/to/glusterfs/libglusterfs/src/event-epoll.c:751 (libglusterfs.so.0+0xcaf23) #9 <null> <null> (libtsan.so.0+0x2d33f) Previous read of size 4 at 0x00000047dfa0 by thread T3 (mutexes: write M3587): #0 cli_cmd_await_connected /path/to/glusterfs/cli/src/cli-cmd.c:321 (gluster+0x40ca37) #1 cli_cmd_process /path/to/glusterfs/cli/src/cli-cmd.c:123 (gluster+0x40cc74) #2 cli_batch /path/to/glusterfs/cli/src/input.c:29 (gluster+0x40c2b9) #3 <null> <null> (libtsan.so.0+0x2d33f) Location is global 'connected' of size 4 at 0x00000047dfa0 (gluster+0x00000047dfa0) Change-Id: Ie85a8a80a2c5b82252c0c1d45e68ebe9938da2eb Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1311
* Indicate timezone offsets in timestampsCsaba Henk2020-03-122-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logs and other output carrying timestamps will have now timezone offsets indicated, eg.: [2020-03-12 07:01:05.584482 +0000] I [MSGID: 106143] [glusterd-pmap.c:388:pmap_registry_remove] 0-pmap: removing brick (null) on port 49153 To this end, - gf_time_fmt() now inserts timezone offset via %z strftime(3) template. - A new utility function has been added, gf_time_fmt_tv(), that takes a struct timeval pointer (*tv) instead of a time_t value to specify the time. If tv->tv_usec is negative, gf_time_fmt_tv(... tv ...) is equivalent to gf_time_fmt(... tv->tv_sec ...) Otherwise it also inserts tv->tv_usec to the formatted string. - Building timestamps of usec precision has been converted to gf_time_fmt_tv, which is necessary because the method of appending a period and the usec value to the end of the timestamp does not work if the timestamp has zone offset, but it's also beneficial in terms of eliminating repetition. - The buffer passed to gf_time_fmt/gf_time_fmt_tv has been unified to be of GF_TIMESTR_SIZE size (256). We need slightly larger buffer space to accommodate the zone offset and it's preferable to use a buffer which is undisputedly large enough. This change does *not* do the following: - Retaining a method of timestamp creation without timezone offset. As to my understanding we don't need such backward compatibility as the code just emits timestamps to logs and other diagnostic texts, and doesn't do any later processing on them that would rely on their format. An exception to this, ie. a case where timestamp is built for internal use, is graph.c:fill_uuid(). As far as I can see, what matters in that case is the uniqueness of the produced string, not the format. - Implementing a single-token (space free) timestamp format. While some timestamp formats used to be single-token, now all of them will include a space preceding the offset indicator. Again, I did not see a use case where this could be significant in terms of representation. - Moving the codebase to a single unified timestamp format and dropping the fmt argument of gf_time_fmt/gf_time_fmt_tv. While the gf_timefmt_FT format is almost ubiquitous, there are a few cases where different formats are used. I'm not convinced there is any reason to not use gf_timefmt_FT in those cases too, but I did not want to make a decision in this regard. Change-Id: I0af73ab5d490cca7ed8d07a2ce7ac22a6df2920a Updates: #837 Signed-off-by: Csaba Henk <csaba@redhat.com>
* cli: fix several signed integer overflows and format specifiersDmitry Antipov2020-06-022-8/+11
| | | | | | | | | | | | | | | Initially found with GCC UBsan: cli/src/cli-rpc-ops.c:5347:73: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' cli/src/cli-rpc-ops.c:5355:74: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Ditto in cli/src/cli-xml-output.c. Change-Id: I14ed51d06dafe5039f154b0c4edf25a0997d696e Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1279
* cli: fix memory leak in gf_cli_gsync_status_output()Dmitry Antipov2020-05-221-8/+0
| | | | | | | | | | | In gf_cli_gsync_status_output(), call to gf_cli_read_status_data() overwrites 'sts_vals' pointers to areas allocated by GF_CALLOC() with pointers to dict data, thus making the allocated areas not accessible. Change-Id: I00c310aec1a1413caf13ade14dc4fed37b51962c Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1259
* core, cli, quota: cleanup malloc debugging and statsDmitry Antipov2020-04-151-6/+0
| | | | | | | | | | | | 1. Since mcheck()/mprobe() etc. features are no longer used, mcheck.h isn't required to be included. 2. Since mallinfo() is used to obtain malloc statistics, it should be detected instead of malloc_stats(). Change-Id: I54c7d2ee568e06ab29938efc01d1a2153c5bd5db Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1172
* cluster/afr: Removing unsupported options from code base to improve coveragekarthik-us2020-04-022-14/+4
| | | | | | | | | | | | | | | | Support for gluster volume heal <volname> info healed/heal-failed was removed by commit bb02cfb56ae08f56df4452c2b948fa962ae1212b in release-3.6. cli parser will display the usage message in all the supported versions whenever these clis are run, leading to some dead code in the latest branches. Since support for these clis were removed long back, this should not give any backward compatibility issues as well. Hence removing the dead code from the code base which will lead to better code coverage by the regression runs as well. Updates: #1052 Change-Id: I0c2b061469caf233c06d9699b0d159ce48e240b9 Signed-off-by: karthik-us <ksubrahm@redhat.com>
* cli: display the error while probing the localhostSanju Rakonde2020-03-101-3/+3
| | | | | | | | | | | | | | With bc6e206c6, we regressed in displaying the error message when a user tries to probe localhost. With this change, we display "probe on localhost not needed" message to the user. credits: Sachin Prabhu <sprabhu@redhat.com> fixes: bz#1810042 Change-Id: Ibf82b5a658c371c08290a0b4f655e5ac5f436c06 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* bitrot: Make number of signer threads configurableKotresh HR2020-02-032-4/+41
| | | | | | | | | | | | | The number of signing process threads (glfs_brpobj) is set to 4 by default. The recommendation is to set it to number of cores available. This patch makes it configurable as follows gluster vol bitrot <volname> signer-threads <count> fixes: bz#1797869 Change-Id: Ia883b3e5e34e0bc8d095243508d320c9c9c58adc Signed-off-by: Kotresh HR <khiremat@redhat.com>
* cli - removing fetch of unnecessary items.Barak Sason Rofman2019-12-041-66/+1
| | | | | | | | | | Somem methods dict_get...(...) values and then not use them anywhere. Removed found occurrences. fixes: #753 Change-Id: Iaeb8f4cec18f76078f6b2f4e4bd6f9795a3467bc Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
* cli - fixing a coverity issueBarak Sason Rofman2020-01-051-1/+1
| | | | | | | | | | Removed unused variable. fixes: CID#1412106 updates: bz#789278 Change-Id: I1d4e1c1625cecf882d51e9cf4f5290383f63d405 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
* cli: duplicate defns of cli_default_conn_timeout and cli_ten_minutes_timeoutKaleb S. KEITHLEY2020-01-022-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Winter is coming. So is gcc-10. Compiling with gcc-10-20191219 snapshot reveals dupe defns of cli_default_conn_timeout and cli_ten_minutes_timeout in .../cli/src/cli.[ch] due to missing extern decl. There are many changes coming in gcc-10 described in https://gcc.gnu.org/gcc-10/changes.html compiling cli.c with gcc-9 we see: ... .quad .LC88 .comm cli_ten_minutes_timeout,4,4 .comm cli_default_conn_timeout,4,4 .text .Letext0: ... and with gcc-10: ... .quad .LC88 .globl cli_ten_minutes_timeout .bss .align 4 .type cli_ten_minutes_timeout, @object .size cli_ten_minutes_timeout, 4 cli_ten_minutes_timeout: .zero 4 .globl cli_default_conn_timeout .align 4 .type cli_default_conn_timeout, @object .size cli_default_conn_timeout, 4 cli_default_conn_timeout: .zero 4 .text .Letext0: ... which is reflected in the .o file as (gcc-9): ... 0000000000000004 C cli_ten_minutes_timeout 0000000000000004 C cli_default_conn_timeout ... and (gcc-10): ... 0000000000000020 B cli_ten_minutes_timeout 0000000000000024 B cli_default_conn_timeout ... See nm(1) and ld(1) for a description C (common) and B (BSS) and how they are treated by the linker. Note: there is still a small chance that gcc-10 will land in Fedora-32, despite 31 Dec. 2019 having been the deadline for that to happen. Change-Id: I54ea485736a4910254eeb21222ad263721cdef3c Fixes: bz#1193929 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
* geo-rep: Note section is required for ignore_deletesShwetha K Acharya2019-07-313-10/+32
| | | | | | | | | | | | | | | | There exists a window of 15 sec, where the deletes are picked up by history crawl when the ignore_deletes is set to true. And it eventually deletes the file/s from slave which is/are not supposed to be deleted. Though it is working as per design, a note regarding this is needed. Added a warning message indicating the same. Also logged info when the worker restarts after ignore-deletes option set. fixes: bz#1708603 Change-Id: I103be882fac18b4cef935efa355f5037a396f7c1 Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
* cli, libglusterfs: rely on libpthread static initializersDmitry Antipov2019-12-273-19/+0
| | | | | | | | | | | | cli-cmd.c: drop cli_cmd_cond_init() because static mutex and condition variable are initialized with PTHREAD_xxx_INITIALIZERs. syncop-utils.c: since assignment PTHREAD_xxx_INITIALIZERs are never failed, a few overengineered bits may be simplified. Change-Id: Ic4d250a1697047386989f73f058b0abc8b55627b Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: bz#1193929
* glfsheal: install as architecture-dependent binary helperDmitry Antipov2019-12-052-2/+3
| | | | | | | | | | | | Since glfsheal is a binary helper which is not intented to be invoked directly, install it under %{libexecdir}/glusterfs rather than %{sbindir}, adjust invocation from CLI code and RPM spec. Credits: Ravishankar N <ravishankar@redhat.com>. Fixes: bz#1780190 Change-Id: I4b41892d96b89c24a332470ac8c1e82f6795159a Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
* cli-rpc-ops.c: cleanupsYaniv Kaul2019-10-282-1399/+967
| | | | | | | | | | | | | | | | | | | | | | | | | | 1. Move functions and structs to static 2. Use dictionary functions with fixed key length. 3. Reduce key length when not needed. 4. Use const char* for some messages. 5. Use fixed strings for some logs which is repeated in the code. 6. Remove redundant checks. Specifically, cli_to_glusterd() does NULL checks already, so no need to do it before calling it. 7. Aligned some messages - not sure why they were cut over several lines, but it made grep on the code harder. 8. Move dictionary fetching of values closer to where they are actually used. Overall, object size is ~4 smaller, hopefully without functional changes. There's more that can be done, but as this is a very long (>10K lines) file, I think it's enough for one change. Specifically, some functions fetch values from the dictionary without using it - this is a bit of a waste. Filed https://github.com/gluster/glusterfs/issues/753 about it. Change-Id: I31f88d94ab25398e00aef2ea84a8c4af9383b75b updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: refactoring long methodBarak Sason Rofman2019-11-051-4/+0
| | | | | | | | | | | - Refactored set_fuse_mount_options(...) in order to shorten it. - Removed dead code and moved some method to it's apropriate location. - Converted loggin in set_fuse_mount_options(...) to structured logs fixes: bz#1768896 Change-Id: If865833d4c60d517da202871978691ef21235fe4 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
* Removing old log rotate command.kshithijiyer2019-11-302-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The old command for log rotate is still present removing it completely. Also adding testcase to test the log rotate command with both the old as well as the new command and fixing testcase which use the old syntax to use the new one. Code to be removed: 1. In cli-cmd-volume.c from struct cli_cmd volume_cmds[]: {"volume log rotate <VOLNAME> [BRICK]", cli_cmd_log_rotate_cbk, "rotate the log file for corresponding volume/brick" " NOTE: This is an old syntax, will be deprecated from next release."}, 2. In cli-cmd-volume.c from cli_cmd_log_rotate_cbk(): ||(strcmp("rotate", words[2]) == 0))) 3. In cli-cmd-parser.c from cli_cmd_log_rotate_parse() if (strcmp("rotate", words[2]) == 0) volname = (char *)words[3]; else fixes: bz#1750387 Change-Id: I56e4d295044e8d5fd1fc0d848bc87e135e9e32b4 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* cli-*: make some structs static to reduce space consumed.Yaniv Kaul2019-10-045-88/+94
| | | | | | | | | | | | | | | | | | | | | | | There's a small difference when structs are defined static. Whenever possible, define them as such. Specifically, before: text data bss dec hex filename 678 216 0 894 37e ./cli/src/cli-cmd-misc.o 150024 1264 16 151304 24f08 ./cli/src/cli-rpc-ops.o 71980 64 0 72044 1196c ./cli/src/cli-cmd-parser.o 66189 4 16 66209 102a1 ./cli/src/cli-xml-output.o After: text data bss dec hex filename 670 216 0 886 376 ./cli/src/cli-cmd-misc.o 149848 1392 16 151256 24ed8 ./cli/src/cli-rpc-ops.o 70346 1320 0 71666 117f2 ./cli/src/cli-cmd-parser.o 66157 4 16 66177 10281 ./cli/src/cli-xml-output.o Change-Id: I206bd895290595d79fac7b26eee66f4279b50f92 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* cli: display detailed rebalance infoSanju Rakonde2019-10-221-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: When one of the node is down in cluster, rebalance status is not displaying detailed information. Cause: In glusterd_volume_rebalance_use_rsp_dict() we are aggregating rsp from all the nodes into a dictionary and sending it to cli for printing. While assigning a index to keys we are considering all the peers instead of considering only the peers which are up. Because of which, index is not reaching till 1. while parsing the rsp cli unable to find status-1 key in dictionary and going out without printing any information. Solution: The simplest fix for this without much code change is to continue to look for other keys when status-1 key is not found. fixes: bz#1764119 Change-Id: I0062839933c9706119eb85416256eade97e976dc Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* cli: raise error in cli when replica != 2 while ta vol creationVishal Pandey2019-09-231-1/+2
| | | | | | | | | | | | When creating a thin-arbiter volume, if the replica-count provided is other than 2, the cli command fails(which is the expected behaviour) but it fails while transaction is being committed on localhost. This, ideally should be handled in cli itself. Change-Id: I52ecdaf49a7df85670505e4743cdcf3101c71c9f Signed-off-by: Vishal Pandey <vpandey@redhat.com> Fixes: bz#1754477
* cli: fix distCount valueSanju Rakonde2019-10-061-2/+3
| | | | | | | | | | gluster volume info --xml id displaying wrong distCount value. This patch addresses it. fixes: bz#1758878 Change-Id: I64081597e06018361e6524587b433b0c4b2a0260 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* build: Fix libglusterd Makefile targetAnoop C S2019-08-291-1/+1
| | | | | | | | | | | | | * Fix libglusterd.la target path in cli/src/Makefile.am * Like libglusterfs, libgfxdr and libgfrpc, libglusterd is also expected to be ready by the time xlators/mgmt/glusterd sources are compiled. Therefore this change removes the additional mentioning of libglusterd.la target in Makefile.am Change-Id: I1b787316cfb6cd7487f49e661490b9788a0b80b3 Updates: bz#1193929 Signed-off-by: Anoop C S <anoopcs@redhat.com>
* cli - group files to set volume options supports commentsBarak Sason2019-08-201-0/+5
| | | | | | | | | | Modified parsing of group files in such a way that line that starts with "#" would be treated as comments Fixes: bz#1423442 Change-Id: Id85ceb49f8f9c920d4ea551f60bd28767279d4be Signed-off-by: Barak Sason <bsasonro@redhat.com>
* Revert "glusterd: (storhaug) remove ganesha (843e1b0)"Jiffin Tony Thottan2017-10-165-1/+263
| | | | | | | | | please note as an additional change, macro GLUSTERD_GET_SNAP_DIR moved from glusterd-store.c to glusterd-snapshot-utils.h Change-Id: I811efefc148453fe32e4f0d322e80455447cec71 updates: #663 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
* libglusterfs: remove dependency of rpcAmar Tumballi2019-06-282-3/+8
| | | | | | | | | | | | | | | | | | Goal: 'libglusterfs' files shouldn't have any dependency outside of the tree, specially the header files, shouldn't have '#include' from outside the tree. Fixes: * Had to introduce libglusterd so, methods and structures required for only mgmt/glusterd, and cli/ are separated from 'libglusterfs/' * Remove rpc/xdr/gen from build, which was used mainly so dependency for libglusterfs could be properly satisfied. * Move rpcsvc_auth_data to client_t.h, so all dependencies could be handled. Updates: bz#1636297 Change-Id: I0e80243a5a3f4615e6fac6e1b947ad08a9363fce Signed-off-by: Amar Tumballi <amarts@redhat.com>
* Multiple files: get trivial stuff done before lockYaniv Kaul2019-06-081-6/+7
| | | | | | | | | Initialize a dictionary for example seems to be prefectly fine to be done before taking a lock. Change-Id: Ib29516c4efa8f0e2b526d512beab488fcd16d2e7 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* event: rename event_XXX with gf_ prefixedXiubo Li2019-07-262-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I hit one crash issue when using the libgfapi. In the libgfapi it will call glfs_poller() --> event_dispatch() in file api/src/glfs.c:721, and the event_dispatch() is defined by libgluster locally, the problem is the name of event_dispatch() is the extremly the same with the one from libevent package form the OS. For example, if a executable program Foo, which will also use and link the libevent and the libgfapi at the same time, I can hit the crash, like: kernel: glfs_glfspoll[68486]: segfault at 1c0 ip 00007fef006fd2b8 sp 00007feeeaffce30 error 4 in libevent-2.0.so.5.1.9[7fef006ed000+46000] The link for Foo is: lib_foo_LADD = -levent $(GFAPI_LIBS) It will crash. This is because the glfs_poller() is calling the event_dispatch() from the libevent, not the libglsuter. The gfapi link info : GFAPI_LIBS = -lacl -lgfapi -lglusterfs -lgfrpc -lgfxdr -luuid If I link Foo like: lib_foo_LADD = $(GFAPI_LIBS) -levent It will works well without any problem. And if Foo call one private lib, such as handler_glfs.so, and the handler_glfs.so will link the GFAPI_LIBS directly, while the Foo won't and it will dlopen(handler_glfs.so), then the crash will be hit everytime. The link info will be: foo_LADD = -levent libhandler_glfs_LIBADD = $(GFAPI_LIBS) I can avoid the crash temporarily by linking the GFAPI_LIBS in Foo too like: foo_LADD = $(GFAPI_LIBS) -levent libhandler_glfs_LIBADD = $(GFAPI_LIBS) But this is ugly since the Foo won't use any APIs from the GFAPI_LIBS. And in some cases when the --as-needed link option is added(on many dists it is added as default), then the crash is back again, the above workaround won't work. Fixes: #699 Change-Id: I38f0200b941bd1cff4bf3066fca2fc1f9a5263aa Signed-off-by: Xiubo Li <xiubli@redhat.com>
* cli: defer create_frame() (and dict creation) to later stages.Yaniv Kaul2019-06-055-151/+199
| | | | | | | | | Where possible, defer create_frame() - whenever possible, after command line verification, for example. Change-Id: Id6606e90e7ea6190f30b225c4733b229c519bb2f updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* cli: Remove Wformat-truncation compiler warningSheetal Pamecha2019-07-012-19/+59
| | | | | | | | | | | | This warning is issued due to unhandled output truncation. As in the code, truncation is expected, we can remove this warning by placing a check on the return value of the function and handling it. In this way, the warning will not be issued. Change-Id: I1820b58fe9a7601961c20944b259df322db35057 updates: bz#1193929 Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
* Removing one top command from gluster v helpkshithijiyer2019-06-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The current help show 2 different top commands intead of one single top command which can be easily observed when "# gluster v help" command is issued. Removing one "volume top <VOLNAME>" and clubbing into them into a single command. Current help: volume top <VOLNAME> {open|read|write|opendir|readdir|clear} [nfs|brick <brick>] [list-cnt <value>] | volume top <VOLNAME> {read-perf|write-perf} [bs <size> count <count>] [brick <brick>] [list-cnt <value>] - volume top operations Expected help: volume top <VOLNAME> {open|read|write|opendir|readdir|clear} [nfs|brick <brick>] [list-cnt <value>] | {read-perf|write-perf} [bs <size> count <count>] [brick <brick>] [list-cnt <value>] - volume top operations fixes: bz#1725034 Change-Id: Ifbc4c95f2558286e27dfc5e9667046b80eb1715d Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* glusterd/thin-arbiter: Thin-arbiter integration with GD1Vishal Pandey2019-04-243-6/+158
| | | | | | | | | | | | | | | | | | | | | | | | gluster volume create <VOLNAME> replica 2 thin-arbiter 1 <host1>:<brick1> <host2>:<brick2> <thin-arbiter-host>:<path-to-store-replica-id-file> [force] The changes have been made in a way that the last brick in the bricks list will be treated as the thin-arbiter. GD1 will be manipulated to consider replica count to be as 2 and continue creating the volume like any other replica 2 volume but since thin-arbiter volumes need ta-brick client xlator entries for each subvolume in fuse volfile, volfile generation is modified in a way to inject these entries seperately in the volfile for every subvolume. Few more additions - 1- Save the volinfo with new fields ta_bricks list and thin_arbiter_count. 2- Introduce a new option client.ta-brick-port to add remote-port to ta-brick xlator entry in fuse volfiles. The option can be set using the following CLI syntax - gluster volume set <VOLNAME> client.ta-brick-port <PORTNO.> 3- Volume Info will contain a Thin-Arbiter-path entry to distinguish from other replicate volumes. Change-Id: Ib434e2313b29716f32476c6c211d282c4ef39406 Updates #687 Signed-off-by: Vishal Pandey <vpandey@redhat.com>
* Adding white spaces to description of set group.kshithijiyer2019-06-241-4/+4
| | | | | | | | | | | | | | | | | | | | The description of set group is missing spaces which leads to the description look like: volume set <VOLNAME> group <GROUP> - This option can be used for setting multiple pre-defined volume optionswhere group_name is a file under /var/lib/glusterd/groups containing onekey, value pair per line Instead of: volume set <VOLNAME> group <GROUP> - This option can be used for setting multiple pre-defined volume options where group_name is a file under /var/lib/glusterd/groups containing one key value pair per line Fixes: bz#1723455 Change-Id: I4957988c0c1f35f043db3f64089c049193e60e8f Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
* cli: don't fail if logging initialize failsAmar Tumballi2019-06-141-1/+0
| | | | | | | | | | | | in many cases, gluster's cli can run as non-privileged mode (like in geo-rep non-root setup). Just because logging fails in cli, lets not fail the overall process. Not much of debugging help in CLI logs anyways. Most of the debugging happens once the call reaches server (glusterd). Fixes: bz#1535511 Change-Id: I9f07c61b8c3acc95ec08230ff539a35dfd0ff9dc Signed-off-by: Amar Tumballi <amarts@redhat.com>
* build: always build glusterfs-cli to allow monitoring/managing from clientsNiels de Vos2019-06-141-2/+0
| | | | | | Fixes: bz#1720615 Change-Id: I5071f3255ff615113b36b08cd5326be6e37d907d Signed-off-by: Niels de Vos <ndevos@redhat.com>
* cli: Remove-brick warning seems unnecessaryShwetha K Acharya2019-06-031-8/+9
| | | | | | | | | | | As force-migration option is disabled by default, the warning seems unnessary. Rephrased the warning to make best sense out of it. fixes: bz#1712668 Change-Id: Ia18c3c5e7b3fec808fce2194ca0504a837708822 Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
* Fix some "Null pointer dereference" coverity issuesXavi Hernandez2019-05-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | This patch fixes the following CID's: * 1124829 * 1274075 * 1274083 * 1274128 * 1274135 * 1274141 * 1274143 * 1274197 * 1274205 * 1274210 * 1274211 * 1288801 * 1398629 Change-Id: Ia7c86cfab3245b20777ffa296e1a59748040f558 Updates: bz#789278 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* geo-rep: Geo-rep help text issueShwetha K Acharya2019-05-091-2/+2
| | | | | | | | | Modified Geo-rep help text for better sanity. fixes: bz#1652887 Change-Id: I40ef7ef709eaecf0125ab4b4a7517e2c5d1ef4a0 Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>