Re: [openstack-dev] A question about strange behavior of oslo.config in eclipse

2015-02-23 Thread Doug Hellmann


On Mon, Feb 23, 2015, at 01:29 AM, Joshua Zhang wrote:
> Hi Doug,
> 
>  I can't find above error when using the latest codes (2015-02-22),
>  but
> new error occur ( see [1] ).  I feel it has no concern with the
> code(ConfigOpts.import_opt), the same code can be run in both bash and
> pycharm, it just didn't work in eclipse+pydev. It looks like there are
> some
> conflicts between oslo/monkey patch and pydev. You are python expert,
> could
> you give me some input by the following traceback ?

Unfortunately, I don't know much about eclipse or pydev, so I'm not sure
how much help I can be. The traceback is saying that the MultiString
class is missing from oslo_config.types. Is that true? Do you somehow
have a version of the file without that class? Is there another version
of oslo.config installed elsewhere that could be interfering with the
imports?

> 
>  Another question,  'Gevent compatible debugging' feature both in
> eclipse and pycharm doesn't work, changing 'thread=False' for monkey
> patch
> may cause the error [2], so now I have to get back to use pdb to debug
> openstack. Could you have some idea to make oslo/monkey patch is more
> friendly for IDE ? many thanks.

This is outside of my area of expertise. Maybe another pydev user can
share information about how they have configured it?

> 
> *[1]*, traceback when running 'neutron-server --config-file
> /etc/neutron/neutron.conf --config-file
> /etc/neutron/plugins/ml2/ml2_conf.ini' in eclipse+pydev env. while we can
> run this command well in bash and pycharm.
> 
> Traceback (most recent call last):
>   File "/usr/local/bin/neutron-server", line 9, in 
> load_entry_point('neutron==2015.1.dev202', 'console_scripts',
> 'neutron-server')()
>   File
>   "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
> line 521, in load_entry_point
> return get_distribution(dist).load_entry_point(group, name)
>   File
>   "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
> line 2632, in load_entry_point
> return ep.load()
>   File
>   "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
> line 2312, in load
> return self.resolve()
>   File
>   "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
> line 2318, in resolve
> module = __import__(self.module_name, fromlist=['__name__'], level=0)
>   File "/bak/openstack/neutron/neutron/cmd/eventlet/server/__init__.py",
> line 13, in 
> from neutron import server
>   File "/bak/openstack/neutron/neutron/server/__init__.py", line 26, in
> 
> from neutron.common import config
>   File "/bak/openstack/neutron/neutron/common/config.py", line 25, in
> 
> import oslo_messaging
>   File
>   "/usr/local/lib/python2.7/dist-packages/oslo_messaging/__init__.py",
> line 18, in 
> from .notify import *
>   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/notify/__init__.py",
> line 23, in 
> from .notifier import *
>   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/notify/notifier.py",
> line 32, in 
> help='Driver or drivers to handle sending notifications.'),
>   File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
> 1108, in __init__
> item_type=types.MultiString(),
> AttributeError: 'module' object has no attribute 'MultiString'
> 
> *[2] *
> 
> 2015-02-22 14:56:24.117 ERROR oslo_messaging.rpc.dispatcher
> [req-65501748-3db5-43b6-b00e-732565d2192a TestNetworkVPNaaS-1393357785
> TestNetworkVPNaaS-1147259963] Exception during message handling:
> _oslo_messaging_localcontext_9bb7d928d1a042e085f354eb118e98a0
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
> Traceback
> (most recent call last):
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py",
> line 142, in _dispatch_and_reply
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
> executor_callback))
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py",
> line 188, in _dispatch
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
> localcontext.clear_local_context()
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher   File
> "/usr/local/lib/python2.7/dist-packages/oslo_messaging/localcontext.py",
> line 55, in clear_local_context
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
> delattr(_STORE, _KEY)
> 2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
> AttributeError:
> _oslo_messaging_localcontext_9bb7d928d1a042e085f354eb118e98a0
> 
> 
> 
> On Sat, Feb 14, 2015 at 7:05 AM, Doug Hellmann 
> wrote:
> 
> >
> >
> > On Thu, Feb 12, 2015, at 07:19 AM, Joshua Zhang wrote:
> > > Hi Doug,
> > >
> > >Thank you very much for your reply. I don't have any codes, so no any
> > > special codes as well.
> > >Only thing I d

Re: [openstack-dev] A question about strange behavior of oslo.config in eclipse

2015-02-22 Thread Joshua Zhang
Hi Doug,

 I can't find above error when using the latest codes (2015-02-22), but
new error occur ( see [1] ).  I feel it has no concern with the
code(ConfigOpts.import_opt), the same code can be run in both bash and
pycharm, it just didn't work in eclipse+pydev. It looks like there are some
conflicts between oslo/monkey patch and pydev. You are python expert, could
you give me some input by the following traceback ?

 Another question,  'Gevent compatible debugging' feature both in
