Revert "fix bug for priate vgname not found"

This commit is contained in:
z00793368
2023-08-30 16:21:07 +08:00
parent 201787c3c6
commit b61281d802
4 changed files with 51 additions and 24 deletions

View File

@ -66,20 +66,46 @@ class DssInst():
return items
@staticmethod
def get_private_vgname_by_ini(dss_home, dss_id):
def get_private_vg_num(dss_home):
'''
Obtaining a Private Volume
Obtaining Private Volumes
'''
vg_cfg = os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini')
if os.path.isfile(vg_cfg):
try:
with open(vg_cfg, "r") as fp:
context = fp.read().strip()
pris = re.findall('(.+):(.+)', context)
if pris and len(pris) == 2:
return pris[1][0].strip()
elif pris and len(pris) > dss_id + 1:
return pris[dss_id + 1][0].strip()
pris = re.findall(
'(.*):/dev/.*private_.*', context)
if pris:
return len(pris)
else:
raise Exception(ErrorCode.GAUSS_504["GAUSS_50416"] %
'in dss_vg_conf.ini')
except Exception as eds:
raise Exception(ErrorCode.GAUSS_504["GAUSS_50414"] % eds)
else:
raise Exception(ErrorCode.GAUSS_502["GAUSS_50201"] % vg_cfg)
@staticmethod
def get_private_vgname_by_ini(dss_home, dss_id, xlog_in_one_priv_vg):
'''
Obtaining a Private Volume
'''
if xlog_in_one_priv_vg:
dss_id = 0
vg_cfg = os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini')
if os.path.isfile(vg_cfg):
try:
with open(vg_cfg, "r") as fp:
context = fp.read().strip()
pris = re.findall(
'(.*):/dev/.*private_{}'.format(str(dss_id)), context)
if pris:
return pris[0].strip()
else:
raise Exception(ErrorCode.GAUSS_504["GAUSS_50416"] %
'in dss_vg_conf.ini')

View File

@ -151,8 +151,13 @@ class DN_OLAP(Kernel):
'dss_nodes_list', self.dss_config, action='decode')
cfg_context = DssInst.get_dms_url(dss_nodes_list)
xlog_in_one_priv_vg = False
infos = list(filter(None, re.split(r':|:|,', dss_nodes_list)))
pri_vg_num = DssInst.get_private_vg_num(dss_home)
# when use one private vg for xlog, vgname should get from inst_id=0
pri_vgname = DssInst.get_private_vgname_by_ini(dss_home, inst_id)
if (pri_vg_num < len(infos[::3]) and pri_vg_num == 1):
xlog_in_one_priv_vg = True
pri_vgname = DssInst.get_private_vgname_by_ini(dss_home, inst_id, xlog_in_one_priv_vg)
cmd += " -n --vgname=\"{}\" --enable-dss --dms_url=\"{}\" -I {}" \
" --socketpath=\"{}\"".format(
"+{},+{}".format(vgname, pri_vgname), cfg_context, inst_id,

View File

@ -196,15 +196,13 @@ class InstallImplOLAP(InstallImpl):
return
self.context.logger.log('Start to create the dss vg.')
count = 0
for vgname, dss_disk in {
**self.context.clusterInfo.dss_shared_disks,
**self.context.clusterInfo.dss_pri_disks
}.items():
for vgname, dss_disk in UdevContext.get_all_vgname_disk_pair(
self.context.clusterInfo.dss_shared_disks,
self.context.clusterInfo.dss_pri_disks,
self.context.user).items():
au_size = '4096'
if count != 0:
if dss_disk.find('shared') == -1:
au_size = '65536'
count += 1
source_cmd = "source %s; " % self.context.mpprcFile
show_cmd = source_cmd + f'dsscmd showdisk -g {vgname} -s vg_header'
cv_cmd = source_cmd + f'dsscmd cv -g {vgname} -v {dss_disk} -s {au_size}'

View File

@ -887,15 +887,14 @@ Common options:
'''
Preparing the VG Configuration File
'''
dss_vg_ini = os.path.realpath(
os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini'))
lun_map = UdevContext.get_all_vgname_disk_pair(
self.clusterInfo.dss_shared_disks, self.clusterInfo.dss_pri_disks,
self.user)
context = [
':'.join([k, v]) for k, v in {
**self.clusterInfo.dss_shared_disks,
**self.clusterInfo.dss_pri_disks
}.items()
]
context = [':'.join([k, v]) for k, v in lun_map.items()]
FileUtil.write_custom_context(
dss_vg_ini, context, authority=DefaultValue.KEY_FILE_MODE_IN_OS)
@ -911,8 +910,7 @@ Common options:
self.prepareGivenPath(dss_cfg, False)
self.prepareGivenPath(dss_log, False)
self.prepare_dss_inst_ini(dss_home, dss_id)
# this function does not need to be detected under multipath
# self.prepare_dss_soft_link()
self.prepare_dss_soft_link()
self.prepare_dss_vg_ini(dss_home)