mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-05 13:33:58 +00:00
Wait for 'net.IsGlobalUnicast' IP address (#115)
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'. Change the waiting for IP address to ignore IPv4 link-local addresses and IPv6 link-local addresses.
This commit is contained in:
parent
f72e911230
commit
029dc1fb0a
@ -9,6 +9,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||||
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -406,6 +407,18 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(ctx conte
|
|||||||
missingIP = true
|
missingIP = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasGlobalUnicast := false
|
||||||
|
for _, addr := range *nic.IPAddresses {
|
||||||
|
if ip := net.ParseIP(addr.Address); ip != nil && ip.IsGlobalUnicast() {
|
||||||
|
hasGlobalUnicast = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !hasGlobalUnicast {
|
||||||
|
missingIP = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user