osdict: Fix get_recommended_resources minimum logic
If an OS has a <minimum> resources section, and a <recommended> resources section, but there's a field in the former that isn't in the latter, currently we throw out the former field entirely. This is the case for n-cpus for a few OS. Instead we should be using the <minimum> ncpus value. This changes the default <vcpu> value for a quite a few test cases.
This commit is contained in:
parent
9199c2d157
commit
4238e3f7d7
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="aarch64" machine="virt">hvm</type>
|
||||
<loader readonly="yes" type="pflash">/usr/share/AAVMF/AAVMF_CODE.fd</loader>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="aarch64" machine="virt">hvm</type>
|
||||
<loader readonly="yes" type="pflash">/usr/share/AAVMF/AAVMF_CODE.fd</loader>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="aarch64" machine="virt">hvm</type>
|
||||
<loader readonly="yes" type="pflash">/usr/share/AAVMF/AAVMF_CODE.fd</loader>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="cdrom"/>
|
||||
|
@ -88,7 +88,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64">exe</type>
|
||||
<init>/bin/sh</init>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<boot dev="network"/>
|
||||
|
@ -76,7 +76,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="network"/>
|
||||
|
@ -78,7 +78,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="network"/>
|
||||
|
@ -82,7 +82,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="network"/>
|
||||
|
@ -76,7 +76,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="cdrom"/>
|
||||
|
@ -78,7 +78,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
|
@ -86,7 +86,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="ppc64le" machine="pseries">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="ppc64le" machine="pseries">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="s390x" machine="s390-ccw-virtio">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="s390x" machine="s390-ccw-virtio">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>1048576</memory>
|
||||
<currentMemory>1048576</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="xenpv">xen</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
|
@ -41,7 +41,7 @@
|
|||
</metadata>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="xenpv">xen</type>
|
||||
<boot dev="hd"/>
|
||||
|
|
|
@ -476,9 +476,17 @@ class _OsVariant(object):
|
|||
storage_scale = minimum and 2 or 1
|
||||
for r in _OsinfoIter(resources):
|
||||
if r.get_architecture() == arch:
|
||||
ret["ram"] = r.get_ram() * ram_scale
|
||||
ret["n-cpus"] = r.get_n_cpus() * n_cpus_scale
|
||||
ret["storage"] = r.get_storage() * storage_scale
|
||||
ram = r.get_ram()
|
||||
if ram > 0:
|
||||
ret["ram"] = ram * ram_scale
|
||||
|
||||
ncpus = r.get_n_cpus()
|
||||
if ncpus > 0:
|
||||
ret["n-cpus"] = r.get_n_cpus() * n_cpus_scale
|
||||
|
||||
storage = r.get_storage()
|
||||
if storage > 0:
|
||||
ret["storage"] = storage * storage_scale
|
||||
break
|
||||
|
||||
# libosinfo may miss the recommended resources block for some OS,
|
||||
|
|
Loading…
Reference in New Issue