Merge "Remove deprecated option libvirt.remove_unused_kernels"

This commit is contained in:
Jenkins 2016-05-18 22:27:39 +00:00 committed by Gerrit Code Review
commit 704052a78f
4 changed files with 10 additions and 26 deletions

View File

@ -250,14 +250,6 @@ libvirt_imagecache_opts = [
'%(image)s.info',
help='Allows image information files to be stored in '
'non-standard locations'),
cfg.BoolOpt('remove_unused_kernels',
default=True,
deprecated_for_removal=True,
help='DEPRECATED: Should unused kernel images be removed? '
'This is only safe to enable if all compute nodes have '
'been updated to support this option (running Grizzly or '
'newer level compute). This will be the default behavior '
'in the 13.0.0 release.'),
cfg.IntOpt('remove_unused_resized_minimum_age_seconds',
default=3600,
help='Unused resized base images younger than this will not be '

View File

@ -2940,13 +2940,13 @@ class LibvirtDriver(driver.ComputeDriver):
'ramdisk_id': instance.ramdisk_id}
if disk_images['kernel_id']:
fname = imagecache.get_cache_fname(disk_images, 'kernel_id')
fname = imagecache.get_cache_fname(disk_images['kernel_id'])
raw('kernel').cache(fetch_func=libvirt_utils.fetch_raw_image,
context=context,
filename=fname,
image_id=disk_images['kernel_id'])
if disk_images['ramdisk_id']:
fname = imagecache.get_cache_fname(disk_images, 'ramdisk_id')
fname = imagecache.get_cache_fname(disk_images['ramdisk_id'])
raw('ramdisk').cache(fetch_func=libvirt_utils.fetch_raw_image,
context=context,
filename=fname,
@ -2958,7 +2958,7 @@ class LibvirtDriver(driver.ComputeDriver):
# currently happens only on rescue - we still don't want to
# create a base image.
if not booted_from_volume:
root_fname = imagecache.get_cache_fname(disk_images, 'image_id')
root_fname = imagecache.get_cache_fname(disk_images['image_id'])
size = instance.root_gb * units.Gi
if size == 0 or suffix == '.rescue':

View File

@ -44,28 +44,15 @@ LOG = logging.getLogger(__name__)
CONF = nova.conf.CONF
def get_cache_fname(images, key):
def get_cache_fname(image_id):
"""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
key in ['kernel_id', 'ramdisk_id'])):
return image_id
else:
return hashlib.sha1(image_id).hexdigest()
return hashlib.sha1(image_id).hexdigest()
def get_info_filename(base_path):

View File

@ -0,0 +1,5 @@
---
upgrade:
- The deprecated config option ``remove_unused_kernels`` has been removed from the
``[libvirt]`` config section. No replacement is required, as this behaviour
is no longer relevant.