Bug 268741

Summary: mkdumprd incorrectly reports remote filesystem space
Product: Red Hat Enterprise Linux 5 Reporter: Maarten Broekman <maarten>
Component: kexec-toolsAssignee: Cong Wang <amwang>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.1CC: rkhan
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-18 10:41:44 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:
Attachments:
Description Flags
command output
none
patch to make df output posix compliant in ssh case
none
Patch (method 1)
none
Patch (method 2)
none
corrected patch (method 2)
none
unified patch none

Description Maarten Broekman 2007-08-30 19:49:50 UTC
Description of problem:
When I rebuild my kdump image after updating kdump.conf, I am told that there 
isn't space enough for the vmcore file on my remote server (for scp).

Warning: There is not space enough to save a vmcore.
         The size of netdump.xx.xx:/var/crash/tmp.DOWHY25340 should be 
much greater than 16502136 bytes.

Version-Release number of selected component (if applicable):
1.101-192.el5

How reproducible:
100%

Steps to Reproduce:
1.  Configure kdump to scp to a remote server
2.  Make sure the remote server has less than your server's memory of USED 
space on the appropriate filesystem
3.  Restart kdump.
  
Actual results:
warning about less than 16G of space available

Expected results:
No warning when less than 16G of space used.

Additional info:
The remote_df check in mkdumprd is referencing field 10 of the output.  This 
field is the _used_ filesystem space.  The _available_ filesystem space is 
field 11.  As long as there is sufficient _available_ space, we shouldn't get 
warnings.

Also, the message states that I should have at least that many _bytes_ of free 
space.  In actuality, it should be kilobytes.

Comment 1 Maarten Broekman 2007-08-30 19:49:50 UTC
Created attachment 181721 [details]
command output

Comment 2 Neil Horman 2007-08-30 20:03:04 UTC
Created attachment 181761 [details]
patch to make df output posix compliant in ssh case

I think this is what you need.	Please use it to patch mkdumprd and let me know
if it fixes your problem.  Thanks

Comment 3 Maarten Broekman 2007-08-30 20:37:09 UTC
Created attachment 181921 [details]
Patch (method 1)

The simplest patch is a 1 character change from -f10 to -f11.

Comment 4 Maarten Broekman 2007-08-30 20:39:07 UTC
Created attachment 181941 [details]
Patch (method 2)

This is a patch that is based off Neil's patch...it tails the df output before
returning it to mkdumprd (to remove the column headers).

Comment 5 Neil Horman 2007-08-30 23:25:53 UTC
in response to comment 3: Thats also the wrong patch.  The column number you cut
at will change based on the size of the mounted fs path, since w/o the -P option
on df it will insert newlines for readability.

in response to comment #4: Why are you tailing this twice?

Please just confirm the patch as I provided it to you.  Thank you

Comment 6 Maarten Broekman 2007-08-31 12:27:09 UTC
The patch you provided eliminated the warning but did not do the proper 
comparison.  The result of your patch was (running with bash -x):

++ ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no netdump.40.81 
df -P /var/crash/tmp.QVTtV28107
+ remote_df='Filesystem         1024-blocks      Used Available Capacity 
Mounted on
/dev/cciss/c0d1p1     70005824    152748  69141852       1% /var/crash'
++ echo Filesystem 1024-blocks Used Available Capacity Mounted 
on /dev/cciss/c0d1p1 70005824 152748 69141852 1% /var/crash
++ tail -1
++ tr -s ' ' '|'
++ cut '-d|' -f4
+ available_size=Available
+ '[' Available -lt 16502136 ']'
/sbin/mkdumprd: line 1647: [: Available: integer expression expected

The second 'tail' is unneeded.

The field that is needed is number 11.  This is regardless of the newlines 
because of the way the output is returned and then echo'd.

remote_df may have newlines embedded, but when it is echo'd back for the 
purporses of tailling, translating, and cutting, the newlines seem to be 
ignored. (see above output).

Several ways around this are to use field 11 (since the newlines don't get 
echo'd into the pipelined commands in the current incarnation of the code) 
(aka patch in comment #3)...or to move the tail from the echo $remote_df line 
to the ssh command (patch in comment #4 minus the second tail)...or to combine 
the two and do all your pipelining within the ssh command so that the 
available space is returned from that rather than the whole df output.

see attachments

Comment 7 Maarten Broekman 2007-08-31 12:27:59 UTC
Created attachment 183161 [details]
corrected patch (method 2)

Comment 8 Maarten Broekman 2007-08-31 12:29:00 UTC
Created attachment 183181 [details]
unified patch

this performs all the parsing of df within the ssh command and returns the
available size.

Comment 9 Neil Horman 2007-08-31 13:37:51 UTC
oops, your right, the tail does need to be on the remote side.  I'll add the
patch from comment 7 to minimize remote side processing.  Thanks.  This will be
available in RHEL5.2

Comment 10 Maarten Broekman 2010-05-10 20:57:55 UTC
This has been fixed for quite a while.  This should be able to be closed now.