The nova.virt.libvirt.imagecache Module

Image cache manager.

The cache manager implements the specification at

class ImageCacheManager

Bases: nova.virt.imagecache.ImageCacheManager

update(context, all_instances)
get_cache_fname(images, key)

Return a filename based on the SHA1 hash of a given image ID.

Image files stored in the _base directory that match this pattern are considered for cleanup by the image cache manager. The cache manager considers the file to be in use if it matches an instance’s image_ref, kernel_id or ramdisk_id property.

However, in grizzly-3 and before, only the image_ref property was considered. This means that it’s unsafe to store kernel and ramdisk images using this pattern until we’re sure that all compute nodes are running a cache manager newer than grizzly-3. For now, we require admins to confirm that by setting the remove_unused_kernels boolean but, at some point in the future, we’ll be safely able to assume this.


Construct a filename for storing additional information about a base image.

Returns a filename.


Test if a given path matches the pattern for info files.

read_stored_checksum(target, timestamped=True)

Read the checksum.

Returns the checksum (as hex) or None.

read_stored_info(target, field=None, timestamped=False)

Read information about an image.

Returns an empty dictionary if there is no info, just the field value if a field is requested, or the entire dictionary otherwise.


Write a checksum to disk for a file in _base.

write_stored_info(target, field=None, value=None)

Write information about an image.

Previous topic

The nova.virt.libvirt.imagebackend Module

Next topic

The nova.virt.libvirt.instancejobtracker Module

Project Source

This Page