Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1145042 - The output of "/usr/libexec/qemu-kvm -M ?" should be ordered.
The output of "/usr/libexec/qemu-kvm -M ?" should be ordered.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.1
x86_64 Linux
low Severity low
: rc
: ---
Assigned To: Laszlo Ersek
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-22 05:12 EDT by huiqingding
Modified: 2015-03-05 04:55 EST (History)
7 users (show)

See Also:
Fixed In Version: qemu-kvm-rhev-2.1.2-7.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-05 04:55:59 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0624 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2015-03-05 09:37:36 EST

  None (edit)
Description huiqingding 2014-09-22 05:12:17 EDT
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:
Comment 2 Laszlo Ersek 2014-09-22 06:03:02 EDT
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.
Comment 3 Laszlo Ersek 2014-09-22 07:35:14 EDT
Posted upstream series
http://lists.nongnu.org/archive/html/qemu-devel/2014-09/msg04167.html
Comment 4 Laszlo Ersek 2014-09-22 18:02:55 EDT
Posted upstream v2
http://thread.gmane.org/gmane.comp.emulators.qemu/298434
Comment 5 Laszlo Ersek 2014-11-04 03:37:14 EST
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 \?
Comment 7 Miroslav Rezanina 2014-11-06 13:32:54 EST
Fix included in qemu-kvm-rhev-2.1.2-7.el7
Comment 9 huiqingding 2014-11-12 03:09:53 EST
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
Comment 10 huiqingding 2014-11-12 03:11:27 EST
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.
Comment 13 errata-xmlrpc 2015-03-05 04:55:59 EST
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

Note You need to log in before you can comment on or make changes to this bug.