Can't set "pointer_model = None" in nova.conf

Bug #1866106 reported by Albert Braden
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Low
melanie witt
oslo.config
Won't Fix
Undecided
Unassigned

Bug Description

Description
===========

nova.conf includes option pointer_model. The help text in the config has 2 "possible values" sections (copied below) specifying either "None" or "<None>" as correct values. Neither of these is accepted by Nova. Here are the error messages from nova-compute.log:

2020-03-03 11:05:17.233 228915 ERROR nova ConfigFileValueError: Value for option pointer_model is not valid: Valid values are [None, ps2mouse, usbtablet], but found '<None>'

2020-03-03 11:06:24.761 229290 ERROR nova ConfigFileValueError: Value for option pointer_model is not valid: Valid values are [None, ps2mouse, usbtablet], but found 'None'

#
# Generic property to specify the pointer type.
#
# Input devices allow interaction with a graphical framebuffer. For
# example to provide a graphic tablet for absolute cursor movement.
#
# If set, the 'hw_pointer_model' image property takes precedence over
# this configuration option.
#
# Possible values:
#
# * None: Uses default behavior provided by drivers (mouse on PS2 for
# libvirt x86)
# * ps2mouse: Uses relative movement. Mouse connected by PS2
# * usbtablet: Uses absolute movement. Tablet connect by USB
#
# Related options:
#
# * usbtablet must be configured with VNC enabled or SPICE enabled and SPICE
# agent disabled. When used with libvirt the instance mode should be
# configured as HVM.
# (string value)
# Possible values:
# <None> - <No description provided>
# ps2mouse - <No description provided>
# usbtablet - <No description provided>
#pointer_model = usbtablet

Steps to reproduce
==================

On an openstack hypervisor:
1. Edit nova.conf and change line "#pointer_model = usbtablet" to either "pointer_model = None" or "pointer_model = <None>"
2. Restart nova-compute service
3. Tail nova-compute.log

Expected result
===============

Nova runs without errors and does not load the USB driver.

Actual result
=============

Nova throws the error described above.

Environment
===========

1. Openstack version is Rocky:

root@us01odc-p01-hv227:~# dpkg -l | grep nova
ii nova-common 2:18.2.1-0ubuntu1~cloud4 all OpenStack Compute - common files
ii nova-compute 2:18.2.1-0ubuntu1~cloud4 all OpenStack Compute - compute node base
ii nova-compute-kvm 2:18.2.1-0ubuntu1~cloud4 all OpenStack Compute - compute node (KVM)
ii nova-compute-libvirt 2:18.2.1-0ubuntu1~cloud4 all OpenStack Compute - compute node libvirt support
ii python-nova 2:18.2.1-0ubuntu1~cloud4 all OpenStack Compute Python 2 libraries
ii python-novaclient 2:11.0.0-0ubuntu1~cloud0 all client library for OpenStack Compute API - Python 2.7

2. Hypervisor: libvirt+KVM

root@us01odc-p01-hv227:~# libvirtd --version
libvirtd (libvirt) 4.0.0

root@us01odc-p01-hv227:~# kvm --version
QEMU emulator version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.21)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

3. Storage type: local LVM

root@us01odc-p01-hv227:~# lvm version
  LVM version: 2.02.176(2) (2017-11-03)
  Library version: 1.02.145 (2017-11-03)
  Driver version: 4.39.0
  Configuration: ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --exec-prefix= --bindir=/bin --libdir=/lib/x86_64-linux-gnu --sbindir=/sbin --with-usrlibdir=/usr/lib/x86_64-linux-gnu --with-optimisation=-O2 --with-cache=internal --with-clvmd=corosync --with-cluster=internal --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --with-default-pid-dir=/run --with-default-run-dir=/run/lvm --with-default-locking-dir=/run/lock/lvm --with-thin=internal --with-thin-check=/usr/sbin/thin_check --with-thin-dump=/usr/sbin/thin_dump --with-thin-repair=/usr/sbin/thin_repair --enable-applib --enable-blkid_wiping --enable-cmdlib --enable-cmirrord --enable-dmeventd --enable-dbus-service --enable-lvmetad --enable-lvmlockd-dlm --enable-lvmlockd-sanlock --enable-lvmpolld --enable-notify-dbus --enable-pkgconfig --enable-readline --enable-udev_rules --enable-udev_sync

3. Networking: neutron

Logs & Configs
==============

nova-compute.log:
2020-03-04 10:48:34.774 116036 ERROR nova
2020-03-04 10:48:36.616 116046 INFO os_vif [-] Loaded VIF plugins: ovs, linux_bridge
2020-03-04 10:48:36.688 116046 WARNING oslo_config.cfg [req-20c7f0dd-706b-41fa-b374-0b264184c2c4 - - - - -] Deprecated: Option "use_neutron" from group "DEFAULT" is deprecated for removal (
nova-network is deprecated, as are any related configuration options.
). Its value may be silently ignored in the future.
2020-03-04 10:48:36.703 116046 WARNING oslo_config.cfg [req-20c7f0dd-706b-41fa-b374-0b264184c2c4 - - - - -] Deprecated: Option "enable" from group "cells" is deprecated for removal (Cells v1 is being replaced with Cells v2.). Its value may be silently ignored in the future.
2020-03-04 10:48:36.721 116046 INFO nova.virt.driver [req-20c7f0dd-706b-41fa-b374-0b264184c2c4 - - - - -] Loading compute driver 'libvirt.LibvirtDriver'
2020-03-04 10:48:36.779 116046 WARNING oslo_config.cfg [req-20c7f0dd-706b-41fa-b374-0b264184c2c4 - - - - -] Deprecated: Option "firewall_driver" from group "DEFAULT" is deprecated for removal (
nova-network is deprecated, as are any related configuration options.
). Its value may be silently ignored in the future.
2020-03-04 10:48:36.783 116046 WARNING os_brick.initiator.connectors.remotefs [req-20c7f0dd-706b-41fa-b374-0b264184c2c4 - - - - -] Connection details not present. RemoteFsClient may not initialize properly.
2020-03-04 10:48:36.786 116046 CRITICAL nova [req-20c7f0dd-706b-41fa-b374-0b264184c2c4 - - - - -] Unhandled error: ConfigFileValueError: Value for option pointer_model is not valid: Valid values are [None, ps2mouse, usbtablet], but found 'None'
2020-03-04 10:48:36.786 116046 ERROR nova Traceback (most recent call last):
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/bin/nova-compute", line 10, in <module>
2020-03-04 10:48:36.786 116046 ERROR nova sys.exit(main())
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/nova/cmd/compute.py", line 59, in main
2020-03-04 10:48:36.786 116046 ERROR nova service.wait()
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/nova/service.py", line 460, in wait
2020-03-04 10:48:36.786 116046 ERROR nova _launcher.wait()
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/oslo_service/service.py", line 392, in wait
2020-03-04 10:48:36.786 116046 ERROR nova status, signo = self._wait_for_exit_or_signal()
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/oslo_service/service.py", line 367, in _wait_for_exit_or_signal
2020-03-04 10:48:36.786 116046 ERROR nova self.conf.log_opt_values(LOG, logging.DEBUG)
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/oslo_config/cfg.py", line 3020, in log_opt_values
2020-03-04 10:48:36.786 116046 ERROR nova _sanitize(opt, getattr(self, opt_name)))
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/oslo_config/cfg.py", line 2636, in __getattr__
2020-03-04 10:48:36.786 116046 ERROR nova return self._get(name)
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/oslo_config/cfg.py", line 3070, in _get
2020-03-04 10:48:36.786 116046 ERROR nova value, loc = self._do_get(name, group, namespace)
2020-03-04 10:48:36.786 116046 ERROR nova File "/usr/lib/python2.7/dist-packages/oslo_config/cfg.py", line 3120, in _do_get
2020-03-04 10:48:36.786 116046 ERROR nova % (opt.name, str(ve)))
2020-03-04 10:48:36.786 116046 ERROR nova ConfigFileValueError: Value for option pointer_model is not valid: Valid values are [None, ps2mouse, usbtablet], but found 'None'
2020-03-04 10:48:36.786 116046 ERROR nova

