[one-users] Any way to force a recalculate of image size and quota use?

Daniel Molina dmolina at opennebula.org
Tue Dec 13 03:18:44 PST 2011


Hi Graeme,

On 5 December 2011 04:08, Graeme Gillies <graeme.r.gillies at gmail.com> wrote:
> Hi,
>
> I recently upgraded our opennebula environment to 3.0 and as part of
> that move I switched from sqlite to mysql database, forcing me to
> basically start again and re-import all our images, vms, templates,
> networks etc.
>
> I did most the work as the oneadmin user, for example, importing all
> users images, then used
>
> oneimage chown $imageid $username users
>
> to give the images back to the original owner.
>
> This has all seemed to go fine, however, during the import I noticed a
> couple of the bigger images have had their size reported incorrectly
> in opennebula
>
>  ID USER     GROUP    NAME            SIZE TYPE          REGTIME PUB
> PER STAT  RVMS
>  14 <hidden> users    <hidden>-storage   14.6G   DB   12/04 09:55:48
> No Yes used     1
>
> IMAGE 14 INFORMATION
> ID             : 14
> NAME           : <hidden>-storage
> USER           : <hiden>
> GROUP          : users
> TYPE           : DATABLOCK
> REGISTER TIME  : 12/04 09:55:48
> PUBLIC         : No
> PERSISTENT     : Yes
> SOURCE         : /var/lib/one/images/1e5164009f66cb87de73b6f4c29c9317
> SIZE           : 14903
> STATE          : used
> RUNNING_VMS    : 1
>
> but the size of that disk is much larger
>
> ls -lah /var/lib/one/images/1e5164009f66cb87de73b6f4c29c9317
>
> -rw-rw---- 1 oneadmin oneadmin 49G Dec  4 20:26
> /var/lib/one/images/1e5164009f66cb87de73b6f4c29c9317
>
> Is there anyway (either through the tools, or someone just writing a
> ruby script using the opennebula libraries) to make opennebula go
> through each image in the database and confirm the size is correct to
> what is on disk? To solve these discrepancies.

There was a bug in the file size calculation that was fixed for the
next release [1]. OpenNebula calculates this value when the image is
added to the repository, or after a save_as, but there is no way to
modify it unless you update the DB.

>
> Also, I enabled the quota module for my installation, and restarted
> oned. When I do onequota show $userid It gives me
>
>  uid          cpu       memory      num_vms      storage
>   6          0/3       0/4096          0/3      0/20480
>
> Even though the user does indeed have vms running (and disk images
> used). Can a similar thing be done as above, and force oneauth to
> recalculate the quota usage for everyone?

You can use the -f option to force the usage calculation, otherwise it
will use the usage cache, which is updated after each authorization
request. (These command should be run as oneadmin)

>
> Regards,
>
> Graeme
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org



-- 
Daniel Molina
Project Engineer
OpenNebula - The Open Source Toolkit for Data Center Virtualization
www.OpenNebula.org | dmolina at opennebula.org | @OpenNebula



More information about the Users mailing list