[ovirt-users] Virtual Machine Storage Size

Maor Lipchuk mlipchuk at redhat.com
Mon Apr 30 12:16:03 UTC 2018


By "used storage size of a VM" do you mean the disks which are attached to
it?

If it does then you can check each attached disk of the VM and summerize
their sizes.
For getting the disks attachments of the VM you can use the following REST
URL:
http://111.11.11.111:8080/ovirt-engine/api/vms/2222-2222-2222-222/diskattachments

Then you can use the following URL for each disk attachment:
  http://111.11.11.111:8080/ovirt-engine/api/disks/xxxx-xxx-xxx-xxxx

Here is an example of the output:
....
<name>test_Disk1</name>
<link href="
/ovirt-engine/api/disks/2b0c03d6-24e3-4911-9af2-a31927023676/permissions"
rel="permissions"/>
<actual_size>200704</actual_size>
<alias>test_Disk1</alias>
<content_type>data</content_type>
<format>cow</format>
<image_id>6c01687e-54b5-449d-be26-8ecfc092e4f8</image_id>
<propagate_errors>false</propagate_errors>
<provisioned_size>1073741824</provisioned_size>
<qcow_version>qcow2_v3</qcow_version>
<shareable>false</shareable>
<sparse>true</sparse>
<status>ok</status>
<storage_type>image</storage_type>
<total_size>200704</total_size>
<wipe_after_delete>false</wipe_after_delete>
....
</disk>

Regards,
Maor

On Thu, Apr 26, 2018 at 1:05 PM, Hari Prasanth Loganathan <
hariprasanth.l at msystechnologies.com> wrote:

