918 |
vgnames = [vg.name for vg in self.vgs] |
vgnames = [vg.name for vg in self.vgs] |
919 |
if hn is not None and hn != '': |
if hn is not None and hn != '': |
920 |
if hn == 'localhost' or hn == 'localhost.localdomain': |
if hn == 'localhost' or hn == 'localhost.localdomain': |
921 |
vgtemplate = "VolGroup" |
vgtemplate = "main" |
922 |
elif hn.find('.') != -1: |
elif hn.find('.') != -1: |
923 |
template = "vg_%s" % (hn.split('.')[0].lower(),) |
template = "vg_%s" % (hn.split('.')[0].lower(),) |
924 |
vgtemplate = safeLvmName(template) |
vgtemplate = safeLvmName(template) |
926 |
template = "vg_%s" % (hn.lower(),) |
template = "vg_%s" % (hn.lower(),) |
927 |
vgtemplate = safeLvmName(template) |
vgtemplate = safeLvmName(template) |
928 |
else: |
else: |
929 |
vgtemplate = "VolGroup" |
vgtemplate = "main" |
930 |
|
|
931 |
if vgtemplate not in vgnames and \ |
if vgtemplate not in vgnames and \ |
932 |
vgtemplate not in lvm.lvm_vg_blacklist: |
vgtemplate not in lvm.lvm_vg_blacklist: |
951 |
if mountpoint: |
if mountpoint: |
952 |
# try to incorporate the mountpoint into the name |
# try to incorporate the mountpoint into the name |
953 |
if mountpoint == '/': |
if mountpoint == '/': |
954 |
lvtemplate = 'lv_root' |
lvtemplate = 'root' |
955 |
else: |
else: |
956 |
if mountpoint.startswith("/"): |
if mountpoint.startswith("/"): |
957 |
template = "lv_%s" % mountpoint[1:] |
template = "%s" % mountpoint[1:] |
958 |
else: |
else: |
959 |
template = "lv_%s" % (mountpoint,) |
template = "%s" % (mountpoint,) |
960 |
|
|
961 |
lvtemplate = safeLvmName(template) |
lvtemplate = safeLvmName(template) |
962 |
else: |
else: |
964 |
if len([s for s in self.swaps if s in vg.lvs]): |
if len([s for s in self.swaps if s in vg.lvs]): |
965 |
idx = len([s for s in self.swaps if s in vg.lvs]) |
idx = len([s for s in self.swaps if s in vg.lvs]) |
966 |
while True: |
while True: |
967 |
lvtemplate = "lv_swap%02d" % idx |
lvtemplate = "swap%02d" % idx |
968 |
if lvtemplate in [lv.lvname for lv in vg.lvs]: |
if lvtemplate in [lv.lvname for lv in vg.lvs]: |
969 |
idx += 1 |
idx += 1 |
970 |
else: |
else: |
971 |
break |
break |
972 |
else: |
else: |
973 |
lvtemplate = "lv_swap" |
lvtemplate = "swap" |
974 |
else: |
else: |
975 |
idx = len(vg.lvs) |
idx = len(vg.lvs) |
976 |
while True: |
while True: |