Decision engine logs an error if scope is None

Bug #1881920 reported by Alexandra Nyitraiova on 2020-06-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
watcher
Undecided
licanwei

Bug Description

I use Train version of OpenStack (and train version of watcher as well).
The error is logged not only when I issue command `watcher strategy state <strategy_name>` but also in other time when watcher tries to compute cluster data model.

Here is log attached.

2020-04-28 17:55:38.746 7 DEBUG watcher.decision_engine.model.collector.nova [-] Building latest Nova cluster data model execute /usr/lib/python2.7/site-packages/watcher/decision_engine/model/collector/nova.py:179
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling [-] 'NoneType' object is not iterable: TypeError: 'NoneType' object is not iterable
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling Traceback (most recent call last):
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling File "/usr/lib/python2.7/site-packages/watcher/decision_engine/scheduling.py", line 74, in _sync
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling timed_sync()
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling File "/usr/lib/python2.7/site-packages/watcher/decision_engine/scheduling.py", line 62, in _timed_sync
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling sync_func()
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling File "/usr/lib/python2.7/site-packages/watcher/decision_engine/model/collector/base.py", line 194, in synchronize
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling self.cluster_data_model = self.execute()
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling File "/usr/lib/python2.7/site-packages/watcher/decision_engine/model/collector/nova.py", line 186, in execute
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling return builder.execute(self._data_model_scope)
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling File "/usr/lib/python2.7/site-packages/watcher/decision_engine/model/collector/nova.py", line 462, in execute
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling updata_model_flag = self._check_model_scope(model_scope)
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling File "/usr/lib/python2.7/site-packages/watcher/decision_engine/model/collector/nova.py", line 445, in _check_model_scope
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling for _scope in model_scope:
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling TypeError: 'NoneType' object is not iterable
2020-04-28 17:55:38.748 7 ERROR watcher.decision_engine.scheduling

The following helped me:
https://github.com/openstack/watcher/blob/stable/train/watcher/decision_engine/strategy/strategies/base.py#L162
Changed this line from `self._audit_scope = None` to `self._audit_scope = []`

Or little if here https://github.com/openstack/watcher/blob/stable/train/watcher/decision_engine/model/collector/nova.py#L445
and on other places (for example https://github.com/openstack/watcher/blob/stable/train/watcher/decision_engine/scope/storage.py#L134) to check whether the scope is None.

summary: - Decision engine logs an error is scope is None
+ Decision engine logs an error if scope is None
licanwei (li-canwei2) on 2020-06-06
Changed in watcher:
assignee: nobody → licanwei (li-canwei2)
Alexandra Nyitraiova (saskan) wrote :

Since I am new to Watcher, and I do not have Watcher's GUI available in my environment, I would like to ask, how do I set up a scope in command line for command `watcher strategy state`? Command `watcher strategy state --help` did not suggest any suitable flag to pass scope. Are there actions which are only available through Watcher's GUI and not through CLI?

licanwei (li-canwei2) wrote :

Scope is related to audit, you can run command 'watcher audittemplate create' to create a audit template with scope, such as 'watcher audittemplate create at1 dummy --scope /path/jsaonfile', you can get more help through 'watcher help audittemplate create'.
btw, Watcher don't create data model until audit is created after bp https://specs.openstack.org/openstack/watcher-specs/specs/stein/implemented/scope-for-watcher-datamodel.html.

Reviewed: https://review.opendev.org/733938
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=9f0138e1cf4bb22cfedd9c0db9744e374d4a62e6
Submitter: Zuul
Branch: master

commit 9f0138e1cf4bb22cfedd9c0db9744e374d4a62e6
Author: licanwei <email address hidden>
Date: Sat Jun 6 11:02:23 2020 +0800

    Check if scope is None

    if scope is None, don't create data model

    Change-Id: Icf611966c9b0a3882615d778ee6c72a8da73841d
    Closed-Bug: #1881920

Reviewed: https://review.opendev.org/736873
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=8ef9d14a548a6cc38b9c8ddde38ea1e3f5c8b15f
Submitter: Zuul
Branch: stable/train

commit 8ef9d14a548a6cc38b9c8ddde38ea1e3f5c8b15f
Author: licanwei <email address hidden>
Date: Sat Jun 6 11:02:23 2020 +0800

    Check if scope is None

    if scope is None, don't create data model

    Change-Id: Icf611966c9b0a3882615d778ee6c72a8da73841d
    Closed-Bug: #1881920
    (cherry picked from commit 9f0138e1cf4bb22cfedd9c0db9744e374d4a62e6)

tags: added: in-stable-train
tags: added: in-stable-ussuri

Reviewed: https://review.opendev.org/736872
Committed: https://git.openstack.org/cgit/openstack/watcher/commit/?id=cbb06e6765a7129e15db238b48bb0bea5a4a8000
Submitter: Zuul
Branch: stable/ussuri

commit cbb06e6765a7129e15db238b48bb0bea5a4a8000
Author: licanwei <email address hidden>
Date: Sat Jun 6 11:02:23 2020 +0800

    Check if scope is None

    if scope is None, don't create data model

    Change-Id: Icf611966c9b0a3882615d778ee6c72a8da73841d
    Closed-Bug: #1881920
    (cherry picked from commit 9f0138e1cf4bb22cfedd9c0db9744e374d4a62e6)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers