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 1300512 - oneshot mode doesn't work when starting as service
Summary: oneshot mode doesn't work when starting as service
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: virt-who
Version: 6.8
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Radek Novacek
QA Contact: Eko
URL:
Whiteboard:
: 1294760 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-21 03:30 UTC by Liushihui
Modified: 2016-12-01 00:34 UTC (History)
6 users (show)

Fixed In Version: virt-who-0.16-2.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-05-10 23:57:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2016:0859 0 normal SHIPPED_LIVE virt-who bug fix and enhancement update 2016-05-10 22:44:47 UTC

Description Liushihui 2016-01-21 03:30:52 UTC
Description of problem:
When configure VIRTWHO_ONE_SHOT=1, virt-who will start at background mode rather than one-shot mode.

Version-Release number of selected component (if applicable):
virt-who-0.16-1.el6.noarch
subscription-manager-1.16.7-1.el6.x86_64
python-rhsm-1.16.5-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Register system to satellite
2.Configure virt-who run at kvm one-shot mode:
[root@hp-dl120gen9-01 ~]# cat /etc/sysconfig/virt-who  | grep -v ^# | grep -v ^$
VIRTWHO_DEBUG=1
VIRTWHO_ONE_SHOT=1
3.Restart virt-who service, then check virt-who's log
[root@hp-dl120gen9-01 ~]# service virt-who restart
[root@hp-dl120gen9-01 ~]# tail -f /var/log/rhsm/rhsm.log

Actual results:
It will show error info in the log
2016-01-20 22:07:14,760 [virtwho.init ERROR] MainProcess(6533):MainThread @virtwho.py:parseOptions:710 - Background and oneshot can't be used together, using background mode

Expected results:
As virt-who not support background mode, the related function should remove.
When configure one-shot mode in config file, virt-who can work at one-shot mode rather than background mode.

Additional info:
Check virt-who's source code. background related code should be removed.
# vim virt-who.py
line586-588
    env = os.getenv("VIRTWHO_BACKGROUND", "0").strip().lower()
    if env in ["1", "true"]:
        options.background = True
line 709-711:
    if options.background and options.oneshot:
        logger.error("Background and oneshot can't be used together, using background mode")
        options.oneshot = False

Comment 1 Radek Novacek 2016-01-28 10:19:39 UTC
The background mode is still needed internally on RHEL-6. When a service is started using `service virt-who start` it should do a double-fork to detach from the terminal. This is original purpose of background mode. There is (and will be) environment variable VIRTWHO_BACKGROUND that is set up by the initscript that will do the double-fork in virt-who. On RHEL-7 the double-fork is not needed as systemd can handle it directly.

Nevertheless the conflict between oneshot and background mode is no longer valid, so I'll remove it.

Comment 2 Radek Novacek 2016-01-28 10:23:18 UTC
*** Bug 1294760 has been marked as a duplicate of this bug. ***

Comment 3 Radek Novacek 2016-01-28 13:04:13 UTC
Fixed in virt-who-0.16-2.el6.

Comment 5 Liushihui 2016-02-04 07:21:46 UTC
Verified it on virt-who-0.16-3.el6.noarch since virt-who can send h/g mapping when VIRTWHO_DEBUG=1 and VIRTWHO_ONE_SHOT=1 in /etc/sysconfig/virt-who. The log file as the following:

2016-02-04 02:19:27,915 [virtwho.init INFO] MainProcess(13530):MainThread @virtwho.py:parseOptions:630 - Using reporter_id='intel-canoepass-10.lab.bos.redhat.com'
2016-02-04 02:19:27,917 [virtwho.init INFO] MainProcess(13530):MainThread @virtwho.py:main:714 - No configurations found, using libvirt as backend
2016-02-04 02:19:27,917 [virtwho.init INFO] MainProcess(13530):MainThread @virtwho.py:main:721 - Using configuration "env/cmdline" ("libvirt" mode)
2016-02-04 02:19:28,078 [virtwho.env_cmdline DEBUG] Libvirtd-1(13539):MainThread @virt.py:run:358 - Virt backend 'env/cmdline' started
2016-02-04 02:19:28,081 [virtwho.env_cmdline INFO] Libvirtd-1(13539):MainThread @libvirtd.py:_connect:156 - Using libvirt url: ""
2016-02-04 02:19:28,109 [virtwho.env_cmdline DEBUG] Libvirtd-1(13539):MainThread @libvirtd.py:_listDomains:236 - Libvirt domains found: 9ebbeb2c-e391-b586-1d29-5e579c190a31
2016-02-04 02:19:28,110 [virtwho.env_cmdline DEBUG] Libvirtd-1(13539):MainThread @virt.py:enqueue:351 - Report gathered, putting to queue for sending
2016-02-04 02:19:28,126 [virtwho.main DEBUG] MainProcess(13533):MainThread @subscriptionmanager.py:_connect:121 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-02-04 02:19:28,324 [virtwho.main INFO] MainProcess(13533):MainThread @subscriptionmanager.py:sendVirtGuests:147 - Sending update in guests lists for config "env/cmdline": 1 guests found
2016-02-04 02:19:28,324 [virtwho.main DEBUG] MainProcess(13533):MainThread @subscriptionmanager.py:sendVirtGuests:148 - Domain info: [
    {
        "guestId": "9ebbeb2c-e391-b586-1d29-5e579c190a31", 
        "state": 5, 
        "attributes": {
            "active": 0, 
            "hypervisorVersion": "0.12.1", 
            "virtWhoType": "libvirt", 
            "hypervisorType": "QEMU"
        }
    }
]
2016-02-04 02:19:29,113 [virtwho.env_cmdline DEBUG] Libvirtd-1(13539):MainThread @virt.py:run:377 - Virt backend 'env/cmdline' stopped after sending one report
2016-02-04 02:19:30,772 [virtwho.main DEBUG] MainProcess(13533):MainThread @virtwho.py:send_current_report:159 - Report for config "env/cmdline" sent
2016-02-04 02:19:30,774 [virtwho.main DEBUG] MainProcess(13533):MainThread @virtwho.py:<module>:805 - virt-who terminated
2016-02-04 02:19:30,774 [virtwho.main DEBUG] MainProcess(13533):MainThread @virtwho.py:terminate:352 - virt-who is shutting down

Comment 7 errata-xmlrpc 2016-05-10 23:57:18 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/RHEA-2016-0859.html


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