nova.conf:

root@us01odc-p01-hv227:~# cat /etc/nova/nova.conf|grep -v ^#|grep -v ^$
[DEFAULT]
lock_path = /var/lock/nova
state_path = /var/lib/nova
default_ephemeral_format = ext3
reserved_host_disk_mb = 62914
reserved_host_memory_mb = 16384
reserved_host_cpus = 2
cpu_allocation_ratio = 1.0
ram_allocation_ratio = 1.0
my_ip = 10.195.50.242
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver
debug = false
verbose = false
transport_url = rabbit://openstack:<pwd>@us01odc-p01-ctrl1.internal.synopsys.com,openstack:<pwd>@us01odc-p01-ctrl2.internal.synopsys.com,openstack:<pwd>@us01odc-p01-ctrl3.internal.synopsys.com
auth_strategy = keystone
[api]
auth_strategy = keystone
[api_database]
connection = sqlite:////var/lib/nova/nova_api.sqlite
[barbican]
[cache]
[cells]
enable = False
[cinder]
[compute]
[conductor]
[console]
[consoleauth]
[cors]
[database]
connection = sqlite:////var/lib/nova/nova.sqlite
[devices]
[ephemeral_storage_encryption]
[filter_scheduler]
[glance]
api_server = http://us01odc-p01-lb.internal.synopsys.com:9292
[guestfs]
[healthcheck]
[hyperv]
[ironic]
[key_manager]
[keystone]
[keystone_authtoken]
auth_url = http://us01odc-p01-lb.internal.synopsys.com:5001/v3
memcached_servers = us01odc-p01-ctrl1.internal.synopsys.com:11211,us01odc-p01-ctrl2.internal.synopsys.com:11211,us01odc-p01-ctrl3.internal.synopsys.com:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = <pwd>
[libvirt]
virt_type = kvm
cpu_mode = host-passthrough
[matchmaker_redis]
[metrics]
[mks]
[neutron]
url = http://us01odc-p01-lb.internal.synopsys.com:29696
service_metadata_proxy = True
metadata_proxy_shared_secret = <pwd>
auth_type = password
auth_url = http://us01odc-p01-lb.internal.synopsys.com:5001/v3
project_name = service
project_domain_name = default
username = neutron
user_domain_name = default
password = <pwd>
region_name = us01-p01
[notifications]
[osapi_v21]
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_messaging_zmq]
[oslo_middleware]
[oslo_policy]
[pci]
[placement]
os_region_name = openstack
auth_type = password
auth_url = http://us01odc-p01-lb.internal.synopsys.com:5001/v3
project_name = service
project_domain_name = Default
username = placement
user_domain_name = Default
password = <pwd>
region_name = us01-p01
[placement_database]
[powervm]
[profiler]
[quota]
[rdp]
[remote_debug]
[scheduler]
[serial_console]
[service_user]
[spice]
[upgrade_levels]
[vault]
[vendordata_dynamic_auth]
[vmware]
[vnc]
enabled = True
server_listen = 0.0.0.0
server_proxyclient_address = 10.195.50.242
novncproxy_base_url = http://us01odc-p01-lb.internal.synopsys.com:16080/vnc_auto.html
[workarounds]
[wsgi]
[xenserver]
[xvp]
[zvm]

Tags: config libvirt
Revision history for this message
melanie witt (melwitt) wrote :

This looks valid to me. When someone tries to set None in the config file, the StrOpt appears to be unable to treat it as anything other than a string. So the true None will not match the string 'None'.

I see several other examples under nova/conf/ especially in nova/conf/libvirt.py where a None choice is represented as 'none' likely for this reason.

