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

Not possible to create more than 3 network interfaces! #279

Closed
tommymunter opened this issue Dec 6, 2017 · 1 comment · Fixed by #280
Closed

Not possible to create more than 3 network interfaces! #279

tommymunter opened this issue Dec 6, 2017 · 1 comment · Fixed by #280
Labels
bug Type: Bug crash Impact: Crash

Comments

@tommymunter
Copy link

Hi there,

Terraform Version

Terraform v0.11.1

vSphere Provider Version

  • provider.vsphere v1.0.1
  • provider.vsphere v1.0.2

Affected Resource(s)

Please list the resources as a list, for example:

  • vsphere_virtual_machine

Terraform Configuration Files

data "vsphere_datacenter" "dc" {
  name = "ha-datacenter"
}

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

data "vsphere_resource_pool" "pool" {}

data "vsphere_network" "mgmt_lan" {
  name          = "MGMT LAN"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_network" "red" {
  name          = "Behind server"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

resource "vsphere_virtual_machine" "test2" {
  name             = "test2"
  resource_pool_id = "${data.vsphere_resource_pool.pool.id}"
  datastore_id     = "${data.vsphere_datastore.datastore.id}"

  num_cpus   = 1
  memory     = 2048
  wait_for_guest_net_timeout = 0
  guest_id = "centos7_64Guest"
  nested_hv_enabled =true
  network_interface {
   network_id     = "${data.vsphere_network.mgmt_lan.id}"
   adapter_type   = "vmxnet3"
   use_static_mac = true
   mac_address    = "00:50:56:17:01:01"
  }

  network_interface {
   network_id     = "${data.vsphere_network.mgmt_lan.id}"
   adapter_type   = "vmxnet3"
   use_static_mac = true
   mac_address    = "00:50:56:17:02:01"
  }

  network_interface {
   network_id     = "${data.vsphere_network.mgmt_lan.id}"
   adapter_type   = "vmxnet3"
   use_static_mac = true
   mac_address    = "00:50:56:17:03:01"
  }

  network_interface {
   network_id     = "${data.vsphere_network.red.id}"
   adapter_type   = "vmxnet3"
   use_static_mac = true
   mac_address    = "00:50:56:17:05:01"
  }

  disk {
   size             = 16
   name             = "test2.vmdk"
   eagerly_scrub    = false
   thin_provisioned = true
  }
}

Debug Output

Panic Output

panic: runtime error: index out of range
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4:
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: goroutine 111 [running]:
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice.(*NetworkInterfaceSubresource).assignEthernetCard(0xc42000c560, 0xc42013a600, 0xe, 0x10, 0x2038340, 0xc4203655e0, 0x2037fc0, 0xc420242070, 0xc4203655e0, 0x0)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go:871 +0x28e
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice.(*NetworkInterfaceSubresource).Create(0xc42000c560, 0xc42013a600, 0xe, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go:587 +0x406
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice.NetworkInterfaceApplyOperation(0xc420520690, 0xc420593750, 0xc42013a600, 0xe, 0x10, 0x1, 0x1, 0x1, 0xc420581380, 0x1, ...)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go:201 +0x1339
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere.applyVirtualDevices(0xc420520690, 0xc420593750, 0xc42013a600, 0xb, 0x10, 0x9, 0x10, 0x0, 0x0, 0x0)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:887 +0x32d
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere.resourceVSphereVirtualMachineCreateBare(0xc420520690, 0x11f23e0, 0xc420592d00, 0x1162800, 0xc420342ca0, 0x0)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:630 +0xa56
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vsphere.resourceVSphereVirtualMachineCreate(0xc420520690, 0x11f23e0, 0xc420592d00, 0x24, 0x20d4e60)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:212 +0x40a
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc42057dce0, 0xc420059b30, 0xc4203ff6c0, 0x11f23e0, 0xc420592d00, 0x1, 0xc4202db6e0, 0xc4204014a0)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:227 +0x364
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc4205e0310, 0xc420059a90, 0xc420059b30, 0xc4203ff6c0, 0x7f1efb225000, 0x0, 0x18)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0xa4
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc420517860, 0xc4203fe660, 0xc4202df500, 0x0, 0x0)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: reflect.Value.call(0xc4203b6240, 0xc4204ac000, 0x13, 0x1477d1e, 0x4, 0xc420041f20, 0x3, 0x3, 0x0, 0x0, ...)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /usr/local/go/src/reflect/value.go:434 +0x906
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: reflect.Value.Call(0xc4203b6240, 0xc4204ac000, 0x13, 0xc420022720, 0x3, 0x3, 0xc4203b7560, 0x0, 0x0)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /usr/local/go/src/reflect/value.go:302 +0xa4
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: net/rpc.(*service).call(0xc4205a0100, 0xc420058050, 0xc42053a070, 0xc420458000, 0xc420516580, 0x1110100, 0xc4203fe660, 0x16, 0x1110140, 0xc4202df500, ...)
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /usr/local/go/src/net/rpc/server.go:381 +0x142
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: created by net/rpc.(*Server).ServeCodec
2017-12-06T14:37:57.290+0100 [DEBUG] plugin.terraform-provider-vsphere_v1.0.1_x4: /usr/local/go/src/net/rpc/server.go:475 +0x36b
2017/12/06 14:37:57 [TRACE] root: eval: *terraform.EvalWriteState
2017/12/06 14:37:57 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2017/12/06 14:37:57 [TRACE] root: eval: *terraform.EvalIf
2017/12/06 14:37:57 [TRACE] root: eval: *terraform.EvalWriteState
2017/12/06 14:37:57 [TRACE] root: eval: *terraform.EvalWriteDiff
2017/12/06 14:37:57 [TRACE] root: eval: *terraform.EvalApplyPost
2017/12/06 14:37:57 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

  • vsphere_virtual_machine.test2: unexpected EOF

Expected Behavior

Create a new VM with 4 nic

Actual Behavior

Only possible to create a VM with 3 nic's!

Not even possible is you create a VM with 3 nic, then add 1 more, crash

Steps to Reproduce

  1. terraform apply

Important Factoids

verified on both esxi 5.5 and 6.5, same behavior.

References

@vancluever vancluever added bug Type: Bug crash Impact: Crash labels Dec 6, 2017
vancluever added a commit that referenced this issue Dec 6, 2017
This corrects an issue with the way NIC devices were checked to see if
the slots they are supposed to occupy on the PCI bus were already used
or not. An offset that was used to populate the current device range was
not being used when the devices were actually checked, creating invalid
results and out of range errors.

Fixes #279.
@vancluever
Copy link
Contributor

Hey @tommymunter, sorry you are having trouble and there is a fix for this in PR now.

Thanks!

vancluever added a commit that referenced this issue Dec 6, 2017
This corrects an issue with the way NIC devices were checked to see if
the slots they are supposed to occupy on the PCI bus were already used
or not. An offset that was used to populate the current device range was
not being used when the devices were actually checked, creating invalid
results and out of range errors.

Fixes #279.
vancluever added a commit that referenced this issue Dec 6, 2017
r/virtual_machine: Correct present NIC device calculation
@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug crash Impact: Crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants