From 7144640d4ef7745cc351aa7241614412d9a94456 Mon Sep 17 00:00:00 2001 From: Hunt Xu Date: Thu, 1 Jun 2017 10:28:03 +0800 Subject: [PATCH] openstack-neutron: 2014.2-34.eayunstack.dev Signed-off-by: Hunt Xu --- ...k-if-extra-actions-params-is-correct.patch | 99 +++++++++++++++++++ .../openstack-neutron/openstack-neutron.spec | 7 +- 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 packaging/openstack-neutron/0108-Add-check-if-extra-actions-params-is-correct.patch diff --git a/packaging/openstack-neutron/0108-Add-check-if-extra-actions-params-is-correct.patch b/packaging/openstack-neutron/0108-Add-check-if-extra-actions-params-is-correct.patch new file mode 100644 index 0000000..24d2ee1 --- /dev/null +++ b/packaging/openstack-neutron/0108-Add-check-if-extra-actions-params-is-correct.patch @@ -0,0 +1,99 @@ +From 9e5332c0dec70a02535c1b00e14777f877731a11 Mon Sep 17 00:00:00 2001 +From: "cheng.tang" +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 +Signed-off-by: Hunt Xu +--- + 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 + diff --git a/packaging/openstack-neutron/openstack-neutron.spec b/packaging/openstack-neutron/openstack-neutron.spec index 9b56deb..b29b0f8 100644 --- a/packaging/openstack-neutron/openstack-neutron.spec +++ b/packaging/openstack-neutron/openstack-neutron.spec @@ -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 @@ -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 @@ -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}' {} + @@ -1196,6 +1198,9 @@ exit 0 %changelog +* Thu Jun 01 2017 Xu Meihong 2014.2-34.eayunstack.dev +- add patch 0108 from github pull request #99 (redmine#10217) + * Thu May 18 2017 Xu Meihong 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)