Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fix for storage capacity & system pool output #4074

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

rmoralesjr
Copy link
Collaborator

@rmoralesjr rmoralesjr commented Oct 4, 2022

Add fix for storage capacity & system pool output

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Output from acceptance testing:

=== RUN TestAccIBMPIStorageTypeCapacityDataSourceBasic
--- PASS: TestAccIBMPIStorageTypeCapacityDataSourceBasic (20.74s)
PASS

=== RUN TestAccIBMPISystemPoolsDataSourceBasic
--- PASS: TestAccIBMPISystemPoolsDataSourceBasic (11.97s)
PASS

$ make testacc TESTARGS='-run=TestAccXXX'

...

@rmoralesjr
Copy link
Collaborator Author

rmoralesjr commented Oct 4, 2022

An internal IBM terraform user found some issues with the output function of a couple of the data sources: ibm_pi_system_pools and ibm_pi_storage_type_capacity. Some output was wrong or missing. I was able to reproduce.
Here is the main.tf
data "ibm_pi_system_pools" "system_pools" {
pi_cloud_instance_id = var.powerinstanceid
}
data "ibm_pi_storage_type_capacity" "type_tier1" {
pi_cloud_instance_id = var.powerinstanceid
pi_storage_type = "tier1"
}
data "ibm_pi_storage_type_capacity" "type_tier3" {
pi_cloud_instance_id = var.powerinstanceid
pi_storage_type = "tier3"
}

and output.tf
output "storage_tier1" {
description = "Needed capacity on fast 'tier1' storage in the chosen data center."
value = data.ibm_pi_storage_type_capacity.type_tier1
}

output "storage_tier3" {
description = "Needed capacity on standard 'tier3' storage in the chosen data center."
value = data.ibm_pi_storage_type_capacity.type_tier3
}
output "memory_hana" {
description = "Needed Memory (in GB) for all SAP HANA workloads in the chosen data center."
value = data.ibm_pi_system_pools.system_pools.system_pools
}
and that resulted in this output on a terraform apply
Notice the values like "capacity" are tomap({}) and many fields like "cores" are tostring(null) and "max_allocation_size" are 0 and "total_capacity" is 0


