Red Hat Training

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

3.4. Example: Add Host to Cluster

This example adds a host to the default cluster and shows a host named host1 registered with the storage environment.

Example 3.4. Add Server to Cluster

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

<host>
  <cluster id="99408929-82cf-4dc7-a532-9d998063fa95"/>
  <name>host1</name>
  <address>IP_ADDRESS</address>
  <root_password>ROOT_PASSWORD</root_password>
</host>
cURL command:
curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" -u [USER:PASS] --cacert [CERT] https://[RHSC HOST]/api/hosts -d "<host><cluster id=\"99408929-82cf-4dc7-a532-9d998063fa95\"/><name>host1</name><address>IP_ADDRESS</address><root_password>ROOT_PASSWORD</root_password></host>"
The API returns the following representation of the newly created server:
HTTP/1.1 201 Created
Content-Type: application/xml

<host href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349" id="de173e6a-fb05-11e1-a2fc-0050568c4349">
    <name>host1</name>
    <actions>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/fence" rel="fence"/>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/install" rel="install"/>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/activate" rel="activate"/>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/deactivate" rel="deactivate"/>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/approve" rel="approve"/>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/iscsilogin" rel="iscsilogin"/>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/iscsidiscover" rel="iscsidiscover"/>
        <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/commitnetconfig" rel="commitnetconfig"/>
    </actions>
    <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/storage" rel="storage"/>
    <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/nics" rel="nics"/>
    <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/tags" rel="tags"/>
    <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/permissions" rel="permissions"/>
    <link href="/api/hosts/de173e6a-fb05-11e1-a2fc-0050568c4349/statistics" rel="statistics"/>
    <address>10.16.159.64</address>
    <status>
        <state>unassigned</state>
    </status>
    <cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
    <port>54321</port>
    <type>rhel</type>
    <storage_manager priority="5">false</storage_manager>
    <power_management>
        <enabled>false</enabled>
        <options/>
    </power_management>
    <ksm>
        <enabled>false</enabled>
    </ksm>
    <transparent_hugepages>
        <enabled>false</enabled>
    </transparent_hugepages>
    <cpu>
        <speed>0</speed>
    </cpu>
    <memory>0</memory>
    <summary>
        <total>0</total>
    </summary>
</host>
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A3522632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug