fog / fog-vsphere

Fog for vSphere
MIT License
36 stars 63 forks source link

IPv6 config fails to deploy on VSphere 7 #290

Closed rembart closed 10 months ago

rembart commented 10 months ago

Hello,

we are running fog-vsphere-3.6.2 with Red Hat Satellite (build: 6.13.5)

While deploying a VM ip4/6 dualstack, we get the error: expected array for 'ip', got CustomizationFixedIpV6

Satellite/Foreman userdata template

nicSettingMap:
<%- @host.interfaces.each do |interface| -%>
<%- next unless interface.subnet -%>
  - adapter:
      dnsDomain: <%= interface.domain %>
      dnsServerList: [<%= interface.subnet.dns_servers.join(', ') %>]
      gateway: [<%= interface.subnet.gateway %>]
      ip: <%= interface.ip %>
      subnetMask: <%= interface.subnet.mask %>
      <% if interface.ip6 -%>ipV6Spec:
        ipAddress: "<%= interface.ip6 %>"
        subnetMask: 64
        gateway: ["<%= interface.subnet6.gateway %>"]
      <%- end -%>
<%- end -%>

according to the VM documentation, the 'ip' field should be an array:

https://vdc-repo.vmware.com/vmwb-repository/dcr-public/60dac10c-4b37-4fc6-968a-7473ebe4d2c4/2d1fa8d2-5137-4731-947d-a1a5c04c8743/SDK/spbm/docs/ReferenceGuide/vim.vm.customization.IPSettings.IpV6AddressSpec.html

In the code the static ipv6 object is passed directly into it, https://github.com/fog/fog-vsphere/blob/ddc5f494e72b15de375900d0c87afd9fdcde8b9c/lib/fog/vsphere/requests/compute/vm_clone.rb#L543C92-L543C92

It works when wrapping custom_ipv6 in [] custom_ipv6Spec = RbVmomi::VIM.CustomizationIPSettingsIpV6AddressSpec(ip: [custom_ipv6])

Best Klaus

chris1984 commented 10 months ago

Fixed with PR