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

@ -64,22 +64,48 @@ class DssInst():
else: else:
raise Exception(ErrorCode.GAUSS_502["GAUSS_50201"] % self.cfg_path) raise Exception(ErrorCode.GAUSS_502["GAUSS_50201"] % self.cfg_path)
return items return items
@staticmethod @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') vg_cfg = os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini')
if os.path.isfile(vg_cfg): if os.path.isfile(vg_cfg):
try: try:
with open(vg_cfg, "r") as fp: with open(vg_cfg, "r") as fp:
context = fp.read().strip() context = fp.read().strip()
pris = re.findall('(.+):(.+)', context) pris = re.findall(
if pris and len(pris) == 2: '(.*):/dev/.*private_.*', context)
return pris[1][0].strip() if pris:
elif pris and len(pris) > dss_id + 1: return len(pris)
return pris[dss_id + 1][0].strip() 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: else:
raise Exception(ErrorCode.GAUSS_504["GAUSS_50416"] % raise Exception(ErrorCode.GAUSS_504["GAUSS_50416"] %
'in dss_vg_conf.ini') 'in dss_vg_conf.ini')

View File

@ -151,8 +151,13 @@ class DN_OLAP(Kernel):
'dss_nodes_list', self.dss_config, action='decode') 'dss_nodes_list', self.dss_config, action='decode')
cfg_context = DssInst.get_dms_url(dss_nodes_list) 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 # 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 {}" \ cmd += " -n --vgname=\"{}\" --enable-dss --dms_url=\"{}\" -I {}" \
" --socketpath=\"{}\"".format( " --socketpath=\"{}\"".format(
"+{},+{}".format(vgname, pri_vgname), cfg_context, inst_id, "+{},+{}".format(vgname, pri_vgname), cfg_context, inst_id,

View File

@ -196,15 +196,13 @@ class InstallImplOLAP(InstallImpl):
return return
self.context.logger.log('Start to create the dss vg.') self.context.logger.log('Start to create the dss vg.')
count = 0 for vgname, dss_disk in UdevContext.get_all_vgname_disk_pair(
for vgname, dss_disk in { self.context.clusterInfo.dss_shared_disks,
**self.context.clusterInfo.dss_shared_disks, self.context.clusterInfo.dss_pri_disks,
**self.context.clusterInfo.dss_pri_disks self.context.user).items():
}.items():
au_size = '4096' au_size = '4096'
if count != 0: if dss_disk.find('shared') == -1:
au_size = '65536' au_size = '65536'
count += 1
source_cmd = "source %s; " % self.context.mpprcFile source_cmd = "source %s; " % self.context.mpprcFile
show_cmd = source_cmd + f'dsscmd showdisk -g {vgname} -s vg_header' 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}' 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 Preparing the VG Configuration File
''' '''
dss_vg_ini = os.path.realpath( dss_vg_ini = os.path.realpath(
os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini')) 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 = [ context = [':'.join([k, v]) for k, v in lun_map.items()]
':'.join([k, v]) for k, v in {
**self.clusterInfo.dss_shared_disks,
**self.clusterInfo.dss_pri_disks
}.items()
]
FileUtil.write_custom_context( FileUtil.write_custom_context(
dss_vg_ini, context, authority=DefaultValue.KEY_FILE_MODE_IN_OS) 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_cfg, False)
self.prepareGivenPath(dss_log, False) self.prepareGivenPath(dss_log, False)
self.prepare_dss_inst_ini(dss_home, dss_id) 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) self.prepare_dss_vg_ini(dss_home)