From 6fee532f92146a8e6b58d65565ae3630aefd481f Mon Sep 17 00:00:00 2001 From: Dan Petersen Date: Fri, 26 Jun 2020 22:09:51 +0200 Subject: [PATCH] fix: ignore ip addresses from lo interface and increase container state timeout --- proxmox/virtual_environment_vm.go | 14 ++++++++++---- .../resource_virtual_environment_container.go | 11 ++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/proxmox/virtual_environment_vm.go b/proxmox/virtual_environment_vm.go index cff74794..f1016d4c 100644 --- a/proxmox/virtual_environment_vm.go +++ b/proxmox/virtual_environment_vm.go @@ -180,10 +180,16 @@ func (c *VirtualEnvironmentClient) WaitForNetworkInterfacesFromVMAgent(nodeName missingIP := false if waitForIP { - for _, nic := range *data.Result { - if nic.IPAddresses != nil && len(*nic.IPAddresses) == 0 { - missingIP = true - break + if len(*data.Result) == 0 { + missingIP = true + } else if len(*data.Result) == 1 && (*data.Result)[0].Name == "lo" { + missingIP = true + } else { + for _, nic := range *data.Result { + if nic.IPAddresses != nil && len(*nic.IPAddresses) == 0 { + missingIP = true + break + } } } } diff --git a/proxmoxtf/resource_virtual_environment_container.go b/proxmoxtf/resource_virtual_environment_container.go index f9b7656a..6ff8be89 100644 --- a/proxmoxtf/resource_virtual_environment_container.go +++ b/proxmoxtf/resource_virtual_environment_container.go @@ -1622,11 +1622,8 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa resource := resourceVirtualEnvironmentContainer() // Prepare the new primitive values. - if d.HasChange(mkResourceVirtualEnvironmentContainerDescription) { - description := d.Get(mkResourceVirtualEnvironmentContainerDescription).(string) - - updateBody.Description = &description - } + description := d.Get(mkResourceVirtualEnvironmentContainerDescription).(string) + updateBody.Description = &description template := proxmox.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)) @@ -1853,7 +1850,7 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa return err } - err = veClient.WaitForContainerState(nodeName, vmID, "running", 120, 5) + err = veClient.WaitForContainerState(nodeName, vmID, "running", 300, 5) if err != nil { return err @@ -1871,7 +1868,7 @@ func resourceVirtualEnvironmentContainerUpdate(d *schema.ResourceData, m interfa return err } - err = veClient.WaitForContainerState(nodeName, vmID, "stopped", 30, 5) + err = veClient.WaitForContainerState(nodeName, vmID, "stopped", 300, 5) if err != nil { return err