From 4c0d3b79ef8ba6625f95907816e2e6f861709b6e Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 3 Sep 2021 15:41:20 +0000 Subject: [PATCH] Set "cache_ok=True" in "TypeDecorator" inheriting classes By setting this flag to True, it is assumed that the parameters passed to the object are safe to be used as a cache. Closes-Bug: #1942621 Change-Id: I582c89d8999db304923a51eb28c25f12046a4ebe --- nova/db/types.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nova/db/types.py b/nova/db/types.py index a10e29380fc7..859564817a4d 100644 --- a/nova/db/types.py +++ b/nova/db/types.py @@ -38,6 +38,7 @@ class IPAddress(types.TypeDecorator): """An SQLAlchemy type representing an IP-address.""" impl = types.String + cache_ok = True def load_dialect_impl(self, dialect): if dialect.name == 'postgresql': @@ -61,6 +62,7 @@ class CIDR(types.TypeDecorator): """An SQLAlchemy type representing a CIDR definition.""" impl = types.String + cache_ok = True def load_dialect_impl(self, dialect): if dialect.name == 'postgresql':