Skip to content

Commit

Permalink
Merge pull request #5998 from nutanix-cloud-native/bugzilla-2095917
Browse files Browse the repository at this point in the history
Bug 2095917: Nutanix set osDisk with diskSizeGB rather than diskSizeMiB
  • Loading branch information
openshift-ci[bot] authored Jun 16, 2022
2 parents 6ea3eda + 61b5c3c commit 4f2095a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ spec:
osDisk:
description: OSDisk defines the storage for instance.
properties:
diskSizeMiB:
description: DiskSizeMiB defines the size of disk in
MiB.
diskSizeGiB:
description: DiskSizeGiB defines the size of disk in
GiB.
format: int64
type: integer
type: object
Expand Down Expand Up @@ -1089,8 +1089,8 @@ spec:
osDisk:
description: OSDisk defines the storage for instance.
properties:
diskSizeMiB:
description: DiskSizeMiB defines the size of disk in MiB.
diskSizeGiB:
description: DiskSizeGiB defines the size of disk in GiB.
format: int64
type: integer
type: object
Expand Down Expand Up @@ -2359,8 +2359,8 @@ spec:
osDisk:
description: OSDisk defines the storage for instance.
properties:
diskSizeMiB:
description: DiskSizeMiB defines the size of disk in MiB.
diskSizeGiB:
description: DiskSizeGiB defines the size of disk in GiB.
format: int64
type: integer
type: object
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/machines/nutanix/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func provider(clusterID string, platform *nutanix.Platform, mpool *nutanix.Machi
Type: machinev1.NutanixIdentifierUUID,
UUID: &platform.PrismElements[0].UUID,
},
SystemDiskSize: resource.MustParse(fmt.Sprintf("%dMi", mpool.OSDisk.DiskSizeMiB)),
SystemDiskSize: resource.MustParse(fmt.Sprintf("%dGi", mpool.OSDisk.DiskSizeGiB)),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func defaultNutanixMachinePoolPlatform() nutanixtypes.MachinePool {
NumCoresPerSocket: 1,
MemoryMiB: 16384,
OSDisk: nutanixtypes.OSDisk{
DiskSizeMiB: decimalRootVolumeSize * 1024,
DiskSizeGiB: decimalRootVolumeSize,
},
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/types/nutanix/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ type MachinePool struct {

// OSDisk defines the disk for a virtual machine.
type OSDisk struct {
// DiskSizeMiB defines the size of disk in MiB.
// DiskSizeGiB defines the size of disk in GiB.
//
// +optional
DiskSizeMiB int64 `json:"diskSizeMiB,omitempty"`
DiskSizeGiB int64 `json:"diskSizeGiB,omitempty"`
}

// Set sets the values from `required` to `p`.
Expand All @@ -54,7 +54,7 @@ func (p *MachinePool) Set(required *MachinePool) {
p.MemoryMiB = required.MemoryMiB
}

if required.OSDisk.DiskSizeMiB != 0 {
p.OSDisk.DiskSizeMiB = required.OSDisk.DiskSizeMiB
if required.OSDisk.DiskSizeGiB != 0 {
p.OSDisk.DiskSizeGiB = required.OSDisk.DiskSizeGiB
}
}
4 changes: 2 additions & 2 deletions pkg/types/nutanix/validation/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
// ValidateMachinePool checks that the specified machine pool is valid.
func ValidateMachinePool(p *nutanix.MachinePool, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if p.DiskSizeMiB < 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("diskSizeMiB"), p.DiskSizeMiB, "storage disk size must be positive"))
if p.DiskSizeGiB < 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("diskSizeGiB"), p.DiskSizeGiB, "storage disk size must be positive"))
}
if p.MemoryMiB < 0 {
allErrs = append(allErrs, field.Invalid(fldPath.Child("memoryMiB"), p.MemoryMiB, "memory size must be positive"))
Expand Down
4 changes: 2 additions & 2 deletions pkg/types/nutanix/validation/machinepool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func TestValidateMachinePool(t *testing.T) {
name: "negative disk size",
pool: &nutanix.MachinePool{
OSDisk: nutanix.OSDisk{
DiskSizeMiB: -1,
DiskSizeGiB: -1,
},
},
expectedErrMsg: `^test-path\.diskSizeMiB: Invalid value: -1: storage disk size must be positive$`,
expectedErrMsg: `^test-path\.diskSizeGiB: Invalid value: -1: storage disk size must be positive$`,
}, {
name: "negative CPUs",
pool: &nutanix.MachinePool{
Expand Down

0 comments on commit 4f2095a

Please sign in to comment.