Red Hat Training

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

3.3. Example: List Host Collection

This example retrieves a representation of the host collection and shows a Red Hat Storage server named host1 registered with the default cluster.

Example 3.3. List hosts collection

GET /api/hosts HTTP/1.1
Accept: application/xml
cURL command:
curl -X GET -H "Accept: application/xml" -u [USER:PASS] --cacert [CERT] https://[RHSC Host]/api/hosts
The API returns the following representation:
HTTP/1.1 200 OK
Accept: application/xml

<hosts>
    <host href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6" id="411fd862-1469-4dff-ad5a-a7be364d83a6">
        <actions>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/approve" rel="approve"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/forceselectspm" rel="forceselectspm"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/iscsilogin" rel="iscsilogin"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/iscsidiscover" rel="iscsidiscover"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/commitnetconfig" rel="commitnetconfig"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/fence" rel="fence"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/deactivate" rel="deactivate"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/install" rel="install"/>
            <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/activate" rel="activate"/>
        </actions>
        <name>host1</name>
        <comment></comment>
        <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/nics" rel="nics"/>
        <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/tags" rel="tags"/>
        <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/permissions" rel="permissions"/>
        <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/statistics" rel="statistics"/>
        <link href="/api/hosts/411fd862-1469-4dff-ad5a-a7be364d83a6/hooks" rel="hooks"/>
        <address>10.70.42.154</address>
        <certificate>
            <organization>TestOrg</organization>
            <subject>O=TestOrg,CN=10.70.42.154</subject>
        </certificate>
        <status>
            <state>up</state>
        </status>
        <cluster href="/api/clusters/02b2bd03-5e54-45f9-9302-33a4ba96eb32" id="02b2bd03-5e54-45f9-9302-33a4ba96eb32"/>
        <port>54321</port>
        <type>rhel</type>
        <storage_manager priority="5">false</storage_manager>
        <version major="4" minor="14" build="7" revision="2" full_version="vdsm-4.14.7.2-1.el6rhs"/>
        <hardware_information>
            <manufacturer>Red Hat</manufacturer>
            <version>6Server-6.4.0.4.el6</version>
            <serial_number>00000000-0000-0000-0000-00259078DB32</serial_number>
            <product_name>RHEV Hypervisor</product_name>
            <uuid>504dd302-0c14-4153-ae48-a0b2fa9484ce</uuid>
            <family>Red Hat Enterprise Linux</family>
        </hardware_information>
        <power_management type="apc">
            <enabled>false</enabled>
            <options/>
        </power_management>
        <ksm>
            <enabled>false</enabled>
        </ksm>
        <transparent_hugepages>
            <enabled>true</enabled>
        </transparent_hugepages>
        <iscsi>
            <initiator>iqn.1994-05.com.redhat:6f8b848932c9</initiator>
        </iscsi>
        <ssh>
            <port>22</port>
            <fingerprint>e7:02:ba:01:72:35:1c:5b:5a:ac:ba:b6:da:5d:23:8e</fingerprint>
        </ssh>
        <cpu>
            <topology sockets="1" cores="1" threads="1"/>
            <name>Intel Xeon E312xx (Sandy Bridge)</name>
            <speed>2200</speed>
        </cpu>
        <memory>2103443456</memory>        <max_scheduling_memory>1698693120</max_scheduling_memory>
        <summary>
            <active>0</active>
            <migrating>0</migrating>
            <total>0</total>
        </summary>
        <os type="RHEL">
            <version full_version="6Server - 6.5.0.1.el6"/>
        </os>
        <libvirt_version major="0" minor="10" build="2" revision="0" full_version="libvirt-0.10.2-29.el6_5.9"/>
    </host>
</hosts>
Note the id code of your Default server. This code identifies this host in relation to other resources of your virtual environment.
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug