Unmount ISO CD-ROM via PC V3 API | Nutanix Community
Skip to main content
Solved

Unmount ISO CD-ROM via PC V3 API


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?

Best answer by Chandru

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

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

4 replies

Alona
Nutanix Employee
Forum|alt.badge.img+5
  • Nutanix Employee
  • 432 replies
  • May 8, 2020

Could you please share they code? Please redact UUIDs.


Forum|alt.badge.img+13
  • Nutanix Employee
  • 44 replies
  • May 8, 2020

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


Forum|alt.badge.img+13
  • Nutanix Employee
  • 44 replies
  • Answer
  • May 8, 2020

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


  • Author
  • Voyager
  • 1 reply
  • May 8, 2020

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.