If hypervisor_properties or resource_properties are set to empty strings
by the API client, they are persisted as empty strings in the database.
However, in convert_requirements(), the code assumes they are JSON
strings and tries to parse them, which raises a MalformedRequirements
exception.
This can be triggered by an operator when updating an extra capability
on a node that is reserved with resource_properties set to an empty
string, as is_updatable_extra_capability() calls convert_requirements().
Blazar would return a 400 Client Error to them.
Ideally, only valid JSON should be persisted to the database. However,
this will require an Alembic migration to change existing empty strings
to empty JSON arrays. In the meantime, this simpler patch can be
backported to stable branches.
Reviewed: https:/ /review. openstack. org/602173 /git.openstack. org/cgit/ openstack/ blazar/ commit/ ?id=77c1a2b6837 16482cc8f64bfc3 ca47708802e2f6
Committed: https:/
Submitter: Zuul
Branch: master
commit 77c1a2b68371648 2cc8f64bfc3ca47 708802e2f6
Author: Pierre Riteau <email address hidden>
Date: Thu Sep 13 11:35:55 2018 -0600
Handle requirements set to empty strings
If hypervisor_ properties or resource_properties are set to empty strings requirements( ), the code assumes they are JSON ements
by the API client, they are persisted as empty strings in the database.
However, in convert_
strings and tries to parse them, which raises a MalformedRequir
exception.
This can be triggered by an operator when updating an extra capability extra_capabilit y() calls convert_ requirements( ).
on a node that is reserved with resource_properties set to an empty
string, as is_updatable_
Blazar would return a 400 Client Error to them.
Ideally, only valid JSON should be persisted to the database. However,
this will require an Alembic migration to change existing empty strings
to empty JSON arrays. In the meantime, this simpler patch can be
backported to stable branches.
Change-Id: Ic6d18418a2515c d37bbeed25ee3ab 8c360624ca3
Closes-Bug: #1792245