We make names from mount points and host names, both of which can contain characters that are invalid to LVM. The dash is the most promiment case here. Checks get run when the user enters these bad characters, but not when anaconda made up the names automatically. So strip dashes out of the generated names before feeding them to LVM. --- autopart.py | 6 +++--- lvm.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/autopart.py b/autopart.py index b1c7644..1e859fa 100644 --- a/autopart.py +++ b/autopart.py @@ -24,6 +24,7 @@ import parted import copy import string, sys import fsset +import re import lvm import logging from anaconda_log import logger, logFile @@ -1674,9 +1675,8 @@ def autoCreateLVMPartitionRequests(autoreq): else: tmp = string.strip(mntpt) tmp = tmp.replace('/', '_') - - while tmp.startswith('_'): - tmp = tmp[1:] + tmp = re.sub("[^0-9a-zA-Z._]", "", tmp) + tmp = tmp.lstrip("_") lvtemplate = "lv_%s" % (tmp,) else: diff --git a/lvm.py b/lvm.py index 0e07a1f..e409aec 100644 --- a/lvm.py +++ b/lvm.py @@ -24,6 +24,7 @@ import os,sys import string import math import isys +import re from flags import flags @@ -540,8 +541,10 @@ def createSuggestedVGName(partitions, network): if hn == 'localhost' or hn == 'localhost.localdomain': vgtemplate = "VolGroup" elif hn.find('.') != -1: + hn = re.sub("[^0-9a-zA-Z._]", "", hn) vgtemplate = "vg_%s" % (hn.split('.')[0].lower(),) else: + hn = re.sub("[^0-9a-zA-Z._]", "", hn) vgtemplate = "vg_%s" % (hn.lower(),) else: vgtemplate = "VolGroup" -- 1.6.0.3 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list