Creating VM with Specific Disk Size via Promox API

Nadir

New Member
Jun 26, 2019
17
0
1
28
Hi
I am trying to create a VM using API. I am facing issue in creating VM with sata.
this is the array of my post fields
$fields = array(
'vmid' => 105,
'cores' => 1,
'start' =>1,
'sockets' =>1,
'name' => "nadiransarionline.grownstar",
'balloon' =>4096,
'memory'=>4096,
'sata0'=>"size:40960"
);
by this promox replies with Error code 500 and a null response. but if i exclude sata0 field then it creates a VM but without any storage attached to it.
I studied API from API Viewer but I am not able to understand how to solve this.

Help please.
And sorry if its is in wrong section of forum.
 
hi,

can you try sending the request with 'size=40960' instead of 'size:40960' ?
 
That was freaking wrong with documentation. Correct parameters are something like this
$fields = array(
'vmid' => 105,
'cores' => 1,
'start' =>1,
'sockets' =>1,
'name' => "nadir.VM",
'balloon' =>4096,
'memory'=>4096,
'cdrom'=>"local:iso/9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.ISO,media=cdrom",
'sata0'=>"local:32,format=qcow2",

);

Issue resolved
 

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!