yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #96368
[Bug 2096341] Re: 'nova-manage image_property set' does not work with traits
Reviewed: https://review.opendev.org/c/openstack/nova/+/946733
Committed: https://opendev.org/openstack/nova/commit/19f206f58c7c49cb148d1801364c46401d1737fb
Submitter: "Zuul (22348)"
Branch: master
commit 19f206f58c7c49cb148d1801364c46401d1737fb
Author: Rajesh Tailor <ratailor@xxxxxxxxxx>
Date: Wed Apr 9 11:39:27 2025 +0530
Fix 'nova-manage image_property set' command
As of now, if operator wants to set traits using 'nova-manage
image_property set' command, it fails with below error, because
in ImageMetaProps traits are not stored as individual fields, but
stored in 'traits_required' field which is of type list.
'Invalid image property name trait:CUSTOM_XYZ'
The setting of traits are handled by _set_attr_from_trait_names
method here [1].
This change handles the issue by continue the loop, if the
property startswith 'traits' string.
[1] https://opendev.org/openstack/nova/src/commit/725a307693806e6e32834198e23be75f771bebc1/nova/objects/image_meta.py#L708-L714
Closes-Bug: #2096341
Change-Id: Ifc20894801f723627726e3c9bed7076144542660
Signed-off-by: Rajesh Tailor <ratailor@xxxxxxxxxx>
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/2096341
Title:
'nova-manage image_property set' does not work with traits
Status in OpenStack Compute (nova):
Fix Released
Bug description:
Originally reported downstream [1]:
This was reported in the Compute DFG channel – the `nova-manage
image_property set` command is not working properly with compute
traits, for example:
# nova-manage image_property set 07e35fd5-0a83-4216-bcdd-64a1e51da767 --property trait:CUSTOM_WINDOWS_HOST='required'
Invalid image property name trait:CUSTOM_WINDOWS_HOST.
# nova-manage image_property set 07e35fd5-0a83-4216-bcdd-64a1e51da767 --property CUSTOM_WINDOWS_HOST=required
Invalid image property name CUSTOM_WINDOWS_HOST.
The problem was tracked down to some code intended for property name validation [2]:
# Validate the names of each property by checking against the o.vo
# fields currently listed by ImageProps. We can't use from_dict to
# do this as it silently ignores invalid property keys.
for image_property_name in image_properties.keys():
if image_property_name not in objects.ImageMetaProps.fields:
raise exception.InvalidImagePropertyName(
image_property_name=image_property_name)
This fails for traits because in the ImageMetaProps object traits are
stored in a list field [3] and will thus not be found as individual
fields that match the names of traits:
# The required traits associated with the image. Traits are expected to
# be defined as starting with `trait:` like below:
# trait:HW_CPU_X86_AVX2=required
# for trait in image_meta.traits_required:
# will yield trait strings such as 'HW_CPU_X86_AVX2'
'traits_required': fields.ListOfStringsField(),
The ImageMetaProps object already handles adding traits from a dict
representation of image properties to the internal "traits_required"
list, so it appears that to fix it, the validation code needs to
simply continue/ignore image property names that begin with "trait:".
[1] https://issues.redhat.com/browse/OSPRH-13327
[2] https://github.com/openstack/nova/blob/6f537e756bdcaa1d86a629940abf3775b3d56c80/nova/cmd/manage.py#L3335-L3341
[3] https://github.com/openstack/nova/blob/6f537e756bdcaa1d86a629940abf3775b3d56c80/nova/objects/image_meta.py#L614
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/2096341/+subscriptions
References