We will need to change the current None choice to be 'none' and handle it accordingly in the code.

Changed in nova:
assignee: nobody → melanie witt (melwitt)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Matt Riedemann (mriedem) wrote :

The problem is in oslo.config I think right here:

https://github.com/openstack/oslo.config/blob/20a7cee3e3019d60c4b367bb76922a1db41d1750/oslo_config/types.py#L142

That's coercing the value None to a string 'None' so it fails. According to Ben Nemec:

(02:13:48 PM) bnemec: The only way for a config opt to have a None value is for that to be the default and for the opt to be unset.
(02:14:14 PM) bnemec: So completely absent from the file, not something like "opt="

But that seems like a bug because I would think that code could be smarter about not coercing the value if the value is None, None is a valid choice and a default is set (so you need to override the default).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/711315

Changed in nova:
status: Confirmed → In Progress
Matt Riedemann (mriedem)
Changed in oslo.config:
status: New → Won't Fix
tags: added: config libvirt
Revision history for this message
Albert Braden (ozzzo) wrote :

Can we fix the comment text in nova.conf to correctly show the 2 options?

Existing text in Rocky:

#
# Generic property to specify the pointer type.
#
# Input devices allow interaction with a graphical framebuffer. For
# example to provide a graphic tablet for absolute cursor movement.
#
# If set, the 'hw_pointer_model' image property takes precedence over
# this configuration option.
#
# Possible values:
#
# * None: Uses default behavior provided by drivers (mouse on PS2 for
# libvirt x86)
# * ps2mouse: Uses relative movement. Mouse connected by PS2
# * usbtablet: Uses absolute movement. Tablet connect by USB
#
# Related options:
#
# * usbtablet must be configured with VNC enabled or SPICE enabled and SPICE
# agent disabled. When used with libvirt the instance mode should be
# configured as HVM.
# (string value)
# Possible values:
# <None> - <No description provided>
# ps2mouse - <No description provided>
# usbtablet - <No description provided>
#pointer_model = usbtablet

Proposed text:

#
# Generic property to specify the pointer type.
#
# Input devices allow interaction with a graphical framebuffer. For
# example to provide a graphic tablet for absolute cursor movement.
#
# If set, the 'hw_pointer_model' image property takes precedence over
# this configuration option.
#
# Possible values:
#
# * ps2mouse: Uses default behavior provided by drivers (mouse on PS2 for
# libvirt x86)
# * usbtablet: Uses absolute movement. Tablet connect by USB
#pointer_model = usbtablet

Revision history for this message
melanie witt (melwitt) wrote :

Yeah ... I'm trying to think what to do here because this CONF.pointer_model option is supposed to be available for all virt drivers ... it's just only used in the libvirt driver.

Maybe it should have been defined strictly under CONF.libvirt.pointer_model, then it would be more straightforward what to do with it.

If None worked, None and ps2mouse are doing the same thing today, they're exposing the default behavior. You're not actually "choosing" anything when you choose 'ps2mouse'. So I think that's misleading too.

So ... the easiest thing would be to use the proposed patch as-is, to simply fix the treatment of the intended None choice. That would punt the misleading nature of the options.

But if we re-evaluate all the choices, it seems to me the most valid/straightforward choices would be something like: 'usbtablet' and 'default', where 'default' uses default behavior.

I could update my patch to add a deprecation note for 'ps2mouse' and add 'default' to replace it, and then remove the broken None option altogether.

Revision history for this message
melanie witt (melwitt) wrote :

The more I think about the deprecation and removal path, the more I question whether users would find value in the choice name accurately conveying the meaning. For now maybe the best step is to do as you suggested and just remove the None choice and update the ps2mouse choice to accurately describe what it does in the config help.

Revision history for this message
melanie witt (melwitt) wrote :

Downgrading this to Low because the intended None option would not have done anything different than the already existing ps2mouse option.

Changed in nova:
importance: Medium → Low
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.