How user quota work?

Hello OpenNebula Team,

How do user quotas work in OpenNebula? I am using Ceph for image storage. I have set the datastore quota to 10GB, and when I create a virtual machine from an OS image and resize it to 10GB, the datastore quota is correctly reflected as 10GB/10GB. However, when I attach a blank 10GB datablock image (stored in the same place as the OS image), the quota does not change. It still shows 10GB/10GB, even though the user has used 20GB. How can I limit this?

Thanks
Frontend version: Opennebula 6.8

Hello @Khang_Nguyen_Phuc,
the user datastore quotas depends on the storage driver (Ceph, qcow2, lvm, …) and the persistent flag of the used image. I’ll focus only on Ceph datastore.

If user creates an image on the Datastore, the image size is counted to the usage quotas. No matter the persistent flag.

If user creates Virtual Machine (or attaches disk):

  • non-persistent image - copy of the image is created on the Datastore, the size of the image is added to usage quotas
  • persistent image - no copy, no usage quota is added

From your example I guess the OS Image is non-persistnet and the datablock Image is persistent, both created by admin user. Then used by regular user with the quota limit.

If it’s not like that, then please share an output of oneimage list command (you can filter only those 2 images) and the name of the user with the quota limit.

How can I limit this?

If I’m correct and the datablock image is persistent. Attaching the disk doesn’t consume more size on the storage, so you can’t limit it by the size quota.
You can limit how many times the image is used by Virtual Machines, see the Image->RVMS quota. Not sure if this is what you need, this limit is for individual images.

Thank you for your response, but my datablock is non-persistent, and when attached to VMs, it still doesn’t count towards the datastore quota. Could it be that I missed some configuration?
My datablock infor (Datablock image ID is 15, and OS image ID is 14) :

IMAGE 15 INFORMATION
ID             : 15
NAME           : Blank-Data-20GB
USER           : oneadmin
GROUP          : oneadmin
LOCK           : None
DATASTORE      : images
TYPE           : DATABLOCK
REGISTER TIME  : 12/26 13:48:51
PERSISTENT     : No
SOURCE         : ceph-cloud/one-15
FORMAT         : raw
SIZE           : 20G
STATE          : used
RUNNING_VMS    : 2

PERMISSIONS
OWNER          : um-
GROUP          : ---
OTHER          : ---

IMAGE TEMPLATE
DEV_PREFIX="vd"
DRIVER="raw"

VIRTUAL MACHINES...

IMAGE 14 INFORMATION
ID             : 14
NAME           : WindowsOS
USER           : oneadmin
GROUP          : oneadmin
LOCK           : None
DATASTORE      : images
TYPE           : OS
REGISTER TIME  : 12/26 13:24:12
PERSISTENT     : No
SOURCE         : ceph-cloud/one-14
FORMAT         : raw
SIZE           : 40G
STATE          : used
RUNNING_VMS    : 2

PERMISSIONS
OWNER          : um-
GROUP          : ---
OTHER          : ---

IMAGE TEMPLATE
DEV_PREFIX="vd"
DRIVER="raw

Thanks

Hello @Khang_Nguyen_Phuc,
thank you for response. You are right, the quotas for CEPH datastore is not counted correctly, I’ve created a github issue for this