Remove deprecated option libvirt.remove_unused_kernels
This option was deprecated in Grizzly, and explicitly marked for removal in 13.0.0. We have reached this version, and it complicates the cleanup of writing to the image cache, so now is the time to remove it. Change-Id: Iadfe21c956880d9cbe5c16a1e277e1c5362a5755
This commit is contained in:
parent
cff4d78a4a
commit
547dc45044
@ -250,14 +250,6 @@ libvirt_imagecache_opts = [
|
|||||||
'%(image)s.info',
|
'%(image)s.info',
|
||||||
help='Allows image information files to be stored in '
|
help='Allows image information files to be stored in '
|
||||||
'non-standard locations'),
|
'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',
|
cfg.IntOpt('remove_unused_resized_minimum_age_seconds',
|
||||||
default=3600,
|
default=3600,
|
||||||
help='Unused resized base images younger than this will not be '
|
help='Unused resized base images younger than this will not be '
|
||||||
|
@ -2940,13 +2940,13 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||||||
'ramdisk_id': instance.ramdisk_id}
|
'ramdisk_id': instance.ramdisk_id}
|
||||||
|
|
||||||
if disk_images['kernel_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,
|
raw('kernel').cache(fetch_func=libvirt_utils.fetch_raw_image,
|
||||||
context=context,
|
context=context,
|
||||||
filename=fname,
|
filename=fname,
|
||||||
image_id=disk_images['kernel_id'])
|
image_id=disk_images['kernel_id'])
|
||||||
if disk_images['ramdisk_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,
|
raw('ramdisk').cache(fetch_func=libvirt_utils.fetch_raw_image,
|
||||||
context=context,
|
context=context,
|
||||||
filename=fname,
|
filename=fname,
|
||||||
@ -2958,7 +2958,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||||||
# currently happens only on rescue - we still don't want to
|
# currently happens only on rescue - we still don't want to
|
||||||
# create a base image.
|
# create a base image.
|
||||||
if not booted_from_volume:
|
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
|
size = instance.root_gb * units.Gi
|
||||||
|
|
||||||
if size == 0 or suffix == '.rescue':
|
if size == 0 or suffix == '.rescue':
|
||||||
|
@ -44,28 +44,15 @@ LOG = logging.getLogger(__name__)
|
|||||||
CONF = nova.conf.CONF
|
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.
|
"""Return a filename based on the SHA1 hash of a given image ID.
|
||||||
|
|
||||||
Image files stored in the _base directory that match this pattern
|
Image files stored in the _base directory that match this pattern
|
||||||
are considered for cleanup by the image cache manager. The cache
|
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
|
manager considers the file to be in use if it matches an instance's
|
||||||
image_ref, kernel_id or ramdisk_id property.
|
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])
|
return hashlib.sha1(image_id).hexdigest()
|
||||||
if ((not CONF.libvirt.remove_unused_kernels and
|
|
||||||
key in ['kernel_id', 'ramdisk_id'])):
|
|
||||||
return image_id
|
|
||||||
else:
|
|
||||||
return hashlib.sha1(image_id).hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
def get_info_filename(base_path):
|
def get_info_filename(base_path):
|
||||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user