Bug 1394180

Summary: mkdumprd fails if cluster's FQDN in cluster.conf is greater than 40 character
Product: Red Hat Enterprise Linux 6 Reporter: Shatadru Bandyopadhyay <sbandyop>
Component: libxml2Assignee: Daniel Veillard <veillard>
Status: CLOSED WONTFIX QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8CC: cww, ggore, kdump-team-bugs, piliu, qguo, qzhao, ruyang, sbandyop, veillard
Target Milestone: rcFlags: sbandyop: needinfo? (veillard)
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-13 17:52:28 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:
Attachments:
Description Flags
Propose patch none

Description Shatadru Bandyopadhyay 2016-11-11 10:51:38 UTC
Description of problem:
mkdumprd fails if clustername is greater than 40 character


Version-Release number of selected component (if applicable):
kexec-tools-2.0.0-300.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. In a pacemaker cluster node add cluster FQDN longer than 40 charecters in /etc/cluster/cluster.conf

2. touch /etc/kdump.conf 

3. service restart kdump


Actual results:
# service kdump restart
Stopping kdump:                                            [  OK  ]
No kdump initial ramdisk found.                            [WARNING]
Rebuilding /boot/initrd-2.6.32-504.el6.x86_64kdump.img
The ifcfg-is or ifcfg-xxx which contains DEVICE=is field doesn't exist.
Failed to run mkdumprd


Expected results:
It should work without issue

Additional info:

The reason mkdumrd is failing is below lines :
~~~
1607 # Returns list of nodes defined in Pacemaker cluster.
1608 get_pcs_cluster_nodes()
1609 {
1610     echo "xpath /cluster/clusternodes/clusternode/@name" \
1611         | xmllint --shell $CLUSTER_CONFIG_FILE | grep content | cut -d'=' -f2
1612 }
~~~

The above lines only returns upto 40 char and then adds trailing dots.

For example :
~~~
echo "xpath /cluster/clusternodes/clusternode/@name"  | xmllint --shell /etc/cluster/cluster.conf| grep content | cut -d'=' -f2
clust6-ha-pcs-node1.gsslab.pnq.redhat.co...
clust6-ha-pcs-node2.gsslab.pnq.redhat.co...
~~~
As per my discussion with maintainer of libxml2 for 'xmllint --shell' this is expected as  "it's intended for human consumption and there is no reason to display a 2000 caracter string value"

One can use --xpath :
~~~
 xmllint --xpath '/cluster/clusternodes/clusternode/@name'  cluster.conf
name="clust6-ha-pcs-node1.gsslab.pnq.redhat.com" name="clust6-ha-pcs-node2.gsslab.pnq.redhat.com"
~~~

Unfortunately --xpath is not available even for latest libxml2 available in RHEL 6.x

Comment 2 Shatadru Bandyopadhyay 2016-11-16 05:43:31 UTC
Created attachment 1221032 [details]
Propose patch

Comment 3 Pingfan Liu 2016-11-22 08:24:21 UTC
Hi Shatadru Bandyopadhyay,

I am trying to reproduce the bug, but fail to setup the env.
I have "yum -y install pcs pacemaker fence-agents-all resource-agents",
and see the /etc/cluster/cluster.conf. But I can not get the dir "/cluster/clusternodes/clusternode/".
Could you give me some detail about the env.

Thank you very much
Pingfan 

