Skip to content

Commit

Permalink
Pull in latest go-vcloud-director SDK with 10.1 fixes (#489)
Browse files Browse the repository at this point in the history
This PR bumps govcd dependency to support 10.1 and also:
* Adds a note about NSX-T not being supported yet
* Adds a support deprecation warning during apply phase for vCD <=9.1
* Adds a link to changelog in GitHub in main documentation page (https://www.terraform.io/docs/providers/vcd/index.html)
* Removes 9.1 from the list of supported versions and adds 10.1 in https://www.terraform.io/docs/providers/vcd/index.html
* Uses "Undeploy()" instead of PowerOff() for VMs during update phase
* Closes #473 by pulling in vmware/go-vcloud-director#299 .
  • Loading branch information
Didainius authored Apr 10, 2020
1 parent ff00b68 commit b1ef030
Show file tree
Hide file tree
Showing 20 changed files with 144 additions and 65 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ BUG FIXES
* `resource/vcd_vapp_vm` sometimes reports incorrect `vcd_vapp_vm.ip` and `vcd_vapp_vm.mac` fields in deprecated network
configuration (when using `vcd_vapp_vm.network_name` and `vcd_vapp_vm.vapp_network_name` parameters instead of
`vcd_vapp_vm.network` blocks) [GH-478]
* `resource/vcd_vapp_org_network` fix potential error 'NAT rule cannot be configured for nics with
DHCP addressing mode' during removal [GH-489]

DEPRECATIONS:
* vCD 9.1 support is deprecated. Next version will require at least version 9.5 [GH-489]

NOTES:

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ go 1.13
require (
github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/terraform-plugin-sdk v1.8.0
github.com/vmware/go-vcloud-director/v2 v2.7.0-alpha.3
github.com/vmware/go-vcloud-director/v2 v2.7.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvc
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU=
github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmware/go-vcloud-director/v2 v2.7.0-alpha.3 h1:6VkppoKh+Z1JLyo/+XvC0e+qwND5ynyhXuGArLJZp74=
github.com/vmware/go-vcloud-director/v2 v2.7.0-alpha.3/go.mod h1:XY9Fmqp1JeHIU2nP87NykB6unNCsY6qV4Zdu5JI4aZU=
github.com/vmware/go-vcloud-director/v2 v2.7.0 h1:mXdk5ZXr5yP78sL7FrBZV5iTNme8ALx77t5+9KnutLI=
github.com/vmware/go-vcloud-director/v2 v2.7.0/go.mod h1:XY9Fmqp1JeHIU2nP87NykB6unNCsY6qV4Zdu5JI4aZU=
github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw=
github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=
Expand Down
40 changes: 40 additions & 0 deletions scripts/skip-upgrade-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,43 @@ vcd.TestAccVcdNetworkRoutedStatic2.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdNetworkRoutedStaticSub2.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmDhcpWait.tf v2.7.0 "Fixed bug in DNS default and 10.1 read error"
vcd.TestAccVcdVAppVmDhcpWait-step1.tf v2.7.0 "Fixed bug in DNS default and 10.1 read error"
vcd.TestAccCheckVcdVApp_PowerOff.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdDNAT_WithOrgNetw.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdEdgeDnat-step3.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdEdgeSnat-step1.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdEdgeSnat.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdMediaInsertBasic.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdNsxvDhcpRelay-step1.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdNsxvDhcpRelay.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdNsxvEdgeFirewallRule-step3.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdNsxvEdgeFirewallRuleVms-step1.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdNsxvEdgeFirewallRuleVms.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdOrgVdcAllocationFlex.tf v2.7.0 "pVdc read did not work in 10.1"
vcd.TestAccVcdOrgVdcAllocationPool.tf v2.7.0 "pVdc read did not work in 10.1"
vcd.TestAccVcdOrgVdcAllocationVapp.tf v2.7.0 "pVdc read did not work in 10.1"
vcd.TestAccVcdOrgVdcReservationPool.tf v2.7.0 "pVdc read did not work in 10.1"
vcd.TestAccVcdSNAT_Basic.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppRaw_Basic.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmMulti.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-NetOnly.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-NetVapp.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-allocated.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-step10.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-step2.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-step4.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-step6.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmSingleNIC-step8.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVm_Basic.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVm_Clone.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVappNetworkDS.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVappNetwork_Isolated-Update.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVappNetwork_Nat-Update.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVappNetwork_Nat.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVappOrgNetworkDS.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVappOrgNetwork_Fenced.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVappOrgNetwork_NotFenced.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVdcDatasource.tf v2.7.0 "pVdc read did not work in 10.1"
vcd.TestAccVcdVmInternalDisk-CreateALl.tf v2.7.0 "pVdc read did not work in 10.1"
vcd.TestAccVcdVmInternalDisk-Update1.tf v2.7.0 "pVdc read did not work in 10.1"
vcd.runVappNetworkTest.tf v2.7.0 "Fixed bug in DNS default"
vcd.TestAccVcdVAppVmMultiNIC.tf v2.7.0 "Network read error in 10.1"
10 changes: 5 additions & 5 deletions scripts/test-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,11 @@ do
echo "# $dash_line"
continue
fi
init_options=$(grep '^# init-options' $CF | sed -e 's/# init-options //')
plan_options=$(grep '^# plan-options' $CF | sed -e 's/# plan-options //')
apply_options=$(grep '^# apply-options' $CF | sed -e 's/# apply-options //')
plancheck_options=$(grep '^# plancheck-options' $CF | sed -e 's/# plancheck-options //')
destroy_options=$(grep '^# destroy-options' $CF | sed -e 's/# destroy-options //')
init_options="-compact-warnings $(grep '^# init-options' $CF | sed -e 's/# init-options //')"
plan_options="-compact-warnings $(grep '^# plan-options' $CF | sed -e 's/# plan-options //')"
apply_options="-compact-warnings $(grep '^# apply-options' $CF | sed -e 's/# apply-options //')"
plancheck_options="-compact-warnings $(grep '^# plancheck-options' $CF | sed -e 's/# plancheck-options //')"
destroy_options="-compact-warnings $(grep '^# destroy-options' $CF | sed -e 's/# destroy-options //')"
using_tags=$(grep '^# tags' $CF | sed -e 's/# tags //')
already_run=$(grep $CF already_run.txt)
if [ -n "$already_run" ]
Expand Down
5 changes: 5 additions & 0 deletions vcd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ func (c *Config) Client() (*VCDClient, error) {
cachedVCDClients.conMap[checksum] = cachedConnection{initTime: time.Now(), connection: vcdClient}
cachedVCDClients.Unlock()

// Throw a deprecated warning for vCD versions <= 9.1
if vcdClient.Client.APIVCDMaxVersionIs("<= 30") {
_, _ = fmt.Fprintln(getTerraformStdout(), "WARNING: Support for vCD versions older than 9.5 is deprecated")
}

return vcdClient, nil
}

Expand Down
17 changes: 1 addition & 16 deletions vcd/resource_vcd_vapp_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -887,22 +887,7 @@ func resourceVcdVAppVmUpdateExecute(d *schema.ResourceData, meta interface{}) er
vm.VM.Name, d.HasChange("memory"), d.HasChange("cpus"), d.HasChange("cpu_cores"), d.HasChange("power_on"), d.HasChange("disk"),
d.HasChange("expose_hardware_virtualization"), d.HasChange("network"))

// If customization is not requested then a simple shutdown is enough
if vmStatusBeforeUpdate != "POWERED_OFF" && !customizationNeeded {
log.Printf("[DEBUG] Powering off VM %s for offline update. Previous state %s",
vm.VM.Name, vmStatusBeforeUpdate)
task, err := vm.PowerOff()
if err != nil {
return fmt.Errorf("error Powering Off: %s", err)
}
err = task.WaitTaskCompletion()
if err != nil {
return fmt.Errorf(errorCompletingTask, err)
}
}

// If customization was requested then a shutdown with undeploy is needed
if vmStatusBeforeUpdate != "POWERED_OFF" && customizationNeeded {
if vmStatusBeforeUpdate != "POWERED_OFF" {
log.Printf("[DEBUG] Un-deploying VM %s for offline update. Previous state %s",
vm.VM.Name, vmStatusBeforeUpdate)
task, err := vm.Undeploy()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b1ef030

Please sign in to comment.