Bug 736596

Summary: libvirtMib_subagent will stop when request information after libvirtd restarted
Product: [Community] Virtualization Tools Reporter: xhu
Component: libvirt-snmpAssignee: Martin Kletzander <mkletzan>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: cwei, dyuan, mshao, mzhan
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-03 06:30:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description xhu 2011-09-08 08:07:15 UTC
Description of problem:
libvirtMib_subagent will stop when request information after libvirtd restarted

Version-Release number of selected component (if applicable):
libvirt-snmp-0.0.2-1.el6.x86_64
libvirt-0.9.4-10.el6.x86_64
qemu-kvm-0.12.1.2-2.185.el6.x86_64
kernel-2.6.32-193.el6.x86_64

How reproducible:
everytimes

Steps to Reproduce:

1. install libvirt-snmp
# sudo yum install libvirt-snmp

2. prepare /etc/snmp/snmpd.conf as follows:
# cat /etc/snmp/snmpd.conf
rwcommunity public
master agentx
trapcommunity public
trap2sink  localhost

3. append the following lines to /etc/snmp/snmptrapd.conf
# Example configuration file for snmptrapd
authCommunity log,execute,net public
logOption f /var/log/snmptraps.log

4. add the following lines to /etc/sysconfig/snmptrapd:
OPTIONS="-m ALL -p /var/run/snmptrapd.pid"

5. restart snmpd and snmptrapd service
# service snmpd restart
# service snmptrapd restart

6. run libvirt snmp agent daemon
# LIBVIRT_DEFAULT_URI="qemu:///system" libvirtMib_subagent -f -L

7. running snmpwalk to query domain status
# virsh list --all
 Id Name                 State
----------------------------------
  2 rhel6                running
  - rhel6-clone          shut off
  - toy                  shut off

# snmpwalk -m ALL -v 2c -c public -OX localhost libvirtMIB
LIBVIRT-MIB::libvirtGuestName[STRING: d39ce525-fb33-3a6a-8f03-ded842370fad] = STRING: "rhel6"
LIBVIRT-MIB::libvirtGuestState[STRING: d39ce525-fb33-3a6a-8f03-ded842370fad] = INTEGER: running(1)
LIBVIRT-MIB::libvirtGuestCpuCount[STRING: d39ce525-fb33-3a6a-8f03-ded842370fad] = Gauge32: 1
LIBVIRT-MIB::libvirtGuestMemoryCurrent[STRING: d39ce525-fb33-3a6a-8f03-ded842370fad] = Gauge32: 1024
LIBVIRT-MIB::libvirtGuestMemoryLimit[STRING: d39ce525-fb33-3a6a-8f03-ded842370fad] = Gauge32: 1024
LIBVIRT-MIB::libvirtGuestCpuTime[STRING: d39ce525-fb33-3a6a-8f03-ded842370fad] = Counter64: 2163690000000
LIBVIRT-MIB::libvirtGuestRowStatus[STRING: d39ce525-fb33-3a6a-8f03-ded842370fad] = INTEGER: active(1)

8. restart libvirtd
# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]

9. running snmpwalk to query domain status
# snmpwalk -m ALL -v 2c -c public -OX localhost libvirtMIB
Error in packet.
Reason: (genError) A general failure occured
Failed object: LIBVIRT-MIB::libvirtMIB

LIBVIRT-MIB::libvirtMIB = No Such Object available on this agent at this OID

Actual results:
After step 9, libvirtMib_subagent will stop

Expected results:
libvirtMib_subagent will not stop and can get domain status

Additional info:

Comment 6 Dave Allan 2012-07-18 15:08:14 UTC
Perhaps the keepalive code will help with this problem, just a random thought.

Comment 9 Martin Kletzander 2014-09-03 06:30:14 UTC
Thinking about this from another perspective, the libvirt subagent should be encapsulated in a service that would depend on libvirtd.  That way it would be restarted with the libvirt daemon service properly.

I'm closing this as WONTFIX as there is no plan to do that, but the user can create the service for themselves (based on the distribution/init system running) pretty easily.  Also distributions might have a take on that and properly create the service themselves.

Reopen if necessary.