此内容没有您所选择的语言版本。
Chapter 9. Hosts
The
hosts
collection provides information about the hosts in a Red Hat Gluster Storage environment. An API user accesses this information through the rel="hosts"
link obtained from the entry point URI (see Chapter 5, Entry Point).
The following table shows specific elements contained in a hosts resource representation.
Element | Type | Description | Properties |
---|---|---|---|
link rel="nics" | relationship | A link to the nics sub-collection for host network interfaces. | |
link rel="tags" | relationship | A link to the tags sub-collection for host tags. | |
link rel="permissions" | relationship | A link to the permissions sub-collection for host permissions. See Chapter 7, Common Features. | |
link rel="statistics" | relationship | A link to the statistics sub-collection for host statistics. | ![]() |
address | string | The IP address or hostname of the host. | ![]() ![]() |
status | See below | The host status. | ![]() |
cluster id= | GUID | A reference to the cluster that includes this host. | |
port | integer | The listen port of the VDSM daemon running on this host. | ![]() |
iscsi | complex | The SCSI initiator for the host. | ![]() |
cpu | complex | Statistics for the host CPU. Includes sub-elements for the CPU's name , topology cores= , topology sockets= and speed . The topology cores= aggregates the total cores while the topology sockets= aggregates the total physical CPUs. | ![]() |
version major= minor= | complex | The compatibility level of the host. | ![]() |
root_password | string | The root password of this host, by convention only included in the client-provided host representation on creation. | ![]() ![]() |
The
status
contains one of the following enumerative values: down
, error
, initializing
, installing
, install_failed
, maintenance
, non_operational
, non_responsive
, pending_approval
, preparing_for_maintenance
, connecting
, reboot
, unassigned
and up
. These states are listed in host_states
under capabilities
.
Example 9.1. An XML representation of a host
Creation of a new host requires the
name
, address
and root_password
elements. See Section 7.2.4, “Creating a Resource in a Collection” for more information.
Example 9.2. Creating a host
New host creation applies only to the addition of Red Hat Enterprise Linux hosts.
The
root_password
element is only included in the client-provided initial representation and is not exposed in the representations returned from subsequent requests.
The
name
and cluster
elements are updatable post-creation. See Section 7.3.2, “Updating a Resource” for more information.
Example 9.3. Updating a host
Removal of a host requires a
DELETE
request.
Example 9.4. Removing a host
DELETE /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3 HTTP/1.1 204 No Content
DELETE /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3
HTTP/1.1 204 No Content
9.1. Network Interface Sub-Collection 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The
nics
sub-collection represents a host's physical network interfaces. Each host_nic
element in the representation acts as a network interface and contains the following elements:
Note
The icons used in the properties column of this table are described in Table 7.1, “Element property icons”
Element | Type | Description | Properties |
---|---|---|---|
name | string | The name of the host network interface, e.g. eth0 | ![]() ![]() |
link rel="statistics" | relationship | A link to the statistics sub-collection for a host's network interface statistics. | ![]() |
link rel="master" | relationship | A reference to the master bonded interface, if this is a slave interface. | ![]() |
host id= | GUID | A reference to the host. | ![]() |
network id= | GUID | A reference to the network, if any, that the interface is attached. | ![]() |
mac address= | string | The MAC address of the interface. | ![]() |
ip address= netmask= gateway= | complex | The IP level configuration of the interface. | |
boot_protocol | enumerated | The protocol for IP address assignment when the host is booting. A list of enumerated values is available in capabilities . | |
speed | integer | The network interface speed in bits per second. | ![]() |
status | enumerated | The link status for the network interface. These states are listed in host_nic_states under capabilities . | ![]() |
vlan id | integer | The VLAN which this interface represents. | ![]() |
bonding | complex | A list of options and slave NICs for bonded interfaces. | ![]() ![]() |
[a]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
[b]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
[c]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
|
Example 9.5. An XML representation of a network interface on a host
An API user creates only bonded interfaces (see Section 9.1.1, “Bonded Interfaces”). All other network interfaces contain updatable
network
, ip
and boot_protocol
elements using a PUT
request.
When adding a new network interface, the
name
and network
elements are required. Identify the network
element with the id
attribute or name
element.
An API user modifies a network interface with a
PUT
request.
An API user removes a network interface with a
DELETE
request.
DELETE /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/ e8f02fdf-3d7b-4135-86e1-1bf185570cd8 HTTP/1.1 HTTP/1.1 204 No Content
DELETE /api/hosts/2ab5e1da-b726-4274-bbf7-0a42b16a0fc3/nics/
e8f02fdf-3d7b-4135-86e1-1bf185570cd8 HTTP/1.1
HTTP/1.1 204 No Content
9.1.1. Bonded Interfaces 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
A bonded interface is represented as a
host_nic
resource containing a bonding
element.
Element | Type | Description | Properties |
---|---|---|---|
options | complex | A list of option elements for a bonded interface. Each option contains property name and value attributes. | ![]() ![]() |
slaves | complex | A list of slave host_nic id= elements for a bonded interface. | ![]() ![]() |
[a]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
[b]
Only required when adding bonded interfaces. Other interfaces are read-only and cannot be added.
|
An API user creates a new bond when
POST
ing to a host_nic
with bonding options and slave interfaces. The name
, network
and bonded
elements are required when creating a new bonded interface. Either the id
or name
elements identify the network
and slave host_nic
s.
Example 9.6. Creating a bonded interface
Important
bond0
, bond1
, bond2
, bond3
and bond4
are the only valid names for a bonded interface.
Like other resources, a
DELETE
request to a bonded interface URI deletes it.
Important
Changes to bonded interface configuration must be explicitly committed. See Section 9.3.5, “Commit Network Configuration Action”.
9.1.2. Network Interface Statistics 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Each host's network interface exposes a
statistics
sub-collection for a host's network interface statistics. Each statistic
contains the following elements:
Element | Type | Description |
---|---|---|
name | string | The unique identifier for the statistic entry. |
description | string | A plain text description of the statistic. |
unit | string | The unit or rate to measure the statistical values. |
type | One of GAUGE or COUNTER | The type of statistic measures. |
values type= | One of INTEGER or DECIMAL | The data type for the statistical values that follow. |
value | complex | A data set that contains datum . |
datum | see values type | An individual piece of data from a value . |
host_nic id= | relationship | A relationship to the containing host_nic resource. |
The following table lists the statistic types for network interfaces on hosts.
Name
|
Description
|
---|---|
data.current.rx |
The rate in bytes per second of data received.
|
data.current.tx |
The rate in bytes per second of data transmitted.
|
errors.total.rx |
Total errors from receiving data.
|
errors.total.tx |
Total errors from transmitting data.
|
Example 9.7. An XML representation of a host's network interface statistics sub-collection
Note
This
statistics
sub-collection is read-only.
9.1.3. Attach Action 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
A host network interface is attached to a network, indicating the given network is accessible over the interface. Either the
id
or name
elements identify the network
.
Example 9.8. Action to attach a host network interface to a network
Important
This networking configuration change must be explicitly committed. See Section 9.3.5, “Commit Network Configuration Action”.
9.1.4. Detach Action 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Detach an interface from a network. Either the
id
or name
elements identify the network
.
Example 9.9. Action to detach a host network interface to a network
Important
This networking configuration change must be explicitly committed. See Section 9.3.5, “Commit Network Configuration Action”.