resize failed: got timeout

emoxam

Well-Known Member
Apr 9, 2019
67
1
48
43
Got the error when trying to create VM via terraform.

pveversion
pve-manager/8.2.4/faa83925c9641325 (running kernel: 6.8.8-1-pve)


Code:
Plan: 1 to add, 0 to change, 0 to destroy.
proxmox_vm_qemu.vm[0]: Creating...
proxmox_vm_qemu.vm[0]: Still creating... [10s elapsed]
proxmox_vm_qemu.vm[0]: Still creating... [20s elapsed]
proxmox_vm_qemu.vm[0]: Still creating... [30s elapsed]
proxmox_vm_qemu.vm[0]: Still creating... [40s elapsed]
proxmox_vm_qemu.vm[0]: Still creating... [50s elapsed]
proxmox_vm_qemu.vm[0]: Still creating... [1m0s elapsed]
╷
│ Error: command '/usr/bin/qemu-img resize -f qcow2 /opt/st/images/194/vm-194-disk-1.qcow2 10737418240' failed: got timeout


Running terraform right from the PVE node.

cat main.tf
Code:
terraform {
  required_providers {
    proxmox = {
      source  = "registry.local/telmate/proxmox"
#      source  = "telmate/proxmox"
      version = "3.0.1-rc4"
    }
  }
}

provider "proxmox" {
  pm_api_url = "https://172.16.11.1:8006/api2/json"
  pm_api_token_id     = "redacted"
  pm_api_token_secret = "redacted"
  pm_timeout = 7200
}

variable "vm_ips" {
  default = ["172.16.10.161", "172.16.10.162", "172.16.10.163"]
}

resource "proxmox_vm_qemu" "vm" {
  timeouts {
    create = "60m"
    delete = "10m"
  }

  count       = 1
  name        = "terraform-vm-${count.index}"
  agent       = 1
  boot        = "order=scsi0"
  target_node = "Node-5"
  clone      = "cloud-init-template"
  full_clone = true
  clone_wait        = 45
  scsihw     = "virtio-scsi-pci"
##  machine    = "pc"
  # storage     = "st"
  cores  = 2
  memory = 4096

     disks {
       scsi {
         scsi0 {
           disk {
             size    = "10G"
             storage = "st"
             format = "qcow2"
           }
         }
       }
     }
...




mount | grep /opt/st
/dev/mapper/pve-data on /opt/st type ext4 (rw,relatime,errors=remount-ro,stripe=16)
 
Hi,

I would try another storage (faster) for the VM disk/image, to see if the timeout might be due to slow storage.
 
Hi,

I would try another storage (faster) for the VM disk/image, to see if the timeout might be due to slow storage.
Something with TRIM on my raid 1 ssd array ? If i wait for a some time - i can create VMs and resize goes ok, but if i try to create right after destroy i've got

Code:
proxmox_vm_qemu.vm[2]: Creation complete after 2m34s [id=Node-5/qemu/258]
╷
│ Error: command '/usr/bin/qemu-img resize -f qcow2 /opt/st/images/194/vm-194-disk-1.qcow2 5368709120' failed: got timeout
│
│   with proxmox_vm_qemu.vm[1],
│   on main.tf line 32, in resource "proxmox_vm_qemu" "vm":
│   32: resource "proxmox_vm_qemu" "vm" {
│
╵
╷
│ Error: command '/usr/bin/qemu-img resize -f qcow2 /opt/st/images/252/vm-252-disk-1.qcow2 5368709120' failed: got timeout
│
│   with proxmox_vm_qemu.vm[0],
│   on main.tf line 32, in resource "proxmox_vm_qemu" "vm":
│   32: resource "proxmox_vm_qemu" "vm" {
│
╵