diff --git a/script/gspylib/component/DSS/dss_comp.py b/script/gspylib/component/DSS/dss_comp.py index acd807fac249d140bf5ae1ff53349060f046c59d..66f0f9153640281d10155d6a795add5e8c1552ad 100644 --- a/script/gspylib/component/DSS/dss_comp.py +++ b/script/gspylib/component/DSS/dss_comp.py @@ -64,48 +64,22 @@ class DssInst(): else: raise Exception(ErrorCode.GAUSS_502["GAUSS_50201"] % self.cfg_path) return items - - @staticmethod - def get_private_vg_num(dss_home): - ''' - 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( - '(.*):/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): + def get_private_vgname_by_ini(dss_home, dss_id): ''' 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/.*'.format(str(dss_id)), context) - if pris: - return pris[0].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() else: raise Exception(ErrorCode.GAUSS_504["GAUSS_50416"] % 'in dss_vg_conf.ini') diff --git a/script/gspylib/component/Kernel/DN_OLAP/DN_OLAP.py b/script/gspylib/component/Kernel/DN_OLAP/DN_OLAP.py index 5a94e88558f18c21d30ff8b9af22cd14c7c67b71..db08fc28e11bd4cb031c3f3c3a903f159e3b9a56 100644 --- a/script/gspylib/component/Kernel/DN_OLAP/DN_OLAP.py +++ b/script/gspylib/component/Kernel/DN_OLAP/DN_OLAP.py @@ -151,13 +151,8 @@ 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 - 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) + pri_vgname = DssInst.get_private_vgname_by_ini(dss_home, inst_id) cmd += " -n --vgname=\"{}\" --enable-dss --dms_url=\"{}\" -I {}" \ " --socketpath=\"{}\"".format( "+{},+{}".format(vgname, pri_vgname), cfg_context, inst_id, diff --git a/script/impl/install/OLAP/InstallImplOLAP.py b/script/impl/install/OLAP/InstallImplOLAP.py index cb1810fc0502a4623cf02af3a8ea4ace21fc10a7..84da2c12212132e8fac66e2310d7275f8ffc1ba9 100644 --- a/script/impl/install/OLAP/InstallImplOLAP.py +++ b/script/impl/install/OLAP/InstallImplOLAP.py @@ -196,13 +196,15 @@ class InstallImplOLAP(InstallImpl): return self.context.logger.log('Start to create the dss vg.') - 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(): + count = 0 + for vgname, dss_disk in { + **self.context.clusterInfo.dss_shared_disks, + **self.context.clusterInfo.dss_pri_disks + }.items(): au_size = '4096' - if dss_disk.find('shared') == -1: + if count != 0: 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}' diff --git a/script/local/PreInstallUtility.py b/script/local/PreInstallUtility.py index d8c85af35a13e22130814c4110f60cac7ca44348..1aee3a06cc302812a54fbf6131150a0df8fab64b 100644 --- a/script/local/PreInstallUtility.py +++ b/script/local/PreInstallUtility.py @@ -887,34 +887,15 @@ Common options: ''' Preparing the VG Configuration File ''' - - dss_dict = {} dss_vg_ini = os.path.realpath( os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini')) - - lun_map = self.clusterInfo.dss_vg_info - lun_dss_vgname = self.clusterInfo.dss_vgname - - # dss_vg_info checker - infos = list(filter(None, re.split(r':|,', lun_map))) - - # The volume name must correspond to the disk. - if (lun_map.count(':') != lun_map.count(',') + 1) or ( - not infos) or (infos and len(infos) % 2 != 0): - raise Exception(ErrorCode.GAUSS_504["GAUSS_50414"] % - "The volume name must correspond to the disk.") - - # The shared volume must be in vg_config. - if lun_dss_vgname not in infos[::2]: - raise Exception(ErrorCode.GAUSS_504["GAUSS_50419"] % - (lun_dss_vgname, lun_map)) - - for i in range(0, len(infos), 2): - key = infos[i] - value = infos[i + 1] - dss_dict[key] = value - - context = [':'.join([k, v]) for k, v in dss_dict.items()] + + context = [ + ':'.join([k, v]) for k, v in { + **self.clusterInfo.dss_shared_disks, + **self.clusterInfo.dss_pri_disks + }.items() + ] FileUtil.write_custom_context( dss_vg_ini, context, authority=DefaultValue.KEY_FILE_MODE_IN_OS)