Bug 654384

Summary: hrStorageSize from HOST-RESOURCES-TYPES mib reports incorrect size for filesystems > 16TB
Product: Red Hat Enterprise Linux 5 Reporter: Andrew Blum <ablum>
Component: net-snmpAssignee: Jan Safranek <jsafrane>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: jbastian, ksrot, ovasik, qguo, rdassen, rvokal
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 741789 748410 (view as bug list) Environment:
Last Closed: 2011-07-21 09:12:04 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:
Bug Depends On:    
Bug Blocks: 741789, 748410    

Description Andrew Blum 2010-11-17 18:22:25 UTC
Description of problem:
When trying to monitor filesystems greater than 16 TB using
net-snmp in RHEL5 using snmpwalk walking OID .1.3.6.1.2.1.25.2.3.1 from HOST-RESOURCES-TYPES, hrStorageAllocationUnits * hrStorageSize does not report the correct size for > 16 TB filesystems.

Version-Release number of selected component (if applicable):
net-snmp-libs-5.3.2.2-9.el5_5.1
net-snmp-utils-5.3.2.2-9.el5_5.1

How reproducible:
Every time

Steps to Reproduce:
1. Create a >16TB filesystem and mount it (verify correct size using df).
2. Run the equivalent of 'snmpwalk -Os -c test -v 1 127.0.0.1 .1.3.6.1.2.1.25.2.3.1' and look at hrStorageAllocationUnits and hrStorageSize.
3. The product of hrStorageAllocationUnits and hrStorageSize does not reflect the accurate size of the filesystem
  
Actual results:

# df -B 4096
Filesystem           4K-blocks      Used Available Use% Mounted on
/dev/sdc1            26843512732      1832 26843510900   1% /mnt

# snmpwalk -Os -c test -v 1 127.0.0.1 .1.3.6.1.2.1.25.2.3.1

hrStorageDescr.9 = STRING: /mnt
hrStorageAllocationUnits.9 = INTEGER: 4096 Bytes
hrStorageSize.9 = INTEGER: 1073708956

Expected results:

The product of hrStorageAllocationUnits and hrStorageSize should be accurate for > 16 TB filesystems.

Additional info:

Comment 2 Jan Safranek 2010-11-18 11:16:07 UTC
(In reply to comment #0)
> hrStorageAllocationUnits.9 = INTEGER: 4096 Bytes
> hrStorageSize.9 = INTEGER: 1073708956

The hrStorageSize is certainly wrong, but there is not much I can do about it. It *must* be 32bit value, as defined in RFC 2790. In new Net-SNMP release it does not wrap at 2^31 but sticks to it if the real value is higher, i.e. reports 2147483647 for all devices bigger than 2 billion of allocation unit (instead of reporting 'size modulo 2^21').

We talked upstream about possibility of lying about hrStorageAllocationUnits - not to use the real allocation unit size, but compute a bigger one so hrStorageSize fits into 32 bits (and hrStorageAllocationUnits*hrStorageSize provide real size of the device), but it was generally frowned upon. Maybe the time for such measures has come...

Comment 3 Jan Safranek 2011-02-18 14:45:44 UTC
I have finally pushed it upstream, see http://net-snmp.svn.sourceforge.net/viewvc/net-snmp?view=revision&revision=19941

I'll port it back to RHEL5/6, but the new behavior will be off by default and it must be explicitly enabled in snmpd.conf.

Comment 7 Karel Srot 2011-05-20 13:07:02 UTC
Andrew, thank you for the reproducer.

I have tested this bug with net-snmp-5.3.2.2-12.el5 (see reproducer https://tcms.engineering.redhat.com/case/92807/)
but snmpd does not see the XFS filesystem while the old version does.

[root@rhel5 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       5999168   1928576   3760936  34% /
/dev/vda1               101086     12547     83320  14% /boot
tmpfs                   513456         0    513456   0% /dev/shm
/dev/vdb             107374050928      7328 107374043600   1% /mnt/hugefs

[root@rhel5 ~]# rpm -q net-snmp
net-snmp-5.3.2.2-12.el5
[root@rhel5 ~]# snmpwalk -v2c -c public -v 1 127.0.0.1 .1.3.6.1.2.1.25.2.3.1 | grep hrStorageDescr
HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: Memory buffers
HOST-RESOURCES-MIB::hrStorageDescr.7 = STRING: Cached memory
HOST-RESOURCES-MIB::hrStorageDescr.10 = STRING: Swap space
HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.35 = STRING: /boot

[root@rhel5 ~]# rpm -q net-snmp
net-snmp-5.3.2.2-9.el5
[root@rhel5 ~]# snmpwalk -v2c -c public -v 1 127.0.0.1 .1.3.6.1.2.1.25.2.3.1 | grep hrStorageDescr
HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Memory Buffers
HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: Real Memory
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Swap Space
HOST-RESOURCES-MIB::hrStorageDescr.4 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.5 = STRING: /boot
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: /mnt/hugefs

# snmpwalk -v2c -c public -v 1 127.0.0.1 hrFSTable | grep '\.3'
HOST-RESOURCES-MIB::hrFSIndex.3 = INTEGER: 3
HOST-RESOURCES-MIB::hrFSMountPoint.3 = STRING: "/mnt/hugefs"
HOST-RESOURCES-MIB::hrFSRemoteMountPoint.3 = ""
HOST-RESOURCES-MIB::hrFSType.3 = OID: HOST-RESOURCES-TYPES::hrFSOther
HOST-RESOURCES-MIB::hrFSAccess.3 = INTEGER: readWrite(1)
HOST-RESOURCES-MIB::hrFSBootable.3 = INTEGER: false(2)
HOST-RESOURCES-MIB::hrFSStorageIndex.3 = INTEGER: 6
HOST-RESOURCES-MIB::hrFSLastFullBackupDate.3 = STRING: 0-1-1,0:0:0.0
HOST-RESOURCES-MIB::hrFSLastPartialBackupDate.3 = STRING: 0-1-1,0:0:0.0

Comment 8 Jan Safranek 2011-05-23 08:00:36 UTC
Moving to 'assigned', XFS needs to be fixed

Comment 13 errata-xmlrpc 2011-07-21 09:12:04 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1076.html

Comment 14 errata-xmlrpc 2011-07-21 12:22:58 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1076.html