eclipse and pycharm doesn't work, changing 'thread=False' for monkey patch
may cause the error [2], so now I have to get back to use pdb to debug
openstack. Could you have some idea to make oslo/monkey patch is more
friendly for IDE ? many thanks.

*[1]*, traceback when running 'neutron-server --config-file
/etc/neutron/neutron.conf --config-file
/etc/neutron/plugins/ml2/ml2_conf.ini' in eclipse+pydev env. while we can
run this command well in bash and pycharm.

Traceback (most recent call last):
  File "/usr/local/bin/neutron-server", line 9, in 
load_entry_point('neutron==2015.1.dev202', 'console_scripts',
'neutron-server')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
line 521, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
line 2632, in load_entry_point
return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
line 2312, in load
return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py",
line 2318, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/bak/openstack/neutron/neutron/cmd/eventlet/server/__init__.py",
line 13, in 
from neutron import server
  File "/bak/openstack/neutron/neutron/server/__init__.py", line 26, in

from neutron.common import config
  File "/bak/openstack/neutron/neutron/common/config.py", line 25, in

import oslo_messaging
  File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/__init__.py",
line 18, in 
from .notify import *
  File
"/usr/local/lib/python2.7/dist-packages/oslo_messaging/notify/__init__.py",
line 23, in 
from .notifier import *
  File
"/usr/local/lib/python2.7/dist-packages/oslo_messaging/notify/notifier.py",
line 32, in 
help='Driver or drivers to handle sending notifications.'),
  File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
1108, in __init__
item_type=types.MultiString(),
AttributeError: 'module' object has no attribute 'MultiString'


*[2] *

2015-02-22 14:56:24.117 ERROR oslo_messaging.rpc.dispatcher
[req-65501748-3db5-43b6-b00e-732565d2192a TestNetworkVPNaaS-1393357785
TestNetworkVPNaaS-1147259963] Exception during message handling:
_oslo_messaging_localcontext_9bb7d928d1a042e085f354eb118e98a0
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher Traceback
(most recent call last):
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher   File
"/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py",
line 142, in _dispatch_and_reply
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
executor_callback))
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher   File
"/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py",
line 188, in _dispatch
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
localcontext.clear_local_context()
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher   File
"/usr/local/lib/python2.7/dist-packages/oslo_messaging/localcontext.py",
line 55, in clear_local_context
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
delattr(_STORE, _KEY)
2015-02-22 14:56:24.117 28042 TRACE oslo_messaging.rpc.dispatcher
AttributeError:
_oslo_messaging_localcontext_9bb7d928d1a042e085f354eb118e98a0



On Sat, Feb 14, 2015 at 7:05 AM, Doug Hellmann 
wrote:

