From 02efd99c88ae7ff70f757ed975a75aa4210f380f Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Mon, 13 Nov 2023 14:23:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=A3=80=E6=B5=8B=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E5=BD=93=E5=89=8D=E5=B7=B2=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysmig_agent/Abisystmcompchk.py | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py index cf34c87..bf32e49 100644 --- a/sysmig_agent/Abisystmcompchk.py +++ b/sysmig_agent/Abisystmcompchk.py @@ -642,3 +642,37 @@ def mycopyfile(srcfile, dstfile, logger): return dstfile + +#Generate report name +def create_migrate_report_name(flag, logg): + + migrate_before_report_path = '/var/tmp/uos-migration/UOS_analysis_report/' + migrate_behind_report_path = '/var/tmp/uos-migration/UOS_migration_completed_report/' + + migrate_report_before_sample_name = 'UOS_migration_report_HOSTIP_HOSTNAME_YYYYMMDDHHMM-BEFORE.xls' + migrate_report_behind_sample_name = 'UOS_migration_report_HOSTIP_HOSTNAME_YYYYMMDDHHMM-BEHIND.xls' + + hostip = get_local_ip() + hostname = socket.gethostname() + hosttime = datetime.datetime.now().strftime('%Y%m%d%H%M') + abs_path = os.path.abspath('sysmig_agent/txts/') + + if not os.path.exists(migrate_behind_report_path): + os.makedirs(migrate_behind_report_path) + + #migration before + if flag=='0': + migrate_name_01 = migrate_report_before_sample_name.replace('HOSTIP', hostip) + migrate_name_02 = migrate_name_01.replace('HOSTNAME', hostname) + migrate_name = migrate_before_report_path + migrate_name_02.replace('YYYYMMDDHHMM-BEFORE', hosttime) + migrate_path_name_sample = abs_path + '/' + migrate_report_before_sample_name + + #migration behind + elif flag=='1': + migrate_name_01 = migrate_report_behind_sample_name.replace('HOSTIP', hostip) + migrate_name_02 = migrate_name_01.replace('HOSTNAME', hostname) + migrate_name = migrate_behind_report_path + migrate_name_02.replace('YYYYMMDDHHMM-BEHIND', hosttime) + migrate_path_name_sample = abs_path + '/' + migrate_report_behind_sample_name + + #Rename the real report name + return mycopyfile(migrate_path_name_sample, migrate_name, logg) -- 2.20.1