Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM deployment from OVF is failing, Terraform crash, SCSI controller: panic: interface conversion: interface is nil, not types.BaseVirtualDevice #1138

Closed
sumitAgrawal007 opened this issue Jul 19, 2020 · 4 comments · Fixed by #1179
Labels
acknowledged Status: Issue or Pull Request Acknowledged bug Type: Bug size/s Relative Sizing: Small

Comments

@sumitAgrawal007
Copy link
Contributor

sumitAgrawal007 commented Jul 19, 2020

vSphere Provider Version

v1.21.0

Affected Resource(s)

virtual_machine

If this issue appears to affect multiple resources, it may be an issue with
Terraform's core, so please mention this.
--->

Terraform Configuration Files

data "vsphere_datacenter" "dc" {
  name = "Sample_DC_2"
}

data "vsphere_datastore" "datastore" {
  name          = "Shared_NFS_Volume"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_resource_pool" "pool" {
  name          = "Cluster1/Resources"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_host" "host" {
  name          = "10.78.185.98"
  datacenter_id = data.vsphere_datacenter.dc.id
}


resource "vsphere_virtual_machine" "vmFromRemoteOvf" {
  name                       = "vm3"
  resource_pool_id           = data.vsphere_resource_pool.pool.id
  datastore_id               = data.vsphere_datastore.datastore.id
  host_system_id             = data.vsphere_host.host.id
  wait_for_guest_net_timeout = 0
  wait_for_guest_ip_timeout  = 0
  datacenter_id              = data.vsphere_datacenter.dc.id
  ovf_deploy {
    // Url to remote ovf/ova file
    local_ovf_path = "/Users/asumit/Downloads/smallvm/yVM.ova"
  }
}

Debug Output

2020-07-19T19:06:01.766+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:06:01 [DEBUG] ReadSCSIBusType: SCSI controller layout for first 1 controllers:
2020-07-19T19:06:01.768+0530 [DEBUG] plugin.terraform-provider-vsphere: panic: interface conversion: interface is nil, not types.BaseVirtualDevice

2020-07-19T19:05:57.788+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:05:57 [DEBUG] VM "/Sample_DC_2/vm/vm3" found for UUID "4219ac4e-77e4-612f-2209-decc338576ae"
2020-07-19T19:05:57.788+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:05:57 [DEBUG] Fetching properties for VM "/Sample_DC_2/vm/vm3"
2020-07-19T19:05:58.593+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:05:58 [DEBUG] MOID for VM "/Sample_DC_2/vm/vm3" is "vm-81"
2020-07-19T19:05:58.593+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:05:58 [DEBUG] Locating vApp container with ID resgroup-43
2020-07-19T19:05:58.909+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:05:58 [DEBUG] Locating datastore with ID "datastore-61"
2020-07-19T19:05:59.318+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:05:59 [DEBUG] Datastore with ID "datastore-61" found
2020-07-19T19:06:01.356+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:06:01 [DEBUG] queryAssociatedProfile: Retrieving storage policy of server object of type [virtualMachine] and key [vm-81].
2020-07-19T19:06:01.766+0530 [DEBUG] plugin.terraform-provider-vsphere: 2020/07/19 19:06:01 [DEBUG] ReadSCSIBusType: SCSI controller layout for first 1 controllers:
2020-07-19T19:06:01.768+0530 [DEBUG] plugin.terraform-provider-vsphere: panic: interface conversion: interface is nil, not types.BaseVirtualDevice

Panic Output

https://gist.github.com/sumitAgrawal007/265aab2f227148da5758a8de36904b3b

Expected Behavior

VM should have been deployed successfully from OVA.

Actual Behavior

Terraform crashed

Steps to Reproduce

Important Factoids

This was working in release 1.19, could have been broken after this change
#1118
failing here https://github.com/hashicorp/terraform-provider-vsphere/blob/master/vsphere/internal/virtualdevice/virtual_machine_device_subresource.go#L707

References

#1118

  • #0000

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@sumitAgrawal007 sumitAgrawal007 added the bug Type: Bug label Jul 19, 2020
@sumitAgrawal007 sumitAgrawal007 changed the title VM deployment from OVF is failing, Terraform crash VM deployment from OVF is failing, Terraform crash, SCSI controller: panic: interface conversion: interface is nil, not types.BaseVirtualDevice Jul 19, 2020
@bill-rich
Copy link
Contributor

Thanks for reporting this @sumitAgrawal007. I have a pretty good idea on the cause of the issue, but can you give me an example OVA to deploy from that will reproduce the issue?

@sumitAgrawal007
Copy link
Contributor Author

@bill-rich bill-rich added acknowledged Status: Issue or Pull Request Acknowledged size/s Relative Sizing: Small labels Jul 23, 2020
@teamosceola
Copy link

I can confirm that I am seeing the exact same problem as the OP.

Terraform version

0.13.0

Go runtime version

go1.14.2

vSphere Provider Version

v1.22.0

Terraform Configuration File

provider "vsphere" {
  user           = var.vsphere_username
  password       = var.vsphere_password
  vsphere_server = var.vsphere_ip

  # If you have a self-signed cert
  allow_unverified_ssl = true
}

data "vsphere_datacenter" "dc" {
  name = "enclave"
}

