The original code created a new list which had True/False items. The only case where the returned value would be False is for empty list which never happens in real environment. Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- .../compare/virt-install-cpu-rhel7-default.xml | 12 ++++++++++-- virtinst/domcapabilities.py | 8 +++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/cli-test-xml/compare/virt-install-cpu-rhel7-default.xml b/tests/cli-test-xml/compare/virt-install-cpu-rhel7-default.xml index 04a49f41..c471233c 100644 --- a/tests/cli-test-xml/compare/virt-install-cpu-rhel7-default.xml +++ b/tests/cli-test-xml/compare/virt-install-cpu-rhel7-default.xml @@ -12,7 +12,11 @@ <acpi/> <apic/> </features> - <cpu mode="host-model"/> + <cpu mode="custom" match="exact"> + <model>Skylake-Client-IBRS</model> + <feature policy="require" name="spec-ctrl"/> + <feature policy="require" name="ssbd"/> + </cpu> <clock offset="utc"> <timer name="rtc" tickpolicy="catchup"/> <timer name="pit" tickpolicy="delay"/> @@ -57,7 +61,11 @@ <acpi/> <apic/> </features> - <cpu mode="host-model"/> + <cpu mode="custom" match="exact"> + <model>Skylake-Client-IBRS</model> + <feature policy="require" name="spec-ctrl"/> + <feature policy="require" name="ssbd"/> + </cpu> <clock offset="utc"> <timer name="rtc" tickpolicy="catchup"/> <timer name="pit" tickpolicy="delay"/> diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py index 922a4c21..8993822e 100644 --- a/virtinst/domcapabilities.py +++ b/virtinst/domcapabilities.py @@ -233,9 +233,11 @@ class DomainCapabilities(XMLBuilder): host-model infact predates this support, however it wasn't general purpose safe prior to domcaps advertisement. """ - return [(m.name == "host-model" and m.supported and - m.models[0].fallback == "forbid") - for m in self.cpu.modes] + for m in self.cpu.modes: + if (m.name == "host-model" and m.supported and + m.models[0].fallback == "forbid"): + return True + return False def get_cpu_models(self): models = [] -- 2.20.1 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list