Skip to content

openstack-neutron: 2014.2-42.eayunstack.dev #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
openstack-neutron: 2014.2-34.eayunstack.dev
Signed-off-by: Hunt Xu <[email protected]>
  • Loading branch information
Hunt Xu committed Oct 13, 2017
commit 6f5ba593288723908d879abee5c04c9630a4823c
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
From 9e5332c0dec70a02535c1b00e14777f877731a11 Mon Sep 17 00:00:00 2001
From: "cheng.tang" <[email protected]>
Date: Wed, 31 May 2017 17:30:42 +0800
Subject: [PATCH] Add check if extra actions params is correct

Fixes: redmine #10217

Signed-off-by: cheng.tang <[email protected]>
Signed-off-by: Hunt Xu <[email protected]>
---
neutron/db/loadbalancer/loadbalancer_db.py | 32 ++++++++++++++++++++++++++++++
neutron/extensions/loadbalancer.py | 14 +++++++++++++
2 files changed, 46 insertions(+)

diff --git a/neutron/db/loadbalancer/loadbalancer_db.py b/neutron/db/loadbalancer/loadbalancer_db.py
index 061735b24..1b2a368a6 100644
--- a/neutron/db/loadbalancer/loadbalancer_db.py
+++ b/neutron/db/loadbalancer/loadbalancer_db.py
@@ -29,6 +29,7 @@ from neutron.extensions import loadbalancer
from neutron.extensions import loadbalancer_l7
from neutron import manager
from neutron.openstack.common import excutils
+from neutron.openstack.common import jsonutils
from neutron.openstack.common import log as logging
from neutron.openstack.common import uuidutils
from neutron.plugins.common import constants
@@ -329,6 +330,35 @@ class LoadBalancerPluginDb(loadbalancer.LoadBalancerPluginBase,

return self._fields(res, fields)

+ def _check_extra_action_info(self, action_info):
+ action_info = jsonutils.loads(action_info)
+ if not isinstance(action_info, dict):
+ raise loadbalancer.ExtraActionsInvalid()
+
+ # no operation
+ def _noop_and_warning(key, value):
+ LOG.warning(_("Not supported action key %(key)s "
+ "and value %(value)s."),
+ {'key': key, 'value': value})
+
+ def _check_max_age(key, value):
+ if not isinstance(value, dict):
+ raise loadbalancer.ExtraActionsSetCookieForMemberInvalid()
+ if 'max_age' in value:
+ try:
+ int(value.get('max_age'))
+ except ValueError:
+ raise loadbalancer.ExtraActionsMaxAgeInvalid(
+ max_age=value.get('max_age'))
+ else:
+ raise loadbalancer.ExtraActionsSetCookieForMemberInvalid()
+
+ support_actions = {
+ 'set_cookie_for_member': _check_max_age
+ }
+ for k, v in action_info.iteritems():
+ support_actions.get(k, _noop_and_warning)(k, v)
+
def _check_session_persistence_info(self, info):
"""Performs sanity check on session persistence info.

@@ -338,6 +368,8 @@ class LoadBalancerPluginDb(loadbalancer.LoadBalancerPluginBase,
if not info.get('cookie_name'):
raise ValueError(_("'cookie_name' should be specified for this"
" type of session persistence."))
+ if info.get('extra_actions'):
+ self._check_extra_action_info(info.get('extra_actions'))
else:
if 'cookie_name' in info or 'extra_actions' in info:
raise ValueError(_("'cookie_name' or 'extra_actions' is not"
diff --git a/neutron/extensions/loadbalancer.py b/neutron/extensions/loadbalancer.py
index 3c6ecb8ff..5f3589681 100644
--- a/neutron/extensions/loadbalancer.py
+++ b/neutron/extensions/loadbalancer.py
@@ -46,6 +46,20 @@ class VipExists(qexception.NeutronException):
message = _("Another Vip already exists for pool %(pool_id)s")


+class ExtraActionsInvalid(qexception.BadRequest):
+ message = _("Extra action shoud be a JSON object")
+
+
+class ExtraActionsSetCookieForMemberInvalid(qexception.BadRequest):
+ message = _("Extra action set_cookie_for_member "
+ "shoud be a JSON object")
+
+
+class ExtraActionsMaxAgeInvalid(qexception.BadRequest):
+ message = _("Extra action set_cookie_for_member "
+ "with invalid max_age %(max_age)s")
+
+
class PoolNotFound(qexception.NotFound):
message = _("Pool %(pool_id)s could not be found")

--
2.13.0

7 changes: 6 additions & 1 deletion packaging/openstack-neutron/openstack-neutron.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Name: openstack-neutron
Version: 2014.2
Release: 33%{?dist_eayunstack}
Release: 34%{?dist_eayunstack}
Provides: openstack-quantum = %{version}-%{release}
Obsoletes: openstack-quantum < 2013.2-0.4.b3
Summary: OpenStack Networking Service
Expand Down Expand Up @@ -150,6 +150,7 @@ Patch0104: 0104-Fix-error-when-update-l7policy-with-pool_id-None.patch
Patch0105: 0105-es-metering-fix-port-selection-when-tcp_port-is-spec.patch
Patch0106: 0106-Optimize-haproxy-driver-port_to_pool_id-dict.patch
Patch0107: 0107-OpenFlow-EW-DVR-be-more-torelant-when-syncing-dvr-po.patch
Patch0108: 0108-Add-check-if-extra-actions-params-is-correct.patch


BuildArch: noarch
Expand Down Expand Up @@ -735,6 +736,7 @@ IPSec.
%patch0105 -p1
%patch0106 -p1
%patch0107 -p1
%patch0108 -p1

find neutron -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +

Expand Down Expand Up @@ -1196,6 +1198,9 @@ exit 0


%changelog
* Thu Jun 01 2017 Xu Meihong <[email protected]> 2014.2-34.eayunstack.dev
- add patch 0108 from github pull request #99 (redmine#10217)

* Thu May 18 2017 Xu Meihong <[email protected]> 2014.2-33.eayunstack.dev
- add patch 0105 from github pull request #93 (redmine#10055)
- add patch 0106 from github pull request #94 (redmine#10056)
Expand Down