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

virtual_machine_resource failes when having multiple disks #308

Closed
perbly opened this issue Dec 11, 2017 · 6 comments
Closed

virtual_machine_resource failes when having multiple disks #308

perbly opened this issue Dec 11, 2017 · 6 comments
Labels
bug Type: Bug

Comments

@perbly
Copy link

perbly commented Dec 11, 2017

Hi

We are getting this error from vsphere when we are provisioning a virtual machine from template with 2 disks. vSphere clones the templates first but fails on the reconfigure step with this error:
vsphere_virtual_machine.vm: error reconfiguring virtual machine: Cannot complete file creation operation

If we remove the second disks segment the machine get´s created successful.

Any idea what we are doing wrong?

Terraform Version

Terraform v0.11.1

vSphere Provider Version

provider.vsphere v1.1.0 (tried 1.0.3 also)

Affected Resource(s)

Please list the resources as a list, for example:

  • vsphere_virtual_machine

Terraform Configuration Files

data "vsphere_datacenter" "dc" {
  name = "ibiza1-tuinordic"
}

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

data "vsphere_network" "network" {
   name 	 = "network1"
   datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_resource_pool" "pool" {
  name          = "ibiza-cluster1/Resources/Normal"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_virtual_machine" "template" {
  name          = "ubuntu-1604"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

resource "vsphere_virtual_machine" "vm" {
  count      = "${var.count}"
  name       = "pascha"
  num_cpus       = "${var.cpu}"
  memory     = "${var.memory}"
  resource_pool_id = "${data.vsphere_resource_pool.pool.id}"
  datastore_id = "${data.vsphere_datastore.datastore.id}"
  guest_id = "${data.vsphere_virtual_machine.template.guest_id}"
  scsi_type = "${data.vsphere_virtual_machine.template.scsi_type}"

  network_interface {
    network_id = "${data.vsphere_network.network.id}"
  }

  disk {
    name = "pascha.vmdk"
    size  = "${data.vsphere_virtual_machine.template.disks.0.size}"
    eagerly_scrub    = "${data.vsphere_virtual_machine.template.disks.0.eagerly_scrub}"
    thin_provisioned = "${data.vsphere_virtual_machine.template.disks.0.thin_provisioned}"
  }

  disk {
    name = "pascha_data_0.vmdk"
    size = "50"
    unit_number = 1
  }

  clone {
    template_uuid = "${data.vsphere_virtual_machine.template.id}"
    customize {
      linux_options {
          host_name = "pascha"
	  domain = "sunrise.local"
      }
      network_interface {}
    }
  }
}
@perbly
Copy link
Author

perbly commented Dec 11, 2017

Adding the plan file also if it helps:

      id:                                               <computed>
      boot_retry_delay:                                 "10000"
      change_version:                                   <computed>
      clone.#:                                          "1"
      clone.0.customize.#:                              "1"
      clone.0.customize.0.linux_options.#:              "1"
      clone.0.customize.0.linux_options.0.domain:       "sunrise.local"
      clone.0.customize.0.linux_options.0.host_name:    "pascha"
      clone.0.customize.0.linux_options.0.hw_clock_utc: "true"
      clone.0.customize.0.network_interface.#:          "1"
      clone.0.customize.0.timeout:                      "10"
      clone.0.template_uuid:                            "423500fe-f566-33ae-844e-162d3b6e7ad1"
      clone.0.timeout:                                  "30"
      cpu_limit:                                        "-1"
      cpu_share_count:                                  <computed>
      cpu_share_level:                                  "normal"
      datastore_id:                                     "datastore-12"
      default_ip_address:                               <computed>
      disk.#:                                           "2"
      disk.0.attach:                                    "false"
      disk.0.device_address:                            <computed>
      disk.0.disk_mode:                                 "persistent"
      disk.0.disk_sharing:                              "sharingNone"
      disk.0.eagerly_scrub:                             "false"
      disk.0.io_limit:                                  "-1"
      disk.0.io_reservation:                            "0"
      disk.0.io_share_count:                            "0"
      disk.0.io_share_level:                            "normal"
      disk.0.keep_on_remove:                            "false"
      disk.0.key:                                       "0"
      disk.0.name:                                      "pascha.vmdk"
      disk.0.size:                                      "19"
      disk.0.thin_provisioned:                          "false"
      disk.0.unit_number:                               "0"
      disk.0.write_through:                             "false"
      disk.1.attach:                                    "false"
      disk.1.device_address:                            <computed>
      disk.1.disk_mode:                                 "persistent"
      disk.1.disk_sharing:                              "sharingNone"
      disk.1.eagerly_scrub:                             "false"
      disk.1.io_limit:                                  "-1"
      disk.1.io_reservation:                            "0"
      disk.1.io_share_count:                            "0"
      disk.1.io_share_level:                            "normal"
      disk.1.keep_on_remove:                            "false"
      disk.1.key:                                       "0"
      disk.1.name:                                      "pascha_data_0.vmdk"
      disk.1.size:                                      "1"
      disk.1.thin_provisioned:                          "true"
      disk.1.unit_number:                               "1"
      disk.1.write_through:                             "false"
      ept_rvi_mode:                                     "automatic"
      firmware:                                         "bios"
      force_power_off:                                  "true"
      guest_id:                                         "ubuntu64Guest"
      guest_ip_addresses.#:                             <computed>
      host_system_id:                                   <computed>
      hv_mode:                                          "hvAuto"
      imported:                                         <computed>
      memory:                                           "1024"
      memory_limit:                                     "-1"
      memory_share_count:                               <computed>
      memory_share_level:                               "normal"
      migrate_wait_timeout:                             "30"
      name:                                             "pascha"
      network_interface.#:                              "1"
      network_interface.0.adapter_type:                 "vmxnet3"
      network_interface.0.bandwidth_limit:              "-1"
      network_interface.0.bandwidth_reservation:        "0"
      network_interface.0.bandwidth_share_count:        <computed>
      network_interface.0.bandwidth_share_level:        "normal"
      network_interface.0.device_address:               <computed>
      network_interface.0.key:                          <computed>
      network_interface.0.mac_address:                  <computed>
      network_interface.0.network_id:                   "dvportgroup-113"
      num_cores_per_socket:                             "1"
      num_cpus:                                         "1"
      reboot_required:                                  <computed>
      resource_pool_id:                                 "resgroup-183"
      run_tools_scripts_after_power_on:                 "true"
      run_tools_scripts_after_resume:                   "true"
      run_tools_scripts_before_guest_shutdown:          "true"
      run_tools_scripts_before_guest_standby:           "true"
      scsi_controller_count:                            "1"
      scsi_type:                                        "pvscsi"
      shutdown_wait_timeout:                            "3"
      swap_placement_policy:                            "inherit"
      tags.#:                                           "3"
      tags.1119635994:                                  "urn:vmomi:InventoryServiceTag:a9ed4ad4-7446-4748-ab1b-2839576bb25f:GLOBAL"
      tags.1250399651:                                  "urn:vmomi:InventoryServiceTag:997d6231-6ce5-47a1-b25e-c024e6a12b16:GLOBAL"
      tags.465994353:                                   "urn:vmomi:InventoryServiceTag:157d55f6-892f-46f7-a249-1fb22fb3cfd1:GLOBAL"
      uuid:                                             <computed>
      vmware_tools_status:                              <computed>
      vmx_path:                                         <computed>
      wait_for_guest_net_timeout:                       "5"

@adnoh
Copy link

adnoh commented Dec 12, 2017

@perbly the typos in your config are just copy / paste errors?
""ibiza-cluster1/Resources/Normal""
"ubuntu-1604

@vancluever vancluever added the bug Type: Bug label Dec 14, 2017
@perbly
Copy link
Author

perbly commented Dec 14, 2017

Yes, they are copy paste typos @adnoh we use datasource lookup up for them using a homemade CMDB so i just replaced the value with something.

@vidkun
Copy link

vidkun commented Jan 8, 2018

I'm getting the same thing. Same error message as OP and was about to open a new issue because I didn't think it was disk related. However, I just commented out the second disk definition for each VM resource and it completed successfully just fine.

Plan gist is here: https://gist.github.com/vidkun/883e1e69c254ba04843379594de886b7

Trace Log snippet gist is here: https://gist.github.com/vidkun/54a8a2a74fede9a92949c669867cdc84

$ terraform -v
Terraform v0.11.1
+ provider.vsphere v1.1.1

@chrisipa
Copy link

Same error here. Please fix ...

@ryancurrah
Copy link

We just compiled master branch with PR 363 change, tested it and we confirm it fixes this issue

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug
Projects
None yet
Development

No branches or pull requests

7 participants