1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 12:45:38 +01:00

157 Commits

Author SHA1 Message Date
Poornima G
2869f88344 BlockVolume: Input block host volume properties in block create request
Signed-off-by: Poornima G <pgurusid@redhat.com>
2019-02-21 09:49:55 +05:30
Aravinda VK
bebbc65052 Support for loopback bricks
Register the Bricks hosting directory using,

```
glustercli device add <peerid> <path> --provisioner loop
```

Example:

```
glustercli device add 70d79c3f-e7af-43f6-8b65-05dff2423da1 \
	   /exports --provisioner loop
```

Now create the volume using,

```
glustercli volume create gv1 --size 1G \
	   --provisioner loop \
	   --replica 3
```

Fixes: #1418
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2019-02-14 10:49:17 +05:30
Sridhar Seshasayee
ec25ca6619 Tracing: Implement glustercli command to disable the trace configuration
Implement glustercli command to disable and delete the current tracing
configuration on the cluster. The changes include gd2 transaction that
first deletes the trace configuration from the store on one node and then
a subsequent step clears the in-memory trace configuration on all nodes.

closes #1368

Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
2019-02-12 08:08:00 +05:30
Sridhar Seshasayee
219ce69b48 Tracing: Implement glustercli command to update the trace configuration
Implement glustercli command to update the current tracing status on the
cluster. All trace config options are passed as flags to the command. If
any option is not passed, the existing value for that option will be
retained.

closes #1368

Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
2019-02-12 08:08:00 +05:30
Sridhar Seshasayee
4c65b6f95a Tracing: Implement glustercli command to get current tracing status
Implement glustercli command to get the current tracing status on the
cluster. The tracing info is read from the store and presented to the
user in table format with info like Status, Jaeger Endpoints, Sampler
type and sample fraction. For e.g.,

+------------------------+----------------------------+
|      TRACE OPTION      |           VALUE            |
+------------------------+----------------------------+
| Status                 | enabled                    |
| Jaeger Endpoint        | http://192.168.122.1:14268 |
| Jaeger Agent Endpoint  | http://192.168.122.1:6831  |
| Jaeger Sampler         | 2 (Probabilistic)          |
| Jaeger Sample Fraction | 0.99                       |
+------------------------+----------------------------+

Add "trace enable" e2e test cases. The tests also exercise the
"trace status" request.

closes #1368

Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
2019-02-12 08:08:00 +05:30
Sridhar Seshasayee
6158f4a040 Tracing: Implement glustercli command to enable tracing
Implement glustercli command to enable tracing. The rest client performs
basic checks of the tracing options prior to sending the request.

closes #1368

Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
2019-02-12 08:08:00 +05:30
Madhu Rajanna
18c0b006be Add device info cli command
* Added device info CLI command, which
will list the devices if the Peer ID is
passed or else it will list all devices
in the cluster.

```
[root@dhcp43-209 build]# ./glustercli device info

Peer Name: dhcp43-209.lab.eng.blr.redhat.com
Peer ID: 335f3b47-cdc6-46ad-806e-6340f867c428
+----------+---------+------------+-----------+-----------+--------+
|  DEVICE  |  STATE  | TOTAL SIZE | FREE SIZE | USED SIZE | USED % |
+----------+---------+------------+-----------+-----------+--------+
| /dev/vdb | enabled | 0.0 B      | 0.0 B     | 0.0 B     |   0.00 |
| /dev/vdc | enabled | 199.9 GiB  | 129.1 GiB | 70.8 GiB  |  35.41 |
+----------+---------+------------+-----------+-----------+--------+

Peer Name: dhcp43-106.lab.eng.blr.redhat.com
Peer ID: 7d0df840-698a-4604-acf0-457fe87e4641
+----------+---------+------------+-----------+-----------+--------+
|  DEVICE  |  STATE  | TOTAL SIZE | FREE SIZE | USED SIZE | USED % |
+----------+---------+------------+-----------+-----------+--------+
| /dev/vdb | enabled | 199.9 GiB  | 149.2 GiB | 50.7 GiB  |  25.35 |
+----------+---------+------------+-----------+-----------+--------+

Peer Name: dhcp42-71.lab.eng.blr.redhat.com
Peer ID: e0567090-202a-429c-a13e-408a5f36e312
+----------+---------+------------+-----------+-----------+--------+
|  DEVICE  |  STATE  | TOTAL SIZE | FREE SIZE | USED SIZE | USED % |
+----------+---------+------------+-----------+-----------+--------+
| /dev/vdb | enabled | 199.9 GiB  | 149.2 GiB | 50.7 GiB  |  25.35 |
+----------+---------+------------+-----------+-----------+--------+

[root@dhcp43-209 build]# ./glustercli device info e0567090-202a-429c-a13e-408a5f36e312

Peer Name: dhcp42-71.lab.eng.blr.redhat.com
Peer ID: e0567090-202a-429c-a13e-408a5f36e312
+----------+---------+------------+-----------+-----------+--------+
|  DEVICE  |  STATE  | TOTAL SIZE | FREE SIZE | USED SIZE | USED % |
+----------+---------+------------+-----------+-----------+--------+
| /dev/vdb | enabled | 199.9 GiB  | 149.2 GiB | 50.7 GiB  |  25.35 |
+----------+---------+------------+-----------+-----------+--------+

```

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-12-18 11:07:13 +05:30
Madhu Rajanna
140393c6fa Add logging if there is an error in CLI
add logging if there is an error in CLI,
with the help of -v flag user should
be able to check the failure logs.

