Skip to content

Commit 53739c3

Browse files
Zheyu Shenarsdragonfly
authored andcommitted
fix
1 parent 3d95175 commit 53739c3

4 files changed

Lines changed: 8 additions & 2 deletions

builder/azure/arm/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,12 @@ func assertRequiredParametersSet(c *Config, errs *packersdk.MultiError) {
16011601
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("The disk_caching_type %q is invalid", c.DiskCachingType))
16021602
}
16031603

1604+
if c.DiskControllerType != "" {
1605+
if !strings.EqualFold(c.DiskControllerType, "SCSI") && !strings.EqualFold(c.DiskControllerType, "NVMe") {
1606+
errs = packersdk.MultiErrorAppend(errs, fmt.Errorf("The disk_controller_type %q is invalid, the valid values are SCSI and NVMe", c.DiskControllerType))
1607+
}
1608+
}
1609+
16041610
/////////////////////////////////////////////
16051611
// License Type (Azure Hybrid Benefit)
16061612
if c.LicenseType != "" {

builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentDiskControllerType01.approved.json renamed to builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentDiskControllerTypeDefault.approved.json

File renamed without changes.

builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentDiskControllerType02.approved.json renamed to builder/azure/arm/template_factory_test.TestVirtualMachineDeploymentDiskControllerTypeNVMe.approved.json

File renamed without changes.

builder/azure/arm/template_factory_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ func TestVirtualMachineDeploymentAcceleratedNetworking02(t *testing.T) {
674674
}
675675

676676
// Ensure disk controller type is not set when not specified in config
677-
func TestVirtualMachineDeploymentDiskControllerType01(t *testing.T) {
677+
func TestVirtualMachineDeploymentDiskControllerTypeDefault(t *testing.T) {
678678
var c Config
679679
_, err := c.Prepare(getArmBuilderConfiguration(), getPackerConfiguration())
680680
if err != nil {
@@ -689,7 +689,7 @@ func TestVirtualMachineDeploymentDiskControllerType01(t *testing.T) {
689689
}
690690

691691
// Ensure disk controller type is set when specified in config
692-
func TestVirtualMachineDeploymentDiskControllerType02(t *testing.T) {
692+
func TestVirtualMachineDeploymentDiskControllerTypeNVMe(t *testing.T) {
693693
var c Config
694694
_, err := c.Prepare(getArmBuilderConfiguration(), getPackerConfiguration())
695695
if err != nil {

0 commit comments

Comments
 (0)