Bug 987531

Summary: [LVM2 name validation needed] DeviceCreateError: ('vgcreate failed for fedora-\xc5\x82\xc5\x81: running lvm vgcreate -s 4m --config devices { ... } fedora-\xc5\x82\xc5\x81 /dev/sda2 failed', 'fedora-\xc5\x82\xc5\x
Product: [Fedora] Fedora Reporter: Steve Tyler <stephent98>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: anaconda-maint-list, dshea, g.kaviyarasu, jonathan, mkolman, sbueno, stephent98, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-29 20:45:05 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:
Embargoed:
Attachments:
Description Flags
anaconda-tb-49kybv none

Description Steve Tyler 2013-07-23 15:16:51 UTC
Created attachment 777360 [details]
anaconda-tb-49kybv

Description of problem:
Changing the volume group name to include non-ASCII characters (fedora-łŁ) results in a DeviceCreateError exception during installation.

Version-Release number of selected component (if applicable):
anaconda 19.30.13-1
Fedora-19-x86_64-DVD.iso

How reproducible:
Always.

Steps to Reproduce:
1. Initialize a disc image and start the F19 installer:
   $ qemu-img create f19-test-3.img 12G
   $ qemu-kvm -m 4096 -hda f19-test-3.img -cdrom ~/xfr/fedora/F19/Fedora-19-x86_64-DVD.iso -vga std -boot menu=on

2. Select Polish as the installation language.
3. From Installation Summary, click keyboard icon to switch keyboard to "pl".
4. Enter Custom Partitioning.
5. Click to auto-create disk configuration.
6. Select a logical volume.
7. Click to modify the volume group name.
8. Append non-ASCII characters:
   Press alt-L for "ł".
   Press alt-shift-L for "Ł".
9. Begin Installation.

Actual results:
DeviceCreateError exception during volume group creation.

13:23:12,025 INFO program: Running... lvm vgcreate -s 4m --config  devices { filter=["r|/loop3$|","r|/loop4$|","r|/loop5$|","r|/loop6$|","r|/loop7$|"] }  fedora-łŁ /dev/sda2
13:23:12,066 INFO program:   New volume group name "fedora-łŁ" is invalid
13:23:12,067 INFO program:   Run `vgcreate --help' for more information.
13:23:12,067 DEBUG program: Return code: 3

Expected results:
Invalid volume group names are rejected before installation begins.

Additional info:

This bug report is essentially a duplicate of Bug 883689, which is assigned to LVM2. I am opening this, because it doesn't look like that bug will be addressed any time soon, and because anaconda could do the validation itself with a simple function. From the LVM2 documentation and the LVM2 source, it should be easy to identify the length and character-set rules. Those are highly unlikely to ever change, so embedding them in anaconda does not seem like a potential maintenance problem.

Bug 883689 - RFE: export a Python name-validation function ([vgcreate] New volume group name "ñ" is invalid)

Comment 1 Steve Tyler 2013-07-23 15:27:58 UTC
(In reply to Steve Tyler from comment #0)
...
> This bug report is essentially a duplicate of Bug 883689, which is assigned
> to LVM2. I am opening this, because it doesn't look like that bug will be
> addressed any time soon, ...

Specifically, Bug 883689, Comment 11:
"This seems reasonable.  However, until anaconda picks up and uses the python bindings for lvm (instead of command line) they should really do some type of validation in anaconda."

Comment 2 Steve Tyler 2013-07-23 16:53:07 UTC
The LVM2 name validation function and the maximum name length:

int validate_name(const char *n)
https://git.fedorahosted.org/cgit/lvm2.git/tree/lib/misc/lvm-string.c?id=v2_02_98#n72

#define NAME_LEN 128
https://git.fedorahosted.org/cgit/lvm2.git/tree/lib/misc/lvm-string.h?id=v2_02_98#n22

https://git.fedorahosted.org/git/lvm2.git

$ sudo repoquery lvm2
lvm2-0:2.02.98-9.fc19.x86_64