The 'get_flags_by_flavor_specs' function is intended to return a list of
CPU flags extracted from flavor extra spec traits, the idea being that
you can request a specific CPU flag using traits. However, this looks
through every trait in the image and uses 'dict.get' to try figure out
if the trait is a CPU flag trait. 'dict.get' returns None if no match is
found, so we can end up returning 'set([None])'. This isn't false'y,
which means we end up calling '_match_cpu_model_by_flags' later on and
*that* fails because 'set([None])' won't be a subset of any CPU model's
set of flags (no CPU has a 'None' or null flag).
The solution is easy - don't add the None values.
Change-Id: I1468ad4b724b8d0e3a855c329bd8c8af513d986c
Signed-off-by: Stephen Finucane <email address hidden>
Closes-Bug: #1843836
Reviewed: https:/ /review. opendev. org/681932 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=6ec09de2435 fd849ba8123d587 cce34e1d8b5ec7
Committed: https:/
Submitter: Zuul
Branch: master
commit 6ec09de2435fd84 9ba8123d587cce3 4e1d8b5ec7
Author: Stephen Finucane <email address hidden>
Date: Thu Sep 12 20:57:15 2019 +0100
libvirt: Correctly handle non-CPU flag traits
The 'get_flags_ by_flavor_ specs' function is intended to return a list of cpu_model_ by_flags' later on and
CPU flags extracted from flavor extra spec traits, the idea being that
you can request a specific CPU flag using traits. However, this looks
through every trait in the image and uses 'dict.get' to try figure out
if the trait is a CPU flag trait. 'dict.get' returns None if no match is
found, so we can end up returning 'set([None])'. This isn't false'y,
which means we end up calling '_match_
*that* fails because 'set([None])' won't be a subset of any CPU model's
set of flags (no CPU has a 'None' or null flag).
The solution is easy - don't add the None values.
Change-Id: I1468ad4b724b8d 0e3a855c329bd8c 8af513d986c
Signed-off-by: Stephen Finucane <email address hidden>
Closes-Bug: #1843836