Fixes #1414

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-12-18 10:08:39 +05:30
Madhu Rajanna
c198e1173b add regex for different volume size format
we should be able to create volume size with
different formats like KB, Kib, Mb, MiB etc

Fixes: #1398

```
[root@dhcp43-209 build]# ./glustercli volume create size1 --size=20MB --replica=3 -v
size1 Volume created successfully
Volume ID:  b2693574-8489-4d4b-94ab-3564776d1cce

[root@dhcp43-209 build]# ./glustercli volume create size2 --size=20MiB --replica=3 -v
size2 Volume created successfully
Volume ID:  b1153478-4912-4481-a047-8d67258ab08c

[root@dhcp43-209 build]# ./glustercli volume create size3 --size=20M --replica=3 -v
size3 Volume created successfully
Volume ID:  8ac1c9a5-cc84-45ec-b382-eff17369d024

[root@dhcp43-209 build]# ./glustercli volume create size35 --size=20 --replica=3 -v
size35 Volume created successfully
Volume ID:  560da74f-b7cf-466c-994c-0f03ba07bb24

[root@dhcp43-209 build]# ./glustercli volume create size --size=21mb --replica=3 -v
7size Volume created successfully
Volume ID:  638d4108-bf2e-48e9-9d1d-982a34882586

[root@dhcp43-209 build]# ./glustercli volume create sizes6 --size=20971520 --replica=3 -v
sizes6 Volume created successfully
Volume ID:  c4de7f7e-e4b4-46e6-80d1-92a9e060c4c0

[root@dhcp43-209 build]# ./glustercli volume create size6 --size=20971520sadf --replica=3 -v
Invalid Volume Size specified
```

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-12-17 18:03:23 +05:30
Madhu Rajanna
9bfa47103e print volume capacity,used and free size in human readable format
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-12-17 09:50:00 +05:30
Madhu Rajanna
0358340132 Fix spelling mistake
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-12-17 09:50:00 +05:30
Madhu Rajanna
0c5d70f231 Fix misspelled English words
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-12-14 18:18:38 +05:30
Aravinda VK
56dc388f64 Auto distribute count based on Max brick size
While creating auto provisioned volume, support added to automatically
calculate the distribute count based on max brick size specified in
the request.

For example, below command creates 2x3(Distributed replicate) volume

```
glustercli volume create gv1 --replica 3 --size 1G \
        --max-brick-size 512M
```

Fixes: #999
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-12-13 20:15:36 +05:30
Aravinda VK
c4ce16f9c3 Fix expanding arbiter volume
Arbiter count was not considered when a Volume is expanded.

Fixes: #1161
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-11-29 12:27:21 +05:30
Aravinda VK
66a9b6e308 geo-rep: Fixes for remote authentication and gsyncd path
- gsyncd path defaulted to /usr/libexec/glusterfs/gsyncd
- Fixes remote REST API auth issues
- Workaround to make it work with marker xlator

Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-11-29 11:40:33 +05:30
Aravinda VK
419ae7dff5 Fix the Volume Capacity display in CLI
Earlier `humanReadable` function was accepting values in `MiB`
With PR #1326 default unit is changed to bytes.

Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-11-26 16:04:06 +05:30
Vishal Pandey
933aa93c8f split brain operations API and CLI
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
2018-11-23 19:46:46 +05:30
Aravinda VK
552d07b7d9 lvm and fs utils code refactor
Moved lvm related functions from `$SRC/glusterd2/snapshot/lvm`
and `$SRC/plugins/device/deviceutils/` to `$SRC/pkg/lvmutils`

