<div dir="ltr">Thanks Slawek. I'm happy to do that, but I thought I should write here first in case it is some kind of user error, and not really a bug in the Neutron code.<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 16, 2020 at 1:12 PM Slawek Kaplonski <<a href="mailto:skaplons@redhat.com">skaplons@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Can You report a LP bug for that and attach full stack traces from the neutron<br>
server?<br>
<br>
On Tue, Jun 16, 2020 at 09:58:04AM +0100, Neil Jerram wrote:<br>
> With Ussuri I'm hitting this in the neutron server:<br>
> <br>
> Failed to create a duplicate DefaultSecurityGroup: for attribute(s)<br>
> ['PRIMARY'] with value(s) 11447be9beda4bf78dab27cdb75058e2<br>
> pymysql.err.IntegrityError: (1062, "Duplicate entry<br>
> '11447be9beda4bf78dab27cdb75058e2' for key 'PRIMARY'")<br>
> oslo_db.exception.DBDuplicateEntry: (pymysql.err.IntegrityError) (1062,<br>
> "Duplicate entry '11447be9beda4bf78dab27cdb75058e2' for key 'PRIMARY'")<br>
> [SQL: INSERT INTO default_security_group (project_id, security_group_id)<br>
> VALUES (%(project_id)s, %(security_group_id)s)]<br>
> [parameters: {'project_id': '11447be9beda4bf78dab27cdb75058e2',<br>
> 'security_group_id': '9f3a473c-b08a-4cf2-8327-10ecc8b87301'}]<br>
> neutron_lib.objects.exceptions.NeutronDbObjectDuplicateEntry: Failed to<br>
> create a duplicate DefaultSecurityGroup: for attribute(s) ['PRIMARY'] with<br>
> value(s) 11447be9beda4bf78dab27cdb75058e2<br>
> <br>
> (Those are all, I believe, reports of the same problem, at different levels<br>
> of the stack.)<br>
> <br>
> IIUC, this is triggered by my Neutron driver calling<br>
> <br>
> rules = self.db.get_security_group_rules(<br>
> context, filters={'security_group_id': sgids}<br>
> )<br>
> <br>
> where the context has project_id 11447be9beda4bf78dab27cdb75058e2. Deep<br>
> down inside that call, Neutron tries to ensure that there is a default<br>
> security group for that project, and somehow that hits the reported<br>
> exception.<br>
> <br>
> Here's the code in securitygroups_db.py:<br>
> <br>
> def _ensure_default_security_group(self, context, tenant_id):<br>
> """Create a default security group if one doesn't exist.<br>
> <br>
> :returns: the default security group id for given tenant.<br>
> """<br>
> default_group_id = self._get_default_sg_id(context, tenant_id)<br>
> if default_group_id:<br>
> return default_group_id<br>
> <br>
> security_group = {<br>
> 'security_group':<br>
> {'name': 'default',<br>
> 'tenant_id': tenant_id,<br>
> 'description': _('Default security group')}<br>
> }<br>
> return self.create_security_group(context, security_group,<br>
> default_sg=True)['id']<br>
> <br>
> Obviously it checks first if the default SG already exists for the project,<br>
> before creating it if not. So why would that code hit the duplicate<br>
> exception as shown above?<br>
> <br>
> Any ideas welcome!<br>
> <br>
> Best wishes,<br>
> Neil<br>
<br>
-- <br>
Slawek Kaplonski<br>
Senior software engineer<br>
Red Hat<br>
<br>
</blockquote></div>