Fix configuration options

When fixing bug #1854188 (Change-ID:
I62e992804a3ae6aa0b4aa4f883807783197d4b33) we broke configuration
options, because now we cannot pass configuration options from the
DEFAULT section, and some ListOpt don't work because cinderlib was
incorrectly expecting all these options to have bounds=True, but some
don't define it and default to False.

Most of the "crazy" code we currently have around oslo config is because
we wanted to support drivers that add configuration options on runtime
and reload the configuration.

This made sense when cinderlib was not an OpenStack official project,
but now that it is it makes more sense to force Cinder drivers to do the
right thing.

Aligned with this, this patch removes all the faking of the cinder.conf
file as a StringIO object, and simply sets things in the configuration
object that is passed to the drivers, which is the only thing they
should be using.

This will make cinderlib code more robust, even if some drivers will now
need to be modified to work with cinderlib.

We are validating known configuration options and ignoring unknown ones,
like Cinder does.

The NetApp driver was one of the drivers that would get broken, but
since I have access to it and we can make a very small and targeted
workaround to avoid breaking it, we do it as well.

Closes-Bug: #1856556
Change-Id: I67fbf8e9d7ee79f3d6617b4d0ae755dae0e1987a
This commit is contained in:
Gorka Eguileor
2019-12-18 17:48:16 +01:00
parent d81fbeb3a9
commit fbd7a72c1b
3 changed files with 134 additions and 280 deletions

View File

@@ -223,12 +223,12 @@ VMAX
hpe3par_api_url: https://w.x.y.z:8080/api/v1
hpe3par_username: user
hpe3par_password: toomanysecrets
hpe3par_cpg: CPG_name
hpe3par_cpg: [CPG_name]
san_ip: w.x.y.z
san_login: user
san_password: toomanysecrets
volume_driver: cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver
hpe3par_iscsi_ips: w.x.y2.z2,w.x.y2.z3,w.x.y2.z4,w.x.y2.z4
hpe3par_iscsi_ips: [w.x.y2.z2,w.x.y2.z3,w.x.y2.z4,w.x.y2.z4]
hpe3par_debug: false
hpe3par_iscsi_chap_enabled: false
hpe3par_snapshot_retention: 0