8.2. Gluster Hooks
The
glusterhooks
collection provides information about Gluster Hooks in a Red Hat Storage environment. An API user accesses this information through the rel="glusterhooks"
link obtained from the entry point URI (see Chapter 5, Entry Point).
Note
Gluster Hooks data from the storage cluster is collected periodically every two hours.
The following table shows specific elements contained in a Gluster Hooks resource representation.
Element | Type | Description | Properties |
---|---|---|---|
cluster | relationship | A reference to the cluster that includes this hook. | locked |
name | string | The name of the hook script | Read only |
gluster_command | string | gluster volume command for which the hook is executed | read only |
stage | string | stage of the command; PRE or POST | read only |
content_type | string | TEXT or BINARY | read only |
checksum | string | md5 checksum of the hook script | read only |
content | string | content of the hook script | read only |
conflict_status | integer | bit representation of the conflict detected for the hook. First bit is for content, second is for status and third is for missing hooks. | read only |
conflicts | string | comma separated list of conflict | read only |
status | One of enabled or disabled | The status of the hook. | update |
Example 8.8. An XML representation of Gluster Hook Collection
<glusterhooks> <gluster_hook href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6" id="8ead05b0-3085-41a3-8693-9a7dfd6761a6"> <actions> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6/resolve" rel="resolve"/> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6/enable" rel="enable"/> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6/disable" rel="disable"/> </actions> <name>add-brick-PRE-28Quota-enable-root-xattr-heal.sh</name> <cluster href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59" id="419590b8-5aa0-473b-9651-aa41f1372c59"> <name>Cluster_3_3</name> ... </cluster> <gluster_command>add-brick</gluster_command> <stage>PRE</stage> <content_type>TEXT</content_type> <checksum>f08a82c0ac88b2565842d1de7cdb14c0</checksum> <conflict_status>0</conflict_status> <conflicts></conflicts> <status> <state>enabled</state> </status> </gluster_hook>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug
8.2.1. Managing Gluster Hooks
This section describes the Gluster Hooks operations of the Red Hat Storage Console API such as listing, enabling, resolving, and removing them from a cluster.
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug
8.2.1.1. Listing Gluster Hooks
A listing of hooks in the cluster along with conflict status is obtained by issuing a
GET
request on the volume URI
.
GET /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glusterhooks HTTP/1.1 Accept: application/xml
The API returns the following representation:
HTTP/1.1 200 OK Accept: application/xml <glusterhooks> <gluster_hook href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6" id="8ead05b0-3085-41a3-8693-9a7dfd6761a6"> <actions> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6/resolve" rel="resolve"/> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6/enable" rel="enable"/> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/8ead05b0-3085-41a3-8693-9a7dfd6761a6/disable" rel="disable"/> </actions> <name>add-brick-PRE-28Quota-enable-root-xattr-heal.sh</name> <cluster href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59" id="419590b8-5aa0-473b-9651-aa41f1372c59"> <name>Cluster_3_3</name> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/networks" rel="networks"/> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/permissions" rel="permissions"/> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glustervolumes" rel="glustervolumes"/> <link href="/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks" rel="glusterhooks"/> <memory_policy> <overcommit percent="100"/> <transparent_hugepages> <enabled>true</enabled> </transparent_hugepages> </memory_policy> <scheduling_policy> <policy>none</policy> </scheduling_policy> <error_handling> <on_error>migrate</on_error> </error_handling> <virt_service>false</virt_service> <gluster_service>true</gluster_service> <threads_as_cores>false</threads_as_cores> <tunnel_migration>false</tunnel_migration> <trusted_service>false</trusted_service> <ballooning_enabled>false</ballooning_enabled> </cluster> <gluster_command>add-brick</gluster_command> <stage>PRE</stage> <content_type>TEXT</content_type> <checksum>f08a82c0ac88b2565842d1de7cdb14c0</checksum> <conflict_status>0</conflict_status> <conflicts></conflicts> <status> <state>enabled</state> </status> </gluster_hook>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug
8.2.1.2. Enabling Gluster Hooks
A Gluster Hook is enabled by issuing a
POST
request to its URI
.
POST /api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/747bbb9e-ace6-424b-be31-16b33e02d882/enable HTTP/1.1 Accept: application/xml
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC HOST]/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/747bbb9e-ace6-424b-be31-16b33e02d882/enable -d "<action/>"
The API returns the following representation:
<action> <job href="/api/jobs/58584575-6089-4cef-bdae-a2fc5f406bbd" id="58584575-6089-4cef-bdae-a2fc5f406bbd"/> <status> <state>complete</state> </status> </action>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug
8.2.1.3. Resolving Gluster Hook Conflict
Gluster Hooks conflict is resolved by issuing a
POST
request. MISSING_HOOK
, CONTENT_CONFLICT
, and STATUS_CONFLICT
are the types of conflict that can be resolved on a cluster.
- Missing Hook Conflict:
MISSING_HOOK
conflict can be resolved either by adding the hook to the host where it is missing or by removing it from all hosts and from the Red Hat Storage Console by issuing aDELETE
request.cURL command to resolve missing hook conflict by adding hook: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/glusterhooks/59ecbacb-1ce3-43f7-82e4-55db8ed74f56/resolve -d "<action><resolution_type>ADD</resolution_type></action>"
The API returns the following representation:<action> <resolution_type>ADD</resolution_type> <job href="/api/jobs/46d89857-37a1-492a-9327-78922884a778" id="46d89857-37a1-492a-9327-78922884a778"/> <status> <state>complete</state> </status> </action>
cURL command to resolve missing hook conflict by deleting hook:curl -X DELETE -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] https://[RHSC HOST]/api/clusters/44571c63-a110-4fba-9a8c-7b30446ba8bf/glusterhooks/18782869-3e62-42a5-a59d-91f896afd5d7
<action> <job href="/api/jobs/3dd9800f-a8c6-4f58-a3cf-dff190d2f06f" id="3dd9800f-a8c6-4f58-a3cf-dff190d2f06f"/> <status><state>complete</state> </status> </action>
- Content ConflictThis conflict can be resolved with the
resolution_type = copy
. If the version of the hook is incorrect in Red Hat Storage Console, the content is copied from a host by passing the host.name parameter. If the host.name parameter is empty, then the content is copied from Red Hat Storage Console to all host where content is differentcURL 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/glusterhooks/59ecbacb-1ce3-43f7-82e4-55db8ed74f56/resolve -d "<action><resolution_type>COPY</resolution_type><host><name>host.name</name></host></action>"
The API returns the following representation:<action> <host> <name>host.name</name> </host> <resolution_type>COPY</resolution_type> <job href="/api/jobs/75486b97-ee5b-4a61-af6e-960b874985fc" id="75486b97-ee5b-4a61-af6e-960b874985fc"/> <status> <state>complete</state> </status> </action>
- Status ConflictThis conflict is resolved by either enabling or disabling a hook in a cluster.
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug