Bug 1300512
| Summary: | oneshot mode doesn't work when starting as service | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Liushihui <shihliu> |
| Component: | virt-who | Assignee: | Radek Novacek <rnovacek> |
| Status: | CLOSED ERRATA | QA Contact: | Eko <hsun> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.8 | CC: | gxing, hsun, ovasik, rbalakri, sgao, shihliu |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | virt-who-0.16-2.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-05-10 23:57:18 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: | |||
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. *** Bug 1294760 has been marked as a duplicate of this bug. *** Fixed in virt-who-0.16-2.el6. 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
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 |
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