data "vsphere_datastore" "datastore" {
  name = "iscsi_datastore"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_resource_pool" "pool" {
  name          = "cluster/Resources"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_host" "host" {
  name = "esxhost.example.com"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_network" "network0" {
  name          = "management_external"
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_virtual_machine" "d004bkup01" {
  name  = "d004bkup01"
  resource_pool_id  = data.vsphere_resource_pool.pool.id
  datastore_id  = data.vsphere_datastore.datastore.id
  host_system_id  = data.vsphere_host.host.id
  wait_for_guest_net_timeout = 0
  wait_for_guest_ip_timeout  = 0
  datacenter_id = data.vsphere_datacenter.dc.id
  ovf_deploy {
    local_ovf_path       = "/mnt/vm_templates/Rubrik/rubrik-va-edge-trial-esx-5.2.0-p2-9418.ova"
    disk_provisioning    = "thin"
    ovf_network_map = {
      "VM Network" = data.vsphere_network.network0.id
    }
  }
}

Debug Output

2020-08-21T02:31:31.661Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] PowerOn task for VM "/enclave/vm/d004bkup01" was successful.
2020-08-21T02:31:31.661Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Fetching properties for VM "/enclave/vm/d004bkup01"
2020-08-21T02:31:31.671Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Skipping IP waiter for VM "/enclave/vm/d004bkup01"
2020-08-21T02:31:31.671Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Skipping network waiter for VM "/enclave/vm/d004bkup01"
2020-08-21T02:31:31.671Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] vsphere_virtual_machine (ID = 42096896-974d-c6b6-902e-e9150be7898d): Create complete
2020-08-21T02:31:31.671Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] vsphere_virtual_machine (ID = 42096896-974d-c6b6-902e-e9150be7898d): Reading state of virtual machine
2020-08-21T02:31:31.671Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Locating virtual machine with UUID "42096896-974d-c6b6-902e-e9150be7898d"
2020-08-21T02:31:31.671Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Using SearchIndex to look up UUID "42096896-974d-c6b6-902e-e9150be7898d"
2020-08-21T02:31:31.679Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] VM "/enclave/vm/d004bkup01" found for UUID "42096896-974d-c6b6-902e-e9150be7898d"
2020-08-21T02:31:31.679Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Fetching properties for VM "/enclave/vm/d004bkup01"
2020-08-21T02:31:31.687Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] MOID for VM "/enclave/vm/d004bkup01" is "vm-62"
2020-08-21T02:31:31.687Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Locating vApp container with ID resgroup-9
2020-08-21T02:31:31.690Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Locating datastore with ID "datastore-24"
2020-08-21T02:31:31.692Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] Datastore with ID "datastore-24" found
2020-08-21T02:31:31.713Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] queryAssociatedProfile: Retrieving storage policy of server object of type [virtualMachine] and key [vm-62].
2020-08-21T02:31:31.818Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 2020/08/21 02:31:31 [DEBUG] ReadSCSIBusType: SCSI controller layout for first 1 controllers: <nil>
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: panic: interface conversion: interface is nil, not types.BaseVirtualDevice
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: goroutine 65 [running]:
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice.ReadSCSIBusType(0xc000107e00, 0xe, 0x10, 0x1, 0xc0006720c0, 0x1)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice/virtual_machine_device_subresource.go:707 +0x21d
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: github.com/hashicorp/terraform-provider-vsphere/vsphere.resourceVSphereVirtualMachineRead(0xc000144d90, 0x144fec0, 0xc00063c980, 0x1, 0x1)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:549 +0xbf2
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: github.com/hashicorp/terraform-provider-vsphere/vsphere.resourceVSphereVirtualMachineCreate(0xc000144d90, 0x144fec0, 0xc00063c980, 0x2, 0x270e500)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:432 +0x621
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000111900, 0xc00087c500, 0xc00070d100, 0x144fec0, 0xc00063c980, 0x1485c01, 0xc00012b708, 0xc0006649c0)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:305 +0x365
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000190c80, 0xc0007fb8e0, 0xc00087c500, 0xc00070d100, 0xc0006674c8, 0xc0000bab30, 0x1487b20)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:294 +0x99
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00000e180, 0x1b0e4c0, 0xc0005de180, 0xc0000bc8a0, 0xc00000e180, 0xc0005de180, 0xc000877a48)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:885 +0x8b4
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1713940, 0xc00000e180, 0x1b0e4c0, 0xc0005de180, 0xc0000bc840, 0x0, 0x1b0e4c0, 0xc0005de180, 0xc000159000, 0xdce)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3189 +0x217
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000e0160, 0x1b1aa00, 0xc00008ad80, 0xc000106300, 0xc000478120, 0x26d3e60, 0x0, 0x0, 0x0)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:995 +0x460
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: google.golang.org/grpc.(*Server).handleStream(0xc0000e0160, 0x1b1aa00, 0xc00008ad80, 0xc000106300, 0x0)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:1275 +0xd3d
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00003e190, 0xc0000e0160, 0x1b1aa00, 0xc00008ad80, 0xc000106300)
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:710 +0xa1
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-08-21T02:31:31.820Z [DEBUG] plugin.terraform-provider-vsphere_v1.22.0_x4: 	/opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:708 +0xa1
2020/08/21 02:31:31 [DEBUG] vsphere_virtual_machine.d004bkup01: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing

@ghost
Copy link

ghost commented Oct 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 10, 2020
staebler pushed a commit to openshift/terraform-provider-vsphere that referenced this issue Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
acknowledged Status: Issue or Pull Request Acknowledged bug Type: Bug size/s Relative Sizing: Small
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants