The nova.virt.vmwareapi.imagecache Module

Image cache class

Images that are stored in the cache folder will be stored in a folder whose name is the image ID. In the event that an image is discovered to be no longer used then a timestamp will be added to the image folder. The timestamp will be a folder - this is due to the fact that we can use the VMware API’s for creating and deleting of folders (it really simplifies things). The timestamp will contain the time, on the compute node, when the image was first seen to be unused. At each aging iteration we check if the image can be aged. This is done by comparing the current nova compute time to the time embedded in the timestamp. If the time exceeds the configured aging time then the parent folder, that is the image ID folder, will be deleted. That effectively ages the cached image. If an image is used then the timestamps will be deleted.

When accessing a timestamp we make use of locking. This ensure that aging will not delete an image during the spawn operation. When spawning the timestamp folder will be locked and the timestamps will be purged. This will ensure that an image is not deleted during the spawn.

class ImageCacheManager(session, base_folder)

Bases: nova.virt.imagecache.ImageCacheManager

enlist_image(image_id, datastore, dc_ref)
get_image_cache_folder(datastore, image_id)

Returns datastore path of folder containing the image.

timestamp_cleanup(dc_ref, ds_browser, ds_path)
timestamp_folder_get(ds_path, image_id)

Returns the timestamp folder.

update(context, instances, datastores_info)

The cache manager entry point.

This will invoke the cache manager. This will update the cache according to the defined cache management scheme. The information populated in the cached stats will be used for the cache management.

Previous topic

The nova.virt.vmwareapi.host Module

Next topic

The nova.virt.vmwareapi.images Module

Project Source

This Page