Also moved fs related functions from `plugins/deviceutils` to
`$SRC/pkg/fsutils`.

Fixes: #1187
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-11-22 22:38:37 +05:30
Vishal Pandey
48a7ebfd28 Brick resize for volume expand
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
2018-11-22 17:19:02 +05:30
rishubhjain
643fb9dd1b Using bytes instead of KB for volume creation 2018-11-19 15:16:41 +05:30
vpandey-RH
e6ce7cfd90 Volume profile info API + CLI
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
2018-11-16 18:52:23 +05:30
Hari Gowtham
b5e55a7427 Arbiter brick size calculation for smart volume creation.
This patch creates the arbiter brick for the smart volume as per the
calculation:

brick size = 4 KB * ( size in KB of largest data brick in volume or
replica set / average file size in KB)

Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
2018-11-12 09:58:13 +05:30
imjoey
72ccf646db Fix capitalized error message format. 2018-10-26 09:31:33 +05:30
Aravinda VK
b974fd12b7 Environment variable support for glustercli endpoints
Endpoints are taken in following order of precedence
(highest to lowest):

- --endpoints
- GD2_ENDPOINTS (environment variable)
- (default value)

Fixes: #1291
Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-10-24 16:16:27 +05:30
Madhu Rajanna
76f12739b4 Fix typo in snapshot create CLI flag
Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-10-24 13:30:07 +05:30
Prashanth Pai
edda2c5063 Refactor cluster options package
* Merge 'glusterd2/cluster' package into `glusterd2/options` package.
* Rename 'glusterd2/commands/global' to 'glusterd2/commands/options'.

Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-10-11 16:26:30 +05:30
Redhat
fe29991a2a Fixed GeorepStatusList response
Signed-off-by: Sidharth Anupkrishnan <sanupkri@redhat.com>
2018-10-11 16:17:50 +05:30
Prashanth Pai
dd2f77ac5c Fix typos reported by misspell tool
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-10-05 11:41:04 +05:30
Prashanth Pai
4ecc175f1a Refactor flags/filters applied to set volume options
'--advanced' in the CLI and REST API during volume create doesn't intuitively
and clearly indicate that it's for the volume options. A new user may read this
as creation of an "advanced volume" which isn't true.

The flags have now been prepended with 'allow' in the fields of request structs.
The API has been renamed as 'allow-<type>-options'.

Also, created 'VolOptionFlags' struct for flags of options and embeded it in
all request structs.

Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-10-04 20:38:24 +05:30
Hari Gowtham
486e23ed22 volume: add capacity field
Added capacity field to volume GET AP response. This is currently
returned only for volumes provisioned dynamically and their volume
snapshots.

The CLI prints the volume capacity in a human friendly format.

Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
2018-10-03 09:35:40 +05:30
Mohammed Rafi KC
5b2d07b69b snapshot/delete: Implement snapshot delete all
Glustercli will have an added feature of deleting all
snapshots in the cluster or all snapshots of a particular
volume

Example CLI commands

Example 1 :-> Delete a particular snapshot
glustercli snapshot delete <snapname>

Example 2 :-> Delete all snapshots of a cluster
glustercli snapshot delete all

