Merge "Add device_id when a loadbalancer is created instead of at listener create" into stable/kilo

This commit is contained in:
Jenkins 2015-10-14 01:20:44 +00:00 committed by Gerrit Code Review
commit bde0af2e24
5 changed files with 3 additions and 18 deletions

View File

@ -98,7 +98,7 @@ class LoadBalancerPluginDbv2(base_db.CommonDbMixin,
'network_id': subnet['network_id'],
'mac_address': attributes.ATTR_NOT_SPECIFIED,
'admin_state_up': False,
'device_id': '',
'device_id': lb_db.id,
'device_owner': n_constants.DEVICE_OWNER_LOADBALANCERV2,
'fixed_ips': [fixed_ip]
}

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import uuid
from neutron.common import exceptions as n_exc
from neutron.extensions import portbindings
from neutron.i18n import _LW
@ -166,8 +164,6 @@ class LoadBalancerCallbacks(object):
return
port['admin_state_up'] = True
port['device_owner'] = 'neutron:' + constants.LOADBALANCERV2
port['device_id'] = str(uuid.uuid5(uuid.NAMESPACE_DNS, str(host)))
port[portbindings.HOST_ID] = host
self.plugin.db._core_plugin.update_port(
context,

View File

@ -15,7 +15,6 @@
import os
import shutil
import socket
import uuid
import netaddr
from neutron.agent.common import config
@ -148,10 +147,6 @@ class HaproxyNSDriver(driver_base.LoadBalancerBaseDriver):
def _build_port_dict(self):
return {'admin_state_up': True,
'device_owner': 'neutron:{0}'.format(
constants.LOADBALANCER),
'device_id': str(uuid.uuid5(uuid.NAMESPACE_DNS,
str(self.conf.host))),
portbindings.HOST_ID: self.conf.host}
def _get_state_file_path(self, loadbalancer_id, kind,

View File

@ -161,6 +161,8 @@ class TestLoadBalancerCallbacks(
with self.loadbalancer() as loadbalancer:
lb_id = loadbalancer['loadbalancer']['id']
if 'device_id' not in expected:
expected['device_id'] = lb_id
self.plugin_instance.db.update_loadbalancer_provisioning_status(
context.get_admin_context(),
loadbalancer['loadbalancer']['id'])
@ -173,8 +175,6 @@ class TestLoadBalancerCallbacks(
def test_plug_vip_port(self):
exp = {
'device_owner': 'neutron:' + constants.LOADBALANCERV2,
'device_id': 'c596ce11-db30-5c72-8243-15acaae8690f',
'admin_state_up': True
}
self._update_port_test_helper(
@ -185,8 +185,6 @@ class TestLoadBalancerCallbacks(
def test_plug_vip_port_mock_with_host(self):
exp = {
'device_owner': 'neutron:' + constants.LOADBALANCERV2,
'device_id': 'c596ce11-db30-5c72-8243-15acaae8690f',
'admin_state_up': True,
portbindings.HOST_ID: 'host'
}

View File

@ -15,7 +15,6 @@
import collections
import contextlib
import uuid
import mock
from neutron.common import exceptions
@ -138,9 +137,6 @@ class TestHaproxyNSDriver(base.BaseTestCase):
def test_build_port_dict(self):
self.driver.conf.host = 'host1'
ret = {'admin_state_up': True,
'device_owner': 'neutron:LOADBALANCER',
'device_id': str(uuid.uuid5(uuid.NAMESPACE_DNS,
str(self.conf.host))),
portbindings.HOST_ID: self.conf.host}
self.assertEqual(ret, self.driver._build_port_dict())