Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jwmatthews/d1b1727b063385269d6ce59b6d22177c to your computer and use it in GitHub Desktop.
Save jwmatthews/d1b1727b063385269d6ce59b6d22177c to your computer and use it in GitHub Desktop.
# cat ovirt_list_volumes.sh
#!/bin/sh
if [ "$#" -lt "1" ]; then
echo "Please re-run with VM ID"
exit 1
fi
VM_ID="$1"
USER="admin@internal"
PASS="dog8code"
# For 3.6 URL is just IP/api
# For 4.0 URL is IP/ovirt/api/v3
URL="https://192.168.155.11/api"
curl -k --user ${USER}:${PASS} -i -X GET -H "Accept: application/xml; detail=disks; detail=nics; detail=hosts;" ${URL}/vms/${VM_ID}/disks
[root@sat ~]# ./ovirt_list_volumes.sh "9ce9d090-6efc-4bef-860c-fcbfbc6d93be"
HTTP/1.1 200 OK
Date: Thu, 21 Jul 2016 17:12:32 GMT
Pragma: No-cache
Cache-Control: no-cache
Expires: Wed, 31 Dec 1969 19:00:00 EST
Content-Type: application/xml
Content-Length: 4379
Vary: Accept-Encoding
Connection: close
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<disks>
<disk href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/3bf80387-5021-46ed-95c3-c201dd05a951" id="3bf80387-5021-46ed-95c3-c201dd05a951">
<actions>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/3bf80387-5021-46ed-95c3-c201dd05a951/deactivate" rel="deactivate"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/3bf80387-5021-46ed-95c3-c201dd05a951/activate" rel="activate"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/3bf80387-5021-46ed-95c3-c201dd05a951/export" rel="export"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/3bf80387-5021-46ed-95c3-c201dd05a951/move" rel="move"/>
</actions>
<name>jwm1-ose-node1-example-com_Disk1</name>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/3bf80387-5021-46ed-95c3-c201dd05a951/permissions" rel="permissions"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/3bf80387-5021-46ed-95c3-c201dd05a951/statistics" rel="statistics"/>
<vm href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be" id="9ce9d090-6efc-4bef-860c-fcbfbc6d93be"/>
<alias>jwm1-ose-node1-example-com_Disk1</alias>
<image_id>b6f55890-680d-4058-9cdc-033e60961445</image_id>
<storage_domains>
<storage_domain id="c8878c1f-fc87-4326-b46c-9d7012b51125"/>
</storage_domains>
<size>16106127360</size>
<provisioned_size>16106127360</provisioned_size>
<actual_size>1750474752</actual_size>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>cow</format>
<sparse>true</sparse>
<bootable>true</bootable>
<shareable>false</shareable>
<wipe_after_delete>false</wipe_after_delete>
<propagate_errors>false</propagate_errors>
<active>true</active>
<read_only>false</read_only>
<disk_profile href="/api/diskprofiles/30b3a15b-77de-4573-ad24-aaad8c27d5b3" id="30b3a15b-77de-4573-ad24-aaad8c27d5b3"/>
<storage_type>image</storage_type>
</disk>
<disk href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/39c4834c-375d-4d8f-b36d-48d3ddf0a165" id="39c4834c-375d-4d8f-b36d-48d3ddf0a165">
<actions>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/39c4834c-375d-4d8f-b36d-48d3ddf0a165/deactivate" rel="deactivate"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/39c4834c-375d-4d8f-b36d-48d3ddf0a165/activate" rel="activate"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/39c4834c-375d-4d8f-b36d-48d3ddf0a165/export" rel="export"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/39c4834c-375d-4d8f-b36d-48d3ddf0a165/move" rel="move"/>
</actions>
<name>jwm1-ose-node1-example-com_Disk2</name>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/39c4834c-375d-4d8f-b36d-48d3ddf0a165/permissions" rel="permissions"/>
<link href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be/disks/39c4834c-375d-4d8f-b36d-48d3ddf0a165/statistics" rel="statistics"/>
<vm href="/api/vms/9ce9d090-6efc-4bef-860c-fcbfbc6d93be" id="9ce9d090-6efc-4bef-860c-fcbfbc6d93be"/>
<alias>jwm1-ose-node1-example-com_Disk2</alias>
<image_id>f3465a46-5991-439e-b76b-93d190df68f6</image_id>
<storage_domains>
<storage_domain id="c8878c1f-fc87-4326-b46c-9d7012b51125"/>
</storage_domains>
<size>32212254720</size>
<provisioned_size>32212254720</provisioned_size>
<actual_size>787750912</actual_size>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>cow</format>
<sparse>true</sparse>
<bootable>false</bootable>
<shareable>false</shareable>
<wipe_after_delete>false</wipe_after_delete>
<propagate_errors>false</propagate_errors>
<active>true</active>
<read_only>false</read_only>
<disk_profile href="/api/diskprofiles/30b3a15b-77de-4573-ad24-aaad8c27d5b3" id="30b3a15b-77de-4573-ad24-aaad8c27d5b3"/>
<storage_type>image</storage_type>
</disk>
</disks>
[root@sat ~]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment