Bug 1145042 - The output of "/usr/libexec/qemu-kvm -M ?" should be ordered.
Summary: The output of "/usr/libexec/qemu-kvm -M ?" should be ordered.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.1
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Laszlo Ersek
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-22 09:12 UTC by huiqingding
Modified: 2015-03-05 09:55 UTC (History)
7 users (show)

Fixed In Version: qemu-kvm-rhev-2.1.2-7.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 09:55:59 UTC


Attachments (Terms of Use)


Links
System 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 14:37:36 UTC

Description huiqingding 2014-09-22 09:12:17 UTC
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 10:03:02 UTC
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 11:35:14 UTC
Posted upstream series
http://lists.nongnu.org/archive/html/qemu-devel/2014-09/msg04167.html

Comment 4 Laszlo Ersek 2014-09-22 22:02:55 UTC
Posted upstream v2
http://thread.gmane.org/gmane.comp.emulators.qemu/298434

Comment 5 Laszlo Ersek 2014-11-04 08:37:14 UTC
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 18:32:54 UTC
Fix included in qemu-kvm-rhev-2.1.2-7.el7

Comment 9 huiqingding 2014-11-12 08:09:53 UTC
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 08:11:27 UTC
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 09:55:59 UTC
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.