hashicorp / packer-plugin-vsphere

Packer plugin for VMware vSphere Builder
https://www.packer.io/docs/builders/vsphere
Mozilla Public License 2.0
97 stars 93 forks source link

User is not warned when using uppercase MAC in vsphere builder #324

Closed olinux-dev closed 11 months ago

olinux-dev commented 1 year ago

Community Note

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

When defining a mac address in the vsphere-iso builder, there is no information that the mac address has to be lowercase. It just fails to obtain the IP address without knowing why.

Reproduction Steps

source "vsphere-iso" "client-node" { network_adapters { mac_address ="52:3A:7D:F1:9B:EC" network_card = "vmxnet3" } }

Packer version

v1.6.6

Operating system and Environment details

docker.io/bitnami/python:3.10-debian-11 vpshere 7

tenthirtyam commented 11 months ago

This should be transferred to the hashicorp/packer-plugin-vsphere project.

tenthirtyam commented 11 months ago

@nywilken

I think we could just set MacAddress to lowercase where it's set in vsphere-iso and vsphere-clone builders.

    var networkCards []driver.NIC
    for _, nic := range s.Config.NICs {
        networkCards = append(networkCards, driver.NIC{
            Network:     nic.Network,
            NetworkCard: nic.NetworkCard,
            MacAddress:  strings.ToLower(nic.MacAddress),
            Passthrough: nic.Passthrough,
        })
    }
    vm, err := template.Clone(ctx, &driver.CloneConfig{
        Name:            s.Location.VMName,
        Folder:          s.Location.Folder,
        Cluster:         s.Location.Cluster,
        Host:            s.Location.Host,
        ResourcePool:    s.Location.ResourcePool,
        Datastore:       s.Location.Datastore,
        LinkedClone:     s.Config.LinkedClone,
        Network:         s.Config.Network,
        MacAddress:      strings.ToLower(s.Config.MacAddress)
        Annotation:      s.Config.Notes,
        VAppProperties:  s.Config.VAppConfig.Properties,
        PrimaryDiskSize: s.Config.DiskSize,
        StorageConfig: driver.StorageConfig{
            DiskControllerType: s.Config.StorageConfig.DiskControllerType,
            Storage:            disks,
        },
    })

Thoughts?

tenthirtyam commented 11 months ago

Reference: