VM history cleanup

Hello guys,
is it possible (allowed) to do a cleanup of deleted VMs from database? Currently, each VM that has ever run in Nebula has its record in database. Additionally there is a history table witch records for each VM as well. And the contextualization data are stored in oneadmin’s home in ‘vms’ directory also.

Because our environment is quite dynamic, we have only about 1000 VMs, but their IDs are around 530k - what means there are more than 500k non-needed entries in DB. It makes the DB big and slows down the queries.

Could I delete the records from DB and from the ‘vms’ directory or does Nebula need them (because of generating next VM ID or stuff like that)? I’m not worried about accounting since I don’t need it at all.

1 Like

you can safely delete them (both files in log folder and entries in vm_monitoring table… if you want to hardcore clean you can delete all entries also in host_monitoring and history too) ,

the “next id” is stored in the pool_control table

just have a backup before doing this, just in case

stop one
backup
delete records in tables and logs in folder
start one

test
enjoy

PS: this is something I do on regular basis in production environments… but may not be a best practice. Never had a problem with it anyway.

2 Likes

thanks lorenzo

so far i’ve cleaned up only vm_pool and i’ve also adujsted my db backup script to omit history table, but it seems good

1 Like

This is quite interesting, we will evaluate its implementation for the next
version. Thanks!

http://dev.opennebula.org/issues/150

(there was an old request for this but it was closed during an issue
cleanup)

1 Like