(In reply to Shatadru Bandyopadhyay from comment #0)
> Description of problem:
> mkdumprd fails if clustername is greater than 40 character
> 
> 
> Version-Release number of selected component (if applicable):
> kexec-tools-2.0.0-300.el6.x86_64
> 
> How reproducible:
> Always
> 
> Steps to Reproduce:
> 1. In a pacemaker cluster node add cluster FQDN longer than 40 charecters in
> /etc/cluster/cluster.conf
> 
> 2. touch /etc/kdump.conf 
> 
> 3. service restart kdump
> 
> 
> Actual results:
> # service kdump restart
> Stopping kdump:                                            [  OK  ]
> No kdump initial ramdisk found.                            [WARNING]
> Rebuilding /boot/initrd-2.6.32-504.el6.x86_64kdump.img
> The ifcfg-is or ifcfg-xxx which contains DEVICE=is field doesn't exist.
> Failed to run mkdumprd
> 
> 
> Expected results:
> It should work without issue
> 
> Additional info:
> 
> The reason mkdumrd is failing is below lines :
> ~~~
> 1607 # Returns list of nodes defined in Pacemaker cluster.
> 1608 get_pcs_cluster_nodes()
> 1609 {
> 1610     echo "xpath /cluster/clusternodes/clusternode/@name" \
> 1611         | xmllint --shell $CLUSTER_CONFIG_FILE | grep content | cut
> -d'=' -f2
> 1612 }
> ~~~
> 
> The above lines only returns upto 40 char and then adds trailing dots.
> 
> For example :
> ~~~
> echo "xpath /cluster/clusternodes/clusternode/@name"  | xmllint --shell
> /etc/cluster/cluster.conf| grep content | cut -d'=' -f2
> clust6-ha-pcs-node1.gsslab.pnq.redhat.co...
> clust6-ha-pcs-node2.gsslab.pnq.redhat.co...
> ~~~
> As per my discussion with maintainer of libxml2 for 'xmllint --shell' this
> is expected as  "it's intended for human consumption and there is no reason
> to display a 2000 caracter string value"
> 
> One can use --xpath :
> ~~~
>  xmllint --xpath '/cluster/clusternodes/clusternode/@name'  cluster.conf
> name="clust6-ha-pcs-node1.gsslab.pnq.redhat.com"
> name="clust6-ha-pcs-node2.gsslab.pnq.redhat.com"
> ~~~
> 
> Unfortunately --xpath is not available even for latest libxml2 available in
> RHEL 6.x

Comment 4 Pingfan Liu 2016-11-23 07:37:03 UTC
(In reply to Pingfan Liu from comment #3)
> Hi Shatadru Bandyopadhyay,
> 
> I am trying to reproduce the bug, but fail to setup the env.
> I have "yum -y install pcs pacemaker fence-agents-all resource-agents",
> and see the /etc/cluster/cluster.conf. But I can not get the dir
> "/cluster/clusternodes/clusternode/".
> Could you give me some detail about the env.
> 
Make a mistake. I had thought it was something like mountpoint in DFS.
I can work with the env. Please ignore the last comments.

Thx, 

> Thank you very much
> Pingfan 
> 
> (In reply to Shatadru Bandyopadhyay from comment #0)
> > Description of problem:
> > mkdumprd fails if clustername is greater than 40 character
> > 
> > 
> > Version-Release number of selected component (if applicable):
> > kexec-tools-2.0.0-300.el6.x86_64
> > 
> > How reproducible:
> > Always
> > 
> > Steps to Reproduce:
> > 1. In a pacemaker cluster node add cluster FQDN longer than 40 charecters in
> > /etc/cluster/cluster.conf
> > 
> > 2. touch /etc/kdump.conf 
> > 
> > 3. service restart kdump
> > 
> > 
> > Actual results:
> > # service kdump restart
> > Stopping kdump:                                            [  OK  ]
> > No kdump initial ramdisk found.                            [WARNING]
> > Rebuilding /boot/initrd-2.6.32-504.el6.x86_64kdump.img
> > The ifcfg-is or ifcfg-xxx which contains DEVICE=is field doesn't exist.
> > Failed to run mkdumprd
> > 
> > 
> > Expected results:
> > It should work without issue
> > 
> > Additional info:
> > 
> > The reason mkdumrd is failing is below lines :
> > ~~~
> > 1607 # Returns list of nodes defined in Pacemaker cluster.
> > 1608 get_pcs_cluster_nodes()
> > 1609 {
> > 1610     echo "xpath /cluster/clusternodes/clusternode/@name" \
> > 1611         | xmllint --shell $CLUSTER_CONFIG_FILE | grep content | cut
> > -d'=' -f2
> > 1612 }
> > ~~~
> > 
> > The above lines only returns upto 40 char and then adds trailing dots.
> > 
> > For example :
> > ~~~
> > echo "xpath /cluster/clusternodes/clusternode/@name"  | xmllint --shell
> > /etc/cluster/cluster.conf| grep content | cut -d'=' -f2
> > clust6-ha-pcs-node1.gsslab.pnq.redhat.co...
> > clust6-ha-pcs-node2.gsslab.pnq.redhat.co...
> > ~~~
> > As per my discussion with maintainer of libxml2 for 'xmllint --shell' this
> > is expected as  "it's intended for human consumption and there is no reason
> > to display a 2000 caracter string value"
> > 
> > One can use --xpath :
> > ~~~
> >  xmllint --xpath '/cluster/clusternodes/clusternode/@name'  cluster.conf
> > name="clust6-ha-pcs-node1.gsslab.pnq.redhat.com"
> > name="clust6-ha-pcs-node2.gsslab.pnq.redhat.com"
> > ~~~
> > 
> > Unfortunately --xpath is not available even for latest libxml2 available in
> > RHEL 6.x

Comment 8 Shatadru Bandyopadhyay 2016-11-25 06:18:43 UTC
Hello Qiao,

I think you are kexec-tools-2.0.0-280.el6.x86_64.

Update the kexec-tools to '2.0.0-300.el6.x86_64'

Then, 

# touch /etc/kdump.conf

and restart the kdump service and that should reproduce the issue.

--Shatadru

Comment 9 Qiao Zhao 2016-11-25 06:57:05 UTC
(In reply to Shatadru Bandyopadhyay from comment #8)
> Hello Qiao,
> 
> I think you are kexec-tools-2.0.0-280.el6.x86_64.
> 
> Update the kexec-tools to '2.0.0-300.el6.x86_64'
> 
> Then, 
> 
> # touch /etc/kdump.conf
> 
> and restart the kdump service and that should reproduce the issue.
> 
> --Shatadru

Oh, yes, i will try to test -300 package. Thanks!

Comment 14 Dave Young 2016-11-30 06:32:22 UTC
Reasigning to libxml2 instead considering the patch review issues, it will be better to be resolved in xmllint tool.

Comment 20 Pingfan Liu 2017-02-10 07:20:51 UTC
After browsing the libxml2 code, I think there is a easy fix to avoid the backport.

diff --git a/debugXML.c b/debugXML.c
index a1b550a..75ff912 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -431,7 +431,7 @@ xmlCtxtDumpString(xmlDebugCtxtPtr ctxt, const xmlChar * str)
         fprintf(ctxt->output, "(NULL)");
         return;
     }
-    for (i = 0; i < 40; i++)
+    for (i = 0; i < 128; i++)
         if (str[i] == 0)
             return;
         else if (IS_BLANK_CH(str[i]))

Since the longest hostname should be less than 64 chars. So 128 is big enough.

Regards,
Pingfan

Comment 22 Chris Williams 2017-06-13 17:52:28 UTC
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017.  During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.
 
The official life cycle policy can be reviewed here:
 
http://redhat.com/rhel/lifecycle
 
This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification.  Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:
 
https://access.redhat.com