Terraform vsphere VM 启动缓慢

Terraform vsphere VM 启动缓慢

这是我第一次尝试使用 terraform 创建 vSphere VM。VM 确实成功创建,但需要 7 分钟才能完成。以下是我采取的步骤。

  • 手动上传 Ubuntu 16.04 ova。
  • 手动将图像转换为模板。
  • 通过 GUI 从模板手动创建虚拟机。虚拟机启动大约需要 20 秒。
  • 使用指向模板的 terraform 创建虚拟机。这需要 7 分钟。

使用 terraform,VM 启动顺序与手动创建的 VM 相同,然后在以下消息处挂起大约 6 分半钟。

[   12.109016] blk_update_request: I/O error, dev fd0, sector 0

无论是手动创建还是 Terraform VM 创建,错误消息都会重复出现约 6 次。但在手动创建过程中,它几乎立即转到登录提示。在 Terraform 创建过程中,它会在此消息处挂起约 6 分半钟,然后转到登录提示。知道为什么在 Terraform 创建过程中它会挂起吗?

实例.tf

resource "vsphere_virtual_machine" "hellovm" {
  name = "hellovm2"
  vcpu = 1
  memory = 1024
  datacenter = "Lab09-Datacenter01"

  network_interface {
    label = "Lab09-NetA"
  }

  disk {
    template = "${var.vmtemp}"
    type = "thin"
    datastore = "${var.vmdatastore}"
  }
}

Terraform 应用标准输出

Macbook12:concoursebootstrap steve$ terraform apply
vsphere_folder.concourse-base: Refreshing state... (ID: Lab09-Datacenter01/VirtualMachines)
 vsphere_virtual_machine.hellovm: Refreshing state... (ID: hellovm)
vsphere_virtual_machine.hellovm: Creating...
  datacenter:                             "" => "Lab09-Datacenter01"
  detach_unknown_disks_on_delete:         "" => "false"
  disk.#:                                 "" => "1"
  disk.3867083049.bootable:               "" => ""
  disk.3867083049.controller_type:        "" => "scsi"
  disk.3867083049.datastore:              "" => "nfs-lab09-vol1"
  disk.3867083049.iops:                   "" => ""
  disk.3867083049.keep_on_remove:         "" => ""
  disk.3867083049.key:                    "" => "<computed>"
  disk.3867083049.name:                   "" => ""
  disk.3867083049.size:                   "" => ""
  disk.3867083049.template:               "" => "ubuntu-16.04-server-cloudimg-amd64"
  disk.3867083049.type:                   "" => "thin"
  disk.3867083049.uuid:                   "" => "<computed>"
  disk.3867083049.vmdk:                   "" => ""
  domain:                                 "" => "vsphere.local"
  enable_disk_uuid:                       "" => "false"
  linked_clone:                           "" => "false"
  memory:                                 "" => "1024"
  memory_reservation:                     "" => "0"
  moid:                                   "" => "<computed>"
  name:                                   "" => "hellovm"
  network_interface.#:                    "" => "1"
  network_interface.0.ip_address:         "" => "<computed>"
  network_interface.0.ipv4_address:       "" => "<computed>"
  network_interface.0.ipv4_gateway:       "" => "<computed>"
  network_interface.0.ipv4_prefix_length: "" => "<computed>"
  network_interface.0.ipv6_address:       "" => "<computed>"
  network_interface.0.ipv6_gateway:       "" => "<computed>"
  network_interface.0.ipv6_prefix_length: "" => "<computed>"
  network_interface.0.label:              "" => "Lab09-NetA"
  network_interface.0.mac_address:        "" => "<computed>"
  network_interface.0.subnet_mask:        "" => "<computed>"
  skip_customization:                     "" => "false"
  time_zone:                              "" => "Etc/UTC"
  uuid:                                   "" => "<computed>"
  vcpu:                                   "" => "1"
vsphere_virtual_machine.hellovm: Still creating... (10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (40s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (50s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (1m0s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (1m10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (1m20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (1m30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (1m40s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (1m50s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (2m0s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (2m10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (2m20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (2m30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (2m40s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (2m50s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (3m0s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (3m10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (3m20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (3m30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (3m40s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (3m50s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (4m0s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (4m10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (4m20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (4m30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (4m40s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (4m50s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (5m0s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (5m10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (5m20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (5m30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (5m40s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (5m50s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (6m0s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (6m10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (6m20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (6m30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (6m40s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (6m50s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (7m0s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (7m10s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (7m20s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (7m30s elapsed)
vsphere_virtual_machine.hellovm: Still creating... (7m40s elapsed)
vsphere_virtual_machine.hellovm: Creation complete (ID: hellovm)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

ubuntu dmesg

ubuntu dmesg

虚拟机创建后等待启动时​​的 terraform 跟踪输出

Terrafrom 追踪输出

其余的 Terraform 输出。几分钟的重复日志,然后是以下内容

Terraform 跟踪输出第 2 部分

相关内容