From f78520f16f1eeaeb2c8248e757cb3c65b980dc0a Mon Sep 17 00:00:00 2001 From: thebinary Date: Thu, 4 Oct 2018 17:13:54 +0545 Subject: [PATCH 1/2] bug-fix: add/deletion of inconsistent network_interface --- xenserver/resource_vm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xenserver/resource_vm.go b/xenserver/resource_vm.go index e18dba3..e9ab006 100644 --- a/xenserver/resource_vm.go +++ b/xenserver/resource_vm.go @@ -599,7 +599,7 @@ func resourceVMUpdate(d *schema.ResourceData, m interface{}) error { var err error var remove []*VIFDescriptor - if remove, err = readVIFsFromSchema(c, os.Difference(ns).List()); err == nil { + if remove, err = readVIFsFromSchema(c, os.Difference(ns).List()); err != nil { return err } @@ -641,7 +641,7 @@ func resourceVMUpdate(d *schema.ResourceData, m interface{}) error { } var create []*VIFDescriptor - if create, err = readVIFsFromSchema(c, ns.Difference(os).List()); err == nil { + if create, err = readVIFsFromSchema(c, ns.Difference(os).List()); err != nil { return err } From 377ffc28318704bbc924358e82430f080d91f74b Mon Sep 17 00:00:00 2001 From: thebinary Date: Thu, 4 Oct 2018 17:15:04 +0545 Subject: [PATCH 2/2] bug-fix: device_order inaccurate --- xenserver/resource_vm.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xenserver/resource_vm.go b/xenserver/resource_vm.go index e9ab006..dc729e3 100644 --- a/xenserver/resource_vm.go +++ b/xenserver/resource_vm.go @@ -636,6 +636,9 @@ func resourceVMUpdate(d *schema.ResourceData, m interface{}) error { if err := c.client.VIF.Destroy(c.session, vifToRemove.VIFRef); err != nil { return err } + + // Decrement VIFCount after removal success + vm.VIFCount-- } } }