diff --git a/nova/compute/api.py b/nova/compute/api.py index a6df14e30e3e..2bebff392aaa 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -408,13 +408,14 @@ class API(base.Base): image): """Choose kernel and ramdisk appropriate for the instance. - The kernel and ramdisk can be chosen in one of three ways: + The kernel and ramdisk can be chosen in one of two ways: 1. Passed in with create-instance request. - 2. Inherited from image. + 2. Inherited from image metadata. - 3. Forced to None by using `null_kernel` FLAG. + If inherited from image metadata, and if that image metadata value is + set to 'nokernel', both kernel and ramdisk will default to None. """ # Inherit from image if not specified image_properties = image.get('properties', {}) @@ -425,8 +426,8 @@ class API(base.Base): if ramdisk_id is None: ramdisk_id = image_properties.get('ramdisk_id') - # Force to None if using null_kernel - if kernel_id == str(CONF.null_kernel): + # Force to None if kernel_id indicates that a kernel is not to be used + if kernel_id == 'nokernel': kernel_id = None ramdisk_id = None diff --git a/nova/conf/compute.py b/nova/conf/compute.py index dec5023e00a4..d81b3bc30c72 100644 --- a/nova/conf/compute.py +++ b/nova/conf/compute.py @@ -68,23 +68,6 @@ Possible values: here, since the snapshots that are created from the base images doesn't need them. * Default list: ['cache_in_nova', 'bittorrent'] -"""), - cfg.StrOpt('null_kernel', - default='nokernel', - deprecated_for_removal=True, - deprecated_since='15.0.0', - deprecated_reason=""" -When an image is booted with the property 'kernel_id' with the value -'nokernel', Nova assumes the image doesn't require an external kernel and -ramdisk. This option allows user to change the API behaviour which should not -be allowed and this value "nokernel" should be hard coded. -""", - help=""" -This option is used to decide when an image should have no external -ramdisk or kernel. By default this is set to 'nokernel', so when an -image is booted with the property 'kernel_id' with the value -'nokernel', Nova assumes the image doesn't require an external kernel -and ramdisk. """), cfg.StrOpt('multi_instance_display_name_template', default='%(name)s-%(count)d', diff --git a/nova/tests/functional/regressions/test_bug_1558866.py b/nova/tests/functional/regressions/test_bug_1558866.py index 9f2ab46e4129..d1ad58cd1ad8 100644 --- a/nova/tests/functional/regressions/test_bug_1558866.py +++ b/nova/tests/functional/regressions/test_bug_1558866.py @@ -53,8 +53,8 @@ class TestServerGet(test.TestCase): 'container_format': 'raw', 'disk_format': 'raw', 'size': '25165824', - 'properties': {'kernel_id': CONF.null_kernel, - 'ramdisk_id': CONF.null_kernel, + 'properties': {'kernel_id': 'nokernel', + 'ramdisk_id': 'nokernel', 'architecture': 'x64'}} self.image_id = image_service.create(None, image)['id'] self.flavor_id = self.api.get_flavors()[0]['id'] diff --git a/nova/tests/unit/image/fake.py b/nova/tests/unit/image/fake.py index 6e835fd9169f..9dd23959afa0 100644 --- a/nova/tests/unit/image/fake.py +++ b/nova/tests/unit/image/fake.py @@ -53,8 +53,8 @@ class _FakeImageService(object): 'disk_format': 'raw', 'size': '25165824', 'properties': { - 'kernel_id': CONF.null_kernel, - 'ramdisk_id': CONF.null_kernel, + 'kernel_id': 'nokernel', + 'ramdisk_id': 'nokernel', 'architecture': obj_fields.Architecture.X86_64}} image2 = {'id': 'a2459075-d96c-40d5-893e-577ff92e721c', @@ -68,8 +68,8 @@ class _FakeImageService(object): 'container_format': 'ami', 'disk_format': 'ami', 'size': '58145823', - 'properties': {'kernel_id': CONF.null_kernel, - 'ramdisk_id': CONF.null_kernel}} + 'properties': {'kernel_id': 'nokernel', + 'ramdisk_id': 'nokernel'}} image3 = {'id': '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6', 'name': 'fakeimage123456', @@ -82,8 +82,8 @@ class _FakeImageService(object): 'container_format': 'bare', 'disk_format': 'raw', 'size': '83594576', - 'properties': {'kernel_id': CONF.null_kernel, - 'ramdisk_id': CONF.null_kernel}} + 'properties': {'kernel_id': 'nokernel', + 'ramdisk_id': 'nokernel'}} image4 = {'id': 'cedef40a-ed67-4d10-800e-17455edce175', 'name': 'fakeimage123456', @@ -96,8 +96,8 @@ class _FakeImageService(object): 'container_format': 'ami', 'disk_format': 'ami', 'size': '84035174', - 'properties': {'kernel_id': CONF.null_kernel, - 'ramdisk_id': CONF.null_kernel}} + 'properties': {'kernel_id': 'nokernel', + 'ramdisk_id': 'nokernel'}} image5 = {'id': 'c905cedb-7281-47e4-8a62-f26bc5fc4c77', 'name': 'fakeimage123456', @@ -126,8 +126,8 @@ class _FakeImageService(object): 'disk_format': 'vhd', 'size': '49163826', 'properties': { - 'kernel_id': CONF.null_kernel, - 'ramdisk_id': CONF.null_kernel, + 'kernel_id': 'nokernel', + 'ramdisk_id': 'nokernel', 'architecture': obj_fields.Architecture.X86_64, 'auto_disk_config': 'False'}} @@ -143,8 +143,8 @@ class _FakeImageService(object): 'disk_format': 'vhd', 'size': '74185822', 'properties': { - 'kernel_id': CONF.null_kernel, - 'ramdisk_id': CONF.null_kernel, + 'kernel_id': 'nokernel', + 'ramdisk_id': 'nokernel', 'architecture': obj_fields.Architecture.X86_64, 'auto_disk_config': 'True'}} diff --git a/releasenotes/notes/remove-deprecated-compute-opts-bc935162bc4723ac.yaml b/releasenotes/notes/remove-deprecated-compute-opts-bc935162bc4723ac.yaml new file mode 100644 index 000000000000..6dece640c7be --- /dev/null +++ b/releasenotes/notes/remove-deprecated-compute-opts-bc935162bc4723ac.yaml @@ -0,0 +1,10 @@ +--- +upgrade: + - | + The following deprecated configuration options have been removed from the + ``compute`` section of ``nova.conf``: + + - ``null_kernel`` + + These were deprecated in the 15.0.0 release as they allowed for + inconsistent API behavior across deployments.