nova spawn instance的时候,会先create_image,下面是获取的base image的函数
def 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. """ image_id = str(images[key]) if ((not CONF.libvirt.remove_unused_kernels and # remove_unused_kernels默认值是True key in [‘kernel_id‘, ‘ramdisk_id‘])): return image_id else: return hashlib.sha1(image_id).hexdigest() # base image id生成
本文出自 “the-way-to-cloud” 博客,请务必保留此出处http://iceyao.blog.51cto.com/9426658/1838284
nova - nova base image id的生成算法
原文地址:http://iceyao.blog.51cto.com/9426658/1838284