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 1253614 - virt-who offline function can't support local libvirt mode
Summary: virt-who offline function can't support local libvirt mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-who
Version: 7.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Radek Novacek
QA Contact: xingge
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-14 09:19 UTC by Eko
Modified: 2016-12-01 00:34 UTC (History)
6 users (show)

Fixed In Version: virt-who-0.14-4.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 11:58:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2370 0 normal SHIPPED_LIVE virt-who bug fix and enhancement update 2015-11-19 10:39:27 UTC

Description Eko 2015-08-14 09:19:25 UTC
Description of problem:
make virt-who running for local libvirt mode and create the fake data for local host/guest maaping. virt-who can't send the fake date to server even I set is_hypervisor=False.

Version-Release number of selected component (if applicable):
 - RHEL7.2-20150806.1-Server-x86_64(KVM) against stage candlepin
 - 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

How reproducible:
always

Steps to Reproduce:
1. stop virt-who service

2. set virt-who running for local libvirt
# grep -E -v '(^#|^$)'  /etc/sysconfig/virt-who
VIRTWHO_DEBUG=1
VIRTWHO_INTERVAL=2

3. run virt-who with -p to create the fake data "/root/fake"
# virt-who -p -d > /root/fake
2015-08-14 17:12:06,885 INFO: No configurations found, using libvirt as backend
2015-08-14 17:12:06,885 INFO: Using configuration "env/cmdline" ("libvirt" mode)
2015-08-14 17:12:06,918 INFO: Using libvirt url: ""
2015-08-14 17:12:06,922 DEBUG: Virtual machine found: rhel7.0: 95572a0b-390a-4364-ae96-a48c5134d47d
2015-08-14 17:12:06,923 DEBUG: Virtual machine found: rhel7.0-backup: 5262e779-29c6-4331-a344-c46e78012425
2015-08-14 17:12:06,923 DEBUG: Libvirt domains found: ['95572a0b-390a-4364-ae96-a48c5134d47d', '5262e779-29c6-4331-a344-c46e78012425']
2015-08-14 17:12:06,924 DEBUG: Association for config env/cmdline gathered
2015-08-14 17:12:06,924 DEBUG: Associations found: {
    "hypervisors": [
        {
            "guests": [
                {
                    "guestId": "95572a0b-390a-4364-ae96-a48c5134d47d", 
                    "state": 1, 
                    "attributes": {
                        "active": 1, 
                        "virtWhoType": "libvirt", 
                        "hypervisorType": "QEMU"
                    }
                }, 
                {
                    "guestId": "5262e779-29c6-4331-a344-c46e78012425", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "libvirt", 
                        "hypervisorType": "QEMU"
                    }
                }
            ]
        }
    ]
}
2015-08-14 17:12:06,925 DEBUG: virt-who shut down started


4. create /etc/virt-who.d/virt.fake for offline mode
# vi /etc/virt-who.d/virt.fake
[fake-virt]
type=fake
file=/root/fake
is_hypervisor=True
owner=7652501
env=7652501

5. restart virt-who service and check rhsm.log 
2015-08-14 17:14:22,232 [DEBUG]  @virtwho.py:126 - Using config named 'fake-virt'
2015-08-14 17:14:22,233 [INFO]  @virtwho.py:662 - Using configuration "fake-virt" ("fake" mode)
2015-08-14 17:14:22,233 [DEBUG]  @virtwho.py:209 - Starting infinite loop with 2 seconds interval
2015-08-14 17:14:22,266 [ERROR]  @virt.py:302 - Virt backend 'fake-virt' fails with error: Fake virt file '/root/fake' is not properly formed: 'uuid'

6. change is_hypervisor=False
# vi /etc/virt-who.d/virt.fake
[fake-virt]
type=fake
file=/root/fake
is_hypervisor=False
owner=7652501
env=7652501

7. restart virt-who service again and check rhsm.log
2015-08-14 17:16:58,113 [DEBUG]  @virtwho.py:126 - Using config named 'fake-virt'
2015-08-14 17:16:58,113 [INFO]  @virtwho.py:662 - Using configuration "fake-virt" ("fake" mode)
2015-08-14 17:16:58,114 [DEBUG]  @virtwho.py:209 - Starting infinite loop with 2 seconds interval
2015-08-14 17:16:58,147 [ERROR]  @virt.py:304 - Virt backend 'fake-virt' fails with exception:
Traceback (most recent call last):
  File "/usr/share/virt-who/virt/virt.py", line 300, in run
    self._run()
  File "/usr/share/virt-who/virt/virt.py", line 328, in _run
    report = self._get_report()
  File "/usr/share/virt-who/virt/virt.py", line 276, in _get_report
    return DomainListReport(self.config, self.listDomains())
  File "/usr/share/virt-who/virt/fakevirt/fakevirt.py", line 53, in listDomains
    return hypervisor['guestIds']
KeyError: 'guestIds'


Actual results:
virt-who offline function can't work for local libvirt mode

Expected results:
If I set is_hypervisor=False for offline mode, virt-who can send the local fake date to server

Additional info:

Comment 2 Radek Novacek 2015-08-18 15:57:34 UTC
Fixed in virt-who-0.14-4.el7.

Comment 4 Liushihui 2015-08-25 07:34:32 UTC
Verified it on virt-who-0.14-4.el7 since virt-who can support local libvirt mode when it run at offline mode. Therefore, verify it.

Verified version
virt-who-0.14-4.el7.noarch
subscription-manager-1.15.9-6.el7.x86_64
python-rhsm-1.15.4-2.el7.x86_64
SAM-1.4.1-RHEL-6-20141113.0

Verified process:
1. Register system to SAM
2. Stop virt-who service.
3. Make virt-who run at off-line mode and monitor local host.
[root@ibm-hs22-01 ~]# virt-who -p -d > /root/fake
2015-08-25 09:23:48,882 INFO: No configurations found, using libvirt as backend
2015-08-25 09:23:48,883 INFO: Using configuration "env/cmdline" ("libvirt" mode)
2015-08-25 09:23:48,933 INFO: Using libvirt url: ""
2015-08-25 09:23:48,939 DEBUG: Virtual machine found: 6.7_Server_x86_64: 26e37471-67da-43f4-a5d6-bafb8afe037d
2015-08-25 09:23:48,942 DEBUG: Virtual machine found: 6.5_Server_x86_64: fe8fbb34-fdf3-4f85-adee-d74f5a88cc82
2015-08-25 09:23:48,943 DEBUG: Virtual machine found: 7.1_Server_x86_64: 391246e5-bf3e-44f7-bc13-34308bc04f93
2015-08-25 09:23:48,943 DEBUG: Libvirt domains found: ['26e37471-67da-43f4-a5d6-bafb8afe037d', 'fe8fbb34-fdf3-4f85-adee-d74f5a88cc82', '391246e5-bf3e-44f7-bc13-34308bc04f93']
2015-08-25 09:23:48,945 DEBUG: Association for config env/cmdline gathered
2015-08-25 09:23:48,946 DEBUG: Associations found: {
    "hypervisors": [
        {
            "guests": [
                {
                    "guestId": "26e37471-67da-43f4-a5d6-bafb8afe037d", 
                    "state": 1, 
                    "attributes": {
                        "active": 1, 
                        "virtWhoType": "libvirt", 
                        "hypervisorType": "QEMU"
                    }
                }, 
                {
                    "guestId": "fe8fbb34-fdf3-4f85-adee-d74f5a88cc82", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "libvirt", 
                        "hypervisorType": "QEMU"
                    }
                }, 
                {
                    "guestId": "391246e5-bf3e-44f7-bc13-34308bc04f93", 
                    "state": 5, 
                    "attributes": {
                        "active": 0, 
                        "virtWhoType": "libvirt", 
                        "hypervisorType": "QEMU"
                    }
                }
            ]
        }
    ]
}

4. create /etc/virt-who.d/virt.fake for offline mode
# vi /etc/virt-who.d/virt.fake
[fake-virt]
type=fake
file=/root/fake
is_hypervisor=False

5. Check virt-who's log, virt-who can support local libvirt mode when it run at offline mode.

Comment 5 errata-xmlrpc 2015-11-19 11:58:14 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


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