Skip to content

Commit 6a46bc0

Browse files
authored
Merge pull request #163 from stackhpc/upstream/2024.1-2024-07-08
Synchronise 2024.1 with upstream
2 parents 53b035d + 399eacb commit 6a46bc0

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

neutron/common/ovn/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def validate_and_get_data_from_binding_profile(port):
368368
if (constants.OVN_PORT_BINDING_PROFILE not in port or
369369
not validators.is_attr_set(
370370
port[constants.OVN_PORT_BINDING_PROFILE])):
371-
BPInfo({}, None, [])
371+
return BPInfo({}, None, [])
372372
param_set = {}
373373
param_dict = {}
374374
vnic_type = port.get(portbindings.VNIC_TYPE, portbindings.VNIC_NORMAL)

neutron/conf/policies/subnet.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,19 @@
9595
policy.DocumentedRuleDefault(
9696
name='get_subnet',
9797
check_str=neutron_policy.policy_or(
98-
base.ADMIN_OR_NET_OWNER_MEMBER,
9998
base.PROJECT_READER,
100-
'rule:shared'),
99+
'rule:shared',
100+
base.ADMIN_OR_NET_OWNER_MEMBER,
101+
),
101102
scope_types=['project'],
102103
description='Get a subnet',
103104
operations=ACTION_GET,
104105
deprecated_rule=policy.DeprecatedRule(
105106
name='get_subnet',
106107
check_str=neutron_policy.policy_or(
108+
'rule:shared',
107109
neutron_policy.RULE_ADMIN_OR_OWNER,
108-
'rule:shared'),
110+
),
109111
deprecated_reason=DEPRECATED_REASON,
110112
deprecated_since=versionutils.deprecated.WALLABY)
111113
),
@@ -124,18 +126,19 @@
124126
policy.DocumentedRuleDefault(
125127
name='get_subnets_tags',
126128
check_str=neutron_policy.policy_or(
127-
base.ADMIN_OR_NET_OWNER_MEMBER,
128129
base.PROJECT_READER,
129-
'rule:shared'),
130+
'rule:shared',
131+
base.ADMIN_OR_NET_OWNER_MEMBER,
132+
),
130133
scope_types=['project'],
131134
description='Get the subnet tags',
132135
operations=ACTION_GET_TAGS,
133136
),
134137
policy.DocumentedRuleDefault(
135138
name='update_subnet',
136139
check_str=neutron_policy.policy_or(
137-
base.ADMIN_OR_NET_OWNER_MEMBER,
138-
base.PROJECT_MEMBER),
140+
base.PROJECT_MEMBER,
141+
base.ADMIN_OR_NET_OWNER_MEMBER),
139142
scope_types=['project'],
140143
description='Update a subnet',
141144
operations=ACTION_PUT,
@@ -172,17 +175,19 @@
172175
policy.DocumentedRuleDefault(
173176
name='update_subnets_tags',
174177
check_str=neutron_policy.policy_or(
178+
base.PROJECT_MEMBER,
175179
base.ADMIN_OR_NET_OWNER_MEMBER,
176-
base.PROJECT_MEMBER),
180+
),
177181
scope_types=['project'],
178182
description='Update the subnet tags',
179183
operations=ACTION_PUT_TAGS,
180184
),
181185
policy.DocumentedRuleDefault(
182186
name='delete_subnet',
183187
check_str=neutron_policy.policy_or(
188+
base.PROJECT_MEMBER,
184189
base.ADMIN_OR_NET_OWNER_MEMBER,
185-
base.PROJECT_MEMBER),
190+
),
186191
scope_types=['project'],
187192
description='Delete a subnet',
188193
operations=ACTION_DELETE,
@@ -195,8 +200,9 @@
195200
policy.DocumentedRuleDefault(
196201
name='delete_subnets_tags',
197202
check_str=neutron_policy.policy_or(
203+
base.PROJECT_MEMBER,
198204
base.ADMIN_OR_NET_OWNER_MEMBER,
199-
base.PROJECT_MEMBER),
205+
),
200206
scope_types=['project'],
201207
description='Delete the subnet tags',
202208
operations=ACTION_DELETE_TAGS,

neutron/tests/unit/common/ovn/test_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,11 @@ def test_valid_input_surplus_keys(self):
756756
{portbindings.VNIC_TYPE: portbindings.VNIC_DIRECT,
757757
constants.OVN_PORT_BINDING_PROFILE: binding_profile}))
758758

759+
def test_valid_input_no_binding_profile(self):
760+
# Confirm that we treat a port without binding:profile as valid
761+
self.assertEqual(utils.BPInfo({}, None, []),
762+
utils.validate_and_get_data_from_binding_profile({}))
763+
759764
def test_unknown_profile_items_pruned(self):
760765
# Confirm that unknown profile items are pruned
761766
self.assertEqual(

0 commit comments

Comments
 (0)