1212HW_DISK_BUSES = ("virtio" , "scsi" , None ) # FIXME why None?
1313HYPERVISOR_TYPES = ("qemu" , "kvm" , "xen" , "hyper-v" , "esxi" , None )
1414HW_RNG_MODELS = ("virtio" , None )
15- # Just for nice formatting of image naming hints -- otherwise we capitalize the 1st letter
16- OS_LIST = ("CentOS" , "AlmaLinux" , "Windows Server" , "RHEL" , "SLES" , "openSUSE" )
15+ OS_PURPOSES = ("generic" , "minimal" , "k8snode" , "gpu" , "network" , "custom" )
1716# Auxiliary mapping for `freq2secs` (note that values are rounded up a bit on purpose)
1817FREQ_TO_SEC = {
1918 "never" : 0 ,
3130KIB , MIB , GIB = (1024 ** n for n in (1 , 2 , 3 ))
3231
3332
34- def recommended_name (nm , os_list = OS_LIST ):
35- """Return capitalized name"""
36- for osnm in os_list :
37- osln = len (osnm )
38- if nm [:osln ].casefold () == osnm .casefold ():
39- return osnm + nm [osln :]
40- return nm [0 ].upper () + nm [1 :]
41-
42-
4333def is_url (stg ):
4434 """Is string stg a URL?"""
4535 idx = stg .find ("://" )
@@ -156,6 +146,7 @@ def compute_scs_0102_prop_os_version(images):
156146 # NOTE currently we are content when the property is not empty, but we could be more strict,
157147 # because the standard was recently edited to refer to the OpenStack docs, which prescribe
158148 # certain values for common operating systems.
149+ # - os_version not matching regexp r'[0-9\.]*' (should be a numeric version no)
159150 offenders = [img for img in images if not img .os_version ]
160151 _log_error ('property os_version not set' , offenders )
161152 return not offenders
@@ -164,11 +155,20 @@ def compute_scs_0102_prop_os_version(images):
164155def compute_scs_0102_prop_os_distro (images ):
165156 """This test ensures that each image has a proper value for the property `os_distro`."""
166157 # NOTE see note in `compute_scs_0102_prop_os_version`
158+ # - os_distro not being all-lowercase (they all should be acc. to
159+ # https://docs.openstack.org/glance/2025.1/admin/useful-image-properties.html
167160 offenders = [img for img in images if not img .os_distro ]
168161 _log_error ('property os_distro not set' , offenders )
169162 return not offenders
170163
171164
165+ def compute_scs_0102_prop_os_purpose (images , os_purposes = OS_PURPOSES ):
166+ """This test ensures that each image has a proper value for the property `os_distro`."""
167+ offenders = [img for img in images if img .properties .get ('os_purpose' ) not in os_purposes ]
168+ _log_error ('property os_purpose not set or not correct' , offenders )
169+ return not offenders
170+
171+
172172def compute_scs_0102_prop_hw_disk_bus (images , hw_disk_buses = HW_DISK_BUSES ):
173173 """This test ensures that each image has a proper value for the property `hw_disk_bus`."""
174174 offenders = [img for img in images if img .hw_disk_bus not in hw_disk_buses ]
0 commit comments