Solved

Unmount ISO CD-ROM via PC V3 API

  • 5 May 2020
  • 4 replies
  • 3805 views

I am struggling to get my VM to unmount the ISO via the PC v3 API.  I’m performing a GET, to get the VM Info, I’ve attempted to update the vm with data_source_reference removed, PC updates, but the iso is still attached.  I see different references with V1 on PE, but can’t seem to do it via v3.  anyone had any luck?

icon

Best answer by Chandru 8 May 2020, 12:46

View original

This topic has been closed for comments

4 replies

Userlevel 6
Badge +5

Could you please share they code? Please redact UUIDs.

Userlevel 3
Badge +13

@pso9968 Have you also removed disk_size_bytes and disk_size_mib from the CDROM spec? It works for me. 

Userlevel 3
Badge +13

Here is curl and jq combo that works in unmounting the cd rom for a single cdrom attached vm.

url='https://<pc_ip>:9440/api/nutanix/v3/vms/<vm_uuid>'
curl -k -s -u admin "$url" | jq 'del(.status)|del(.spec.resources.disk_list[]|select(.device_properties.device_type == "CDROM") | .data_source_reference,.disk_size_bytes,.disk_size_mib)' | curl -k -s -u admin "$url" -H "Content-type:application/json" -XPUT -d @-

Replace pc_ip and vm_uuid with appropriate values

I’ll try it.  I had data_source_reference, but didn’t try and set the size elements.  I’ll give that a shot. Thank you for the feedback.