Skip to content

Commit

Permalink
fix: Wait for 'net.IsGlobalUnicast' IP address, again (bpg#100)
Browse files Browse the repository at this point in the history
VM can get IPv6 link-local address faster than a DHCP server response,
that results in 'ipv4_addresses' output being an empty list.
It is then impossible to provision the VM using 'connection.host' field
derived from 'self.ipv4_addresses'.

Once again change waiting for IP address to wait for better address than
IPv4 link-local addresses and IPv6 link-local addresses.

Should not break bpg#182, because it requires only one GlobalUnicast address per VM.
  • Loading branch information
otopetrik committed May 23, 2023
1 parent 18fceb8 commit cccec43
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions proxmox/virtual_environment_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,6 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(
data, err := c.GetVMNetworkInterfacesFromAgent(ctx, nodeName, vmID)

if err == nil && data != nil && data.Result != nil {
missingIP := false
hasAnyGlobalUnicast := false

if waitForIP {
Expand All @@ -678,7 +677,6 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(

if nic.IPAddresses == nil ||
(nic.IPAddresses != nil && len(*nic.IPAddresses) == 0) {
missingIP = true
break
}

Expand All @@ -690,7 +688,7 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(
}
}

if hasAnyGlobalUnicast || !missingIP {
if hasAnyGlobalUnicast {
return data, err
}
}
Expand Down

0 comments on commit cccec43

Please sign in to comment.