-
Notifications
You must be signed in to change notification settings - Fork 4
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
Multi disk support #40
Conversation
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
/ok-to-test sha=cde6ae1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review done in cooperation with @paepke
Makefile
Outdated
@@ -6,7 +6,7 @@ HOSTNAME=hashicorp.com | |||
NAMESPACE=anexia-it | |||
NAME=anxcloud | |||
BINARY=terraform-provider-${NAME} | |||
VERSION=0.2.3 | |||
VERSION=0.2.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change the version in a feature branch. It should only be incremented for release.
anxcloud/schema_virtual_server.go
Outdated
Description: "Requested disk capacity in GB.", | ||
}, | ||
"disk_type": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Requested disk category (limits disk performance, e.g. IOPS). Default as defined by data center.", | ||
}, | ||
"disks": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove legacy support for disk as attribute and change the attribute name for the list to disk.
anxcloud/resource_virtual_server.go
Outdated
@@ -259,17 +288,20 @@ func resourceVirtualServerRead(ctx context.Context, d *schema.ResourceData, m in | |||
diags = append(diags, diag.FromErr(err)...) | |||
} | |||
|
|||
if len(info.DiskInfo) != 1 { | |||
return diag.Errorf("unsupported number of disks, currently only 1 disk is allowed, got %d", len(info.DiskInfo)) | |||
var disks []vm.Disk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
known list length. Use capacity and length to pre-create the list object.
ChangeDisks: changeDisks, | ||
} | ||
|
||
v := vsphere.NewAPI(c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use vsphereAPI
over just v
as variable name.
anxcloud/struct_virtual_server.go
Outdated
@@ -244,3 +270,20 @@ func flattenVirtualServerInfo(in *info.Info) []interface{} { | |||
|
|||
return []interface{}{att} | |||
} | |||
|
|||
func flattenVirtualServerDisks(in []vm.Disk) []interface{} { | |||
att := []interface{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
known length.
anxcloud/struct_virtual_server.go
Outdated
@@ -36,6 +36,32 @@ func expandVirtualServerNetworks(p []interface{}) []vm.Network { | |||
return networks | |||
} | |||
|
|||
func expandVirtualServerDisks(p []interface{}) []vm.Disk { | |||
var disks []vm.Disk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
known length.
anxcloud/resource_virtual_server.go
Outdated
} | ||
if err = d.Set("disk", info.DiskInfo[0].DiskGB); err != nil { | ||
|
||
fDisks := flattenVirtualServerDisks(disks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a better name for fDisks
.
@@ -98,6 +98,65 @@ func TestAccAnxCloudVirtualServer(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestAccAnxCloudVirtualServerMultiDiskScaling(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement all testcases for cases supported by the create/update logic.
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
Signed-off-by: Roland Urbano <[email protected]>
/ok-to-test sha=2ea429f |
Signed-off-by: Roland Urbano <[email protected]>
/ok-to-test sha=616d14b |
Signed-off-by: Roland Urbano <[email protected]>
/ok-to-test sha=5a11c64 |
Signed-off-by: Roland Urbano <[email protected]>
/ok-to-test sha=f3bb0b0 |
Description
This Pull Request introduces a temparary implementation to support multiple disks when creating or updating a
virtual server
. This is temporary until the backend/API allows to configure multiple disks natively. Until then creating avirtual server
with multiple disks requires to create it with one disk and then update it with the rest. This is done automatically ifdisks
is configured with the plan.Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
None
Community Note