~ubuntu-branches/ubuntu/wily/neutron/wily

« back to all changes in this revision

Viewing changes to neutron/db/db_base_plugin_v2.py

  • Committer: Package Import Robot
  • Author(s): Corey Bryant
  • Date: 2015-09-25 17:14:07 UTC
  • mfrom: (1.1.27)
  • Revision ID: package-import@ubuntu.com-20150925171407-bcttci48k7q9togi
Tags: 2:7.0.0~rc1-0ubuntu1
* d/watch: Update to cope with upstream rc versioning.
* New upstream release candidate for OpenStack Liberty.
* d/rules: Drop removal of .eggs directory in override_dh_auto_clean.
* d/control: Bump minimum pbr version to 1.8.
* d/control: Align (build-)depends with upstream.
* d/neutron-common.install: Add neutron-dev-server and neutron-rpc-server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1065
1065
            return port.get('dns_name', '')
1066
1066
        return ''
1067
1067
 
1068
 
    def _get_dns_names_for_port(self, context, network_id, ips,
1069
 
                                request_dns_name):
1070
 
        filter = {'network_id': [network_id]}
1071
 
        subnets = self._get_subnets(context, filters=filter)
1072
 
        v6_subnets = {subnet['id']: subnet for subnet in subnets
1073
 
                      if subnet['ip_version'] == 6}
 
1068
    def _get_dns_names_for_port(self, context, ips, request_dns_name):
1074
1069
        dns_assignment = []
1075
1070
        dns_domain = self._get_dns_domain()
1076
1071
        if request_dns_name:
1079
1074
                request_fqdn = '%s.%s' % (request_dns_name, dns_domain)
1080
1075
 
1081
1076
        for ip in ips:
1082
 
            subnet_id = ip['subnet_id']
1083
 
            is_auto_address_subnet = (
1084
 
                subnet_id in v6_subnets and
1085
 
                ipv6_utils.is_auto_address_subnet(v6_subnets[subnet_id]))
1086
 
            if is_auto_address_subnet:
1087
 
                continue
1088
1077
            if request_dns_name:
1089
1078
                hostname = request_dns_name
1090
1079
                fqdn = request_fqdn
1169
1158
                dns_assignment = []
1170
1159
                if ips:
1171
1160
                    dns_assignment = self._get_dns_names_for_port(
1172
 
                        context, network_id, ips, request_dns_name)
 
1161
                        context, ips, request_dns_name)
1173
1162
 
1174
1163
        if 'dns_name' in p:
1175
1164
            db_port['dns_assignment'] = dns_assignment
1191
1180
            self._check_mac_addr_update(context, db_port,
1192
1181
                                        new_mac, current_owner)
1193
1182
 
1194
 
    def _get_dns_names_for_updated_port(self, context, db_port,
1195
 
                                        original_ips, original_dns_name,
1196
 
                                        request_dns_name, changes):
 
1183
    def _get_dns_names_for_updated_port(self, context, original_ips,
 
1184
                                        original_dns_name, request_dns_name,
 
1185
                                        changes):
1197
1186
        if changes.original or changes.add or changes.remove:
1198
1187
            return self._get_dns_names_for_port(
1199
 
                context, db_port['network_id'], changes.original + changes.add,
 
1188
                context, changes.original + changes.add,
1200
1189
                request_dns_name or original_dns_name)
1201
1190
        if original_ips:
1202
1191
            return self._get_dns_names_for_port(
1203
 
                context, db_port['network_id'], original_ips,
 
1192
                context, original_ips,
1204
1193
                request_dns_name or original_dns_name)
1205
1194
        return []
1206
1195
 
1221
1210
                                                     new_port, new_mac)
1222
1211
            if 'dns-integration' in self.supported_extension_aliases:
1223
1212
                dns_assignment = self._get_dns_names_for_updated_port(
1224
 
                    context, port, original_ips, original_dns_name,
 
1213
                    context, original_ips, original_dns_name,
1225
1214
                    request_dns_name, changes)
1226
1215
        result = self._make_port_dict(port)
1227
1216
        # Keep up with fields that changed
1255
1244
    def _get_dns_name_for_port_get(self, context, port):
1256
1245
        if port['fixed_ips']:
1257
1246
            return self._get_dns_names_for_port(
1258
 
                context, port['network_id'], port['fixed_ips'],
 
1247
                context, port['fixed_ips'],
1259
1248
                port['dns_name'])
1260
1249
        return []
1261
1250