Example 3 :-> Delete a all snapshots of a particular volume
glustercli snapshot delete all <volume-name>

Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
2018-09-26 10:12:01 +05:30
Aravinda VK
8e1cfe4e6d Make Volume name mandatory in Volume create request
- CSI driver also passes Volume name to Volume create API
- Mandatory Volume name also helps to ignore
  duplicate(accidental/network failure) Volume create
  API requests(Discussed here
  https://github.com/gluster/glusterd2/issues/919#issuecomment-401022413)
- Applications can generate name and can pass to API, not much benefit
  of auto generating name from glusterd2
- Supporting both the syntax in CLI adds confusion

Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-09-18 19:23:30 +05:30
Madhu Rajanna
305072d7f9 rename snapTime field to createAt in snapshot response
instead of returning the time as string,return
snapshot creation time as time.Time, the rest user
dont need to convert back to the time.Time if he
want to do any time conversion.

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-09-15 11:34:24 +05:30
rishubhjain
7eddf439b2 glustercli : Displaying volumes not found message if no volume exists 2018-09-07 17:10:52 +05:30
rishubhjain
e767851a72 Adding snapshot description in glustercli snapshot info 2018-09-06 12:09:25 +05:30
Madhu Rajanna
7ba7bd303f return complete snapshot info in snapshot list
during the snapshot list return the complete
snapshots info along with the parent volume
name, if we call snapshotlist we should be
able to get complete snapshot information
like listing volumes.

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-09-05 09:57:30 +05:30
Mohammed Rafi KC
0483c2ff5a snapshot/delete: Implement snapshot delete all
Glustercli will have an added feature of deleting all
snapshots in the cluster or all snapshots of a particular
volume

Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
2018-09-03 21:31:11 +05:30
Mohammed Rafi KC
d284f086d0 snapshot:update options during snap create using default value
This also address review comments in PR 846.

Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
2018-09-03 14:43:13 +05:30
Madhu Rajanna
c5ba295533 Start/Stop daemons during volume start and stop
add Xlator action function to start
daemons if volume starts

add Xlator action function to stop
daemons if volume stops and if daemon
is not managing any other volumes.

update volinfo in ETCD and notify
all nodes about newly generated volfiles

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-08-21 13:37:22 +05:30
Oshank Kumar
353e236304 cli: warning prompt yes/no before volume deletion
closes: #1163

Signed-off-by: Oshank Kumar <okumar@redhat.com>
2018-08-20 15:07:46 +05:30
Oshank Kumar
38d20ee280 restclient: refactor some of the rest client code .
added separate method to create http.Request.
Initializing underlying http.Client while initializing
GlusterD rest client

Signed-off-by: Oshank Kumar <okumar@redhat.com>
2018-08-14 18:28:18 +05:30
Madhu Rajanna
3c9ca8411b log errors with log.WithError()
during error logging we should log
with WithError()

Signed-off-by: Madhu Rajanna <mrajanna@redhat.com>
2018-08-09 14:29:28 +05:30
Oshank Kumar
02e35a95e0 cli: Refactor some of glustercli code
Signed-off-by: Oshank Kumar <okumar@redhat.com>
2018-08-08 12:38:17 +05:30
Oshank Kumar
85692c7411 Valiate Last Error Response in failure function of GlusterCli
If last Error Response is nil, then calling failure function will cause
segmentation fault error
Fixes #1115

Signed-off-by: Oshank Kumar <okumar@redhat.com>
2018-08-03 09:33:23 +05:30
Prashanth Pai
6088f16d2b CLI: Print request and other IDs in error output
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-07-30 09:13:19 +05:30
Prashanth Pai
ae4b61202a arbiter: Support replica 2 arbiter 1 usage
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-07-23 15:53:15 +05:30
Prashanth Pai
8d5b37d85a cli/restclient: Make client timeout configurable
The client timeout is now configurable at the restclient layer and also
in the CLI. The client timeout defaults to 30 seconds in both restclient
and CLI.

Timeout can be configured in:
  * restclient using SetTimeout() API.
  * CLI using --timeout command line flag.

This client timeout is the overall timeout which includes the time taken
from setting up TCP connection till client finishes reading the response
body from glusterd2.

Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-07-19 12:10:27 +05:30
Aravinda VK
5bf8c09ffd Merge Smartvol API into regular Volume Create
Example:

    curl -XPOST http://localhost:24007/v1/volumes \
        -d '{"name": "gv1", "size": 1000, "replica": 3}'

Where size is in Mb.

CLI usage is unchanged

    glustercli volume create --name gv1 --size 1G --replica 3

Signed-off-by: Aravinda VK <avishwan@redhat.com>
2018-07-18 10:21:56 +05:30
Prashanth Pai
c8382f0c83 cli: Add support for reading secret from ENV
With this change, secret is taken by CLI in following order of
precedence (highest to lowest):
--secret
--secret-file
GLUSTERD2_AUTH_SECRET (environment variable)
--secret-file (default path)

The command-line flag '--authfile' has been renamed to '--secret-file'
to be consistent with the flag `--secret`.

Signed-off-by: Prashanth Pai <ppai@redhat.com>
2018-07-17 12:03:13 +05:30
Mohammed Rafi KC
82f980deda Address review comments captured in PR-846
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
2018-07-13 13:06:10 +05:30