summaryrefslogtreecommitdiffstats
path: root/utils/common.h
Commit message (Collapse)AuthorAgeFilesLines
* replace: add replace featurePrasanna Kumar Kalever2018-02-071-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. create conf in new node 2. delete conf from old node 3. replace portals from nodes hosting other paths (HA) $ gluster-block create sample/block ha 3 192.168.124.57,192.168.124.26,192.168.124.30 1GiB --json-pretty { "IQN":"iqn.2016-12.org.gluster-block:d516bb5c-5f56-4d9c-96a7-385df19c2e2c", "PORTAL(S)":[ "192.168.124.57:3260", "192.168.124.26:3260", "192.168.124.30:3260" ], "RESULT":"SUCCESS" } $ gluster-block help gluster-block (0.3) usage: gluster-block <command> <volname[/blockname]> [<args>] [--json*] commands: [...] replace <volname/blockname> <old-node> <new-node> [force] replace operations. [...] supported JSON formats: --json|--json-plain|--json-spaced|--json-pretty $ gluster-block replace sample/block 192.168.124.26 192.168.124.56 --json-pretty { "NAME":"block", "CREATE SUCCESS":"192.168.124.56", "DELETE SUCCESS":"192.168.124.26", "REPLACE PORTAL SUCCESS ON":[ "192.168.124.57", "192.168.124.30" ], "RESULT":"SUCCESS" } Fixes: #4 Change-Id: I0411d15c407111db0d423052d9a6bc075174bf90 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* logger: support logdir choosing via Environment variablePrasanna Kumar Kalever2017-08-171-22/+0
| | | | | | | | | | | | Currently the default logdir is DATADIR /log/gluster-block/ This patch will provide a way to change this default logdir via Env variable $ export GB_LOGDIR=/var/log/gluster-block-new-path/ Note: make sure to restart the processes (cli & daemon) after you set GB_LOGDIR Change-Id: Id142e4a4dfe7b6ebc9cf8296b8ceb8bff37691b8 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* block: add support to prealloc = full | no optionPrasanna Kumar Kalever2017-06-221-0/+48
| | | | | | | | | currently we allocate sparse files for block backends in the gluster volume, with 'prealloc = full' option introduced by this patch we should be able to fully preallocate the backend block file. Change-Id: Ibf32df5f978f732a3fd248693170463da6d08268 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* info: show size in human readable formatPrasanna Kumar Kalever2017-06-131-2/+2
| | | | | | | | | | | | | | | | | | Also s/BLOCK CONFIG NODE(S)/EXPORTED NODE(S)/ in the info output $ gluster-block info sample/block NAME: block VOLUME: sample GBID: 6bd70984-be2c-43ac-9e9d-bad04010e42f SIZE: 1.0 GiB HA: 1 PASSWORD: EXPORTED NODE(S): 192.168.0.105 Change-Id: I473b854b939c96b99be8e0b172ac6957b8bc6006 Fixes: #23 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
* modify: add support for one way authenticationPrasanna Kumar Kalever2017-05-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduce or rather implement modify command for enabling authentication for block devices. The schematics of authentication setting, looks like $ gluster-block modify block-test/sample-block auth enable --json-pretty { "SUCCESSFUL ON":[ "192.168.0.105" ], "IQN":"iqn.2016-12.org.gluster-block:8917def2-e90d-4406-8c9c-6d06b6851bbe", "USERNAME":"8917def2-e90d-4406-8c9c-6d06b6851bbe", "PASSWORD":"a3e75362-a446-45af-98d0-a1ed7e10d7f0", "RESULT":"SUCCESS" } As an effect it brings changes in 'info' command response, note PASSWORD $ gluster-block info block-test/sample-block --json-pretty { "NAME":"sample-block", "VOLUME":"block-test", "GBID":"8917def2-e90d-4406-8c9c-6d06b6851bbe", "SIZE":1073741824, "HA":1, "PASSWORD":"a3e75362-a446-45af-98d0-a1ed7e10d7f0", "BLOCK CONFIG NODE(S)":[ "192.168.0.105" ] } The schematics of auth disabling, looks like $ gluster-block modify block-test/sample-block auth disable --json-pretty { "SUCCESSFUL ON":[ "192.168.0.105" ], "IQN":"iqn.2016-12.org.gluster-block:add99c38-3c14-42d7-bf23-7d02f388e1e7", "RESULT":"SUCCESS" } Change-Id: I06d095b50401c131ac89cc142497f21d2205164a Fixes: #5 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* gluster-block: support json responsePrasanna Kumar Kalever2017-04-281-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is how cli response looks like, on supplying '--json*' flag to cmd-args: $ gluster-block create block-test/sample-block1 ha 1 localhost.localdomain 1GiB --json (or) $ gluster-block create block-test/sample-block2 ha 1 localhost.localdomain 1GiB --json-spaced { "IQN": "iqn.2016-12.org.gluster-block:681af106-85f1-4a02-a122-57c80903458c", \ "PORTAL(S)": [ "localhost.localdomain:3260" ], "RESULT": "SUCCESS" } $ gluster-block create block-test/sample-block3 ha 1 localhost.localdomain 1GiB --json-plain {"IQN":"iqn.2016-12.org.gluster-block:0fdf6647-57f2-477f-8dd4-54a3de06e410",\ "PORTAL(S)":["localhost.localdomain:3260"],"RESULT":"SUCCESS"} $ gluster-block create block-test/sample-block4 ha 1 localhost.localdomain 1GiB --json-pretty { "IQN":"iqn.2016-12.org.gluster-block:e92ca4a0-5325-4c4b-a407-9e75790e4c7f", "PORTAL(S)":[ "localhost.localdomain:3260" ], "RESULT":"SUCCESS" } Change-Id: Ie51039e3dee0b3357d2347b4087e0fbe299aa29e Fixes: #3 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* logging: redirect configshell logs to GB_LOGDIRPrasanna Kumar Kalever2017-04-131-14/+17
| | | | | | | | | | | | | | | | | | | | currently, GLOBAL CONFIG GROUP =================== [...] logfile=hello ------------- Logfile to use. [...] i.e. configshell logs are collected at 'hello' file. This patch will redirect configshell logs to 'GB_LOGDIR/gluster-block-configshell.log' Change-Id: I487c6197578c24412fbec72cb8c354725614de59 Fixes: #13 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* lockfile: don't allow multiple instances of daemon to runPrasanna Kumar Kalever2017-02-211-1/+2
| | | | | | | | | | | | | | until now there is no check to defend on multiple runs of daemon within the same node. This patch takes a non blocking lock on 'gluster-blockd.lock' file, if it succeeds only then daemon is allowed to run, if there is already a lock on lock-file (taken by some other instance of gluster-blockd) we will exit. This patch also renames GB_UNIX_ADDRESS from gluster-block.socket to gluster-blockd.socket, as that makes better sense. Change-Id: I43b285f9da15d078fe3df4d231d0ef8d44272d8f Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* gluster-block: refactor return valuesPrasanna Kumar Kalever2017-02-191-1/+1
| | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* daemon: fix minor bugsPrasanna Kumar Kalever2017-02-161-0/+1
| | | | | Reported-by: Pranith Kumar K <pkarampu@redhat.com> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* cli: cart off unwanted output from create commandPrasanna Kumar Kalever2017-02-151-0/+1
| | | | | | | | | | | | | | The response of below sub-operations as part of create are undesired $ targetcli set global auto_add_default_portal=false $ targetcli / saveconfig $ targetcli set attributes generate_node_acls=1 demo_mode_write_protect=0 Hence redirecting them to '/dev/null' This patch also fix a bug in the previous patch i.e. missed inverting [!] function return in if() Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* gluster-blockd: create logging directoriesPrasanna Kumar Kalever2017-02-151-4/+7
| | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* daemon: redirect logs to logdirPrasanna Kumar Kalever2017-02-141-0/+1
| | | | | | replace fprintf calls with LOG() Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* cli: review fixes in gluster-blockPrasanna Kumar Kalever2017-02-111-3/+5
| | | | | | Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* gluster-block: create block files in '/block-store' dirPrasanna Kumar Kalever2017-02-081-0/+4
| | | | | | | | | | | | | | | | | till now we have '/block-meta' dir for meta files and actual block files used to reside in '/' dir. From now, lets place block files in '/block-store' So, this is how it looks like: $ tree /mnt/ /mnt/ ├── block-meta │   ├── meta.lock │   └── TARGET └── block-store └── 103e4cf1-bf41-404a-9fe1-b7c70fc33b3e Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* gluster-block: migrate build to libtoolz and create rpmPrasanna Kumar Kalever2017-02-071-0/+26
Till now we had simple makefile for checking dependencies and building. Using libtoolz will give more control on dependency checks and flexibility. This patch also introduce rpm build feature. Compiling: $ ./autogen.sh $ ./configure $ make -j $ make install Building RPMS: $ make rpms Running: $ systemctl start gluster-blockd.service Using CLI: $ gluster-block help Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>