>
>
> On Thu, Feb 12, 2015, at 07:19 AM, Joshua Zhang wrote:
> > Hi Doug,
> >
> >Thank you very much for your reply. I don't have any codes, so no any
> > special codes as well.
> >Only thing I did is that:
> >1, use devstack to install a fresh openstack env, all are ok.
> >2, import neutron-vpnaas directory (no any my own codes) into eclipse
> >as
> > pydev project, for example, run unit test
> > (neutron_vpnaas.tests.unit.services.vpn.test_vpn_service ) in eclipse, it
> > throws the following exception.
> >3, but this unit test can be run well in bash, see
> > http://paste.openstack.org/show/172016/
> >4, this unit test can also be run well in eclipse as long as I edit
> > neutron/openstack/common/policy.py file to change oslo.config into
> > oslo_config.
> >
> >
> > ==
> > ERROR: test_add_nat_rule
> >
> (neutron_vpnaas.tests.unit.services.vpn.test_vpn_service.TestVPNDeviceDr

Re: [openstack-dev] A question about strange behavior of oslo.config in eclipse

2015-02-13 Thread Doug Hellmann


On Thu, Feb 12, 2015, at 07:19 AM, Joshua Zhang wrote:
> Hi Doug,
> 
>Thank you very much for your reply. I don't have any codes, so no any
> special codes as well.
>Only thing I did is that:
>1, use devstack to install a fresh openstack env, all are ok.
>2, import neutron-vpnaas directory (no any my own codes) into eclipse
>as
> pydev project, for example, run unit test
> (neutron_vpnaas.tests.unit.services.vpn.test_vpn_service ) in eclipse, it
> throws the following exception.
>3, but this unit test can be run well in bash, see
> http://paste.openstack.org/show/172016/
>4, this unit test can also be run well in eclipse as long as I edit
> neutron/openstack/common/policy.py file to change oslo.config into
> oslo_config.
> 
> 
> ==
> ERROR: test_add_nat_rule
> (neutron_vpnaas.tests.unit.services.vpn.test_vpn_service.TestVPNDeviceDriverCallsToService)
> neutron_vpnaas.tests.unit.services.vpn.test_vpn_service.TestVPNDeviceDriverCallsToService.test_add_nat_rule
> --
> _StringException: Traceback (most recent call last):
>   File
> "/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/unit/services/vpn/test_vpn_service.py",
> line 98, in setUp
> super(TestVPNDeviceDriverCallsToService, self).setUp()
>   File
> "/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/unit/services/vpn/test_vpn_service.py",
> line 53, in setUp
> super(VPNBaseTestCase, self).setUp()
>   File "/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/base.py", line
> 36, in setUp
> override_nvalues()
>   File "/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/base.py", line
> 30, in override_nvalues
> cfg.CONF.set_override('policy_file', neutron_policy)

Yes, this line is trying to force the value of a policy module
configuration value but the test file does not previously import the
module where that option is defined.

For now, you should investigate the fixture class in oslo.config [1],
and update the test class to use ConfigOpts.import_opt() to ensure the
policy option is defined.

After the oslo.policy library is released (and neutron is updated to use
it instead of the incubated version of that code), the tests will need
to be changed again to use an API to update the setting because
configuration options are not part of the public API for Oslo libraries.
I filed a bug against oslo.policy to track the need for that change [2].

Doug

[1] http://docs.openstack.org/developer/oslo.config/fixture.html
[2] https://bugs.launchpad.net/oslo.policy/+bug/1421869

>   File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
> 1679, in __inner
> result = f(self, *args, **kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
> 1949, in set_override
> opt_info = self._get_opt_info(name, group)
>   File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
> 2262, in _get_opt_info
> raise NoSuchOptError(opt_name, group)
> NoSuchOptError: no such option: policy_file
> 
> On Tue, Feb 10, 2015 at 10:38 PM, Doug Hellmann 
> wrote:
> 
> >
> >
> > On Tue, Feb 10, 2015, at 04:29 AM, Joshua Zhang wrote:
> > > Hi Stacker,
> > >A question about oslo.config, maybe a very silly question. but pls
> > >tell
> > > me if you know, thanks in advance.
> > >
> > >I know oslo has removed 'olso' namespace, oslo.config has been changed
> > > to oslo_config, it also retains backwards compat.
> > >
> > >I found I can run openstack successfully, but as long as I run
> > >something
> > > in eclipse/pydev it always said like 'NoSuchOptError: no such option:
> > > policy_file'. I can change 'oslo.config' to 'oslo_config' in
> > > neutron/openstack/common/policy.py temporarily to bypass this problem
> > > when
> > > I want to debug something in eclipse. But I want to know why? who can
> > > help
> > > me to explain ? thanks.
> >
> > It sounds like you have code in one module using an option defined
> > somewhere else and relying on import ordering to cause that option to be
> > defined. The import_opt() method of the ConfigOpts class is meant to
> > help make these cross-module option dependencies explicit [1]. If you
> > provide a more detailed traceback I may be able to give more specific
> > advice about where changes are needed.
> >
> > Doug
> >
> > [1]
> >
> > http://docs.openstack.org/developer/oslo.config/configopts.html?highlight=import_opt#oslo_config.cfg.ConfigOpts.import_opt
> >
> > >
> > >
> > > --
> > > Best Regards
> > > Zhang Hua(张华)
> > > Software Engineer | Canonical
> > > IRC:  zhhuabj
> > >
> > __
> > > OpenStack Development Mailing List (not for usage questions)
> > > Unsubscribe:
> > > openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> >
> > 

Re: [openstack-dev] A question about strange behavior of oslo.config in eclipse

2015-02-12 Thread Joshua Zhang
Hi Doug,

   Thank you very much for your reply. I don't have any codes, so no any
special codes as well.
   Only thing I did is that:
   1, use devstack to install a fresh openstack env, all are ok.
   2, import neutron-vpnaas directory (no any my own codes) into eclipse as
pydev project, for example, run unit test
(neutron_vpnaas.tests.unit.services.vpn.test_vpn_service ) in eclipse, it
throws the following exception.
   3, but this unit test can be run well in bash, see
http://paste.openstack.org/show/172016/
   4, this unit test can also be run well in eclipse as long as I edit
neutron/openstack/common/policy.py file to change oslo.config into
oslo_config.


==
ERROR: test_add_nat_rule
(neutron_vpnaas.tests.unit.services.vpn.test_vpn_service.TestVPNDeviceDriverCallsToService)
neutron_vpnaas.tests.unit.services.vpn.test_vpn_service.TestVPNDeviceDriverCallsToService.test_add_nat_rule
--
_StringException: Traceback (most recent call last):
  File
"/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/unit/services/vpn/test_vpn_service.py",
line 98, in setUp
super(TestVPNDeviceDriverCallsToService, self).setUp()
  File
"/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/unit/services/vpn/test_vpn_service.py",
line 53, in setUp
super(VPNBaseTestCase, self).setUp()
  File "/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/base.py", line
36, in setUp
override_nvalues()
  File "/bak/openstack/neutron-vpnaas/neutron_vpnaas/tests/base.py", line
30, in override_nvalues
cfg.CONF.set_override('policy_file', neutron_policy)
  File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
1679, in __inner
result = f(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
1949, in set_override
opt_info = self._get_opt_info(name, group)
  File "/usr/local/lib/python2.7/dist-packages/oslo_config/cfg.py", line
2262, in _get_opt_info
raise NoSuchOptError(opt_name, group)
NoSuchOptError: no such option: policy_file

On Tue, Feb 10, 2015 at 10:38 PM, Doug Hellmann 
wrote:

>
>
> On Tue, Feb 10, 2015, at 04:29 AM, Joshua Zhang wrote:
> > Hi Stacker,
> >A question about oslo.config, maybe a very silly question. but pls
> >tell
> > me if you know, thanks in advance.
> >
> >I know oslo has removed 'olso' namespace, oslo.config has been changed
> > to oslo_config, it also retains backwards compat.
> >
> >I found I can run openstack successfully, but as long as I run
> >something
> > in eclipse/pydev it always said like 'NoSuchOptError: no such option:
> > policy_file'. I can change 'oslo.config' to 'oslo_config' in
> > neutron/openstack/common/policy.py temporarily to bypass this problem
> > when
> > I want to debug something in eclipse. But I want to know why? who can
> > help
> > me to explain ? thanks.
>
> It sounds like you have code in one module using an option defined
> somewhere else and relying on import ordering to cause that option to be
> defined. The import_opt() method of the ConfigOpts class is meant to
> help make these cross-module option dependencies explicit [1]. If you
> provide a more detailed traceback I may be able to give more specific
> advice about where changes are needed.
>
> Doug
>
> [1]
>
> http://docs.openstack.org/developer/oslo.config/configopts.html?highlight=import_opt#oslo_config.cfg.ConfigOpts.import_opt
>
> >
> >
> > --
> > Best Regards
> > Zhang Hua(张华)
> > Software Engineer | Canonical
> > IRC:  zhhuabj
> >
> __
> > OpenStack Development Mailing List (not for usage questions)
> > Unsubscribe:
> > openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



-- 
Best Regards
Zhang Hua(张华)
Software Engineer | Canonical
IRC:  zhhuabj
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] A question about strange behavior of oslo.config in eclipse

2015-02-10 Thread Doug Hellmann


On Tue, Feb 10, 2015, at 04:29 AM, Joshua Zhang wrote:
> Hi Stacker,
>A question about oslo.config, maybe a very silly question. but pls
>tell
> me if you know, thanks in advance.
> 
>I know oslo has removed 'olso' namespace, oslo.config has been changed
> to oslo_config, it also retains backwards compat.
> 
>I found I can run openstack successfully, but as long as I run
>something
> in eclipse/pydev it always said like 'NoSuchOptError: no such option:
> policy_file'. I can change 'oslo.config' to 'oslo_config' in
> neutron/openstack/common/policy.py temporarily to bypass this problem
> when
> I want to debug something in eclipse. But I want to know why? who can
> help
> me to explain ? thanks.

It sounds like you have code in one module using an option defined
somewhere else and relying on import ordering to cause that option to be
defined. The import_opt() method of the ConfigOpts class is meant to
help make these cross-module option dependencies explicit [1]. If you
provide a more detailed traceback I may be able to give more specific
advice about where changes are needed.

Doug

[1]
http://docs.openstack.org/developer/oslo.config/configopts.html?highlight=import_opt#oslo_config.cfg.ConfigOpts.import_opt

> 
> 
> -- 
> Best Regards
> Zhang Hua(张华)
> Software Engineer | Canonical
> IRC:  zhhuabj
> __
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe:
> openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] A question about strange behavior of oslo.config in eclipse

2015-02-10 Thread Joshua Zhang
Hi Stacker,
   A question about oslo.config, maybe a very silly question. but pls tell
me if you know, thanks in advance.

   I know oslo has removed 'olso' namespace, oslo.config has been changed
to oslo_config, it also retains backwards compat.

   I found I can run openstack successfully, but as long as I run something
in eclipse/pydev it always said like 'NoSuchOptError: no such option:
policy_file'. I can change 'oslo.config' to 'oslo_config' in
neutron/openstack/common/policy.py temporarily to bypass this problem when
I want to debug something in eclipse. But I want to know why? who can help
me to explain ? thanks.


-- 
Best Regards
Zhang Hua(张华)
Software Engineer | Canonical
IRC:  zhhuabj
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev