Add port dns_domain to DB and object models
This patchset adds a new dns_domain attribute to the PortDNS DB model and OVO object. This patchset belongs to a series that adds dns_domain attribute functionality to ports. Change-Id: Ib1ea7d0faee4f0544141fdcbb75164aadcfc5056 Partial-Bug: #1650678
This commit is contained in:
@@ -1 +1 @@
|
||||
c8c222d42aa9
|
||||
349b6fd605a6
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# Copyright 2017 IBM
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Add dns_domain to portdnses
|
||||
|
||||
Revision ID: 349b6fd605a6
|
||||
Revises: c8c222d42aa9
|
||||
Create Date: 2017-04-15 00:22:47.618593
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '349b6fd605a6'
|
||||
down_revision = 'c8c222d42aa9'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.extensions import dns
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('portdnses',
|
||||
sa.Column('dns_domain',
|
||||
sa.String(length=dns.FQDN_MAX_LEN),
|
||||
nullable=False,
|
||||
server_default=''))
|
||||
@@ -16,6 +16,7 @@ from sqlalchemy import orm
|
||||
|
||||
from neutron.db.models import l3 as l3_models
|
||||
from neutron.db import models_v2
|
||||
from neutron.extensions import dns
|
||||
|
||||
|
||||
class NetworkDNSDomain(model_base.BASEV2):
|
||||
@@ -84,6 +85,9 @@ class PortDNS(model_base.BASEV2):
|
||||
previous_dns_domain = sa.Column(sa.String(255),
|
||||
nullable=False)
|
||||
dns_name = sa.Column(sa.String(255), nullable=False)
|
||||
dns_domain = sa.Column(sa.String(dns.FQDN_MAX_LEN),
|
||||
nullable=False,
|
||||
server_default='')
|
||||
# Add a relationship to the Port model in order to instruct
|
||||
# SQLAlchemy to eagerly load this association
|
||||
port = orm.relationship(models_v2.Port,
|
||||
|
||||
@@ -207,7 +207,8 @@ class IPAllocation(base.NeutronDbObject):
|
||||
@obj_base.VersionedObjectRegistry.register
|
||||
class PortDNS(base.NeutronDbObject):
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Add dns_domain attribute
|
||||
VERSION = '1.1'
|
||||
|
||||
db_model = dns_models.PortDNS
|
||||
|
||||
@@ -224,8 +225,14 @@ class PortDNS(base.NeutronDbObject):
|
||||
'previous_dns_name': common_types.DomainNameField(),
|
||||
'previous_dns_domain': common_types.DomainNameField(),
|
||||
'dns_name': common_types.DomainNameField(),
|
||||
'dns_domain': common_types.DomainNameField(),
|
||||
}
|
||||
|
||||
def obj_make_compatible(self, primitive, target_version):
|
||||
_target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
if _target_version < (1, 1):
|
||||
primitive.pop('dns_domain', None)
|
||||
|
||||
|
||||
@obj_base.VersionedObjectRegistry.register
|
||||
class Port(base.NeutronDbObject):
|
||||
|
||||
@@ -101,7 +101,8 @@ class DNSExtensionDriver(api.ExtensionDriver):
|
||||
current_dns_domain=current_dns_domain,
|
||||
previous_dns_name='',
|
||||
previous_dns_domain='',
|
||||
dns_name=dns_name).create()
|
||||
dns_name=dns_name,
|
||||
dns_domain='').create()
|
||||
|
||||
def _update_dns_db(self, dns_name, dns_domain, db_data,
|
||||
plugin_context, has_fixed_ips):
|
||||
@@ -135,7 +136,8 @@ class DNSExtensionDriver(api.ExtensionDriver):
|
||||
current_dns_domain=dns_domain,
|
||||
previous_dns_name='',
|
||||
previous_dns_domain='',
|
||||
dns_name=dns_name)
|
||||
dns_name=dns_name,
|
||||
dns_domain='')
|
||||
dns_data_db.create()
|
||||
return dns_data_db
|
||||
|
||||
@@ -182,7 +184,8 @@ class DNSExtensionDriver(api.ExtensionDriver):
|
||||
current_dns_domain='',
|
||||
previous_dns_name='',
|
||||
previous_dns_domain='',
|
||||
dns_name=dns_name)
|
||||
dns_name=dns_name,
|
||||
dns_domain='')
|
||||
dns_data_db.create()
|
||||
return dns_data_db
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ object_data = {
|
||||
'PortBinding': '1.0-3306deeaa6deb01e33af06777d48d578',
|
||||
'PortBindingLevel': '1.0-de66a4c61a083b8f34319fa9dde5b060',
|
||||
'PortDataPlaneStatus': '1.0-25be74bda46c749653a10357676c0ab2',
|
||||
'PortDNS': '1.0-201cf6d057fde75539c3d1f2bbf05902',
|
||||
'PortDNS': '1.1-c5ca2dc172bdd5fafee3fc986d1d7023',
|
||||
'PortSecurity': '1.0-b30802391a87945ee9c07582b4ff95e3',
|
||||
'ProviderResourceAssociation': '1.0-05ab2d5a3017e5ce9dd381328f285f34',
|
||||
'ProvisioningBlock': '1.0-c19d6d05bfa8143533471c1296066125',
|
||||
|
||||
Reference in New Issue
Block a user