one icon indicating copy to clipboard operation
one copied to clipboard

Datastores - Show allocated capacity

Open feldsam opened this issue 6 years ago • 6 comments

Enhancement Request

Description

I like to see allocated capacity in datastores listing and detail.

Use case

In actual version I can only see used capacity, but not allocated one. I use thin provisioning, and info about allocated space can help getting better view how datastores are used and prevent overprovisining.

Interface Changes

Sunstone - show allocated capacity in second column Sunstone - show allocated capacity in DS detail

Nice to have - define overprovisioning like are in Hosts and scheduler should consider it when deploying VM.

Progress Status

  • [ ] Branch created
  • [ ] Code committed to development branch
  • [ ] Testing - QA
  • [ ] Documentation
  • [ ] Release notes - resolved issues, compatibility, known issues
  • [ ] Code committed to upstream release/hotfix branches
  • [ ] Documentation committed to upstream release/hotfix branches

feldsam avatar Apr 18 '18 10:04 feldsam

Deleted the comments related to support as the user has been redirected to the forum by OP. Thanks!

rsmontero avatar Jul 03 '18 20:07 rsmontero

Maye we can add them both.

USED_MB/ALLOCATED_MB/TOTAL_MB

The allocated part is a little bit more tricky as it has to sum the space of each VM assigned to a particular datastore. I can try to do it myself, but I don't know how on what params should I build the allocated capacity.

TGM avatar Jan 17 '24 14:01 TGM

@TGM - the IMAGE type datastore is easy, there is list of images in datastore XML

<DATASTORE>
  <ID>100</ID>
  <TYPE>0</TYPE>
  ...
  <IMAGES>
    <ID>1</ID>
    <ID>2</ID>
    <ID>3</ID>
    <ID>4</ID>
    ...
  </IMAGES>
</DATASTORE>

for the SYSTEM type datastore, there will be need to add some new element into datastore definition XML and update it durring deployment processes same as it is with hosts. In host definition there is

<HOST>
  <ID>0</ID>
  <VMS>
    <ID>512</ID>
    ...
  </VMS>
</HOST>

feldsam avatar Jan 17 '24 14:01 feldsam

The SYSTEMS type datastores can be scraped from each VM and computed, the SIZE is contained in vm.xml under each VM folder. However, I think that the SIZE param will only be updated on a VM power cycle. (needs testing)

/var/lib/one/datastores/126/305

    <DISK>
      <ALLOW_ORPHANS><![CDATA[YES]]></ALLOW_ORPHANS>
      <CLONE><![CDATA[YES]]></CLONE>
      <CLONE_TARGET><![CDATA[SYSTEM]]></CLONE_TARGET>
      <CLUSTER_ID><![CDATA[115,116]]></CLUSTER_ID>
      <DATASTORE><![CDATA[proton_default]]></DATASTORE>
      <DATASTORE_ID><![CDATA[125]]></DATASTORE_ID>
      <DEV_PREFIX><![CDATA[vd]]></DEV_PREFIX>
      <DISK_ID><![CDATA[0]]></DISK_ID>
      <DISK_SNAPSHOT_TOTAL_SIZE><![CDATA[0]]></DISK_SNAPSHOT_TOTAL_SIZE>
      <DISK_TYPE><![CDATA[FILE]]></DISK_TYPE>
      <DRIVER><![CDATA[qcow2]]></DRIVER>
      <FORMAT><![CDATA[qcow2]]></FORMAT>
      <IMAGE><![CDATA[alp317]]></IMAGE>
      <IMAGE_ID><![CDATA[31]]></IMAGE_ID>
      <IMAGE_STATE><![CDATA[2]]></IMAGE_STATE>
      <LN_TARGET><![CDATA[SYSTEM]]></LN_TARGET>
      <ORIGINAL_SIZE><![CDATA[256]]></ORIGINAL_SIZE>
      <READONLY><![CDATA[NO]]></READONLY>
      <SAVE><![CDATA[NO]]></SAVE>
      <SIZE><![CDATA[61440]]></SIZE>
      <SOURCE><![CDATA[/var/lib/one//datastores/125/d2494e188771aa071973316e029b5af0]]></SOURCE>
      <TARGET><![CDATA[vda]]></TARGET>
      <TM_MAD><![CDATA[ssh]]></TM_MAD>
      <TYPE><![CDATA[FILE]]></TYPE>
    </DISK>

TGM avatar Jan 17 '24 15:01 TGM

Hi, I know about it, but I don't think this way will be accepted by OpenNebula team if you do PR. I think clean way is to update DS on each VM deployment/termination like it is on hosts. In that case you don't need regularry calculate allocated size because it will be updated on events. In my previous reply I forgot to mention additionall field ALLOCATED_MB which will be also updated on events.

feldsam avatar Jan 17 '24 18:01 feldsam

Scraping is the current method used to return a host's USED_MB/FREE_MB/TOTAL_MB for each datastore, seem the correct way to do it.

TGM avatar Jan 18 '24 10:01 TGM