components/openstack/neutron/patches/05-launchpad-1210121.patch
branchs11-update
changeset 3178 77584387a894
equal deleted inserted replaced
3175:1ff833d174d4 3178:77584387a894
       
     1 This proposed upstream patch addresses Launchpad bug 1210121. Although
       
     2 it's been addressed in Icehouse 2014.1, the patch below is still not
       
     3 yet released for Havana.
       
     4 
       
     5 From dbbc8338770d2c340903e006dcb3c90c4aad7b29 Mon Sep 17 00:00:00 2001
       
     6 From: armando-migliaccio <[email protected]>
       
     7 Date: Thu, 13 Mar 2014 12:40:01 -0700
       
     8 Subject: [PATCH] Kill 'Skipping unknown group key: firewall_driver' log trace
       
     9 
       
    10 This is done by trying to import the option first. If this
       
    11 does not work, emit a warning instead as in most cases this is
       
    12 harmless for a number of reasons: a) the service might not
       
    13 even need the opt; b) if things do break down the line, we'll
       
    14 see bigger traces; c) it's not gonna be long for this legacy
       
    15 quantum/neutron stuff to be removed altogether.
       
    16 
       
    17 Closes-bug: 1210121
       
    18 
       
    19 Change-Id: I34917da9cb6117ee1d42140621c742f503279b6b
       
    20 (cherry picked from commit b5ee49623982530bfb3c3fe2eefb9d8ddb6353bc)
       
    21 ---
       
    22  neutron/common/legacy.py          |   20 ++++++++++++++++----
       
    23  neutron/quota.py                  |    2 +-
       
    24  neutron/tests/unit/test_legacy.py |    2 +-
       
    25  3 files changed, 18 insertions(+), 6 deletions(-)
       
    26 
       
    27 diff --git a/neutron/common/legacy.py b/neutron/common/legacy.py
       
    28 index cf37281..d387aa2 100644
       
    29 --- a/neutron/common/legacy.py
       
    30 +++ b/neutron/common/legacy.py
       
    31 @@ -17,6 +17,8 @@
       
    32  
       
    33  # @author Mark McClain (DreamHost)
       
    34  
       
    35 +from oslo.config import cfg
       
    36 +
       
    37  from neutron.openstack.common import log as logging
       
    38  
       
    39  LOG = logging.getLogger(__name__)
       
    40 @@ -45,11 +47,19 @@ def override_config(config, config_keys=None):
       
    41          group = None
       
    42          if not isinstance(key, basestring):
       
    43              try:
       
    44 -                group, key = key
       
    45 +                group, key, module_str = key
       
    46                  old_value = getattr(getattr(config, group), key, None)
       
    47              except AttributeError:
       
    48 -                LOG.error(_('Skipping unknown group key: %s'), key)
       
    49 -                continue
       
    50 +                try:
       
    51 +                    config.import_opt(key, module_str, group)
       
    52 +                    old_value = getattr(getattr(config, group), key, None)
       
    53 +                except (cfg.NoSuchOptError,
       
    54 +                        cfg.NoSuchGroupError,
       
    55 +                        AttributeError):
       
    56 +                    LOG.warn(_('Key %(key)s in group %(group)s is unknown. '
       
    57 +                               'It may not be defined or needed by this '
       
    58 +                               'service.') % {'key': key, 'group': group})
       
    59 +                    continue
       
    60          else:
       
    61              old_value = getattr(config, key, None)
       
    62          if not old_value:
       
    63 @@ -77,7 +87,9 @@ def modernize_quantum_config(config):
       
    64          'router_scheduler_driver',
       
    65          'rpc_backend',
       
    66          'service_plugins',
       
    67 -        ('SECURITYGROUP', 'firewall_driver'),
       
    68 +        ('SECURITYGROUP',
       
    69 +         'firewall_driver',
       
    70 +         'neutron.agent.securitygroups_rpc'),
       
    71      ]
       
    72  
       
    73      override_config(config, config_keys)
       
    74 diff --git a/neutron/quota.py b/neutron/quota.py
       
    75 index 4111078..105be06 100644
       
    76 --- a/neutron/quota.py
       
    77 +++ b/neutron/quota.py
       
    78 @@ -58,7 +58,7 @@ quota_opts = [
       
    79  ]
       
    80  # Register the configuration options
       
    81  cfg.CONF.register_opts(quota_opts, 'QUOTAS')
       
    82 -legacy.override_config(cfg.CONF, [('QUOTAS', 'quota_driver')])
       
    83 +legacy.override_config(cfg.CONF, [('QUOTAS', 'quota_driver', 'neutron.quota')])
       
    84  
       
    85  
       
    86  class ConfDriver(object):
       
    87 diff --git a/neutron/tests/unit/test_legacy.py b/neutron/tests/unit/test_legacy.py
       
    88 index 539f7de..6723d06 100644
       
    89 --- a/neutron/tests/unit/test_legacy.py
       
    90 +++ b/neutron/tests/unit/test_legacy.py
       
    91 @@ -71,7 +71,7 @@ class TestLegacyConfigOverride(base.BaseTestCase):
       
    92  
       
    93      def test_override_config_group_key(self):
       
    94          self.cfg(args=['--bar-baz=quantum'])
       
    95 -        legacy.override_config(self.cfg, [('bar', 'baz')])
       
    96 +        legacy.override_config(self.cfg, [('bar', 'baz', 'mod')])
       
    97          self.assertEqual(self.cfg.bar.baz, 'neutron')
       
    98  
       
    99      def test_override_config_list_value(self):
       
   100 -- 
       
   101 1.7.9.2
       
   102