ошибка клонирования виртуальной машины: ожидание завершения клонирования - PullRequest
0 голосов
/ 03 октября 2019

В настоящее время я использую Terraform для развертывания множества vm в моей vsphere. Проблема в том, что я использую оператор clone для установки статического ip в моем vms, и я получил следующую ошибку: ошибка клонирования виртуальной машины: время ожидания завершения клонирования

В настоящее время я использую terraformверсия v0.11.7 и моя версия vsphere - 6.5

resource "vsphere_virtual_machine" "master" {

  guest_id = "${data.vsphere_virtual_machine.template.guest_id}" 
resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"

count = "${length(var.vms_master)}"

network_interface {
    network_id = "${data.vsphere_network.network.id}"
    adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}"
}

  name = "${var.vms_master[count.index]}"
  datastore_id = "${data.vsphere_datastore.datastore.id}"

  disk {
    label="default_disk"
    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}"
    unit_number=0  
}

  disk {
      size = "100"
      label = "${var.vms_master[count.index]}_1"
      thin_provisioned = "${data.vsphere_virtual_machine.template.disks.0.thin_provisioned}"
      eagerly_scrub    = "${data.vsphere_virtual_machine.template.disks.0.eagerly_scrub}"
        unit_number=2   
 }
  disk {
      size = "10"
      label = "${var.vms_master[count.index]}_2"
      thin_provisioned = "${data.vsphere_virtual_machine.template.disks.0.thin_provisioned}"
      eagerly_scrub    = "${data.vsphere_virtual_machine.template.disks.0.eagerly_scrub}"
        unit_number=3   
 }

  folder = "${vsphere_folder.master.path}"
  memory = 512
  num_cpus = 1
  wait_for_guest_ip_timeout = "0" #el laboratorio va muy lento... entonces el timeout se da antes de q la vm este creada!
  wait_for_guest_net_timeout = "0"

clone {
    template_uuid = "${data.vsphere_virtual_machine.template.id}"
    linked_clone  = "${var.vm_linked_clone}"

    customize {
      //timeout = "0"
  timeouts {
    create = "5s"
    delete = "2h"
  }
      linux_options {
        host_name = "${var.vms_hostname_master[count.index]}"
        domain    = "$ocp.essi.lab"
      }
      network_interface {
        ipv4_address = "${var.ip_list_master[count.index]}"          
        ipv4_netmask = "24"
      }

      ipv4_gateway    ="172.16.1.1"
      dns_server_list = ["${var.dns_servers}"]
    }   
}
}

Ожидаемые результаты: развертывание vm в vsphere

Фактические результаты: вышеупомянутая ошибка: ошибка клонирования виртуальной машины: тайм-аут ожидания клонадля завершения

Спасибо, ребята, любые идеи приветствуются! :)

1 Ответ

0 голосов
/ 07 октября 2019

Обходной путь был очень простым, мне нужно было добавить только еще одну строку времени ожидания:

resource "vsphere_virtual_machine" "master" {

  guest_id = "${data.vsphere_virtual_machine.template.guest_id}" 
resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
datastore_id = "${data.vsphere_datastore.datastore.id}"

count = "${length(var.vms_master)}"

network_interface {
    network_id = "${data.vsphere_network.network.id}"
    adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}"
}

  name = "${var.vms_master[count.index]}"
  datastore_id = "${data.vsphere_datastore.datastore.id}"

  disk {
    label="default_disk"
    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}"
    unit_number=0  
}

  disk {
      size = "100"
      label = "${var.vms_master[count.index]}_1"
      thin_provisioned = "${data.vsphere_virtual_machine.template.disks.0.thin_provisioned}"
      eagerly_scrub    = "${data.vsphere_virtual_machine.template.disks.0.eagerly_scrub}"
        unit_number=2   
 }
  disk {
      size = "10"
      label = "${var.vms_master[count.index]}_2"
      thin_provisioned = "${data.vsphere_virtual_machine.template.disks.0.thin_provisioned}"
      eagerly_scrub    = "${data.vsphere_virtual_machine.template.disks.0.eagerly_scrub}"
        unit_number=3   
 }

  folder = "${vsphere_folder.master.path}"
  memory = 512
  num_cpus = 1
  wait_for_guest_ip_timeout = "0" #el laboratorio va muy lento... entonces el timeout se da antes de q la vm este creada!
  wait_for_guest_net_timeout = "0"

clone {
    template_uuid = "${data.vsphere_virtual_machine.template.id}"
    linked_clone  = "${var.vm_linked_clone}"
      timeout = "0"   //NEW LINE ADDED

    customize {
      timeout = "0"
  timeouts {
    create = "5s"
    delete = "2h"
  }
      linux_options {
        host_name = "${var.vms_hostname_master[count.index]}"
        domain    = "$ocp.essi.lab"
      }
      network_interface {
        ipv4_address = "${var.ip_list_master[count.index]}"          
        ipv4_netmask = "24"
      }

      ipv4_gateway    ="172.16.1.1"
      dns_server_list = ["${var.dns_servers}"]
    }   
}
}
...