masakari segment-list returns error (openstack queens)

Bug #1779752 reported by Torin Woltjer on 2018-07-02
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
masakari
Critical
Shilpa Devharakar
masakari-monitors
Critical
Shilpa Devharakar

Bug Description

Openstack queens
python-openstacksdk version 0.11.3

running masakari segment-list returns an error:
("'NoneType' object has no attribute 'auth_url'", <open file '<stderr>', mode 'w' at 0x7fabdf69f1e0>)

masakari -d segment-list returns:
Traceback (most recent call last):
  File "/usr/local/bin/masakari", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/shell.py", line 189, in main
    MasakariShell().main(args)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/shell.py", line 160, in main
    sc = self._setup_masakari_client(api_ver, args)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/shell.py", line 116, in _setup_masakari_client
    return masakari_client.Client(api_ver, user_agent=USER_AGENT, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/client.py", line 28, in Client
    return cls(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/v1/client.py", line 26, in __init__
    prof=prof, user_agent=user_agent, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/sdk/ha/connection.py", line 52, in create_connection
    raise e
AttributeError: 'NoneType' object has no attribute 'auth_url'

Reproduced by:

git clone -b stable/queens https://github.com/openstack/python-masakariclient.git
cd python-masakariclient
sudo python setup.py install
masakari segment-list

Changed in masakari:
assignee: nobody → SamP (sampath-priyankara)
importance: Undecided → Critical
Changed in masakari:
status: New → Confirmed
Tushar Patil (tpatil) wrote :
Download full text (3.8 KiB)

I have verified segment list command is failing with below error after installing openstackclient of stable/queens branch. Can someone please confirm if you are getting same error becoz I'm trying all these changes on the current master branch (all dependencies lib versions is not stable/queens)?

"$openstack --debug segment list"

Service Descriptors cannot be set
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 402, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/osc/v1/segment.py", line 66, in take_action
    masakari_client = self.app.client_manager.ha
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 60, in __get__
    six.reraise(new_err.__class__, new_err, sys.exc_info()[2])
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 55, in __get__
    self._handle = self.factory(instance)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/plugin.py", line 47, in make_client
    return _make_client_new(instance)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/plugin.py", line 58, in _make_client_new
    conn.add_service(desc)
  File "/usr/local/lib/python2.7/dist-packages/openstack/connection.py", line 339, in add_service
    setattr(self, attr_name.replace('-', '_'), service)
  File "/usr/local/lib/python2.7/dist-packages/openstack/service_description.py", line 104, in __set__
    raise AttributeError('Service Descriptors cannot be set')
PluginAttributeError: Service Descriptors cannot be set
clean_up ListSegment: Service Descriptors cannot be set
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/shell.py", line 134, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 281, in run
    result = self.run_subcommand(remainder)
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/shell.py", line 169, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 402, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/osc/v1/segment.py", line 66, in take_action
    masakari_client = self.app.client_manager.ha
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 60, in __get__
    six.reraise(new_err.__class__, new_err, sys.exc_info()[2])
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 55,...

Read more...

Torin Woltjer (woltjert) wrote :

My output is nearly identical using the stable/queens branch of python-masakariclient

AttributeError: 'NoneType' object has no attribute 'auth_url' raises, as masakarihostmonitor tries to send both login credentials and profile. This behaviour is incorrect within new openstack library.

So this exact problem might be resolved with commenting out "profile" on line 53 of /openstack/venvs/masakari-untagged/lib/python2.7/site-packages/masakarimonitors/ha/masakari.py

However, another problem comes instead. It seems, that openstack knows nothing about masakari on queens, as established connection doesn't contain masakari/ha/instance_ha:

>>> from openstack import connection
>>> conn = connection.Connection(auth_url='http://172.20.0.9:35357', project_name='service', username='masakari', project_domain_id='default', user_domain_id='default')
>>> dir(conn)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_extra_services', '_proxies', 'add_service', u'alarm', u'alarming', u'application_catalog', u'application_container', u'application_deployment', 'authorize', u'backup', 'bare_metal', u'baremetal', u'baremetal_introspection', u'block_storage', 'cluster', u'clustering', u'compute', 'config', u'container', u'container_infrastructure', u'container_infrastructure_management', u'data_processing', u'data_protection_orchestration', u'database', u'dns', u'event', u'events', u'identity', u'image', u'infra_optim', u'key_manager', u'load_balancer', u'message', u'messaging', u'meter', u'metering', u'monitoring', u'monitoring_events', u'monitoring_log_api', u'monitoring_logging', u'multi_region_network_automation', u'network', u'nfv_orchestration', u'object_store', u'operator_policy', u'orchestration', u'placement', u'policy', u'rating', u'rca', u'resource_cluster', u'resource_optimization', u'root_cause_analysis', u'search', 'session', u'share', u'shared_file_system', 'task_manager', u'tricircle', u'volume', u'workflow']

So it's not possible to send notification on service failure, as connection class doesn't contain expected method.

So in the end masakariclient sdk is not integrated with openstacksdk, but tries to use it, which causes service to fail sending notifications. It seems that in rocky openstacksdk had integrated masakari, so it should be resolved in rocky release.

Tushar Patil (tpatil) wrote :

Dmitriy: Yes, masakari sdk is now part of openstacksdk and this issue won't occur in Rocky release.

Tushar Patil (tpatil) wrote :

With openstacksdk 0.11.3, openstackclient ($openstack --debug segment list) fails with an error message:
'BaseProxy' object has no attribute 'proxy_class'

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 402, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/osc/v1/segment.py", line 66, in take_action
    masakari_client = self.app.client_manager.ha
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 60, in __get__
    six.reraise(new_err.__class__, new_err, sys.exc_info()[2])
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 55, in __get__
    self._handle = self.factory(instance)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/plugin.py", line 47, in make_client
    return _make_client_new(instance)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/plugin.py", line 63, in _make_client_new
    client = conn.ha.proxy_class(
PluginAttributeError: 'BaseProxy' object has no attribute 'proxy_class'
clean_up ListSegment: 'BaseProxy' object has no attribute 'proxy_class'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/shell.py", line 134, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 281, in run
    result = self.run_subcommand(remainder)
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/shell.py", line 169, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 402, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 116, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/osc/v1/segment.py", line 66, in take_action
    masakari_client = self.app.client_manager.ha
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 60, in __get__
    six.reraise(new_err.__class__, new_err, sys.exc_info()[2])
  File "/usr/local/lib/python2.7/dist-packages/osc_lib/clientmanager.py", line 55, in __get__
    self._handle = self.factory(instance)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/plugin.py", line 47, in make_client
    return _make_client_new(instance)
  File "/usr/local/lib/python2.7/dist-packages/masakariclient/plugin.py", line 63, in _make_client_new
    client = conn.ha.proxy_class(
PluginAttributeError: 'BaseProxy' object has no attribute 'proxy_class'

END return value: 1

Tushar Patil (tpatil) wrote :

This patch fixes this issue in masakariclient in stable/queens branch.
https://review.openstack.org/#/c/588157

It will work with openstacksdk > 0.11.0.

Tushar Patil (tpatil) on 2018-08-07
Changed in masakari-monitors:
importance: Undecided → Critical
status: New → Confirmed
Changed in masakari:
assignee: SamP (sampath-priyankara) → Shilpa Devharakar (shilpasd)
Changed in masakari-monitors:
assignee: nobody → Shilpa Devharakar (shilpasd)

Reviewed: https://review.openstack.org/590735
Committed: https://git.openstack.org/cgit/openstack/masakari-monitors/commit/?id=3ffd576b7959a90fcebabd5471ff4d6f5a619b3c
Submitter: Zuul
Branch: stable/queens

commit 3ffd576b7959a90fcebabd5471ff4d6f5a619b3c
Author: shilpa.devharakar <email address hidden>
Date: Fri Aug 3 10:16:23 2018 +0530

    Fix masakari-monitor connection issue

    From openstacksdk version 0.11.1 onwards, there is no way
    you can add service to the connection. Hence we need to monkey
    _find_service_filter_class method from sdk to allow
    to point to thee correct service filter class from masakariclient.

    Solution provided here is not going to work in sdk 0.9.19 and
    0.10.0 versions. Because service descriptor is not supported
    in 0.9.19 and 0.10.0 sdk versions and profile parameter doesn't
    work correctly during connection initialization.

    Also solution provided here is not going to work in sdk 0.13.0
    and above, it will still fails with below error
    "'Connection' object has no attribute 'ha'"
    this is because 'Connection' object expecting instance_ha not ha

    Co-Author: tpatil <email address hidden>
    Change-Id: Ic10d1b380abc8b3b6cc38015c9c3bf4ab7705a0c
    Depends-On: I24ec493f3333a5b3f6bfed9395c921fb28500065
    Closes-Bug: #1779752

tags: added: in-stable-queens

This issue was fixed in the openstack/masakari-monitors 5.1.0 release.

Changed in masakari:
status: Confirmed → Fix Released
Changed in masakari-monitors:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers