Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1089715

Summary: poller.py script should execute only when libvirtd is stopped
Product: [Community] Spacewalk Reporter: Stephen Herr <sherr>
Component: ClientsAssignee: Stephen Herr <sherr>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.2CC: anande, bsarathy, cperry, pablo.iranzo, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rhn-virtualization-5.4.53-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 888871 Environment:
Last Closed: 2014-07-17 08:40:46 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:
Bug Depends On: 888871    
Bug Blocks: 1119298    

Description Stephen Herr 2014-04-21 18:36:31 UTC
+++ This bug was initially created as a clone of Bug #888871 +++

[3] What is the nature and description of the request?

/usr/share/rhn/virtualization/poller.py (run as a cron job) provided by package="rhn-virtualization-host"
generates tracebacks (like below) without checking the status of libvirtd.

____________________________

libvir: RPC error : Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': No such file or directory
Warning: Could not retrieve virtualization information!
        libvirtd service needs to be running.
libvir: RPC error : Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': No such file or directory
Traceback (most recent call last):
  File "<stdin>", line 301, in <module>
  File "/usr/share/rhn/virtualization/domain_directory.py", line 70, in __init__
    self.conn = libvirt.openReadOnly(None)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 247, in openReadOnly
    if ret is None:raise libvirtError('virConnectOpenReadOnly() failed')
libvirt.libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock-ro': No such file or directory
____________________________

Which is annoying.


[4] Why does the customer need this? (List the business requirements here)

Customer does not want unwanted tracebacks to be sent as mails - even when libvirtd is running.
The following is *un-acceptable* to the customer.

In /etc/cron.d/rhn-virtualization.cron :

======
0-59/2 * * * * root python < /usr/share/rhn/virtualization/poller.py &> /dev/null
======

This was not be acceptable to them as only the poller.py traces are directed to /dev/null
There exists no easy way for their support-team to get notified if libvirtd crashes/is stopped or 
something else (since poller.py depends upon libvirtd)

but they require the libvirtd crashes *also* be reported to them via mails
This is easier for their SUPPORT team to read and get notified about.



[5] How would the customer like to achieve this? (List the functional requirements here)

- The poller.py should check the status of the libvirtd and only execute when it finds 
  that libvirtd is stopped.
- The cron-job "/etc/cron.d/rhn-virtualization.cron" should be modified to execute in such a way that
  the poller.py comes into action only when libvirtd is detected as stopped.



[8] List any affected packages or components: rhn-virtualization-host


[10] Additional Note:

The following solution was *acceptable* to the customer.

Modify /etc/cron.d/rhn-virtualization.cron as below in the next release version of "rhn-virtualization-host"
like below

=====
0-59/2 * * * * root [ -S /var/run/libvirt/libvirt-sock-ro ] && python < /usr/share/rhn/virtualization/poller.py
===== 

- Addition of "[ -S /var/run/libvirt/libvirt-sock-ro ] &&" will check libvirtd service is running or not.
- If running will execute poller.py, otherwise skip it from running. 

The advantage of this check is that, it will prevent poller.py from executing 
(if libvirtd service is stopped) and hence prevents 
the tracebacks generated due to libvirtd not running. 
At the same time will capture the error message generated by the poller.py 
script when libvirtd is running.

Comment 1 Stephen Herr 2014-04-21 18:40:35 UTC
The description above is a bit confusing, however the root problem is that if the server has both libvirt and rhn-virtualization-host installed and libvirtd is not running, the root user is spammed with email every two minutes from rhn-virtualization-host's cron job telling him that libvirtd is not running.

It is not rhn-virtualization-host's job to tell root that libvirtd is not running; the cron job should just exit silently in that case.

Comment 2 Stephen Herr 2014-04-21 18:44:56 UTC
Committing to Spacewalk master:
f8a772a3fc72941210a4110c57785d01cab5462d

Comment 3 Stephen Herr 2014-04-22 17:58:38 UTC
And commit:
803852b36c12a3585ce3ca25d408236be218d773

Comment 4 Stephen Herr 2014-04-23 12:40:55 UTC
And commit:
3fc294d07efb635f773ad8efbce654996eb63d63

Comment 5 Milan Zázrivec 2014-07-17 08:40:46 UTC
Spacewalk 2.2 has been released:

    https://fedorahosted.org/spacewalk/wiki/ReleaseNotes22