From a6bb2fff426ebc8d031ec992afe4f1a8547305ee Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Fri, 20 May 2022 09:32:26 -0500 Subject: [PATCH] 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 --- doc/source/openstack.rst | 5 +---- nodepool/driver/openstack/config.py | 10 ---------- ...move-diskimage-meta-checks-90f705903000eece.yaml | 13 +++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/remove-diskimage-meta-checks-90f705903000eece.yaml diff --git a/doc/source/openstack.rst b/doc/source/openstack.rst index 2764a7c6e..d80e2e11c 100644 --- a/doc/source/openstack.rst +++ b/doc/source/openstack.rst @@ -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 diff --git a/nodepool/driver/openstack/config.py b/nodepool/driver/openstack/config.py index d5ac6b272..8b87ddc67 100644 --- a/nodepool/driver/openstack/config.py +++ b/nodepool/driver/openstack/config.py @@ -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() diff --git a/releasenotes/notes/remove-diskimage-meta-checks-90f705903000eece.yaml b/releasenotes/notes/remove-diskimage-meta-checks-90f705903000eece.yaml new file mode 100644 index 000000000..2c165f503 --- /dev/null +++ b/releasenotes/notes/remove-diskimage-meta-checks-90f705903000eece.yaml @@ -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.