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

Update Storage Connection [MaxVolSupport] #5667

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ var (
Pi_shared_processor_pool_id string
Pi_snapshot_id string
Pi_spp_placement_group_id string
Pi_storage_connection string
Pi_target_storage_tier string
Pi_volume_clone_task_id string
Pi_volume_group_id string
Expand Down Expand Up @@ -1208,7 +1209,10 @@ func init() {
Pi_shared_processor_pool_id = "tf-pi-shared-processor-pool"
fmt.Println("[WARN] Set the environment variable PI_SHARED_PROCESSOR_POOL_ID for testing ibm_pi_shared_processor_pool resource else it is set to default value 'tf-pi-shared-processor-pool'")
}

Pi_storage_connection = os.Getenv("PI_STORAGE_CONNECTION")
if Pi_storage_connection == "" {
fmt.Println("[WARN] Set the environment variable PI_STORAGE_CONNECTION for testing pi_storage_connection resource else it is empty")
}
Pi_target_storage_tier = os.Getenv("PI_TARGET_STORAGE_TIER")
if Pi_target_storage_tier == "" {
Pi_target_storage_tier = "terraform-test-tier"
Expand Down
6 changes: 6 additions & 0 deletions ibm/service/power/data_source_ibm_pi_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ func DataSourceIBMPIInstance() *schema.Resource {
Description: "The status of the instance.",
Type: schema.TypeString,
},
Attr_StorageConnection: {
Computed: true,
Description: "The storage connection type.",
Type: schema.TypeString,
},
Attr_StoragePool: {
Computed: true,
Description: "The storage Pool where server is deployed.",
Expand Down Expand Up @@ -278,6 +283,7 @@ func dataSourceIBMPIInstancesRead(ctx context.Context, d *schema.ResourceData, m
d.Set(Attr_SharedProcessorPool, powervmdata.SharedProcessorPool)
d.Set(Attr_SharedProcessorPoolID, powervmdata.SharedProcessorPoolID)
d.Set(Attr_Status, powervmdata.Status)
d.Set(Attr_StorageConnection, powervmdata.StorageConnection)
d.Set(Attr_StorageType, powervmdata.StorageType)
d.Set(Attr_StoragePool, powervmdata.StoragePool)
d.Set(Attr_StoragePoolAffinity, powervmdata.StoragePoolAffinity)
Expand Down
6 changes: 6 additions & 0 deletions ibm/service/power/data_source_ibm_pi_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ func DataSourceIBMPIInstances() *schema.Resource {
Description: "The status of the instance.",
Type: schema.TypeString,
},
Attr_StorageConnection: {
Computed: true,
Description: "The storage connection type.",
Type: schema.TypeString,
},
Attr_StoragePool: {
Computed: true,
Description: "The storage Pool where server is deployed.",
Expand Down Expand Up @@ -261,6 +266,7 @@ func flattenPvmInstances(list []*models.PVMInstanceReference, meta interface{})
Attr_SharedProcessorPool: i.SharedProcessorPool,
Attr_SharedProcessorPoolID: i.SharedProcessorPoolID,
Attr_Status: *i.Status,
Attr_StorageConnection: i.StorageConnection,
Attr_StoragePool: i.StoragePool,
Attr_StoragePoolAffinity: i.StoragePoolAffinity,
Attr_StorageType: i.StorageType,
Expand Down
2 changes: 2 additions & 0 deletions ibm/service/power/ibm_pi_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ const (
Attr_Status = "status"
Attr_StatusDescriptionErrors = "status_description_errors"
Attr_StatusDetail = "status_detail"
Attr_StorageConnection = "storage_connection"
Attr_StoragePool = "storage_pool"
Attr_StoragePoolAffinity = "storage_pool_affinity"
Attr_StoragePoolsCapacity = "storage_pools_capacity"
Expand Down Expand Up @@ -458,6 +459,7 @@ const (
Hard = "hard"
Host = "host"
HostGroup = "hostGroup"
MaxVolumeSupport = "maxVolumeSupport"
Netweaver = "Netweaver"
None = "none"
OK = "OK"
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/power/resource_ibm_pi_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func ResourceIBMPIInstance() *schema.Resource {
Description: "Storage Connectivity Group for server deployment",
Optional: true,
Type: schema.TypeString,
ValidateFunc: validate.ValidateAllowedStringValues([]string{vSCSI}),
ValidateFunc: validate.ValidateAllowedStringValues([]string{vSCSI, MaxVolumeSupport}),
},
Arg_SysType: {
Computed: true,
Expand Down
50 changes: 46 additions & 4 deletions ibm/service/power/resource_ibm_pi_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func testAccCheckIBMPIInstanceDeploymentTypeConfig(name, instanceHealthStatus, e
pi_network {
network_id = data.ibm_pi_network.power_networks.id
}

}
`, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus, epic, systype, acc.PiStorageType)
}
Expand Down Expand Up @@ -133,7 +132,6 @@ func testAccCheckIBMPIInstanceIBMiLicense(name, instanceHealthStatus string, IBM
pi_network {
network_id = data.ibm_pi_network.power_networks.id
}

}`, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus, IBMiCSS, IBMiRDSUsers)
}

Expand Down Expand Up @@ -300,6 +298,31 @@ func testAccCheckIBMPIInstanceUserTagsConfig(name, instanceHealthStatus string,
`, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus, acc.PiStorageType, userTagsString)
}

func testAccCheckIBMPIInstanceStorageConnectionConfig(name, instanceHealthStatus string) string {
return fmt.Sprintf(`
resource "ibm_pi_volume" "power_volume" {
pi_cloud_instance_id = "%[1]s"
pi_volume_size = 1
pi_volume_name = "%[2]s"
pi_volume_type = "tier3"
}
resource "ibm_pi_instance" "power_instance" {
pi_cloud_instance_id = "%[1]s"
pi_memory = "2"
pi_processors = "1"
pi_instance_name = "%[2]s"
pi_proc_type = "shared"
pi_image_id = "%[3]s"
pi_sys_type = "s922"
pi_network {
network_id = "%[4]s"
}
pi_storage_connection = "%[5]s"
pi_health_status = "%[6]s"
pi_volume_ids = [ibm_pi_volume.power_volume.volume_id]
}
`, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, acc.Pi_storage_connection, instanceHealthStatus)
}
func testAccCheckIBMPIInstanceDestroy(s *terraform.State) error {
sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession()
if err != nil {
Expand Down Expand Up @@ -380,6 +403,25 @@ func TestAccIBMPIInstanceBasic(t *testing.T) {
},
})
}
func TestAccIBMPIInstanceStorageConnection(t *testing.T) {
instanceRes := "ibm_pi_instance.power_instance"
name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100))
resource.Test(t, resource.TestCase{
PreCheck: func() { acc.TestAccPreCheck(t) },
Providers: acc.TestAccProviders,
CheckDestroy: testAccCheckIBMPIInstanceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckIBMPIInstanceStorageConnectionConfig(name, power.OK),
Check: resource.ComposeTestCheckFunc(
testAccCheckIBMPIInstanceExists(instanceRes),
resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", name),
resource.TestCheckResourceAttr(instanceRes, "pi_storage_connection", acc.Pi_storage_connection),
),
},
},
})
}
func TestAccIBMPIInstanceDeploymentTarget(t *testing.T) {
instanceRes := "ibm_pi_instance.power_instance"
name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100))
Expand Down Expand Up @@ -570,7 +612,7 @@ func testAccIBMPISAPInstanceConfig(name, sapProfile string) string {
pi_storage_type = "tier1"
pi_network {
network_id = resource.ibm_pi_network.power_network.network_id
}
}
}
`, acc.Pi_cloud_instance_id, name, sapProfile, acc.Pi_sap_image)
}
Expand Down Expand Up @@ -747,7 +789,7 @@ func testAccCheckIBMPIStoppedInstanceConfigUpdate(name, instanceHealthStatus, pr
pi_volume_pool = data.ibm_pi_image.power_image.storage_pool
pi_volume_shareable = true
pi_volume_size = 20
}
}
resource "ibm_pi_instance" "power_instance" {
pi_cloud_instance_id = "%[1]s"
pi_health_status = "%[5]s"
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/pi_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ In addition to all argument reference list, you can access the following attribu
- `shared_processor_pool`- (String) The name of the shared processor pool for the instance.
- `shared_processor_pool_id` - (String) The ID of the shared processor pool for the instance.
- `status` - (String) The status of the instance.
- `storage_connection` - (String) The storage connection type for the instance.
- `storage_pool` - (String) The storage Pool where server is deployed.
- `storage_pool_affinity` - (Boolean) Indicates if all volumes attached to the server must reside in the same storage pool.
- `storage_type` - (String) The storage type where server is deployed.
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/pi_instances.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ In addition to all argument reference list, you can access the following attribu
- `shared_processor_pool`- (String) The name of the shared processor pool for the instance.
- `shared_processor_pool_id` - (String) The ID of the shared processor pool for the instance.
- `status` - (String) The status of the instance.
- `storage_connection` - (String) The storage connection type for the instance
- `storage_pool` - (String) The storage Pool where server is deployed.
- `storage_pool_affinity` - (Boolean) Indicates if all volumes attached to the server must reside in the same storage pool.
- `storage_type` - (String) The storage type where server is deployed.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/pi_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Review the argument references that you can specify for your resource.
- `pi_storage_pool` - (Optional, String) Storage Pool for server deployment; if provided then `pi_affinity_policy` will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage pool for a custom image (an imported image or an image that is created from a VM capture) defaults to the storage pool the image was created in.
- `pi_storage_pool_affinity` - (Optional, Boolean) Indicates if all volumes attached to the server must reside in the same storage pool. The default value is `true`. To attach data volumes from a different storage pool (mixed storage) set to `false` and use `pi_volume_attach` resource. Once set to `false`, cannot be set back to `true` unless all volumes attached reside in the same storage type and pool.
- `pi_storage_type` - (Optional, String) - Storage type for server deployment; If storage type is not provided the storage type will default to `tier3`. To get a list of available storage types, please use the [ibm_pi_storage_types_capacity](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/pi_storage_types_capacity) data source.
- `pi_storage_connection` - (Optional, String) - Storage Connectivity Group (SCG) for server deployment. Only supported value is `vSCSI`.
- `pi_storage_connection` - (Optional, String) - Storage Connectivity Group (SCG) for server deployment. Supported values are `vSCSI`, `maxVolumeSupport`.
- `pi_sys_type` - (Optional, String) The type of system on which to create the VM (e880/e980/e1080/s922/s1022).
- Supported SAP system types are (e880/e980/e1080).
- `pi_user_data` - (Optional, String) The user data `cloud-init` to pass to the instance during creation. It can be a base64 encoded or an unencoded string. If it is an unencoded string, the provider will encode it before it passing it down.
Expand Down
Loading