Red Hat Bugzilla – Bug 1145042
The output of "/usr/libexec/qemu-kvm -M ?" should be ordered.
Last modified: 2015-03-05 04:55:59 EST
Description of problem: The output of "/usr/libexec/qemu-kvm -M ?" should be ordered. Version-Release number of selected component (if applicable): kernel-3.10.0-163.el7.x86_64 qemu-kvm-rhev-2.1.0-4.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. # /usr/libexec/qemu-kvm -M ? 2. 3. Actual results: # /usr/libexec/qemu-kvm -M ? Supported machines are: rhel6.0.0 RHEL 6.0.0 PC rhel6.5.0 RHEL 6.5.0 PC rhel6.1.0 RHEL 6.1.0 PC rhel6.2.0 RHEL 6.2.0 PC pc-i440fx-rhel7.0.0 RHEL 7.0.0 PC (i440FX + PIIX, 1996) q35 RHEL-7.1.0 PC (Q35 + ICH9, 2009) (alias of pc-q35-rhel7.1.0) pc-q35-rhel7.1.0 RHEL-7.1.0 PC (Q35 + ICH9, 2009) rhel6.3.0 RHEL 6.3.0 PC none empty machine pc RHEL 7.1.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.1.0) pc-i440fx-rhel7.1.0 RHEL 7.1.0 PC (i440FX + PIIX, 1996) (default) pc-q35-rhel7.0.0 RHEL-7.0.0 PC (Q35 + ICH9, 2009) rhel6.4.0 RHEL 6.4.0 PC Expected results: The output info should be ordered. # /usr/libexec/qemu-kvm -M ? Supported machines are: pc RHEL 7.1.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.1.0) pc-i440fx-rhel7.1.0 RHEL 7.1.0 PC (i440FX + PIIX, 1996) (default) pc-i440fx-rhel7.0.0 RHEL 7.0.0 PC (i440FX + PIIX, 1996) rhel6.5.0 RHEL 6.5.0 PC rhel6.4.0 RHEL 6.4.0 PC rhel6.3.0 RHEL 6.3.0 PC rhel6.2.0 RHEL 6.2.0 PC rhel6.1.0 RHEL 6.1.0 PC rhel6.0.0 RHEL 6.0.0 PC q35 RHEL-7.1.0 PC (Q35 + ICH9, 2009) (alias of pc-q35-rhel7.1.0) pc-q35-rhel7.1.0 RHEL-7.1.0 PC (Q35 + ICH9, 2009) pc-q35-rhel7.0.0 RHEL-7.0.0 PC (Q35 + ICH9, 2009) Additional info:
Not sure if we should care about the ordering. If we should, then it was most likely broken in commit 261747f176f6f2d88f8268aaebfdd1a1afe887e2 Author: Marcel Apfelbaum <marcel.a@redhat.com> Date: Wed Mar 5 19:30:46 2014 +0200 vl: Use MachineClass instead of global QEMUMachine list The machine registration flow is refactored to use the QOM functionality. Instead of linking the machines into a list, each machine has a type and the types can be traversed in the QOM way. Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Before this commit, a new machine type was always appended to the end of a list at registration. After the commit, the machine type is registered with type_register(), which calls g_hash_table_insert() internally. Hash tables don't keep or provide ordering. The list of supported machine types is printed by machine_parse(), which was rebased from traversing the permanent list to traversing an ad-hoc list retrieved with object_class_get_list(TYPE_MACHINE, false). This function uses g_hash_table_foreach() internally, which doesn't provide ordering. If the order is significant, then machine_parse() should sort the list before printing it.
Posted upstream series http://lists.nongnu.org/archive/html/qemu-devel/2014-09/msg04167.html
Posted upstream v2 http://thread.gmane.org/gmane.comp.emulators.qemu/298434
Upstream commits to backport: 1 2709f26 well-defined listing order for machine types 2 562542b i386/pc: add piix and q35 machtypes to sorting families for -M \?
Fix included in qemu-kvm-rhev-2.1.2-7.el7
Reproduce this issue using the following version: qemu-kvm-rhev-2.1.2-5.el7.x86_64 Steps to Reproduce: 1. # /usr/libexec/qemu-kvm -M ? Supported machines are: rhel6.0.0 RHEL 6.0.0 PC rhel6.5.0 RHEL 6.5.0 PC rhel6.1.0 RHEL 6.1.0 PC rhel6.2.0 RHEL 6.2.0 PC pc-i440fx-rhel7.0.0 RHEL 7.0.0 PC (i440FX + PIIX, 1996) q35 RHEL-7.1.0 PC (Q35 + ICH9, 2009) (alias of pc-q35-rhel7.1.0) pc-q35-rhel7.1.0 RHEL-7.1.0 PC (Q35 + ICH9, 2009) rhel6.3.0 RHEL 6.3.0 PC none empty machine pc RHEL 7.1.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.1.0) pc-i440fx-rhel7.1.0 RHEL 7.1.0 PC (i440FX + PIIX, 1996) (default) pc-q35-rhel7.0.0 RHEL-7.0.0 PC (Q35 + ICH9, 2009) rhel6.4.0 RHEL 6.4.0 PC
Verify this issue using the following version: qemu-kvm-rhev-2.1.2-7.el7.x86_64 Steps to Verify: 1. # /usr/libexec/qemu-kvm -M ? Supported machines are: pc RHEL 7.1.0 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-rhel7.1.0) pc-i440fx-rhel7.1.0 RHEL 7.1.0 PC (i440FX + PIIX, 1996) (default) pc-i440fx-rhel7.0.0 RHEL 7.0.0 PC (i440FX + PIIX, 1996) rhel6.5.0 RHEL 6.5.0 PC rhel6.4.0 RHEL 6.4.0 PC rhel6.3.0 RHEL 6.3.0 PC rhel6.2.0 RHEL 6.2.0 PC rhel6.1.0 RHEL 6.1.0 PC rhel6.0.0 RHEL 6.0.0 PC q35 RHEL-7.1.0 PC (Q35 + ICH9, 2009) (alias of pc-q35-rhel7.1.0) pc-q35-rhel7.1.0 RHEL-7.1.0 PC (Q35 + ICH9, 2009) pc-q35-rhel7.0.0 RHEL-7.0.0 PC (Q35 + ICH9, 2009) none empty machine The above output is ordered, so this bug has been fixed.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-0624.html