Chapter 10. Volumes
The
volumes collection provides information about volumes in a Red Hat Gluster Storage environment.
The following table shows specific elements contained in a volume resource representation.
| Element | Type | Description | Properties |
|---|---|---|---|
volumeName | relationship | Name of the volume to be created. |
|
volumeType | relationship | DISTRIBUTE, REPLICATE, DISTRIBUTED_REPLICATE. |
|
replicaCount | complex | replicaCount is mandatory if volumeType is REPLICATE or DISTRIBUTED_REPLICATE |
|
bricks | complex | list of bricks of a volume. You can add/remove bricks to/from a volume. |
|
| options | complex | list of options of the volume |
Example 10.1. An XML representation of a volume
<gluster_volume href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50" id="6d4bc7ed-4278-45e1-973e-e9a5e061de50">
<actions>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/rebalance" rel="rebalance"/>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/stoprebalance" rel="stoprebalance"/>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/resetoption" rel="resetoption"/>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/resetalloptions" rel="resetalloptions"/>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/setoption" rel="setoption"/>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/start" rel="start"/>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/stop" rel="stop"/>
</actions>
<name>newVol</name>
<link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes/6d4bc7ed-4278-45e1-973e-e9a5e061de50/bricks" rel="bricks"/>
<cluster href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59" id="419590b8-5aa0-473b-9651-aa41f1372c59"/>
<volume_type>distribute</volume_type>
<transport_types>
<transport_type>tcp</transport_type>
</transport_types>
<replica_count>0</replica_count>
<options/>
<status>
<state>down</state>
</status>
</gluster_volume>
10.1. Creating a Volume Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Creation of a new volume requires the
volumeName, volumeType,transportType and brick elements. The API creates a new volume with a POST request to the URI containing a representation of the new volume
.
Example 10.2. Creating a volume
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes HTTP/1.1
Accept: application/xml
Content-type: application/xml
<gluster_volume>
<name>data</name>
<volume_type>distribute</volume_type>
<bricks>
<brick>
<server_id>fcb46b88-f32e-11e1-918a-0050568c4349</server_id>
<brick_dir>/export/data/brick1</brick_dir>
</brick>
<brick>
<server_id>de173e6a-fb05-11e1-a2fc-0050568c4349</server_id>
<brick_dir>/export/data/brick2</brick_dir>
</brick>
</bricks>
</gluster_volume>
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] --cacert [CERT] https://[RHGSC HOST]/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes -d "<gluster_volume><name>data</name><volume_type>DISTRIBUTE</volume_type><bricks><brick><server_id>fcb46b88-f32e-11e1-918a-0050568c4349</server_id><brick_dir>/export/data/brick1</brick_dir></brick><brick><server_id>de173e6a-fb05-11e1-a2fc-0050568c4349</server_id><brick_dir>/export/data/brick2</brick_dir></brick></bricks></gluster_volume>"
The API returns the following representation of the newly created volume resource:
HTTP/1.1 201 Created
Content-Type: application/xml
<gluster_volume href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554" id="83101900-2f12-4855-838e-36b8a9e04554">
<name>data</name>
<actions>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/start" rel="start"/>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/stop" rel="stop"/>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/setOption" rel="setOption"/>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/rebalance" rel="rebalance"/>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/resetOption" rel="resetOption"/>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/resetAllOptions" rel="resetAllOptions"/>
</actions>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/bricks" rel="bricks"/>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<volume_type>distribute</volume_type>
<transport_types>
<transport_type>TCP</transport_type>
</transport_types>
<replica_count>0</replica_count>
<options/>
<state>DOWN</state>
</gluster_volume>

