Skip to content

Commit

Permalink
Merge "Fix missing imports and unknown references in loadbalancer mod…
Browse files Browse the repository at this point in the history
…ule"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 28, 2015
2 parents 8e6e45d + ba5644c commit 066ca59
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 22 deletions.
Expand Up @@ -71,14 +71,13 @@ def __init__(self):
connected = False
while not connected:
try:
self._api = VncApi(
admin_user, admin_password, admin_tenant_name,
api_srvr_ip, api_srvr_port, api_server_url,
auth_host=auth_host, auth_port=auth_port,
auth_protocol=auth_protocol, auth_url=auth_url,
auth_type=auth_type, wait_for_connect=True)
self._api = VncApi(admin_user, admin_password, admin_tenant_name,
api_srvr_ip, api_srvr_port, api_server_url,
auth_host=auth_host, auth_port=auth_port,
auth_protocol=auth_protocol, auth_url=auth_url,
auth_type=auth_type, wait_for_connect=True)
connected = True
except requests.exceptions.RequestException as e:
except requests.exceptions.RequestException:
time.sleep(3)

self._pool_manager = \
Expand Down Expand Up @@ -161,12 +160,12 @@ def create_pool_health_monitor(self, context, health_monitor, pool_id):
m = health_monitor['health_monitor']
try:
pool = self._api.loadbalancer_pool_read(id=pool_id)
except NoIdError:
except vnc_exc.NoIdError:
raise loadbalancer.PoolNotFound(pool_id=pool_id)

try:
monitor = self._api.loadbalancer_healthmonitor_read(id=m['id'])
except NoIdError:
except vnc_exc.NoIdError:
raise loadbalancer.HealthMonitorNotFound(monitor_id=m['id'])

if not context.is_admin:
Expand Down Expand Up @@ -196,7 +195,7 @@ def get_pool_health_monitor(self, context, id, pool_id, fields=None):
"""
try:
pool = self._api.loadbalancer_pool_read(id=pool_id)
except NoIdError:
except vnc_exc.NoIdError:
raise loadbalancer.PoolNotFound(pool_id=id)
tenant_id = str(uuid.UUID(context.tenant_id))
if not context.is_admin and tenant_id != pool.parent_uuid:
Expand All @@ -223,15 +222,15 @@ def get_pool_health_monitor(self, context, id, pool_id, fields=None):
def delete_pool_health_monitor(self, context, id, pool_id):
try:
pool = self._api.loadbalancer_pool_read(id=pool_id)
except NoIdError:
except vnc_exc.NoIdError:
raise loadbalancer.PoolNotFound(pool_id=id)
tenant_id = str(uuid.UUID(context.tenant_id))
if not context.is_admin and tenant_id != pool.parent_uuid:
raise loadbalancer.PoolNotFound(pool_id=id)

try:
monitor = self._api.loadbalancer_healthmonitor_read(id=id)
except NoIdError:
except vnc_exc.NoIdError:
raise loadbalancer.HealthMonitorNotFound(monitor_id=id)

in_list = False
Expand Down
Expand Up @@ -10,7 +10,7 @@
from neutron_lbaas.extensions import loadbalancer

from neutron.openstack.common import uuidutils
from vnc_api.vnc_api import IdPermsType, NoIdError
from vnc_api.vnc_api import IdPermsType
from vnc_api.vnc_api import LoadbalancerHealthmonitor
from vnc_api.vnc_api import LoadbalancerHealthmonitorType

Expand Down
Expand Up @@ -10,6 +10,8 @@
from neutron_lbaas.extensions import loadbalancer

from neutron.openstack.common import uuidutils
from neutron.common import exceptions as n_exc

from vnc_api.vnc_api import IdPermsType, NoIdError
from vnc_api.vnc_api import LoadbalancerMember, LoadbalancerMemberType

Expand Down
Expand Up @@ -19,6 +19,7 @@
from resource_manager import ResourceManager
from resource_manager import LoadbalancerMethodInvalid


class LoadbalancerPoolManager(ResourceManager):

_loadbalancer_pool_type_mapping = {
Expand Down
Expand Up @@ -3,6 +3,7 @@
#
from loadbalancer_db import LoadBalancerPluginDb


class LoadBalancerPlugin(LoadBalancerPluginDb):
supported_extension_aliases = ["lbaas"]

Expand All @@ -18,7 +19,4 @@ def _pool_update_provider(self, context, pool):

def create_pool(self, context, pool):
self._pool_update_provider(context, pool['pool'])
p = super(LoadBalancerPlugin, self).create_pool(context, pool)
return p


return super(LoadBalancerPlugin, self).create_pool(context, pool)
Expand Up @@ -15,8 +15,9 @@
import six
import uuid


class LoadbalancerMethodInvalid(n_exc.BadRequest):
message = _("Method %(lb_method)s not supported for pool %(pool_id)s")
message = "Method %(lb_method)s not supported for pool %(pool_id)s"


@six.add_metaclass(ABCMeta)
Expand Down Expand Up @@ -128,7 +129,7 @@ def _get_resource_name(self, resource, parent, name, uuid):
fq_name = list(parent.fq_name)
fq_name.append(name)
try:
obj = self._api.fq_name_to_id(resource, fq_name)
self._api.fq_name_to_id(resource, fq_name)
except NoIdError:
return name

Expand Down
@@ -1,16 +1,18 @@
from neutron.common import exceptions as n_exc
from cfgm_common import exceptions as vnc_exc


def get_subnet_network_id(client, subnet_id):
try:
kv_pair = client.kv_retrieve(subnet_id)
except NoIdError:
except vnc_exc.NoIdError:
raise n_exc.SubnetNotFound(subnet_id=subnet_id)
return kv_pair.split()[0]


def get_subnet_cidr(client, subnet_id):
try:
kv_pair = client.kv_retrieve(subnet_id)
except NoIdError:
except vnc_exc.NoIdError:
raise n_exc.SubnetNotFound(subnet_id=subnet_id)
return kv_pair.split()[1]
Expand Up @@ -308,7 +308,7 @@ def update_object(self, vip_db, id, v):

# check that the pool has no vip configured
if pool.get_virtual_ip_back_refs():
raise loadbalancer.VipExists(pool_id=pool_obj.uuid)
raise loadbalancer.VipExists(pool_id=pool.uuid)

# check that the protocol matches
pool_props = pool.get_loadbalancer_pool_properties()
Expand Down

0 comments on commit 066ca59

Please sign in to comment.