Skip to content

Commit

Permalink
Keep CPU architecture in short name (if non-x86). (#584)
Browse files Browse the repository at this point in the history
* Keep CPU architecture in short name (if non-x86).
* Flake8 happiness.
* Simplify the shortening of names.
  Do this by adding a contructor.
* I can't say that I love flake8 ...
* Use in ('i', 'z')

Signed-off-by: Kurt Garloff <[email protected]>
Co-authored-by: Matthias Büchse <[email protected]>
  • Loading branch information
garloff and mbuechse authored May 16, 2024
1 parent 4bea713 commit 0eea8b2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Tests/iaas/flavor-naming/flavor_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ class CPUBrand:
})
perf = TblAttr("Performance", {"": "Std Perf", "h": "High Perf", "hh": "Very High Perf", "hhh": "Very Very High Perf"})

def __init__(self, cpuvendor="i", cpugen=0, perf=""):
self.cpuvendor = cpuvendor
self.cpugen = cpugen
self.perf = perf


class GPU:
"""Class repesenting GPU support"""
Expand Down Expand Up @@ -234,6 +239,11 @@ def shorten(self):
"""return canonically shortened name as recommended in the standard"""
if self.hype is None and self.hwvirt is None and self.cpubrand is None:
return self
# For non-x86-64, don't strip out CPU brand for short name, as it contains the architecture
if self.cpubrand and self.cpubrand.cpuvendor not in ('i', 'z'):
return Flavorname(cpuram=self.cpuram, disk=self.disk,
cpubrand=CPUBrand(self.cpubrand.cpuvendor),
gpu=self.gpu, ib=self.ib)
return Flavorname(cpuram=self.cpuram, disk=self.disk, gpu=self.gpu, ib=self.ib)


Expand Down

0 comments on commit 0eea8b2

Please sign in to comment.