summaryrefslogtreecommitdiffstats
path: root/nova/db/sqlalchemy/models.py
diff options
context:
space:
mode:
authorSean Dague <sdague@linux.vnet.ibm.com>2013-02-18 15:50:36 -0500
committerMorgan Fainberg <m@metacloud.com>2013-02-18 17:11:48 -0800
commit30c2a8f66edb9f9601a519fb525a46cc4486ab2a (patch)
treeb1b74f83599aaa8e6e1f935c1379352777bd4198 /nova/db/sqlalchemy/models.py
parentb23c557cc8d03028caba95777f98adfe9b1031d9 (diff)
downloadnova-30c2a8f66edb9f9601a519fb525a46cc4486ab2a.tar.gz
nova-30c2a8f66edb9f9601a519fb525a46cc4486ab2a.tar.xz
nova-30c2a8f66edb9f9601a519fb525a46cc4486ab2a.zip
create new cidr type for data storage
it turns out that the 149 migration was overly agressive in its IPAddress conversion, as we actually have a few columns that are really CIDR values. This means that 39 chars isn't enough space to store even a normalized IPv6 cidr in the worst case (you need 4 more to support /127). We must also normalize IPv6 address cidrs otherwise 43 chars isn't long enough. This was more of a problem in theory, than in practice, as real IPv6 addresses rarely are non compressible. This adds a migration to bump up the CIDR columns to 43 characters. There is an infinitessimal chance that someone using mysql and long IPv6 values might loose data in 149 because of truncation. This doesn't address that, which would require modifying 149. The native pg CIDR column type is not used because it would require additional scrubbing of the data as CIDR is invalid if any host bits are set (and it will fail on type conversion). Fixes bug #1127696 Change-Id: I54539ac9c257d726bc4db5943169b5284cc847d3
Diffstat (limited to 'nova/db/sqlalchemy/models.py')
-rw-r--r--nova/db/sqlalchemy/models.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 5eeae30dc..28d8f0882 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -529,7 +529,7 @@ class SecurityGroupIngressRule(BASE, NovaBase):
protocol = Column(String(5)) # "tcp", "udp", or "icmp"
from_port = Column(Integer)
to_port = Column(Integer)
- cidr = Column(types.IPAddress())
+ cidr = Column(types.CIDR())
# Note: This is not the parent SecurityGroup. It's SecurityGroup we're
# granting access for.
@@ -549,7 +549,7 @@ class ProviderFirewallRule(BASE, NovaBase):
protocol = Column(String(5)) # "tcp", "udp", or "icmp"
from_port = Column(Integer)
to_port = Column(Integer)
- cidr = Column(types.IPAddress())
+ cidr = Column(types.CIDR())
class KeyPair(BASE, NovaBase):
@@ -599,8 +599,8 @@ class Network(BASE, NovaBase):
label = Column(String(255))
injected = Column(Boolean, default=False)
- cidr = Column(types.IPAddress(), unique=True)
- cidr_v6 = Column(types.IPAddress(), unique=True)
+ cidr = Column(types.CIDR(), unique=True)
+ cidr_v6 = Column(types.CIDR(), unique=True)
multi_host = Column(Boolean, default=False)
gateway_v6 = Column(types.IPAddress())