Question

VM Creation V3 error

  • 11 January 2018
  • API
  • 1 reply
  • 196 views

Badge +3
Hi All,
I'm trying to create a VM on Prims Central using the V3 APIs, but I get an error. The same call directly to PE works correctly.My setup:PC 5.5NOS 5.5SSP configured (just default project)

The body:
{'name': 'test', 'resources': {'disk_list': [{'data_source_reference': {'kind': 'image', 'uuid': 'b5cf0091-67fe-462c-8cad-0dfe59d2fff5'}, 'device_properties': {'device_type': 'DISK', 'disk_address': {'adapter_type': 'SCSI', 'device_index': 0}}}], 'memory_size_mib': 1024, 'num_sockets': 1, 'num_vcpus_per_socket': 1, 'power_state': 'OFF'}}
The error is: "Error: {'reason': 'INTERNAL_ERROR', 'message': 'Failed to send RPC request'}"
What am I doing wrong?

Thanks

1 reply

Badge +6
Hi @tudamp! Going through and replying to some older posts - hope that's OK. 🙂

I've had a look at your POST body and, while the JSON itself is valid, it doesn't quite conform to the requirements for creating a VM with our v3 APIs. I've modified it slightly and tested against my demo cluster here - I'm running AOS 5.6 (released today) but the request should work the same way on 5.5.

The updated body looks like this - I've got an image UUID for my cluster in there so you'll need to change that back. The main differences are the addition of the "spec" and "metadata" sections.

code:

{
"metadata": {
"kind":"vm"
},
"spec": {
"name":"test",
"resources": {
"disk_list": [
{
"data_source_reference": {
"kind": "image",
"uuid": "a91f56a0-2133-4080-b6b4-60961e94dad7"
},
"device_properties": {
"device_type": "DISK",
"disk_address": {
"adapter_type": "SCSI",
"device_index": 0
}
}
}
],
"memory_size_mib": 1024,
"num_sockets": 1,
"num_vcpus_per_socket": 1,
"power_state": "OFF"
}
}
}



You'll find these things documented here: https://.

Cheers,
Chris R @ Nutanix

Reply