terraform-provider-vcd: Requested disk iops 0 for virtual machine "vm" exceeds maximum allowed iops 3,501

Hi there, After upgrading VMware Cloud Director to version: 10.2.0. Unable to create VM: Requested disk iops 0 for virtual machine “vm” exceeds maximum allowed iops 3,501

Version

Terraform v0.14.2 provider registry.terraform.io/vmware/vcd v3.0.0 VMware Cloud Director version: 10.2.0.17008054

Terraform resource

resource "vcd_vapp_vm" "vm" {
  vapp_name        = var.VAPP_NAME
  name                   = "vm"
  catalog_name     = var.VCD_CATALOG_NAME
  template_name    = var.VCD_TEMPLATE_VM
  memory                = var.RAM
  cpus                     = var.CPU
  storage_profile  = var.STORAGE_POLICY
}

Override_template_disk parameter can be applied after VM creation. Can I somehow set the iops value when creating the vm?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 21

Most upvoted comments

I have tested it now (on VCD 10.2.2.17855680) and replicated.

With your sample HCL got error:

│ Error: error managing internal disks : error updating VM disks: error updating VM disks: API Error: 400: [ 9bb2519c-116e-4317-9b58-37c7116990b0 ] Requested disk iops 0 for virtual machine "testing" exceeds maximum allowed iops 7,001.
│ 
│   with vcd_vapp_vm.instance,
│   on main.tf line 47, in resource "vcd_vapp_vm" "instance":
│   47: resource "vcd_vapp_vm" "instance" {
│ 

In this API call:

2021/06/22 13:59:16 Request caller: govcd.(*VM).UpdateInternalDisksAsync-->govcd.(*VM).UpdateInternalDisksAsync-->govcd.executeRequestWithApiVersion-->govcd.(*Client).executeTaskRequest-->govcd.executeRequestCustomErr-->govcd.(*Client).NewRequestWithApiVersion-->govcd.(*Client).newRequest
2021/06/22 13:59:16 POST https://host/api/vApp/vm-7db0cbae-c993-4280-92eb-52260489588d/action/reconfigureVm
2021/06/22 13:59:16 --------------------------------------------------------------------------------
2021/06/22 13:59:16 Request data: [2446]
<?xml version="1.0" encoding="UTF-8"?>
  <Vm xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns="http://www.vmware.com/vcloud/v1.5" name="testing">
      <VmSpecSection Modified="true">
          <ovf:Info></ovf:Info>
          <OsType>other3xLinux64Guest</OsType>
          <NumCpus>1</NumCpus>
          <NumCoresPerSocket>1</NumCoresPerSocket>
          <CpuResourceMhz>
              <Configured>1</Configured>
          </CpuResourceMhz>
          <MemoryResourceMb>
              <Configured>2048</Configured>
          </MemoryResourceMb>
          <MediaSection>
              <MediaSettings>
                  <DeviceId>3002</DeviceId>
                  <MediaType>ISO</MediaType>
                  <MediaState>DISCONNECTED</MediaState>
                  <UnitNumber>0</UnitNumber>
                  <BusNumber>1</BusNumber>
                  <AdapterType>1</AdapterType>
              </MediaSettings>
              <MediaSettings>
                  <DeviceId>8000</DeviceId>
                  <MediaType>FLOPPY</MediaType>
                  <MediaState>DISCONNECTED</MediaState>
                  <UnitNumber>0</UnitNumber>
                  <BusNumber>0</BusNumber>
              </MediaSettings>
          </MediaSection>
          <DiskSection>
              <DiskSettings>
                  <DiskId>2000</DiskId>
                  <SizeMb>30720</SizeMb>
                  <UnitNumber>0</UnitNumber>
                  <BusNumber>0</BusNumber>
                  <AdapterType>5</AdapterType>
                  <ThinProvisioned>true</ThinProvisioned>
                  <StorageProfile href="https://host/api/vdcStorageProfile/2cfdae00-c147-46ba-b24a-a2e2e2252f8e" id="urn:vcloud:vdcstorageProfile:2cfdae00-c147-46ba-b24a-a2e2e2252f8e" name="*"></StorageProfile>
                  <overrideVmDefault>true</overrideVmDefault>
                  <iops>0</iops>
                  <VirtualQuantityUnit>byte</VirtualQuantityUnit>
              </DiskSettings>
          </DiskSection>
          <HardwareVersion href="https://host/api/vdc/8f38fde4-0473-4fd9-a000-6efcc694f5c1/hwv/vmx-11" type="application/vnd.vmware.vcloud.virtualHardwareVersion+xml">vmx-11</HardwareVersion>
          <VmToolsVersion>2147483647</VmToolsVersion>
          <VirtualCpuType>VM64</VirtualCpuType>
          <TimeSyncWithHost>false</TimeSyncWithHost>
      </VmSpecSection>
  </Vm>

Sounds like the problem is sending <iops>0</iops>which most probably means “unlimited” in API. Will have a glance if there is an easy fix available.

Hello, It took me the whole day, but I think I found the steps to reproduce.

First of all, my hcl

variable "hostname" {
  description = "Hostname for the instance"
  default     = "please_fill_me"
}

variable "image_catalog" {
  description = "Name of the catalog of the image/template"
  default     = "please_fill_me"
}

variable "image_string" {
  description = "Name of the image/template"
  default     = "please_fill_me"
}

variable "storage_profile" {
  description = "Set to use a special storage policy instead of the org vdc default"
  default     = null
}

resource "vcd_vapp" "vapp" {
  lifecycle {
    ignore_changes = [
      power_on,
    ]
  }
  name = var.hostname
}

resource "vcd_vapp_vm" "instance" {
  lifecycle {
    ignore_changes = [
      power_on,
    ]
  }
  vapp_name                = vcd_vapp.vapp.id == "always-not-equal" ? null : var.hostname
  name                     = var.hostname
  computer_name            = var.hostname
  catalog_name             = var.image_catalog
  template_name            = var.image_string
  cpus                     = 2
  cpu_cores                = 1
  memory                   = 4 * 1024
  power_on                 = false

  override_template_disk {
    bus_type        = "paravirtual"
    bus_number      = 0
    unit_number     = 0
    size_in_mb      = 30 * 1024
    storage_profile = var.storage_profile
  }
}

I tested it on 3 clouds (2 external where we are tenant only, and our own), so hostname, catalog name, catalog item and storage_profile needed to be variable.

The third one was a VCD 10.2.1.17444397, anyway I could reproduce it on our own VCD 10.2.2.17855680, so the version should not matter anymore:

  1. Create a local user in the target org (not ldap) to authenticate. (VCD_SYS_ORG should not be set)
  2. Give the local user the Organisation Administrator role.
  3. ALL (!!!) storage policies attached to the VDC needs to have “IOPS Limiting Enabled = true”. If only one storage policy has IOPS Limiting disabled, the issue is not triggered.

In my setup, I connected 2 policies, both with the same settings: image

An allocation limit is not relevant.

It would be great if you can reproduce it now and figure out if you can workaround it inside the provider.