memory_hana = tolist([
  {
    "capacity" = tomap({})
    "core_memory_ratio" = 64
    "max_available" = tomap({})
    "max_cores_available" = tomap({})
    "max_memory_available" = tomap({})
    "shared_core_ratio" = tomap({})
    "system_pool_name" = "e950"
    "systems" = tolist([
      {
        "cores" = tostring(null)
        "id" = tostring(null)
        "memory" = tostring(null)
      },
  . . . .
  storage_tier1 = {
  "id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35/tier1"
  "maximum_storage_allocation" = tomap({})
  "pi_cloud_instance_id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35"
  "pi_storage_type" = "tier1"
  "storage_pools_capacity" = tolist([
    {
      "max_allocation_size" = 0
      "pool_name" = "Tier1-Flash-24c"
      "storage_type" = "tier1"
      "total_capacity" = 0
  . . . .
  
      {
      "max_allocation_size" = 0
      "pool_name" = "Tier3-Flash-1"
      "storage_type" = "tier3"
      "total_capacity" = 0
    },
  ])
}

Those changes result in the this new output that show missing the data

Outputs: memory_hana = tolist([ { "capacity" = tomap({ "cores" = "37" "memory" = "3933" }) "core_memory_ratio" = 64 "max_available" = tomap({ "cores" = "37" "memory" = "3933" }) "max_cores_available" = tomap({ "cores" = "37" "memory" = "3933" }) "max_memory_available" = tomap({ "cores" = "37" "memory" = "3933" }) "shared_core_ratio" = tomap({}) "system_pool_name" = "e950" "systems" = tolist([ { "cores" = "37" "id" = "125" "memory" = "3933" }, { "cores" = "24.5" "id" = "122" "memory" = "3793" }, ]) "type" = "e950" }, { "capacity" = tomap({ "cores" = "117.25" "memory" = "21672" }) "core_memory_ratio" = 64 "max_available" = tomap({ "cores" = "45" "memory" = "20113" }) "max_cores_available" = tomap({ "cores" = "45" "memory" = "20113" }) "max_memory_available" = tomap({ "cores" = "45" "memory" = "20113" }) "shared_core_ratio" = tomap({}) "system_pool_name" = "e980" "systems" = tolist([ { "cores" = "45" "id" = "3" "memory" = "20113" }, ]) "type" = "e980" }, { "capacity" = tomap({ "cores" = "16.75" "memory" = "930" }) "core_memory_ratio" = 64 "max_available" = tomap({ "cores" = "4" "memory" = "832" }) "max_cores_available" = tomap({ "cores" = "4" "memory" = "829" }) "max_memory_available" = tomap({ "cores" = "3" "memory" = "832" }) "shared_core_ratio" = tomap({}) "system_pool_name" = "s922" "systems" = tolist([ { "cores" = "4" "id" = "72" "memory" = "829" }, { "cores" = "3.5" "id" = "53" "memory" = "595" }, { "cores" = "3.25" "id" = "55" "memory" = "818" }, { "cores" = "3" "id" = "68" "memory" = "832" }, { "cores" = "2.25" "id" = "69" "memory" = "621" }, { "cores" = "2.25" "id" = "57" "memory" = "737" }, { "cores" = "2" "id" = "58" "memory" = "648" }, { "cores" = "1.75" "id" = "54" "memory" = "731" }, { "cores" = "1.75" "id" = "56" "memory" = "615" }, { "cores" = "1.25" "id" = "52" "memory" = "780" }, ]) "type" = "s922" }, ]) storage_tier1 = { "id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35/tier1" "maximum_storage_allocation" = tomap({ "max_allocation_size" = "146661" "storage_pool" = "Tier1-Flash-2" "storage_type" = "tier1" }) "pi_cloud_instance_id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35" "pi_storage_type" = "tier1" "storage_pools_capacity" = tolist([ { "max_allocation_size" = 29625 "pool_name" = "Tier1-Flash-24c" "storage_type" = "tier1" "total_capacity" = 40960 }, { "max_allocation_size" = 33557 "pool_name" = "Tier1-Flash-23c" "storage_type" = "tier1" "total_capacity" = 40960 }, { "max_allocation_size" = 33536 "pool_name" = "Tier1-Flash-22c" "storage_type" = "tier1" "total_capacity" = 40960 }, { "max_allocation_size" = 33659 "pool_name" = "Tier1-Flash-21c" "storage_type" = "tier1" "total_capacity" = 40960 }, { "max_allocation_size" = 33690 "pool_name" = "Tier1-Flash-20c" "storage_type" = "tier1" "total_capacity" = 40960 }, { "max_allocation_size" = 146661 "pool_name" = "Tier1-Flash-2" "storage_type" = "tier1" "total_capacity" = 175052 }, ]) } storage_tier3 = { "id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35/tier3" "maximum_storage_allocation" = tomap({ "max_allocation_size" = "63236" "storage_pool" = "Tier3-Flash-1" "storage_type" = "tier3" }) "pi_cloud_instance_id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35" "pi_storage_type" = "tier3" "storage_pools_capacity" = tolist([ { "max_allocation_size" = 33240 "pool_name" = "Tier3-Flash-14c" "storage_type" = "tier3" "total_capacity" = 40960 }, { "max_allocation_size" = 33383 "pool_name" = "Tier3-Flash-13c" "storage_type" = "tier3" "total_capacity" = 40960 }, { "max_allocation_size" = 33424 "pool_name" = "Tier3-Flash-12c" "storage_type" = "tier3" "total_capacity" = 40960 }, { "max_allocation_size" = 33373 "pool_name" = "Tier3-Flash-11c" "storage_type" = "tier3" "total_capacity" = 40960 }, { "max_allocation_size" = 33444 "pool_name" = "Tier3-Flash-10c" "storage_type" = "tier3" "total_capacity" = 40960 }, { "max_allocation_size" = 63236 "pool_name" = "Tier3-Flash-1" "storage_type" = "tier3" "total_capacity" = 175052 }, ]) }

@rmoralesjr rmoralesjr added the service/Power Systems Issues related to Power Systems label Oct 4, 2022
yussufsh
yussufsh previously approved these changes Oct 4, 2022
Copy link
Collaborator

@yussufsh yussufsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
thanks @rmoralesjr

@yussufsh yussufsh dismissed their stale review October 4, 2022 06:18

Just now realized we need changes in data_source_ibm_pi_storage_types_capacity.go as well

@rmoralesjr
Copy link
Collaborator Author

I added the changes to storage types capacity as well

=== RUN TestAccIBMPIStorageTypesCapacityDataSourceBasic
--- PASS: TestAccIBMPIStorageTypesCapacityDataSourceBasic (25.83s)
PASS

I tested the output for it by adding this to a output.tf file
output "storage_types" {
description = "Needed capacity on all storage in the chosen data center."
value = data.ibm_pi_storage_types_capacity.storage_types
}

The output for storage types capacity is this now . . .

storage_types = {
  "id" = "3edb42de-c639-dfed-f87e-c9f5032a598c"
  "maximum_storage_allocation" = tomap({
    "max_allocation_size" = "146794"
    "storage_pool" = "Tier1-Flash-2"
    "storage_type" = "tier1"
  })
  "pi_cloud_instance_id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35"
  "storage_types_capacity" = tolist([
    {
      "maximum_storage_allocation" = tomap({
        "max_allocation_size" = "146794"
        "storage_pool" = "Tier1-Flash-2"
        "storage_type" = "tier1"
      })
      "storage_pools_capacity" = tolist([
        {
          "max_allocation_size" = 29625
          "pool_name" = "Tier1-Flash-24c"
          "storage_type" = "tier1"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33557
          "pool_name" = "Tier1-Flash-23c"
          "storage_type" = "tier1"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33536
          "pool_name" = "Tier1-Flash-22c"
          "storage_type" = "tier1"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33659
          "pool_name" = "Tier1-Flash-21c"
          "storage_type" = "tier1"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33690
          "pool_name" = "Tier1-Flash-20c"
          "storage_type" = "tier1"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 146794
          "pool_name" = "Tier1-Flash-2"
          "storage_type" = "tier1"
          "total_capacity" = 175052
        },
      ])
      "storage_type" = "tier1"
    },
    {
      "maximum_storage_allocation" = tomap({
        "max_allocation_size" = "63236"
        "storage_pool" = "Tier3-Flash-1"
        "storage_type" = "tier3"
      })
      "storage_pools_capacity" = tolist([
        {
          "max_allocation_size" = 33240
          "pool_name" = "Tier3-Flash-14c"
          "storage_type" = "tier3"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33383
          "pool_name" = "Tier3-Flash-13c"
          "storage_type" = "tier3"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33424
          "pool_name" = "Tier3-Flash-12c"
          "storage_type" = "tier3"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33373
          "pool_name" = "Tier3-Flash-11c"
          "storage_type" = "tier3"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 33444
          "pool_name" = "Tier3-Flash-10c"
          "storage_type" = "tier3"
          "total_capacity" = 40960
        },
        {
          "max_allocation_size" = 63236
          "pool_name" = "Tier3-Flash-1"
          "storage_type" = "tier3"
          "total_capacity" = 175052
        },
      ])
      "storage_type" = "tier3"
    },
  ])
}

Copy link
Collaborator

@yussufsh yussufsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmoralesjr could you please verify and fix similar changes in ibm_pi_storage_pools_capacity and ibm_pi_storage_pool_capacity please?

Add fix for storage capacity & system pool output
@rmoralesjr
Copy link
Collaborator Author

ibm_pi_storage_pools_capacity and ibm_pi_storage_pool_capacity data objects have been addressed . . .

=== RUN TestAccIBMPIStoragePoolCapacityDataSourceBasic
--- PASS: TestAccIBMPIStoragePoolCapacityDataSourceBasic (17.65s)
PASS

=== RUN TestAccIBMPIStoragePoolsCapacityDataSourceBasic
--- PASS: TestAccIBMPIStoragePoolsCapacityDataSourceBasic (23.43s)
PASS

The output for these data sources are now . . .

storage_pool_cap = {
"id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35/Tier3-Flash-1"
"max_allocation_size" = 63338
"pi_cloud_instance_id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35"
"pi_storage_pool" = "Tier3-Flash-1"
"storage_type" = "tier3"
"total_capacity" = 175052
}
storage_pools_cap = {
"id" = "282db6f4-06e7-6a07-8385-e3104e76a0dc"
"maximum_storage_allocation" = tomap({
"max_allocation_size" = "146876"
"storage_pool" = "Tier1-Flash-2"
"storage_type" = "tier1"
})
"pi_cloud_instance_id" = "6021a723-bcab-4d3f-9985-d0cb2f864f35"
"storage_pools_capacity" = tolist([
{
"max_allocation_size" = 29625
"pool_name" = "Tier1-Flash-24c"
"storage_type" = "tier1"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33557
"pool_name" = "Tier1-Flash-23c"
"storage_type" = "tier1"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33536
"pool_name" = "Tier1-Flash-22c"
"storage_type" = "tier1"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33659
"pool_name" = "Tier1-Flash-21c"
"storage_type" = "tier1"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33690
"pool_name" = "Tier1-Flash-20c"
"storage_type" = "tier1"
"total_capacity" = 40960
},
{
"max_allocation_size" = 146876
"pool_name" = "Tier1-Flash-2"
"storage_type" = "tier1"
"total_capacity" = 175052
},
{
"max_allocation_size" = 33240
"pool_name" = "Tier3-Flash-14c"
"storage_type" = "tier3"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33383
"pool_name" = "Tier3-Flash-13c"
"storage_type" = "tier3"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33424
"pool_name" = "Tier3-Flash-12c"
"storage_type" = "tier3"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33373
"pool_name" = "Tier3-Flash-11c"
"storage_type" = "tier3"
"total_capacity" = 40960
},
{
"max_allocation_size" = 33444
"pool_name" = "Tier3-Flash-10c"
"storage_type" = "tier3"
"total_capacity" = 40960
},
{
"max_allocation_size" = 63338
"pool_name" = "Tier3-Flash-1"
"storage_type" = "tier3"
"total_capacity" = 175052
},
])
}

Copy link
Collaborator

@yussufsh yussufsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rmoralesjr
Copy link
Collaborator Author

@hkantare Could you please review. Thank you.

@hkantare hkantare merged commit 714c51c into IBM-Cloud:master Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/Power Systems Issues related to Power Systems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants