Red Hat Training

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

Chapter 8. Clusters

The clusters collection provides information about clusters in a Red Hat Storage environment. An API user accesses this information through the rel="clusters" link obtained from the entry point URI (see Chapter 5, Entry Point).
The following table shows specific elements contained in a cluster resource representation.

Table 8.1. Cluster elements

Element Type Description Properties
link rel="networks" relationship A link to the sub-collection for networks associated with this cluster.
link rel="permissions" relationship A link to the sub-collection for cluster permissions. See Section 7.3.7, “Permissions”.
version major= minor= complex The compatibility level of the cluster.
supported_versions complex A list of possible version levels for the cluster.
gluster_service boolean defines whether gluster services are enabled on the cluster. Is always true in Red Hat Storage Console
virt_service boolean defines whether virtualization services are enabled on the cluster. Is always false in Red Hat Storage Console.

Example 8.1. An XML representation of a cluster

  <clusters>
    <cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95">
        <name>Default</name>
        <description>The default server cluster</description>
        <link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks" rel="networks"/>
        <link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/permissions" rel="permissions"/>
        <link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glustervolumes" rel="glustervolumes"/>
        <link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/glusterhooks" rel="glusterhooks"/>
        <data_center href="/api/datacenters/5849b030-626e-47cb-ad90-3ce782d831b3" id="5849b030-626e-47cb-ad90-3ce782d831b3"/>
        <memory_policy>
            <overcommit percent="100"/>
            <transparent_hugepages>
                <enabled>true</enabled>
            </transparent_hugepages>
        </memory_policy>
        <scheduling_policy>
            <policy>none</policy>
        </scheduling_policy>
        <version major="3" minor="4"/>
        <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>
        <ksm>
            <enabled>true</enabled>
        </ksm>
    </clusters>
Creation of a new cluster requires the name and server elements. Identify the server with id attribute and name element. name element is mandatory. See Section 7.2.4, “Creating a Resource in a Collection” for more information.

Example 8.2. Creating a cluster

POST /api/clusters HTTP/1.1
Accept: application/xml
Content-type: application/xml

<cluster>
    <name>cluster1</name>
 </cluster>

Example 8.3. Updating a cluster

PUT /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95 HTTP/1.1
Accept: application/xml
Content-type: application/xml

<cluster>
    <description>Cluster 1</description>
</cluster>
Removal of a cluster requires a DELETE request.

Example 8.4. Removing a cluster

DELETE /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95 HTTP/1.1

HTTP/1.1 204 No Content
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug

8.1. Networks Sub-Collection

Networks associated with a cluster are represented with the networks sub-collection. Every host within a cluster connects to these associated networks.
The representation of a cluster's network sub-collection is the same as a standard network resource with an additional cluster id= to signify a relationship to the cluster and a display element to represent the display network status in the cluster.
An API user manipulates the networks sub-collection as described in Chapter 7, Common Features. POSTing a network id or name reference to the networks sub-collection associates the network with the cluster.

Example 8.5. Associating a network resource with a cluster

POST /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks HTTP/1.1
Accept: application/xml
Content-Type: application/xml

<network>
    <name>ovirtmgmt</name>
</network>

HTTP/1.1 201 Created
Location: https://[host]/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/da05ac09-00be-45a1-b0b5-4a6a2438665f
Content-Type: application/xml

<network id="da05ac09-00be-45a1-b0b5-4a6a2438665f"
  href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/
  da05ac09-00be-45a1-b0b5-4a6a2438665f">
    <name>rhsc</name>
    <status>
        <state>operational</state>
    </status>
    <description>Display Network</description>
    <cluster id="99408929-82cf-4dc7-a532-9d998063fa95"
      href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95"/>
    <data_center id="d70d5e2d-b8ad-494a-a4d2-c7a5631073c4"
      href="/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4"/>
    <display>true</display>
</network>
The display network status is set using a PUT request to specify the Boolean value (true or false) of the display element.

Example 8.6. Setting the display network status

PUT /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/da05ac09-00be-45a1-b0b5-4a6a2438665f HTTP/1.1
Accept: application/xml
Content-Type: application/xml

<network>
    <display>false</display>
</network>
An association is removed with a DELETE request to the appropriate element in the collection.

Example 8.7. Removing a network association from a cluster

DELETE /api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks/da05ac09-00be-45a1-b0b5-4a6a2438665f HTTP/1.1
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug