Fix broken code due to openstack updates

1. Stop using constant AUTO_DELETE_PORT_OWNERS
as Commit Iba02f5a2211b18c2deb9097daad6be5e7d21faf8 removed this
2. Upgrade python-openstackclient and update osc security groups code
to match patch Ifd20b5fc47fd0ea0bb5aeda84820dcc0fb1e8847

Change-Id: I25ad6e1670d19fa3dcf8210eb4fd13aef6c3ad37
This commit is contained in:
asarfaty 2020-07-10 07:59:10 +02:00
parent 76a94f461d
commit 37d9fb4977
4 changed files with 11 additions and 5 deletions

View File

@ -36,7 +36,7 @@ prettytable==0.7.2
psycopg2==2.7
PyMySQL==0.7.6
pylint==1.7.1
python-openstackclient==4.0.0
python-openstackclient==5.3.0
reno==2.5.0
requests==2.14.2
six==1.11.0

View File

@ -14,7 +14,7 @@ stevedore>=1.20.0 # Apache-2.0
neutron-lib>=2.0.0 # Apache-2.0
osc-lib>=1.14.0 # Apache-2.0
octavia-lib>=1.3.1 # Apache-2.0
python-openstackclient>=4.0.0 # Apache-2.0
python-openstackclient>=5.3.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0
oslo.context>=2.19.2 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0

View File

@ -87,6 +87,10 @@ class NsxCreateSecurityGroup(security_group.CreateSecurityGroup):
attrs = {}
attrs['name'] = parsed_args.name
attrs['description'] = self._get_description(parsed_args)
if parsed_args.stateful:
attrs['stateful'] = True
if parsed_args.stateless:
attrs['stateful'] = False
if parsed_args.project is not None:
identity_client = self.app.client_manager.identity
project_id = identity_common.find_project(
@ -136,6 +140,10 @@ class NsxSetSecurityGroup(security_group.SetSecurityGroup):
attrs['name'] = parsed_args.name
if parsed_args.description is not None:
attrs['description'] = parsed_args.description
if parsed_args.stateful:
attrs['stateful'] = True
if parsed_args.stateless:
attrs['stateful'] = False
# add the plugin attributes
attrs = _get_plugin_attrs(attrs, parsed_args, self.app.client_manager)

View File

@ -32,7 +32,6 @@ from neutron.db import agents_db
from neutron.db import agentschedulers_db
from neutron.db import allowedaddresspairs_db as addr_pair_db
from neutron.db.availability_zone import router as router_az_db
from neutron.db import db_base_plugin_v2
from neutron.db import dns_db
from neutron.db import external_net_db
from neutron.db import extradhcpopt_db
@ -2478,8 +2477,7 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
def _has_active_port(self, context, network_id):
ports_in_use = context.session.query(models_v2.Port).filter_by(
network_id=network_id).all()
return not all([p.device_owner in
db_base_plugin_v2.AUTO_DELETE_PORT_OWNERS
return not all([p.device_owner == constants.DEVICE_OWNER_DHCP
for p in ports_in_use]) if ports_in_use else False
def _delete_network_disable_dhcp(self, context, network_id):