← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1086301] Re: Code logic inconsistency in quantum.db.securitygroups_db.py:SecurityGroupDbMixin._ensure_default_security_group

 

*** This bug is a duplicate of bug 1130927 ***
    https://bugs.launchpad.net/bugs/1130927

** Changed in: quantum
       Status: Invalid => Confirmed

** This bug has been marked a duplicate of bug 1130927
   remove external-id and security-group proxy

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to quantum.
https://bugs.launchpad.net/bugs/1086301

Title:
  Code logic inconsistency in
  quantum.db.securitygroups_db.py:SecurityGroupDbMixin._ensure_default_security_group

Status in OpenStack Quantum (virtual network service):
  Confirmed

Bug description:
  def _ensure_default_security_group(self, context, tenant_id,
                                         security_group=None):
          """Create a default security group if one doesn't exist.

          :returns: the default security group id.
          """
          # if in proxy mode a default security group will be created by source
          if not security_group and cfg.CONF.SECURITYGROUP.proxy_mode:
              return

          filters = {'name': ['default'], 'tenant_id': [tenant_id]}
          default_group = self.get_security_groups(context, filters)
          if not default_group:
              security_group = {'security_group': {'name': 'default',
                                                   'tenant_id': tenant_id,
                                                   'description': 'default'}}
  >>> >>>>
  "if security_group:" never can be False. Because it security_group overlap by previous line.
  And as the check, in the begin of this function:
   # if in proxy mode a default security group will be created by source
          if not security_group and cfg.CONF.SECURITYGROUP.proxy_mode:
              return
  We needn't assign 'external_id' at here. Also need reference code at securitygroups_db.py:90-108
  <<<<<<<
              if security_group:
                  security_group['security_group']['external_id'] = (
                      security_group['security_group'].get('external_id'))
              ret = self.create_security_group(context, security_group, True)
              return ret['id']
          else:
              return default_group[0]['id']

To manage notifications about this bug go to:
https://bugs.launchpad.net/quantum/+bug/1086301/+subscriptions