[SOLVED] Proxmox HTTP API Create a new VM with SCSI

q-member

Member
Sep 3, 2021
35
0
11
38
Hi,
I'm trying to create a new VM with the API per Post Request.

This also worked until I wanted to add a drive via SCSI.

For this I have sent this data:

... "&scsi0=moxx01:vm-103-disk-0,discard=on,iops_rd=500,iops_wr=500,size=50G,ssd=1" ...

JSON:
{
    "data":null,
    "errors":{
        "scsi0":"invalid format - duplicate key in comma-separated list property: file\n"
    }
}

I do not understand where the duplicate key is supposed to be.

Thanks in advance
 
can you post the complete post request ?
 
Hi this is the PHP function I use:

Note: without the "&scsi0=..." at the end it works as expected.
1631530198352.png
 
you did not 'urlencode' the data, so my guess is that the '=' in the scsi0 options confuses the backend

also if you want to create a scsi image, you just need to use the special disk creation syntax: 'storage:5' instead of specifying the disk image (5 here is in GiB) this will autocreate an image with the given size and replace it with the actual disk image name in the config
 
Hello,

I have the certain main.tf file:

Code:
resource "proxmox_vm_qemu" "MV-TF-VM" {
  count        = 1
  name         = var.vm_name
  desc         = "Terraform created VM"
  vmid         = var.vmid
  target_node  = var.proxmox_host
  agent        = 0
  clone        = var.template_name
  full_clone   = true
  cores        = 2
  sockets      = 1
  cpu          = "host"
  os_type      = "ubuntu"
  memory       = 2048
  ipconfig0    = var.ipconfig0
  nameserver   = var.nameserver
  onboot       = true
  bootdisk     = "scsi0"
  scsihw       = "virtio-scsi-single"
  disks {
    scsi {
      scsi0 {
        disk {
          size      = var.disksize
          iothread  = true
          storage   = "local-lvm:vm-${var.vmid}-disk-0,format=raw,media=disk,replicate=0"
        }
      }
    }
  }
  network {
    model   = "virtio"
    bridge  = "vmbr0"
  }
}


I've tried to deploy the VM in Proxmox from template over Terraform,
the VM has been cloned successfully, but...the deployment/start and provisioning of VM crashed with error:

Code:
"Error: error updating VM: 400 Parameter verification failed.,
error status:
{"errors":{"scsi0":"invalid format - duplicate key in comma-separated list property: file\n"},"data":null} (params: map[bios:seabios cores:2 cpu:host description:Terraform created VM hotplug:network,disk,usb ide3:local-lvm:cloudinit,format=raw ipconfig0:ip=10.85.70.153/24,gw=10.85.70.1 kvm:true memory:2048 name:MV-TF-VM nameserver:10.85.70.2 net0:virtio=D6:07:75:6A:53:8F,bridge=vmbr0 numa:false onboot:true scsi0:local-lvm:vm:250:disk:0,format:raw,media:disk,replicate:0:10,format=raw,iothread=1,replicate=0 scsihw:virtio-scsi-single sockets:1 tablet:true vmid:250])
with proxmox_vm_qemu.MV-TF-VM[0],
│   on main.tf line 1, in resource "proxmox_vm_qemu" "MV-TF-VM":
│    1: resource "proxmox_vm_qemu" "MV-TF-VM" {"

Could you please hint me/let me know what the problem is?


Thanks,
Sincerely,
Mihail Virlan
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!