OpenStack database auto-cleanup

By design, when deleting a cloud resource, for example, an instance, volume, or router, an OpenStack service does not immediately delete its data but marks it as removed so that it can later be picked up by the garbage collector.

Given that an OpenStack resource is often represented by more than one record in the database, deletion of all of them right away could affect the overall responsiveness of the cloud API. On the other hand, an OpenStack database being severely clogged with stale data is one of the most typical reasons for the cloud slowness.

To keep the OpenStack database small and performance fast, MOSK is pre-configured to automatically clean up the removed database records older than 30 days. By default, the clean up is performed for the following MOSK services every Monday according to the schedule:

The default database cleanup schedule by OpenStack service


Service identifier

Clean up time

Block Storage (OpenStack Cinder)


12:01 a.m.

Compute (OpenStack Nova)


01:01 a.m.

Image (OpenStack Glance)


02:01 a.m.

Instance HA (OpenStack Masakari)


03:01 a.m.

Key Manager (OpenStack Barbican)


04:01 a.m.

Orchestration (OpenStack Heat)


05:01 a.m.

If required, you can adjust the cleanup schedule for the OpenStack database by adding the features:database:cleanup setting to the OpenStackDeployment CR following the example below. The schedule parameter must contain a valid cron expression. The age parameter specifies the number of days after which a stale record gets cleaned up.

          enabled: true
          schedule: "1 0 * * 1"
          age: 30
          batch: 1000