Updated openstack/openstack
Project: openstack/nova  9b4e89a66886184b6d9f0dd396fd1c0938ec9c82

Fix CIDR values denoting hosts in PostgreSQL

We use PostgreSQL INET type to store both hosts IP addresses
and CIDR addresses of IP subnets. PostgreSQL actually has
INET and CIDR data types, which work a bit different.

The one thing they are different at, is the representation of
retrieved values denoting a single host in IP subnet (i. e. an
IP address followed by a netmask which has a value of /32 for
IPv4 address and /128 for IPv6 appropriately): if such value
is stored in column of type INET, it will be returned by SELECT
without a netmask part, so instead of 37.37.37.37/32 one will
receive 37.37.37.37.

For more details, please see:
http://www.postgresql.org/docs/8.2/static/datatype-net-types.html

While existing behaviour is completely OK, it depends on DB backend
which is used. To ensure, that CIDR values denoting a single host in IP
subnet, have the same representation in spite of chosen DB backend,
an SQLAlchemy model hook is provided, which adds a netmask value of /32
or /128 for retrieved values of IPv4 or IPv6 addresses appropriately.

Blueprint: db-api-tests-on-all-backends
Co-Authored-By: Roman Podolyaka <rpodolyaka@mirantis.com>

Change-Id: If36f0f9133b6c7cc6f20ba189a9f5b65001811d1