openstack: Remove metadata limit checks

The limit of 5 metadata items is 8 years old and outdated for modern
OpenStack. Instead of trying to guess what the OpenStack limits are
(which may depend on quota settings), remove all the checks and let
OpenStack reject the image at upload time.

Change-Id: Ifa2e429db3bac2e3cad73dce09e01c901ea133c4
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
This commit is contained in:
Joshua Watt 2022-05-20 09:32:26 -05:00
parent a9affeb234
commit a6bb2fff42
3 changed files with 14 additions and 14 deletions

View File

@ -257,10 +257,7 @@ Selecting the OpenStack driver adds the following options to the
.. attr:: meta
:type: dict
Arbitrary key/value metadata to store for this server using
the Nova metadata service. A maximum of five entries is
allowed, and both keys and values must be 255 characters or
less.
Arbitrary key/value metadata to store as glance image properties.
.. attr:: connection-type
:type: string

View File

@ -265,16 +265,6 @@ class OpenStackProviderConfig(ProviderConfig):
# This dict is expanded and used as custom properties when
# the image is uploaded.
i.meta = image.get('meta', {})
# 5 elements, and no key or value can be > 255 chars
# per Nova API rules
if i.meta:
if len(i.meta) > 5 or \
any([len(k) > 255 or len(v) > 255
for k, v in i.meta.items()]):
# soft-fail
# self.log.error("Invalid metadata for %s; ignored"
# % i.name)
i.meta = {}
for image in self.provider.get('cloud-images', []):
i = ProviderCloudImage()

View File

@ -0,0 +1,13 @@
---
fixes:
- |
Removes diskimage.meta checks from the OpenStack driver. The limit of only
5 entries is anachronistic and now removed. Rather than trying to pre-guess
what OpenStack wants the metadata is now passed as-is and OpenStack will
reject it at upload time.
Previously, metadata was checked by nodepool and invalid values would cause
all metadata to be silently ignored. Now, metadata will be passed directly
to glance, and an API error will occur. This may mean that images that
previously uploaded (with no metadata) will now cause an API error when
uploading.