> Hi Team,
>
> How to get the total and used storage size of a VM? When I run statistics
> Rest URL I get the following response, Which is the Total and Used storage
> in it?
>
> {
>             "next_run_configuration_exists": "false",
>             "numa_tune_mode": "interleave",
>             "status": "down",
>             "stop_time": 1524728637295,
>             "original_template": {
>                 "href": "/ovirt-engine/api/templates/
> 00000000-0000-0000-0000-000000000000",
>                 "id": "00000000-0000-0000-0000-000000000000"
>             },
>             "statistics": {
>                 "statistic": [
>                     {
>                         "kind": "gauge",
>                         "type": "integer",
>                         "unit": "bytes",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 1073741824
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "memory.installed",
>                         "description": "Total memory configured",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/5a89a1d2-32be-33f7-a0d1-
> f8b5bc974ff6",
>                         "id": "5a89a1d2-32be-33f7-a0d1-f8b5bc974ff6"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "integer",
>                         "unit": "bytes",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "memory.used",
>                         "description": "Memory used (agent)",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/b7499508-c1c3-32f0-8174-
> c1783e57bb08",
>                         "id": "b7499508-c1c3-32f0-8174-c1783e57bb08"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "decimal",
>                         "unit": "percent",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "cpu.current.guest",
>                         "description": "CPU used by guest",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/ef802239-b74a-329f-9955-
> be8fea6b50a4",
>                         "id": "ef802239-b74a-329f-9955-be8fea6b50a4"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "decimal",
>                         "unit": "percent",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "cpu.current.hypervisor",
>                         "description": "CPU overhead",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/d849a55f-0049-36f8-ae65-
> face541473ac",
>                         "id": "d849a55f-0049-36f8-ae65-face541473ac"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "decimal",
>                         "unit": "percent",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "cpu.current.total",
>                         "description": "Total CPU used",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/2ec286fe-4bec-32f5-8d63-
> dba7bed58763",
>                         "id": "2ec286fe-4bec-32f5-8d63-dba7bed58763"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "decimal",
>                         "unit": "percent",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "migration.progress",
>                         "description": "Migration Progress",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/892b69a7-41ca-36b1-9a2e-
> ae5177ef21bb",
>                         "id": "892b69a7-41ca-36b1-9a2e-ae5177ef21bb"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "integer",
>                         "unit": "bytes",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "memory.buffered",
>                         "description": "Memory buffered (agent)",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/09e07489-64fd-32ab-8e4e-
> a2b61eed8d60",
>                         "id": "09e07489-64fd-32ab-8e4e-a2b61eed8d60"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "integer",
>                         "unit": "bytes",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "memory.cached",
>                         "description": "Memory cached (agent)",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/1b6244ee-8dbd-365d-8762-
> 482ddc05ee11",
>                         "id": "1b6244ee-8dbd-365d-8762-482ddc05ee11"
>                     },
>                     {
>                         "kind": "gauge",
>                         "type": "integer",
>                         "unit": "bytes",
>                         "values": {
>                             "value": [
>                                 {
>                                     "datum": 0
>                                 }
>                             ]
>                         },
>                         "vm": {
>                             "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded",
>                             "id": "b89deb8c-882c-47a4-9911-b4978cddcded"
>                         },
>                         "name": "memory.free",
>                         "description": "Memory free (agent)",
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics/5a0fba9d-33d7-3cbf-addd-
> ba462040c946",
>                         "id": "5a0fba9d-33d7-3cbf-addd-ba462040c946"
>                     }
>                 ]
>             },
>             "template": {
>                 "href": "/ovirt-engine/api/templates/
> 00000000-0000-0000-0000-000000000000",
>                 "id": "00000000-0000-0000-0000-000000000000"
>             },
>             "actions": {
>                 "link": [
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/detach",
>                         "rel": "detach"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/export",
>                         "rel": "export"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/ticket",
>                         "rel": "ticket"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/reboot",
>                         "rel": "reboot"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/migrate",
>                         "rel": "migrate"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/commitsnapshot",
>                         "rel": "commitsnapshot"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/cancelmigration",
>                         "rel": "cancelmigration"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/clone",
>                         "rel": "clone"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/freezefilesystems",
>                         "rel": "freezefilesystems"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/logon",
>                         "rel": "logon"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/maintenance",
>                         "rel": "maintenance"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/previewsnapshot",
>                         "rel": "previewsnapshot"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/reordermacaddresses",
>                         "rel": "reordermacaddresses"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/thawfilesystems",
>                         "rel": "thawfilesystems"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/undosnapshot",
>                         "rel": "undosnapshot"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/shutdown",
>                         "rel": "shutdown"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/start",
>                         "rel": "start"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/stop",
>                         "rel": "stop"
>                     },
>                     {
>                         "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/suspend",
>                         "rel": "suspend"
>                     }
>                 ]
>             },
>             "name": "memory",
>             "href": "/ovirt-engine/api/vms/b89deb8c-882c-47a4-9911-
> b4978cddcded",
>             "id": "b89deb8c-882c-47a4-9911-b4978cddcded",
>             "bios": {
>                 "boot_menu": {
>                     "enabled": "false"
>                 }
>             },
>             "cpu": {
>                 "architecture": "x86_64",
>                 "topology": {
>                     "cores": "1",
>                     "sockets": "1",
>                     "threads": "1"
>                 }
>             },
>             "display": {
>                 "allow_override": "false",
>                 "copy_paste_enabled": "true",
>                 "disconnect_action": "LOCK_SCREEN",
>                 "file_transfer_enabled": "true",
>                 "monitors": "1",
>                 "single_qxl_pci": "false",
>                 "smartcard_enabled": "false",
>                 "type": "spice"
>             },
>             "io": {
>                 "threads": "0"
>             },
>       *      "memory": 1073741824,*
>             "migration": {
>                 "auto_converge": "inherit",
>                 "compressed": "inherit"
>             },
>             "origin": "ovirt",
>             "os": {
>                 "boot": {
>                     "devices": {
>                         "device": [
>                             "hd"
>                         ]
>                     }
>                 },
>                 "type": "other"
>             },
>             "sso": {
>                 "methods": {
>                     "method": [
>                         {
>                             "id": "guest_agent"
>                         }
>                     ]
>                 }
>             },
>             "stateless": "false",
>             "type": "desktop",
>             "usb": {
>                 "enabled": "false"
>             },
>             "cluster": {
>                 "href": "/ovirt-engine/api/clusters/
> 8111b6c0-c60d-416d-bcdb-ea926f8035fc",
>                 "id": "8111b6c0-c60d-416d-bcdb-ea926f8035fc"
>             },
>             "quota": {
>                 "id": "96e54503-092a-467e-be8e-12ac203b9991"
>             },
>             "link": [
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/cdroms",
>                     "rel": "cdroms"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/watchdogs",
>                     "rel": "watchdogs"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/katelloerrata",
>                     "rel": "katelloerrata"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/permissions",
>                     "rel": "permissions"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/tags",
>                     "rel": "tags"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/diskattachments",
>                     "rel": "diskattachments"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/snapshots",
>                     "rel": "snapshots"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/applications",
>                     "rel": "applications"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/affinitylabels",
>                     "rel": "affinitylabels"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/hostdevices",
>                     "rel": "hostdevices"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/numanodes",
>                     "rel": "numanodes"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/reporteddevices",
>                     "rel": "reporteddevices"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/sessions",
>                     "rel": "sessions"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/graphicsconsoles",
>                     "rel": "graphicsconsoles"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/nics",
>                     "rel": "nics"
>                 },
>                 {
>                     "href": "/ovirt-engine/api/vms/
> b89deb8c-882c-47a4-9911-b4978cddcded/statistics",
>                     "rel": "statistics"
>                 }
>             ],
>             "cpu_shares": "0",
>             "creation_time": 1524728637178,
>             "delete_protected": "false",
>             "high_availability": {
>                 "enabled": "false",
>                 "priority": "0"
>             },
>             "large_icon": {
>                 "href": "/ovirt-engine/api/icons/ae1951e6-d1c8-50a9-4dc3-
> 59a0967afd21",
>                 "id": "ae1951e6-d1c8-50a9-4dc3-59a0967afd21"
>             },
>             "memory_policy": {
>                 "guaranteed": 1073741824,
>                 "max": 4294967296
>             },
>             "migration_downtime": "-1",
>             "placement_policy": {
>                 "affinity": "migratable"
>             },
>             "small_icon": {
>                 "href": "/ovirt-engine/api/icons/07a3e3fc-a384-e5cc-d496-
> 942f8047eea8",
>                 "id": "07a3e3fc-a384-e5cc-d496-942f8047eea8"
>             },
>             "start_paused": "false",
>             "storage_error_resume_behaviour": "auto_resume",
>             "time_zone": {
>                 "name": "Etc/GMT"
>             },
>             "cpu_profile": {
>                 "href": "/ovirt-engine/api/cpuprofiles/ab2e9ead-2464-
> 41f9-94f4-1e68c648a8a1",
>                 "id": "ab2e9ead-2464-41f9-94f4-1e68c648a8a1"
>             }
>         }
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20180430/c790cab0/attachment-0001.html>


More information about the Users mailing list