Red Hat Training

A Red Hat training course is available for Red Hat Gluster Storage

10.3. Managing Volumes

The API starts, stops, re-balances, and set volume option of your volume in your cluster by issuing a POST request to the URI.
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

10.3.1. Starting a Volume

The API starts a volume with a POST request to the volumes URI.

Example 10.4. Starting a Volume

POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/start HTTP/1.1
Accept: application/xml
Content-type: application/xml

<action>
   [ <force>true</force> ]
</action>

cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC-Host]/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/start -d "<action/>"
The API returns the following representation:
<action>
    <status>
        <state>complete</state>
    </status>
</action>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

10.3.2. Stopping a Volume

Stopping of a volume requires a POST request.

Example 10.5. Stopping a Volume

POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/stop HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
   [ <force>true</force> ]
</action>

<action>
    <status>
        <state>complete</state>
    </status>
</action>
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC-Host]/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/stop -d "<action/>"
The API returns the following representation:
<action>
    <status>
        <state>complete</state>
    </status>
</action>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

10.3.3. Removing a Volume

Removal of a volume requires a DELETE request.

Example 10.6. Removing a Volume

DELETE /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/ceb59bbb-173d-4a5a-9b92-0189a17eae27 HTTP/1.1

HTTP/1.1 204 No Content
cURL command:
curl -X DELETE -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC-Host]/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554"
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A3522632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

10.3.4. Setting a Volume Option

The API sets a volume option with a POST request to the volume URI.

Example 10.7. Setting a Volume Option

POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/setOption HTTP/1.1
Accept: application/xml
Content-type: application/xml

<action>
    <option name="key" value="value" />
</action>
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS]https://[RHSC-Host]/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/setOption -d "<action><option name="key" value="value" /></action>"
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

10.3.5. Resetting a Volume Option

Resetting volume options requires a POST request.

Example 10.8. Resetting a Volume Option

POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/resetOption
HTTP/1.1
Accept: application/xml
Content-type: application/xml
<action>
    <option name="key" value="value"/>
    <force>true</force>
</action>
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC-Host]/api/clusters/99408929-82cf-4dc7-a532- 9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/resetOption -d "<action><option name="key" value="value"/><force>true</force></action>"
The API returns the following representation:
<action>
    <status>
        <state>complete</state>
    </status>
</action>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

10.3.6. Resetting all Volume Options

You can reset all volume options with a single POST request.
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/ceb59bbb-173d-4a5a-9b92-0189a17eae27/resetAllOptions HTTP/1.1
Accept: application/xml
Content-type: application/xml
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC-Host]/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/83101900-2f12-4855-838e-36b8a9e04554/resetAllOptions -d "<action/>"
The API returns the following representation:
<action>
    <status>
        <state>complete</state>
    </status>
</action>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

10.3.7. Rebalancing Volume

You can rebalance the volume by issuing a POST request. The status of rebalance operation can be monitored by job id returned by this API.
POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes/ceb59bbb-173d-4a5a-9b92-0189a17eae27/rebalance -d "<action/>" 
HTTP/1.1
Accept: application/xml
Content-type: application/xml
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC-Host]/api/clusters/44571c63-a110-4fba-9a8c-7b30446ba8bf/glustervolumes/380474af-360b-48fa-a210-9c08b913ffa3/rebalance -d "<action/>"
The API returns the following representation:
<action>
    <job href="/api/jobs/0937afb0-2c21-4834-8fee-70e8982b8a8e" id="0937afb0-2c21-4834-8fee-70e8982b8a8e"/>
    <status>
        <state>complete</state>
    </status>
</action>
The status of rebalance is monitored using the job ID and its corresponding step ID by looking at the re-balancing step.
/api/jobs/<job_id>/steps
/api/jobs/<job_id>/steps/<step_id> --for step type rebalance
/api/jobs/<job_id>/steps/<step_id>/statistics -- for detail information of rebalance status per node

Example 10.9. Monitoring Rebalance

<statistics>
    <statistic href="/api/hosts/93fb8339-3888-44de-8050-e1166714e186/statistics/efca817c-2c70-3c82-b5b4-cff3dc24acbd" id="efca817c-2c70
-3c82-b5b4-cff3dc24acbd">
        <name>files.moved</name>
        <description>Number of files moved</description>
        <values type="INTEGER">
            <value>
                <datum>0</datum>
            </value>
        </values>
        <type>COUNTER</type>
        <unit>NONE</unit>
        <host href="/api/hosts/93fb8339-3888-44de-8050-e1166714e186" id="93fb8339-3888-44de-8050-e1166714e186"/>
        <step href="/api/jobs/0937afb0-2c21-4834-8fee-70e8982b8a8e/steps/1560867e-7460-49d4-8bdb-6444a6ffef3a" id="1560867e-7460-49d4-8
bdb-6444a6ffef3a"/>
    </statistic>
...
</statistics>
You can stop a rebalance operation by issuing a POST request.
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC-Host]/api/clusters/44571c63-a110-4fba-9a8c-7b30446ba8bf/glustervolumes/380474af-360b-48fa-a210-9c08b913ffa3/stoprebalance -d "<action/>"
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug