1
0
mirror of https://github.com/gluster/glusterfs.git synced 2026-02-06 18:48:16 +01:00
Commit Graph

150 Commits

Author SHA1 Message Date
mohit84
d3e2e1344a Coverity: Fix several coverity warnings (#4098)
CID 1506829  Use of 32-bit time_t
  cli/src/cli-cmd.c
CID 1504519  DEADCODE
  xlators/mgmt/glusterd/src/glusterd-syncop.c
CID 1502328  Improper use of -ve
  xlators/nfs/server/src/mount3.c
CID 1502327  Uninitialized scalar variable
  xlators/storage/posix/src/posix-inode-fd-ops.c
CID 1502326  Improper use of -ve
  xlators/nfs/server/src/mount3.c
CID 1502325  Improper use of -ve
  xlators/nfs/server/src/mount3.c
CID 1502324  Resource leak
  xlators/features/marker/src/marker.c
CID 1502323  Improper use of -ve
  xlators/cluster/dht/src/dht-rebalance.c
CID 1502322  Improper use of -ve
  xlators/features/changelog/lib/src/gf-history-changelog.c
CID 1502321  Double free
  xlators/system/posix-acl/src/posix-acl.c
CID 1502320  Improper use of -ve
  xlators/storage/posix/src/posix-inode-fd-ops.c
CID 1502317  Improper use of -ve
  xlators/nfs/server/src/mount3.c
CID 1502316  Dereference after NULL check
  libglusterfs/src/glusterfs/dict.h
CID 1502315  Uninitialized scalar variable
  xlators/features/snapview-client/src/snapview-client.c
CID 1502314  Uninitialized scalar variable
  xlators/features/snapview-server/src/snapview-server.c
CID 1502313  Resource leak
  cli/src/cli-cmd-system.c
CID 1502312  Resource leak
  api/src/glfs-fops.c
CID 1502311  Use of 32-bit time_t
  xlators/cluster/ec/src/ec-common.c

Updates #1060
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>

Change-Id: Ic0a939d0bb4f568b5c3f60a5930c90ebeb6a28d4
2023-04-05 19:24:15 +05:30
Niraj Kumar Yadav
f6da05e2c1 [cli-cmd] Fix return type (#4048)
* [cli-cmd] Fix return type

time_t is signed on UNIX/POSIX compliant systems.
 
Use time_t for better clarity of return type

Change-Id: I47976d63f122f24e095c1aacf7a50b50e46616b3
Signed-off-by: black-dragon74 <niryadav@redhat.com>
2023-03-21 06:59:52 +05:30
Kaleb S. KEITHLEY
cef682c03d glusterfs: Build with Modern C, change set 5
GCC and Clang communities are hinting that in versions 14 and 16
respectively they will deprecate or disable legacy C89 features,
e.g. K&R1 style function definitions, among others.

In parallel, Fedora is going to start enforcing C99 as the minimum,
expected to land in F40. (I.e. around Spring 2024 IIRC.)

Currently Fedora is recommending that use of -Werror=implicit-int,
-Werror=implicit-function-declaration, -Werror=int-conversion,
-Werror=strict-prototypes, and -Werror=old-style-definition a set
of options to build with in the mean time to clean up code.

This change fixes a subset of the errors found when compiling with
this set of options.

Change-Id: I2025e39566aeb1f68836226d6d18c43418ca7f95
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
2022-11-02 10:05:46 +01:00
Dmitry Antipov
ce225d8a60 rpc, cli, dht, glusterd: unify defrag related enums
Since 'gf_cli_defrag_type' is actually used beyond cli,
consistently rename it to 'gf_defrag_type_t' and use the
only definition from cli1-xdr.x everywhere, as well as
with 'gf_defrag_status_t'.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2022-05-31 12:39:25 +02:00
Dmitry Antipov
32d9aceecf cli: simplify command submission routines
Drop really unused and always-NULL 'struct iobref *' argument of
'cli_cmd_submit()', 'cli_submit_request()' and 'cli_to_glusterd()',
adjust related code.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2022-05-04 09:37:45 +02:00
Dmitry Antipov
e02c233713 build: drop libglusterd (#3433)
Since libglusterd consists of just two simple functions
which can be easily inlined, it may be replaced with the
only header, which is rpc/rpc-lib/src/protocol-utils.h.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2022-04-18 10:50:28 +05:30
Yaniv Kaul
3b00855b0f Multiple files: reduce the number of include statements (#3141)
We have hundreds of redundant, or unused #include statements in the code. I have a WIP patch to remove many of them
We have several that are circular (include A calls B which calls A ...)
We have some unused statements in popular include file (glusterd.h is a good example).
The end goal would be to reduce the no. of include statements, include what's needed,
and thus improve code readability, maintainability and hopefully reduce compilation times.

Note: it is still not pretty, but it's a good step towards really including what is needed, per file/modulex/xlator/...

Updates: #3130
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
2022-02-12 10:06:42 +05:30
Dmitry Antipov
d23881073f cli: move RPC call timeouts to state data (#2813)
Move default and special RPC call timeouts to 'struct cli_state',
provide meaningful macros and adjust related bits here and there.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2021-10-27 12:44:52 +05:30
Dmitry Antipov
b48e64cebc cli: drop global RPC client contexts (#2767)
Embed glusterd and quotad RPC client context pointers
into CLI state instead of using global variables, adjust
related initialization functions and comments.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2021-09-22 16:04:10 +05:30
Dmitry Antipov
77b9bf1034 cli: drop global state variable (#2753)
Drop 'global_state' and pass CLI state as a parameter
or indirectly via call frame or THIS where appropriate.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2021-09-04 13:11:35 +05:30
Dmitry Antipov
368d5b5891 glusterd, cli: more time_t usage where appropriate (#2749)
More time_t values for time intervals and timeouts,
drop weird is_valid_int() since strtol() is capable
enough to handle errors, adjust relevant comments.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Updates: #1000
2021-09-04 13:08:58 +05:30
schaffung
3b6be62cf3 cli-rpc: conditional init of global quota rpc (#1578)
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>
2020-11-02 11:18:01 +05:30
Kaleb S. KEITHLEY
0f9797a931 cli: type mismatch global_quotad_rpc in cli-quotad-client.c
...
[  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>
2020-07-06 16:19:08 -04:00
Dmitry Antipov
8fe08736f1 cli: fix data race when handling connection status
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
2020-06-16 14:45:03 +03:00
Kaleb S. KEITHLEY
a68516d55d cli: duplicate defns of cli_default_conn_timeout and cli_ten_minutes_timeout
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>
2020-01-02 07:46:23 -05:00
Shwetha K Acharya
ee1a43824a geo-rep: Note section is required for ignore_deletes
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>
2019-07-31 11:34:19 +05:30
Yaniv Kaul
97d798869a cli-rpc-ops.c: cleanups
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>
2019-10-28 21:29:50 +02:00
Jiffin Tony Thottan
5e73b8b5a3 Revert "glusterd: (storhaug) remove ganesha (843e1b0)"
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>
2017-10-16 14:24:29 +05:30
Amar Tumballi
7de620e0df libglusterfs: remove dependency of rpc
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>
2019-06-28 22:51:37 +05:30
Kotresh HR
95cb6d8b7c cli: Validate invalid slave url
This patch validates the invalid slave url
in cli itself and throws appropriate error.

fixes: bz#1098991
Change-Id: I278e2a04a4d619d2c2d1db0dd56ab5bdf7e7f469
Signed-off-by: Kotresh HR <khiremat@redhat.com>
2019-04-23 12:41:32 +05:30
Sanju Rakonde
e6d22da556 tier/cli: remove tier code to increase code coverage in cli
Change-Id: I56cc09243dab23b3be86a7faac45001dda77181f
updates: bz#1693692
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
2019-04-22 19:50:19 +05:30
Aravinda VK
9f3a5993d4 geo-rep: IPv6 support
`address_family=inet6` needs to be added while mounting master and
slave volumes in gverify script.

New option introduced to gluster cli(`--inet6`) which will be used
internally by geo-rep while calling `gluster volume info
--remote-host=<ipv6>`.

Fixes: bz#1688833
Change-Id: I1e0d42cae07158df043e64a2f991882d8c897837
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2019-03-14 20:06:54 +05:30
ShyamsundarR
c9a3f1e267 libglusterfs: Move devel headers under glusterfs directory
libglusterfs devel package headers are referenced in code using
include semantics for a program, this while it works can be better
especially when dealing with out of tree xlator builds or in
general out of tree devel package usage.

Towards this, the following changes are done,
- moved all devel headers under a glusterfs directory
- Included these headers using system header notation <> in all
code outside of libglusterfs
- Included these headers using own program notation "" within
libglusterfs

This change although big, is just moving around the headers and
making it correct when including these headers from other sources.

This helps us correctly include libglusterfs includes without
namespace conflicts.

Change-Id: Id2a98854e671a7ee5d73be44da5ba1a74252423b
Updates: bz#1193929
Signed-off-by: ShyamsundarR <srangana@redhat.com>
2018-11-29 14:08:06 -05:00
Harpreet Kaur Lalwani
c1cc39fe1c cli: "usage()" and "--help" for gluster cli
Added a usage message which will be shown when a user enters an
"unrecognized word" or an "unrecognized command" on the cli.
Also added a "--help" option for gluster cli.

fixes: bz#1535495

Change-Id: Ibcfb3d1c84daa1054e09c5cdfa6a5dab19f534a6
Signed-off-by: Harpreet Kaur Lalwani <hlalwani@redhat.com>
2018-11-21 16:13:36 +05:30
Ravishankar N
e7dd46ae54 glfsheal: add a '--nolog' flag
....and if set, change the log level to GF_LOG_NONE. This is useful for
monitoring applications which invoke the heal info set of commands once
every minute, leading to un-necessary glfsheal* logs in
/var/log/glusterfs/. For example, we can now run

`gluster volume heal <VOLNAME> info --nolog`
`gluster volume heal <VOLNAME> info split-brain --nolog` etc.

The default log level is still retained at GF_LOG_INFO.

The patch also changes glfsheal internally to accept '--xml' instead of 'xml'.
Note: The --nolog flag is *not* displayed in the help anywhere, for the
sake of consistency in how the other flags are not displayed anywhere in
the help.

fixes: bz#1643519
Change-Id: Ia08b6aa6e4a0548379db7e313dd4411ebc66f206
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
2018-10-26 17:51:38 +05:30
Gluster Ant
44d72ea7c7 Land clang-format changes
Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
2018-09-12 17:22:48 +05:30
karthik-us
abb7f279ba cli: Add warning message while converting to replica 2 configuration
Currently while creating replica 2 volume we display a warning message
of ending up in split-brain. But while converting an existing volume
from other configuration to replica 2 by add-brick or remove-brick
operations we do not show any such messages.
With this fix in add-brick and remove-brick cases also we will display
the same warning message and prompt for confirmation if the configuration
changes to replica 2.

Change-Id: Ifc4ed6994a087d2403894f4e743c4eb41633276b
fixes: bz#1627044
Signed-off-by: karthik-us <ksubrahm@redhat.com>
2018-09-10 15:07:43 +05:30
Susant Palai
47ce812a32 cli/glusterd: Add warning message in cli for user to check
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>
2018-02-26 11:33:06 +05:30
Atin Mukherjee
fc69bb63fd events : Add brick list in EVENT_VOLUME_CREATE
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>
2017-09-15 19:01:53 +05:30
Atin Mukherjee
f63eacecab cli: error out incomplete CLI commands
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>
2017-07-26 12:46:42 +05:30
Samikshan Bairagya
3835e862c2 glusterd: Make reset-brick work correctly if brick-mux is on
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>
2017-04-24 22:00:17 +05:30
Kinglong Mee
a9cd0262db cli: fix build error with --disable-xml-output
./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>
2017-04-28 05:46:50 -04:00
Sanoj Unnikrishnan
0730477a76 Fixes quota aux mount failure
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>
2017-03-22 15:02:12 +05:30
Kaleb S. KEITHLEY
63174b6723 glusterd: (storhaug) remove ganesha
remove all vestiges of ganesha

The storhaug CLI is used to manage ganesha and Samba. Also any setup
and teardown of the ganesha HA is initiated using storhaug to preserve
the proper layering.

Change-Id: I0eec0016a1b7802a36e7b2d92896b86fdf8607d5
BUG: 1420713
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/16504
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>
2017-02-01 06:39:03 -05:00
hari gowtham
b277834f07 CLI/TIER: removing old tier commands under rebalance
PROBLEM: gluster v rebalance <volname> tier start works even after
the switch of tier to service framework.
This lets the user have two tierd for the same volume.

FIX: checking for each process will make the new code hard
to maintain. So we are removing the support for old commands.

Change-Id: I5b0974b2dbb74f0bee8344b61c7f924300ad73f2
BUG: 1415590
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: https://review.gluster.org/16463
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: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
2017-01-24 14:24:47 +05:30
Xavier Hernandez
7d107e14d8 cli: keep 'gluster volume status detail' consistent
The output of the command 'gluster volume status <volname> detail' is
not consistent between operating systems. On linux hosts it shows the
file system type, the device name, mount options and inode size of each
brick. However the same command executed on a FreeBSD host doesn't show
all this information, even for bricks stored on a linux.

Additionally, for hosts other than linux, this information is shown as
'N/A' many times. This has been fixed to show as much information as it
can be retrieved from the operating system.

The file contrib/mount/mntent.c has been mostly rewriten because it
contained many errors that caused mount information to not be retrieved
on some operating systems.

Change-Id: Icb6e19e8af6ec82255e7792ad71914ef679fc316
BUG: 1411334
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/16371
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>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
2017-01-10 11:21:06 +01:00
Anuradha Talur
f5855d24da glusterd : Introduce reset brick
The command basically allows replace brick with src and
dst bricks as same.

Usage:
gluster v reset-brick <volname> <hostname:brick-path> start
This command kills the brick to be reset. Once this command is run,
admin can do other manual operations that they need to do,
like configuring some options for the brick. Once this is done,
resetting the brick can be continued with the following options.

gluster v reset-brick <vname> <hostname:brick> <hostname:brick> commit {force}

Does the job of resetting the brick. 'force' option should be used
when the brick already contains volinfo id.

Problem: On doing a disk-replacement of a brick in a replicate volume
the following 2 scenarios may occur :

a) there is a chance that reads are served from this replaced-disk brick,
which leads to empty reads. b) potential data loss if next writes succeed
only on replaced brick, and heal is done to other bricks from this one.

Solution: After disk-replacement, make sure that reset-brick command is
run for that brick so that pending markers are set for the brick and it
is not chosen as source for reads and heal. But, as of now replace-brick
for the same brick-path is not allowed. In order to fix the above
mentioned problem, same brick-path replace-brick is needed.
With this patch reset-brick commit {force} will be allowed even when
source and destination <hostname:brickpath> are identical as long as
1) destination brick is not alive
2) source and destination brick have the same brick uuid and path.
Also, the destination brick after replace-brick will use the same port
as the source brick.

Change-Id: I440b9e892ffb781ea4b8563688c3f85c7a7c89de
BUG: 1266876
Signed-off-by: Anuradha Talur <atalur@redhat.com>
Reviewed-on: http://review.gluster.org/12250
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: Ashish Pandey <aspandey@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
2016-08-22 13:22:03 -04:00
Samikshan Bairagya
d8a78f07e3 glusterd/cli: cli to get local state representation from glusterd
Currently there is no existing CLI that can be used to get the
local state representation of the cluster as maintained in glusterd
in a readable as well as parseable format.

The CLI added has the following usage:

 # gluster get-state [daemon] [odir <path/to/output/dir>] [file <filename>]

This would dump data points that reflect the local state
representation of the cluster as maintained in glusterd (no other
daemons are supported as of now) to a file inside the specified
output directory. The default output directory and filename is
/var/run/gluster and glusterd_state_<timestamp> respectively. The
option for specifying the daemon name leaves room to add support for
other daemons in the future. Following are the data points captured
as of now to represent the state from the local glusterd pov:

 * Peer:
    - Primary hostname
    - uuid
    - state
    - connection status
    - List of hostnames

 * Volumes:
    - name, id, transport type, status
    - counts: bricks, snap, subvol, stripe, arbiter, disperse,
 redundancy
    - snapd status
    - quorum status
    - tiering related information
    - rebalance status
    - replace bricks status
    - snapshots

 * Bricks:
    - Path, hostname (for all bricks these info will be shown)
    - port, rdma port, status, mount options, filesystem type and
signed in status for bricks running locally.

 * Services:
    - name, online status for initialised services

 * Others:
    - Base port, last allocated port
    - op-version
    - MYUUID

Change-Id: I4a45cc5407ab92d8afdbbd2098ece851f7e3d618
BUG: 1353156
Signed-off-by: Samikshan Bairagya <samikshan@gmail.com>
Reviewed-on: http://review.gluster.org/14873
Reviewed-by: Avra Sengupta <asengupt@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
2016-07-07 20:33:02 +05:30
vmallika
d1d1848d2c cli/quota: Sort the list output alphabetically by path
Change-Id: I0b124e119d167817be2ae3eb52ac6c80fc7db5d1
BUG: 1320716
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/14000
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
2016-04-14 17:51:19 +05:30
Atin Mukherjee
28314977ac cli: Make CLI timeout configurable
When number of volumes go high in numbers command like gluster volume status may
timeout from CLI since it follows a static timeout value of 120 secs.

This patch introduces a flag '--timeout' which can pass a specific time out
value for a particular command.

Change-Id: I9795b709f27357fe5ee10ba19de8f4c11b63186f
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/13882
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
2016-04-01 11:50:26 +05:30
vmallika
b05e29bd70 quota: start aux mount from glusterd with inet address
With below patches, quota aux mount now
uses unix domain socket to connect to
glusterd
http://review.gluster.org/#/c/12645/
http://review.gluster.org/#/c/12819/

When USS is enabled, snapd protocol client tries to
connect to glusterd with inet and fails,
because remote-host option by client process
is set to UDS file

This patch starts the aux client process from glusterd
with inet address

Change-Id: I6967043bfd8824658ea39bfd2842591fcc3280fd
BUG: 1299497
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/13255
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
2016-01-18 23:31:59 +05:30
Ravishankar N
dc8752ebe8 cli: Add arbiter details to volinfo xml output
The following are added:
1. "<arbiterCount>1</arbiterCount>" and
"<coldarbiterCount>1</coldarbiterCount>"

2. "<isArbiter>0</isArbiter>" on the brick info, like so:
<brick
uuid="cafa8612-d7d4-4007-beea-72ae7477f3bb">127.0.0.2:/home/ravi/bricks/brick1
<name>127.0.0.2:/home/ravi/bricks/brick1</name>
<hostUuid>cafa8612-d7d4-4007-beea-72ae7477f3bb</hostUuid>
<isArbiter>0</isArbiter>
</brick>

Also fix a bug in gluster vol info where the abiter brick was shown the
wrong brick of the cold tier after performing a tier-attach.

Change-Id: Id978325d02b04f1a08856427827320e169169810
BUG: 1297750
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: http://review.gluster.org/13229
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
2016-01-18 12:19:35 +05:30
Manikandan Selvaganesh
a5e1a35190 cli/quota: show used_space,(file,dir) count even when quota limit is not set
Problem:
As of now quota 'list/list-objects' will list the usage only if limit is
set for every directory else it will fail with ENOATTR(If inode/inode-quota
is already configured for the first time).

Feature:
With the patch we are enhancing this command to list the usage even
if quota limit is not set but still the user has to configure
inode/inode-quota for the first time.

Example:
Consider we have /client/dir and /client1(absolute path from mount point):
Quota limit is set only on /client. when we try listing /client/dir or /client1,
it shows "Limit not set".

Fix:
The patch fixes this by showing "used space" in case of list command and
shows "file_count" & "dir_count" in case of list-objects command. This works
fine with xml output as well.

Change-Id: I68b08ec77a583b3c7f39fe4d6b15d3d77adb095a
BUG: 1284752
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/12741
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
2015-11-25 00:04:39 +05:30
Manikandan Selvaganesh
839dfff273 tier/cli : throw a warning when user issues a detach-tier commit/force command
Change-Id: Idf7664d509156ce46ef4308ffc07fb556a0aedd2
BUG: 1268755
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/12297
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: mohammed rafi  kc <rkavunga@redhat.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
2015-10-05 12:59:18 +05:30
Manikandan Selvaganesh
971ebb1a66 quota : xml output modified to give exact available space in bytes
Currrently, 'gluster v quota <VOLNAME> list' command rounds off the
available space and shows it to the user. Now, 'gluster v quota
<VOLNAME> list --xml' command is modified to show the exact available
space in bytes.

Change-Id: I3772e036a2537c1df12f22cf32dfe4ac7940988f
BUG: 1261404
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/12137
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
2015-09-09 13:03:37 +05:30
hari gowtham
589c7f07c0 Tier/cli: tier related information in volume info xml
gluster v info didnt differentiate the hot bricks and cold bricks
and other few values

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cliOutput>
  <opRet>0</opRet>
  <opErrno>0</opErrno>
  <opErrstr/>
  <volInfo>
    <volumes>
      <volume>
        <name>rmbr</name>
        <id>72d223fc-96ba-4f4a-ac6e-0d0bc16ef127</id>
        <status>1</status>
        <statusStr>Started</statusStr>
        <brickCount>3</brickCount>
        <distCount>1</distCount>
        <stripeCount>1</stripeCount>
        <replicaCount>1</replicaCount>
        <disperseCount>0</disperseCount>
        <redundancyCount>0</redundancyCount>
        <type>5</type>
        <typeStr>Tier</typeStr>
        <transport>0</transport>
        <xlators/>
        <bricks>
          <hotBricks>
            <hotBrickType>Distribute</hotBrickType>
            <numberOfBricks>1</numberOfBricks>
            <brick uuid="81">v1:/hb1<name>v1:/hb1</name><hostUuid>81</hostUuid></brick>
          </hotBricks>
          <coldBricks>
            <coldBrickType>Distribute</coldBrickType>
            <numberOfBricks>2</numberOfBricks>
            <brick uuid="81">v1:/br1<name>v1:/br1</name><hostUuid>81</hostUuid></brick>
            <brick uuid="81">v1:/br2<name>v1:/br2</name><hostUuid>81</hostUuid></brick>
            <count>0</count>
          </coldBricks>
        </bricks>
      </volume>
    </volumes>
  </volInfo>
</cliOutput>

Change-Id: I6e52541bb6d8a6a17e17bfcb42434beaac13db56
BUG: 1261837
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: http://review.gluster.org/12158
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
2015-09-10 20:15:35 +05:30
Dan Lambright
b22bcd488e cluster/tier: add gluster v tier <vol>
Currently the tier feature piggy backs off the rebalance command
syntax to obtain status and this is clumsy. Introduce a new
tier command that can do tier specific operations, starting
with volume status to display counters.

Old commands:
gluster volume attach-tier <vol> [replica count] {bricklist..}
gluster volume detach-tier <vol> {start|stop|commit}

New commands:
gluster volume tier <vol> attach [replica count] {bricklist} |
                          detach {start|stop|commit} |
                          status

Change-Id: Ic07b3c6260588162de7d34380f8cbd3d8a7f35d3
BUG: 1255693
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/11984
Reviewed-by: Gaurav Kumar Garg <ggarg@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
2015-08-21 06:45:46 -04:00
Rajesh Joseph
3b738ae9b3 gluster/cli: snapshot delete all does not work with xml
Problem: snapshot delete all command fails with --xml option
Fix: Provided xml support for delete all command

Change-Id: I77cad131473a9160e188c783f442b6a38a37f758
BUG: 1257533
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-on: http://review.gluster.org/12027
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Avra Sengupta <asengupt@redhat.com>
2015-08-26 08:28:59 +05:30
vmallika
8ea6b4e8a8 cli: on error invoke cli_cmd_broadcast_response function in separate thread
There is a problem in current CLI framework
CLI holds the lock when processing command.
When processing quota list command, below sequence of steps executed in the
same thread and causing deadlock

1) CLI holds the lock
2) Send rpc_clnt_submit request to quotad for quota usage
3) If quotad is down, rpc_clnt_submit invokes cbk function with error
4) cbk function cli_quotad_getlimit_cbk tries to hold lock to broadcast
   the results and hangs, because same thread has already holding the lock

This patch fixes the problem by creating seperate thread for
broadcasting the result

Change-Id: I53be006eadf6aaf348083d9168535530d70a8ab3
BUG: 1242819
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/11990
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-08-24 08:07:14 +05:30
Avra Sengupta
065856fd8f glusterd/shared_storage: Provide a volume set option to create and mount the shared storage
Introducing a global volume set option(cluster.enable-shared-storage)
which helps create and set-up the shared storage meta volume.

gluster volume set all cluster.enable-shared-storage enable

On enabling this option, the system analyzes the number of peers
in the cluster, which are currently connected, and chooses three
such peers(including the node the command is issued from). From these
peers a volume(gluster_shared_storage) is created. Depending on the
number of peers available the volume is either a replica 3
volume(if there are 3 connected peers),  or a replica 2 volume(if there
are 2 connected peers). "/var/run/gluster/ss_brick" serves as the
brick path on each node for the shared storage volume. We also mount
the shared storage at "/var/run/gluster/shared_storage" on all the nodes
in the cluster as part of enabling this option. If there is only one node
in the cluster,  or only one node is up then the command will fail

Once the volume is created, and mounted the maintainance of the
volume like adding-bricks, removing bricks etc., is expected to
be the onus of the user.

On disabling the option, we provide the user a warning, and on
affirmation from the user we stop the shared storage volume, and unmount
it from all the nodes in the cluster.

gluster volume set all cluster.enable-shared-storage disable

Change-Id: Idd92d67b93f444244f99ede9f634ef18d2945dbc
BUG: 1222013
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/10793
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
2015-05-14 15:00:59 +05:30