From ec2e4820e87b355faf0c3a92dc0b22ddb326b7b6 Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Fri, 10 Nov 2023 14:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=92=8C=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysmig_agent/migration.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py index 00b3c89..ef78ed8 100644 --- a/sysmig_agent/migration.py +++ b/sysmig_agent/migration.py @@ -171,3 +171,33 @@ def mig_kernel(kernel_version): # loggen.debug('Can not download kernel .') #log.err return 1 + + +def init_log_dir(): + if not os.path.isdir(PRE_MIG_DIR): + os.makedirs(PRE_MIG_DIR) + if not os.path.isdir(MIGRATION_KERNEL): + os.makedirs(MIGRATION_KERNEL) + if not os.path.isdir(MIGRATION_DIR): + os.makedirs(MIGRATION_DIR) + if not os.path.isdir(MIGRATION_DATA_RPMS_DIR): + os.makedirs(MIGRATION_DATA_RPMS_DIR) + if not os.path.exists(PROGRESS): + with open(PROGRESS,'w+') as fp: + fp.write(' ') + fp.close() + if not os.path.exists(MIGRATION_DATA_RPMS_3_INFO): + with open(MIGRATION_DATA_RPMS_3_INFO,'w+') as fp: + fp.write(' ') + fp.close() + if not os.path.exists(MIGRATION_LOG): + with open(MIGRATION_LOG,'w+') as fp: + fp.write(' ') + fp.close() + if not os.path.exists(PRE_MIG): + with open(PRE_MIG,'w+') as fp: + fp.write(' ') + fp.close() + migInit_porgress() + + -- 2.20.1