image-volume-cache options incorrectly default to None and prevent startup

Bug #1976465 reported by Trent Lloyd
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Cinder Pure Storage Charm
Fix Released
Undecided
Trent Lloyd

Bug Description

The following image-volume-cache options get written to the configuration file with a value of "None" by default which fails to parse and cinder-volume won't start.

image_volume_cache_max_size_gb = None
image_volume_cache_max_count = None

= Error Message =

2022-04-12 05:41:34.758 1194037 ERROR cinder.cmd.volume [req-UUID - - - - -] Volume service cinder-volume@cinder-purestorage failed to start.: oslo_config.cfg.ConfigFileValueError: Value for option image_volume_cache_max_size_gb from LocationInfo(location=<Locations.user: (4, True)>, detail='/etc/cinder/cinder.conf') is not valid: invalid literal for int() with base 10: 'None'
2022-04-12 05:41:34.758 1194037 ERROR cinder.cmd.volume ValueError: invalid literal for int() with base 10: 'None'

= Cause =

This occurs because the config.yaml defaults are Null and config.get returns a value of "None" in such a case.

In most cases this pattenr works because values are only rendered in a template if they pass an "if VARIABLE_NAME" test which fails if it is None. However in this case the values are sent via relation to charm-cinder which then iterates on the list and renders them directly to the file without checking for a value of None.

= Workaround =

You can explicitly configure the values to 0 (which is the upstream default) to workaround the issue:

juju config cinder-purestorage image-volume-cache-max-count=0 image-volume-cache-max-size-gb=0

Trent Lloyd (lathiat)
Changed in charm-cinder-purestorage:
assignee: nobody → Trent Lloyd (lathiat)
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-cinder-purestorage (master)
Changed in charm-cinder-purestorage:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-cinder-purestorage (master)

Reviewed: https://review.opendev.org/c/openstack/charm-cinder-purestorage/+/844256
Committed: https://opendev.org/openstack/charm-cinder-purestorage/commit/b3a5d3b35835d454224e5404b41a548f52322bed
Submitter: "Zuul (22348)"
Branch: master

commit b3a5d3b35835d454224e5404b41a548f52322bed
Author: Trent Lloyd <email address hidden>
Date: Wed Jun 1 15:46:39 2022 +0800

    Fix image-volume-cache configuration defaults

    The image_volume_cache_max_count and image_volume_cache_max_size_gb
    options were incorrectly being written to cinder.conf with a value of
    "None" when not configured.

    This occurred because config.get returns None for values with a null
    default, this value was being placed into a dictionary and sent over
    relation data to charm-cinder which renders it directly from a list of
    key-value pairs.

    Fix the handling of these options not to include them in the dictionary
    if they are None.

    Closes-Bug: #1976465
    Change-Id: I61781fa5d837d0ed5191d8a92cc8e0bdf600c08a

Changed in charm-cinder-purestorage:
status: In Progress → Fix Committed
Revision history for this message
Trent Lloyd (lathiat) wrote :

This fix has been cloned into all branches from stable/train through stable/zed (as well as master).

CharmHub migration seems complete for the charm but it has not yet been tested and released into a channel-per-release. That work is pending.

Revision history for this message
Trent Lloyd (lathiat) wrote :

This has now been released to the edge channel for all releases back to ussuri.

Changed in charm-cinder-purestorage:
status: Fix Committed → Fix Released
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.