neutron-remove-duplicated-port-bindings does not write to stdout

Bug #2012944 reported by Simon Hensel
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
neutron
Confirmed
Medium
Miguel Lavalle

Bug Description

The new neutron-remove-duplicated-port-bindings tool does not log any information when run from the CLI, as the log levels are mismatching.

The logger gets initialized with log_level = WARNING, but the tool uses LOG.info() to display its messages, therefore the user never receives any results.
Furthermore, the logger does not take into account any parameters from the neutron config file during its initialization, and instead relies on its default settings, so log-related settings (log-level, log-path, etc.) cannot be changed.

On another note, dry-running is only possible when setting [cli_script] dry_run=True in the neutron config file, which is inconvenient to say the least.
A proper --debug CLI option would be way more helpful.

Revision history for this message
Miguel Lavalle (minsel) wrote :

The script neutron-remove-duplicated-port-bindings gets a logger here https://opendev.org/openstack/neutron/src/branch/master/neutron/cmd/remove_duplicated_port_bindings.py#L27, which calls oslo.log which in turn calls Python's logging facility here: https://github.com/openstack/oslo.log/blob/master/oslo_log/log.py#L507. The default Python logging level is WARNING. So, yes, since the code logs at INFO level, nothing gets logged.

We should call https://opendev.org/openstack/neutron/src/branch/master/neutron/common/config.py#L111 to initialize logging, like in for example https://opendev.org/openstack/neutron/src/branch/master/neutron/cmd/netns_cleanup.py#L271. This calls oslo.log setup which sets logging level at INFO level by default: https://github.com/openstack/oslo.log/blob/master/oslo_log/log.py#L352

Changed in neutron:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Miguel Lavalle (minsel)
Revision history for this message
Christian Rohmann (christian-rohmann) wrote :

Is there any way to also allow for the dry run option to be given in the command line?
Currently this needs to be set via config file.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.