Skip to content

Commit

Permalink
[Datasource] Power add host reference to host datasources (#5834)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Kita authored Dec 18, 2024
1 parent f25696d commit 6abdc4d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
8 changes: 8 additions & 0 deletions ibm/service/power/data_source_ibm_pi_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ func DataSourceIBMPIHost() *schema.Resource {
Description: "Link to host group resource.",
Type: schema.TypeMap,
},
Attr_HostReference: {
Computed: true,
Description: "Current physical ID of the host.",
Type: schema.TypeInt,
},
Attr_State: {
Computed: true,
Description: "State of the host (up/down).",
Expand Down Expand Up @@ -137,6 +142,9 @@ func dataSourceIBMPIHostRead(ctx context.Context, d *schema.ResourceData, meta i
if host.HostGroup != nil {
d.Set(Attr_HostGroup, hostGroupToMap(host.HostGroup))
}
if host.HostReference != 0 {
d.Set(Attr_HostReference, host.HostReference)
}
if host.State != "" {
d.Set(Attr_State, host.State)
}
Expand Down
8 changes: 8 additions & 0 deletions ibm/service/power/data_source_ibm_pi_hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ func DataSourceIBMPIHosts() *schema.Resource {
Description: "Link to host group resource.",
Type: schema.TypeMap,
},
Attr_HostReference: {
Computed: true,
Description: "Current physical ID of the host.",
Type: schema.TypeInt,
},
Attr_State: {
Computed: true,
Description: "State of the host (up/down).",
Expand Down Expand Up @@ -151,6 +156,9 @@ func dataSourceIBMPIHostsRead(ctx context.Context, d *schema.ResourceData, meta
if host.HostGroup != nil {
hs[Attr_HostGroup] = hostGroupToMap(host.HostGroup)
}
if host.HostReference != 0 {
hs[Attr_HostReference] = host.HostReference
}
if host.State != "" {
hs[Attr_State] = host.State
}
Expand Down
1 change: 1 addition & 0 deletions ibm/service/power/ibm_pi_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const (
Attr_HostGroupID = "host_group_id"
Attr_HostGroups = "host_groups"
Attr_HostID = "host_id"
Attr_HostReference = "host_reference"
Attr_Hosts = "hosts"
Attr_Href = "href"
Attr_Hypervisor = "hypervisor"
Expand Down
21 changes: 9 additions & 12 deletions website/docs/d/pi_host.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ After your data source is created, you can read values from the following attrib
- `capacity` - (List) Capacities of the host.

Nested schema for `capacity`:
- `available_core` - (Float) Number of cores currently available.
- `available_memory` - (Float) Amount of memory currently available (in GB).
- `reserved_core` - (Float) Number of cores reserved for system use.
- `reserved_memory` - (Float) Amount of memory reserved for system use (in GB).
- `total_core` - (Float) Total number of cores of the host.
- `total_memory` - (Float) Total amount of memory of the host (in GB).
- `used_core` - (Float) Number of cores in use on the host.
- `used_memory` - (Float) Amount of memory used on the host (in GB).
- `available_core` - (Float) Number of cores currently available.
- `available_memory` - (Float) Amount of memory currently available (in GB).
- `reserved_core` - (Float) Number of cores reserved for system use.
- `reserved_memory` - (Float) Amount of memory reserved for system use (in GB).
- `total_core` - (Float) Total number of cores of the host.
- `total_memory` - (Float) Total amount of memory of the host (in GB).
- `used_core` - (Float) Number of cores in use on the host.
- `used_memory` - (Float) Amount of memory used on the host (in GB).

- `display_name` - (String) Name of the host.
- `host_group` - (Map) Information about the owning host group.
Expand All @@ -66,11 +66,8 @@ After your data source is created, you can read values from the following attrib
- `access` - (String) Whether the host group is a primary or secondary host group.
- `href` - (String) Link to the host group resource.
- `name` - (String) Name of the host group.

- `host_reference` - (Integer) Current physical ID of the host.
- `state` - (String) State of the host `up` or `down`.

- `id` - (String) The unique identifier of the host.

- `status` - (String) Status of the host `enabled` or `disabled`.

- `sys_type` - (String) System type.
1 change: 1 addition & 0 deletions website/docs/d/pi_hosts.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ After your data source is created, you can read values from the following attrib
- `href` - (String) Link to the host group resource.
- `name` - (String) Name of the host group.
- `host_id` - (String) ID of the host.
- `host_reference` - (Integer) Current physical ID of the host.
- `id` - (String) The unique identifier of the pi_hosts.
- `state` - (String) State of the host `up` or `down`.
- `status` - (String) Status of the host `enabled` or `disabled`.
Expand Down

0 comments on commit 6abdc4d

Please sign in to comment.