REST API V2 nic_uuid not included in NIC creation task object | Nutanix Community
Skip to main content

I have a VM UUID 33ac3949-beba-401e-a114-6ccd48ebf237

I use POST to /vms/{uuid}/nics/ to create a NIC.

The successful task returns UUID 46e8ac39-5dba-460a-afb6-f65bf1b7b43c

{
"uuid": "46e8ac39-5dba-460a-afb6-f65bf1b7b43c",
"meta_request": {
"method_name": "VmNicCreate"
},
"meta_response": {
"error_code": 0
},
"create_time_usecs": 1596037035354721,
"start_time_usecs": 1596037035378557,
"complete_time_usecs": 1596037035579435,
"last_updated_time_usecs": 1596037035579435,
"entity_list": t
{
"entity_id": "33ac3949-beba-401e-a114-6ccd48ebf237",
"entity_type": "VM",
"entity_name": null
}
],
"operation_type": "kVmNicCreate",
"message": "",
"percentage_complete": 100,
"progress_status": "Succeeded",
"parent_task_uuid": "3b61a2df-4fe4-46aa-bd18-a9f87086f723",
"cluster_uuid": "0005883b-67db-3e76-0000-000000015db3"
}

Notice that the entity list refers back to the VM, not to the newly created NIC.  I would expect the operation to return the ‘nic_uuid’ (or the MAC.). 

Here’s what my VM actually has for NICs (from GET to /vms/{uuid}/nics/):

{'mac_address': '50:6b:8d:35:13:cf', 'network_uuid': 'cc7d5370-7235-4494-b7cb-d1c7b2c2f402', 'nic_uuid': '40df57cf-e65d-400e-a2f6-61bc8d996e2d', 'model': '', 'is_connected': True}

All I’m really looking for here is the MAC.  Obviously this is no problem if I’m only creating one NIC but I’m planning to create multiple NICs.  The best I can think of is to do a differential and get a list of the NICs before and after the operation to determine which one is the new one.