このコンテンツは選択した言語では利用できません。
8.2. Gluster Hooks
The
glusterhooks
collection provides information about Gluster Hooks in a Red Hat Gluster 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
8.2.1. Managing Gluster Hooks リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
This section describes the Gluster Hooks operations of the Red Hat Gluster Storage Console API such as listing, enabling, resolving, and removing them from a cluster.
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
GET /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glusterhooks HTTP/1.1
Accept: application/xml
The API returns the following representation:
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
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://[RHGSC HOST]/api/clusters/419590b8-5aa0-473b-9651-aa41f1372c59/glusterhooks/747bbb9e-ace6-424b-be31-16b33e02d882/enable -d "<action/>"
The API returns the following representation:
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 Gluster 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://[RHGSC 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:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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://[RHGSC 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>
<action> <job href="/api/jobs/3dd9800f-a8c6-4f58-a3cf-dff190d2f06f" id="3dd9800f-a8c6-4f58-a3cf-dff190d2f06f"/> <status><state>complete</state> </status> </action>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Content ConflictThis conflict can be resolved with the
resolution_type = copy
. If the version of the hook is incorrect in Red Hat Gluster 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 Gluster 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://[RHGSC 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:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Status ConflictThis conflict is resolved by either enabling or disabling a hook in a cluster.