Glance-Scrubber

Glance-scrubber is a utility for the Image Service that cleans up images that have been deleted; its configuration is stored in the glance-scrubber.conf file.

Images in Glance can be in one the following statuses:

  • queued
  • saving
  • active
  • killed
  • deleted
  • pending_delete

In Glance-Scrubber, what we are concerned is with the deleted and pending_delete status. The image  deleted can take up some amount of time and memory, so it might make other processes a little slow, this is when the pending_delete status comes into picture, it basically deletes the image after some time and is equivalent to delayed delete. The images with the status pending_delete gets deleted after a specific scrub time; and once the image is set with pending_delete status as true, the image is no longer recoverable.

To use scrubber from command line, there is a specific command ‘glance-scrubber’. But for that we need to set up configuration files correctly. By default Dev-Stack does not clones scrubber.conf with glance repository. So, we need to declare it first.

The configuration files are stored in the uppermost directory, if you are using ubuntu,

then do

cd /etc/glance

Various configuration files can be seen here, we can use any text editor to create a new configuration file, name it glance-scrubber.conf and paste the following

[DEFAULT]

# Show more verbose log output (sets INFO log level output)

#verbose = False

# Show debugging output in logs (sets DEBUG log level output)

#debug = False

# Log to this file. Make sure you do not set the same log file for both the API

# and registry servers!

#

# If `log_file` is omitted and `use_syslog` is false, then log messages are

# sent to stdout as a fallback.

log_file = /var/log/glance/scrubber.log

# Send logs to syslog (/dev/log) instead of to file specified by `log_file`

#use_syslog = False

# Should we run our own loop or rely on cron/scheduler to run us

daemon = False

# Loop time between checking for new items to schedule for delete

wakeup_time = 300

# Directory that the scrubber will use to remind itself of what to delete

# Make sure this is also set in glance-api.conf

scrubber_datadir = /var/lib/glance/scrubber

# Only one server in your deployment should be designated the cleanup host

cleanup_scrubber = False

# pending_delete items older than this time are candidates for cleanup

cleanup_scrubber_time = 86400

# Address to find the registry server for cleanups

registry_host = 0.0.0.0

# Port the registry server is listening on

registry_port = 9191

# Auth settings if using Keystone

# auth_url = http://127.0.0.1:5000/v2.0/

# admin_tenant_name = %SERVICE_TENANT_NAME%

# admin_user = %SERVICE_USER%

# admin_password = %SERVICE_PASSWORD%

# Directory to use for lock files. Default to a temp directory

# (string value). This setting needs to be the same for both

# glance-scrubber and glance-api.

#lock_path=<None>

# API to use for accessing data. Default value points to sqlalchemy

# package, it is also possible to use: glance.db.registry.api

#data_api = glance.db.sqlalchemy.api

# ================= Security Options ==========================

# AES key for encrypting store ‘location’ metadata, including

# — if used — Swift or S3 credentials

# Should be set to a random string of length 16, 24 or 32 bytes

#metadata_encryption_key = <16, 24 or 32 char registry metadata key>

# ================= Database Options ===============+==========

[database]

# The SQLAlchemy connection string used to connect to the

# database (string value)

#connection=sqlite:////glance/openstack/common/db/$sqlite_db

# The SQLAlchemy connection string used to connect to the

# slave database (string value)

#slave_connection=

# timeout before idle sql connections are reaped (integer

# value)

#idle_timeout=3600

# Minimum number of SQL connections to keep open in a pool

# (integer value)

#min_pool_size=1

# Maximum number of SQL connections to keep open in a pool

# (integer value)

#max_pool_size=<None>

# maximum db connection retries during startup. (setting -1

# implies an infinite retry count) (integer value)

#max_retries=10

# interval between retries of opening a sql connection

# (integer value)

#retry_interval=10

# If set, use this value for max_overflow with sqlalchemy

# (integer value)

#max_overflow=<None>

# Verbosity of SQL debugging information. 0=None,

# 100=Everything (integer value)

#connection_debug=0

# Add python stack traces to SQL as comment strings (boolean

# value)

#connection_trace=false

# If set, use this value for pool_timeout with sqlalchemy

# (integer value)

#pool_timeout=<None>

We can use various flavors which can vary from trusted-auth, keystone, no- auth. etc

In my particular case, I had to use no-auth to make the scrubber work with some code in the client.py commented out, because the scrubber code still needs some improvement which is being worked upon. To comment it out,go to  

/opt/stack/glance/glance/common/client.py

and comment out line 368 and 369. 

Voila, it works !!

Thanks for reading, I will soon make some more entries 😀

Advertisements

2 thoughts on “Glance-Scrubber

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s