Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1247066

Summary: Suggest to put "uuid" ahead of "guests" when print the host/guests association in JSON format to stdout
Product: Red Hat Enterprise Linux 7 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: xingge <gxing>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: gxing, hsun, ldai, ovasik, sgao
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: virt-who-0.14-3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:57:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Liushihui 2015-07-27 09:19:07 UTC
Description of problem:
When print the host/guests association in JSON format to stdout(virt-who -p), I suggest to put host's "uuid"  ahead of "guests" since it's the key attribute.

Version-Release number of selected component (if applicable):
virt-who-0.14-2.el7.noarch
subscription-manager-1.15.6-1.el7.x86_64
python-rhsm-1.15.3-1.el7.x86_64
Satellite-6.1.0-RHEL-7-20150721.7

How reproducible:
Always

Steps to Reproduce:
1.Register system to satellite
2.Print the host/guests association in JSON format to stdout.
[root@hp-z220-06 virt-who.d]# virt-who --esx --esx-owner=ACME_Corporation --esx-env=Library --esx-server=10.66.79.57 --esx-username=Administrator --esx-password=qwer1234P! -p -d > /root/ddd
2015-07-27 15:27:39,998 INFO: Using configuration "env/cmdline" ("esx" mode)
2015-07-27 15:27:40,028 DEBUG: Log into ESX
2015-07-27 15:27:40,661 DEBUG: Creating ESX event filter
2015-07-27 15:27:40,747 DEBUG: Association for config env/cmdline gathered
2015-07-27 15:27:40,748 DEBUG: Associations found: {
    "hypervisors": [
        {
            "guests": [
                {
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "esx"
                    }, 
                    "guestId": "564dab7d-3b72-51a1-eeda-586036106892", 
                    "state": 5
                }, 
            ], 
            "uuid": "aee4ff00-8c33-11e2-994a-6c3be51d959a"
        },
    ]
}

Actual results:
Host's "uuid" behind of the "guests" since host uuid is the key attribute.

Expected results:
Host's "uuid" should ahead of the "guests" since host uuid is the key attribute.

Additional info:

Comment 1 Radek Novacek 2015-07-30 13:16:46 UTC
Fixed in virt-who-0.14-3.el7.

Comment 3 Liushihui 2015-08-11 06:10:28 UTC
Verified it on virt-who-0.14-3.el7.noarch since "guestId" and "state" have been put ahead of the "guests"

Verified version
virt-who-0.14-3.el7.noarch
subscription-manager-1.15.9-2.el7.x86_64
python-rhsm-1.15.4-2.el7.x86_64
Satellite 6.1.0-20150731.0

Verified process:
1.Register system to satellite
2.Print the host/guests association in JSON format to stdout.
[root@hp-z220-07 ~]# virt-who --esx --esx-owner=ACME_Corporation --esx-env=Library --esx-server=10.66.78.97 --esx-username=Administrator --esx-password=qwer1234P! -p -d > /root/ddd
2015-08-11 14:05:48,254 DEBUG: Using config named 'test-esx1'
2015-08-11 14:05:48,254 INFO: Using configuration "test-esx1" ("esx" mode)
2015-08-11 14:05:48,255 INFO: Using configuration "env/cmdline" ("esx" mode)
2015-08-11 14:05:48,285 DEBUG: Log into ESX
2015-08-11 14:05:48,286 DEBUG: Log into ESX
2015-08-11 14:05:48,484 DEBUG: Creating ESX event filter
2015-08-11 14:05:48,484 DEBUG: Creating ESX event filter
2015-08-11 14:05:48,549 DEBUG: Association for config env/cmdline gathered
2015-08-11 14:05:48,552 DEBUG: Association for config test-esx1 gathered
2015-08-11 14:05:48,553 DEBUG: Associations found: {
    "hypervisors": [
        {
            "uuid": "86b2bd00-8bad-11e2-87f4-6c3be514699d", 
            "guests": [
                {
                    "guestId": "42390187-0ca7-6139-dadb-549a990f34e3", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "esx"
                    }
                }, 
                {
                    "guestId": "564d1d17-06d9-46c3-beea-fed130d564e7", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "esx"
                    }
                }, 
                {
                    "guestId": "4239d107-b6b3-ec67-3317-678288dafe5a", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "esx"
                    }
                }
            ]
        }, 
        {
            "uuid": "86b2bd00-8bad-11e2-87f4-6c3be514699d", 
            "guests": [
                {
                    "guestId": "42390187-0ca7-6139-dadb-549a990f34e3", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "esx"
                    }
                }, 
                {
                    "guestId": "564d1d17-06d9-46c3-beea-fed130d564e7", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "esx"
                    }
                }, 
                {
                    "guestId": "4239d107-b6b3-ec67-3317-678288dafe5a", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "esx"
                    }
                }
            ]
        }
    ]
}

Result: 
Host's "uuid" has been ahead of the "guests", Therefore,verify it .

Comment 4 errata-xmlrpc 2015-11-19 11:57:27 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/RHBA-2015-2370.html