Bug 711445 - LVM vgcreate fails if hostname is invalid
LVM vgcreate fails if hostname is invalid
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2 (Show other bugs)
6.0
Unspecified Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Peter Rajnoha
Corey Marthaler
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-07 10:27 EDT by Frank Lin PIAT
Modified: 2011-12-06 11:57 EST (History)
9 users (show)

See Also:
Fixed In Version: lvm2-2.02.86-1.el6
Doc Type: Bug Fix
Doc Text:
A hostname containing '/' character caused LVM commands to fail while generating an archive of current metadata. Since the hostname is part of the temporary archive filename, we ended up with a file path that was ambiguous and it caused the whole archive operation to fail. To fix this, we replace any '/' character with '?' character in the hostname string and then we use it to compose the temporary archive filename.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 11:57:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Frank Lin PIAT 2011-06-07 10:27:08 EDT
Description of problem:

LVM will fail to create volumegroup if the hostname contains invalid caracter (especialy a slash)

Version-Release number of selected component (if applicable):


How reproducible:

Yes, it is reproducible.

Steps to Reproduce:
1. change hostname to something invalid, for example, execute:
   hostname foo/bar
2. Try creating a VG, for example, execute
   lvm vgcreate TEST /dev/sdd9
  
Actual results:

% lvm vgcreate TESTVG /dev/sdd9
Couldn't create temporary archive name.
Volume group "TESTVG" metadata archive failed.


Expected results:

a more explicit error message.

Additional info:
This problem occured while doing automatic kickstart deployment with anaconda.
Comment 2 Peter Rajnoha 2011-06-07 10:44:43 EDT
Well, we definitely need to escape such characters.
Comment 3 Peter Rajnoha 2011-06-08 04:56:44 EDT
OK, this is only a temporary file name creation. Also, we can't set the hostname containing '/' with recent versions of the 'hostname' command (I don't know the exact version, but the Fedora rawhide version if 'hostname' already checks that). Though we can still set it directly using 'sethostname' from unistd.h.

Since this is really a corner case, I think we don't need any complex escape sequences here. We'll simply replace the '/' with '?'. Patch is upstream now (v2.02.86).
Comment 4 Peter Rajnoha 2011-06-08 07:50:09 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
A hostname containing '/' character caused LVM commands to fail while generating an archive of current metadata. Since the hostname is part of the temporary archive filename, we ended up with a file path that was ambiguous and it caused the whole archive operation to fail. To fix this, we replace any '/' character with '?' character in the hostname string and then we use it to compose the temporary archive filename.
Comment 5 Corey Marthaler 2011-06-09 10:21:53 EDT
Adding QA ack for 6.2.

Devel will need to provide unit testing results however before this bug can be
ultimately verified by QA.
Comment 7 Corey Marthaler 2011-09-08 16:18:04 EDT
Fixed verified in the latest rpms.

[root@grant-01 ~]# hostname foo/bar

[root@foo/bar ~]#  vgcreate TEST /dev/sd[bc][12]
  Volume group "TEST" successfully created

2.6.32-193.el6.x86_64

lvm2-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
lvm2-libs-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
lvm2-cluster-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
udev-147-2.37.el6    BUILT: Wed Aug 10 07:48:15 CDT 2011
device-mapper-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
device-mapper-libs-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
device-mapper-event-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
device-mapper-event-libs-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
cmirror-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
Comment 8 errata-xmlrpc 2011-12-06 11:57:02 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

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

Note You need to log in before you can comment on or make changes to this bug.