diff --git a/.gitignore b/.gitignore index a1c2a238a965f004ff76978ac1086aa6fe95caea..88a499a643c416228391a245b518a2d0545752bb 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,6 @@ *.war *.nar *.ear -*.zip -*.tar.gz *.rar # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml diff --git a/InManageBoot-iboot/.gitignore b/InManageBoot-iboot/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..490e282cdc6a773c60ca5bb2bfb885f6e56316a8 --- /dev/null +++ b/InManageBoot-iboot/.gitignore @@ -0,0 +1,154 @@ +# Created by .ignore support plugin (hsz.mobi) +### Eclipse template +.metadata +.project +.classpath +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target +.target/ + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project + +### Maven template +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/ +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +*.log +*.iml diff --git a/InManageBoot-iboot/.gitlab-ci.yml b/InManageBoot-iboot/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..7cab95664e41537c39f5fe9809d1028c11d6f9cf --- /dev/null +++ b/InManageBoot-iboot/.gitlab-ci.yml @@ -0,0 +1,129 @@ +image: 100.18.33.97:8083/nexus/repository/docker-private/docker:19.03.12 + + +stages: + - deploy + - code-analyze + +maven-build: + rules: + - if: $CI_COMMIT_MESSAGE =~ /\[deploy\]/ + - if: $CI_COMMIT_BRANCH == 'dev' + tags: + - cosmos + + image: 100.18.33.97:8083/nexus/repository/docker-private/maven:3.3.9-jdk-8 + stage: deploy + script: + - mvn -version + - echo ' + + + releases + admin + admin123 + + + snapshots + admin + admin123 + + + + + sifu-154 + * + 私服 + http://100.18.33.154:8081/nexus/content/groups/public + + + + + jdk-1.8 + + 1.8 + + + + repo-zhengzhou + Repository for Zheng Zhou + http://100.18.33.154:8081/nexus/content/groups/public + + true + always + + + true + always + + + + + + ' > $HOME/.m2/settings.xml + - "ls -la $HOME/.m2/" + - "mvn clean deploy -Dmaven.test.skip=true" + +code-analyze-job: + rules: + - if: $CI_COMMIT_MESSAGE =~ /\[deploy\]/ + - if: $CI_COMMIT_BRANCH == 'dev' + tags: + - cosmos + image: 100.18.33.97:8083/nexus/repository/docker-private/maven:3.3.9-jdk-8 + stage: code-analyze + script: + - mvn -version + - echo ' + + + releases + admin + admin123 + + + snapshots + admin + admin123 + + + + + sifu-154 + * + 私服 + http://100.18.33.154:8081/nexus/content/groups/public + + + + + jdk-1.8 + + 1.8 + + + + repo-zhengzhou + Repository for Zheng Zhou + http://100.18.33.154:8081/nexus/content/groups/public + + true + always + + + true + always + + + + + + ' > $HOME/.m2/settings.xml + - "ls -la $HOME/.m2/" + - " mvn clean package org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar -Dsonar.host.url=http://100.18.33.136:9010 -Dmaven.test.skip=true" diff --git a/InManageBoot-iboot/README.md b/InManageBoot-iboot/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/pom.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..06a37e5eb886e42fcfd18b2659015cb0e49a4278 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/pom.xml @@ -0,0 +1,47 @@ + + + + cosmos-biz-iboot-base + com.inspur.cosmos.biz.iboot.base + ${revision} + + 4.0.0 + cosmos-biz-iboot-base-api + Cosmos Biz Iboot Base Api + + + com.inspur.cdc.commons + cdc-commons-lang + + + javax.persistence + javax.persistence-api + + + org.freemarker + freemarker + + + com.itextpdf + itextpdf + + + com.itextpdf.tool + xmlworker + + + jakarta.servlet + jakarta.servlet-api + + + com.google.code.gson + gson + + + com.inspur.cdc + cdc-boot + + + \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/IBootTemplateQueryBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/IBootTemplateQueryBean.java new file mode 100644 index 0000000000000000000000000000000000000000..3af4d4721439df2460ce77c5404ce1fc384c0878 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/IBootTemplateQueryBean.java @@ -0,0 +1,132 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import com.inspur.cdc.commons.lang.web.PageRequest; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/8 + */ +public class IBootTemplateQueryBean extends PageRequest { + private String name; + private Date createTimeStart; + private Date createTimeEnd; + private String createUserID; + private String updateUserID; + private String model; + private String vendor; + private String ip; + private String serial; + private List templateType; + private String architecture; + + public String getArchitecture() { + return architecture; + } + + public void setArchitecture(String architecture) { + this.architecture = architecture; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getSerial() { + return serial; + } + + public void setSerial(String serial) { + this.serial = serial; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Date getCreateTimeStart() { + return createTimeStart; + } + + public void setCreateTimeStart(Date createTimeStart) { + this.createTimeStart = createTimeStart; + } + + public void setCreateTimeStart(String createTimeStart) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + this.createTimeStart = sdf.parse(createTimeStart); + } catch (ParseException e) { + } + } + + public Date getCreateTimeEnd() { + return createTimeEnd; + } + + public void setCreateTimeEnd(Date createTimeEnd) { + this.createTimeEnd = createTimeEnd; + } + + public void setCreateTimeEnd(String createTimeEnd) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + this.createTimeEnd = sdf.parse(createTimeEnd); + } catch (ParseException e) { + } + } + + public String getCreateUserID() { + return createUserID; + } + + public void setCreateUserID(String createUserID) { + this.createUserID = createUserID; + } + + public String getUpdateUserID() { + return updateUserID; + } + + public void setUpdateUserID(String updateUserID) { + this.updateUserID = updateUserID; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public List getTemplateType() { + return templateType; + } + + public void setTemplateType(List templateType) { + this.templateType = templateType; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/OSInstallModeEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/OSInstallModeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..0bbb9ca7d3a20dbdae2f9b3e96e817a81cffa877 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/OSInstallModeEnum.java @@ -0,0 +1,16 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import lombok.Getter; + +@Getter +public enum OSInstallModeEnum { + PRIMARY(1), + SENIOR(2); + + int value; + + OSInstallModeEnum(int value) { + this.value = value; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/RaidLevelEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/RaidLevelEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..f873acc3350a00a59224ec3fdc12b43b8a43b3d1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/RaidLevelEnum.java @@ -0,0 +1,18 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/10 + */ +public enum RaidLevelEnum { + RAID0, + RAID1, + JBOD, + RAID5, + RAID10, + RAID1E, + RAID6, + RAID50, + RAID60; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/ReplaceBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/ReplaceBean.java new file mode 100644 index 0000000000000000000000000000000000000000..f0f26881b24691a394e695994837005e4619d9c0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/ReplaceBean.java @@ -0,0 +1,27 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import lombok.Data; + +/** + * @author zhangchen + * @date 2023/08/10 + */ +@Data +public class ReplaceBean { + + /** + * 需要替换的旧字符串 + */ + private String oldStr; + /** + * 需要替换的新字符串 + */ + private String newStr; + + public ReplaceBean(String oldStr, String newStr) { + this.oldStr = oldStr; + this.newStr = newStr; + } + + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/ResultBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/ResultBean.java new file mode 100644 index 0000000000000000000000000000000000000000..e0371f676547b930470bfdc9d4398d9d7ec2550c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/ResultBean.java @@ -0,0 +1,25 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class ResultBean { + + /** + * 操作标志位 + */ + private boolean flag; + + /** + * 返回信息 + */ + private String message; + + /** + * 返回数据 + */ + private Object data; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskHostStatusEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskHostStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..7154d4fd7cc1362d9f02230b57ef57db98958201 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskHostStatusEnum.java @@ -0,0 +1,33 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import static com.inspur.cdc.commons.i18n.Languages.getLocale; + +/** + * 单个设备的状态 + */ +public enum TaskHostStatusEnum { + FAILED("失败", "FAILED"), + SUCCESS("成功", "SUCCESS"), + RUNNING("运行中", "RUNNING"), + WAITING("等待中", "WAITING"), + PART_SUCCESS("部分成功", "PART_SUCCESS"), + HISTORY("历史", "HISTORY"); + + String statusNameCn; + String statusNameEn; + + TaskHostStatusEnum(String statusNameCn, String statusNameEn) { + this.statusNameCn = statusNameCn; + this.statusNameEn = statusNameEn; + } + + public String getStatusName() { + final String lang = getLocale().toString(); + final String LANGUAGE_ZH_CN = "zh_CN"; + if (LANGUAGE_ZH_CN.equals(lang)) { + return this.statusNameCn; + } else { + return this.statusNameEn; + } + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskQueryBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskQueryBean.java new file mode 100644 index 0000000000000000000000000000000000000000..f2610be93e4faa57a88622cb6d3bbb8ba96884df --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskQueryBean.java @@ -0,0 +1,8 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; + +public class TaskQueryBean extends DeviceQueryBean { + private static final long serialVersionUID = 7254430337535077230L; + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskStatusEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..320301c93374e6c1b7ec258755292a71fc1255d5 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TaskStatusEnum.java @@ -0,0 +1,33 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import static com.inspur.cdc.commons.i18n.Languages.getLocale; + +/** + * 大任务的状态 + */ +public enum TaskStatusEnum { + Failed("失败", "Failed"), + Success("成功", "Success"), + Running("运行中", "Running"), + Waiting("等待中", "Waiting"), + Part_Success("部分成功", "Part Success"); + + + String statusNameCn; + String statusNameEn; + + TaskStatusEnum(String statusNameCn, String statusNameEn) { + this.statusNameCn = statusNameCn; + this.statusNameEn = statusNameEn; + } + + public String getStatusName() { + final String lang = getLocale().toString(); + final String LANGUAGE_ZH_CN = "zh_CN"; + if (LANGUAGE_ZH_CN.equals(lang)) { + return this.statusNameCn; + } else { + return this.statusNameEn; + } + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TemplateTypeEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TemplateTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..1d57b11117ae4ec8383a066caf9760fd7388b9b0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/TemplateTypeEnum.java @@ -0,0 +1,41 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean; + +import static com.inspur.cdc.commons.i18n.Languages.getLocale; + +/** + * @description 模板类型枚举 + * @auther gengzhicheng + * @date 2023/8/7 + */ +public enum TemplateTypeEnum { + + USER_CONF("用户配置", "UserConfig"), + RAID_SET_CONF("Raid配置", "RaidConfig"), + NETWORK_CONF("网络配置", "NetworkConfig"), + STRESS_TEST("压力测试", "StressTest"), + CUSTOM_TEMPLATE("自定义模板", "CustomTemplate"), + DEVICE_REFRESH("设备刷新", "DeviceRefresh"), + OS_INSTALL("操作系统安装", "OSInstall"), + DISK_CLONE("磁盘克隆", "Disk Clone"), + DISK_RESTORE("磁盘还原", "Disk Restore"), + OS_EXPLORE("系统探测", "OSExplore"); + + String templateNameCn; + String templateNameEn; + + TemplateTypeEnum(String templateNameCn, String templateNameEn) { + this.templateNameCn = templateNameCn; + this.templateNameEn = templateNameEn; + } + + public String getTemplateName() { + final String lang = getLocale().toString(); + final String LANGUAGE_ZH_CN = "zh_CN"; + if (LANGUAGE_ZH_CN.equals(lang)) { + return this.templateNameCn; + } else { + return this.templateNameEn; + } + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ArchitectureEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ArchitectureEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..dd93024a5f5c65cd2431169d179cb6f43325356f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ArchitectureEnum.java @@ -0,0 +1,15 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +/** + * @author zhangchen06 + * @version v1.0 + * @date 2022/02/14 15:58:01 + * @description 架构枚举 + */ +public enum ArchitectureEnum { + x86_64, + mips, + arm, + // 作为编排模板的默认架构 + def; +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/BootOptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/BootOptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..32172a5da8bdd73255baeb57f049d44b2f0e15ea --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/BootOptionEnum.java @@ -0,0 +1,10 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +/** + * @author zhangshuai17 + * @date 2023/8/8 + * @description + */ +public enum BootOptionEnum { + UEFI, LEGACY +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceControllerBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceControllerBean.java new file mode 100644 index 0000000000000000000000000000000000000000..e996961842fae857f9c0e525779f0e6d713ab8e2 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceControllerBean.java @@ -0,0 +1,189 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + + +import lombok.Data; + +import java.util.List; + +@Data +public class DeviceControllerBean { + + private static final long serialVersionUID = -4936995732278468539L; + + /** + * productName: 产品名称 + */ + private String productName; + + /** + * serialNumber: 序列号 + */ + private String serialNumber; + + /** + * controllerId: 控制器ID + */ + private String controllerId; + + /** + * deviceId: 设备ID + */ + private String deviceId; + + /** + * 设备类型:LSI、PMC + */ + private String type; + + private String deviceName; + + /** + * subdeviceId: 子设备ID + */ + private String subdeviceId; + + /** + * vendorId: 厂商ID + */ + private String vendorId; + + private String vendorName; + + /** + * subvendorId: 子厂商ID + */ + private String subvendorId; + + /** + * deviceInterface: 设备端口 + */ + private String deviceInterface; + + /** + * hostInterface: 接口类型(插在pcie) + */ + private String hostInterface; + + /** + * smartPolling: 硬盘检测周期 + */ + private String smartPolling; + + /** + * coercionMode: 强制模式 + */ + private String coercionMode; + + /** + * chipTemperature: 芯片温度 + */ + private String chipTemperature; + + /** + * shieldStateSupported: 屏蔽状态 + */ + private String shieldStateSupported; + + /** + * maintainPdFailHistory: 物理磁盘故障历史记录 + */ + private String maintainPdFailHistory; + + private String jbodEnable; + + /** + * alarmControl: 报警控制 + */ + private String alarmControl; + + /** + * biosVersion: BIOS版本 + */ + private String biosVersion; + + /** + * firmwareVersion: 固件版本 [NFV] + */ + private String firmwareVersion; + + /** + * firmwarePackageVersion: 固件包版本 + */ + private String firmwarePackageVersion; + + /** + * firmwareTime: 固件当前时间 + */ + private String firmwareTime; + + /** + * portCount: 端口数 + */ + private String portCount; + + /** + * driveCount: 设备数 + */ + private String driveCount; + + private String hdFailedCount; + + private String hdPerfailCount; + + /** + * minStripSize: DDF最小条带大小(单位:KB) + */ + private String minStripSize; + + /** + * nvramSize: NVRAM大小(单位:KB) + */ + private String nvramSize; + + /** + * memorySize: 内存大小(单位:MB) + */ + private String memorySize; + + /** + * autoRebuild: 自动重建 + */ + private String autoRebuild; + + /** + * rebuildRate: 重建率 + */ + private String rebuildRate; + + /** + * backGroundInitRate: 后台初始化率 + */ + private String backGroundInitRate; + + /** + * cacheFlushInterval: 缓存刷新频率(单位:秒) + */ + private String cacheFlushInterval; + + /** + * clusterMode: 群集模式 + */ + private String clusterMode; + + /** + * smartCopybackEnabled: 智能回写使能 + */ + private String smartCopybackEnabled; + + /** + * sasAddress: SAS地址 + */ + private String sasAddress; + + private String status; + + + private List volumes; + + private List drives; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceControllerBeanFilter.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceControllerBeanFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..0e3be9739fe9ef3f82d28c3b027fae7f3955e2f7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceControllerBeanFilter.java @@ -0,0 +1,7 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import com.fasterxml.jackson.annotation.JsonFilter; + +@JsonFilter("deviceControllerBeanFilter") +public class DeviceControllerBeanFilter { +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDetailBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDetailBean.java new file mode 100644 index 0000000000000000000000000000000000000000..cc9e7261d964868ed19ec11d3ddd772db95f5df9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDetailBean.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +/** + * @author zhangshuai17 + * @date 2023/8/9 + * @description + */ +@Data +public class DeviceDetailBean { + private DeviceSystemInfoBean system; + private DeviceStorageBean storage; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDiskCloneBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDiskCloneBean.java new file mode 100644 index 0000000000000000000000000000000000000000..4eaca9be6bb1a76674efe938ee732e8e98501488 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDiskCloneBean.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +import java.util.List; + +@Data +public class DeviceDiskCloneBean { + private String deviceId; + private String sn; + private List disk; + private String imageName; + private DiskCloneMethodEnum method; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveBean.java new file mode 100644 index 0000000000000000000000000000000000000000..185cdc9cb95a80c88e7ded13134366edbf0f27b9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveBean.java @@ -0,0 +1,193 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + + +import lombok.Data; + +@Data +public class DeviceDriveBean { + + private String serialNumber; + + /** + * 设备ID + */ + private String deviceId; + + private String deviceName; + + /** + * 厂商ID + */ + private String vendorId; + + private String vendorName; + + /** + * 磁盘框ID + */ + private String enclosureId; + + /** + * 产品id + */ + private String productId; + + /** + * 控制器ID, 多控制器情况下,可能需要此字段 + */ + private String controllerId; + + /** + * 媒体类型 + */ + private String mediaType; + + /** + * 设备接口 + */ + private String deviceInterface; + + /** + * 温度 + */ + private String temperature; + + /** + * SAS地址 + */ + private String sasAddress; + + /** + * 路径是否损坏 + */ + private String isPathBroken; + + /** + * 全盘加密使能 + */ + private String fdeCapable; + + /** + * 电源状态 + */ + private String powerState; + + private String pdLife; + + /** + * (单位:Gbps) + */ + private String maxSpeed; + + /** + * 连接速度(单位:Gbps) + */ + private String negotiatedLinkSpeed; + + /** + * 用户数据块大小(单位:B) + */ + private String userDataBlockSize; + + /** + * 原始大小(单位:GB) + */ + private String rawSize; + + /** + * COD强制预留大小(单位:GB) + */ + private String coercedSize; + + /** + * 固件版本 + */ + private String firmwareVersion; + + /** + * 媒体错误数 + */ + private String mediaErrorCount; + + /** + * 槽位号 + */ + private String slotNumber; + + /** + * 连接端口 + */ + private String connectedPort; + + /** + * 错误数量 + */ + private String predictiveFailCount; + + /** + * 物理盘状态 + */ + private String status; + + /** + * 物理盘状态说明 + */ + private String statusTip; + + /** + * 固件状态 + */ + private String firmwareState; + + private String security; + + /** + * 安全擦除使能 + */ + private String secureErase; + + /** + * 重建使能 + */ + private String rebuild; + + /** + * 巡读使能 + */ + private String patrolRead; + + /** + * 硬盘指示灯位置使能 + */ + private String locate; + + /** + * 禁用移除 + */ + private String disabledRemoval; + + /** + * 紧急备份设置 + */ + private String emergencySpare; + + /** + * 回拷 + */ + private String copyBack; + + /** + * 热备盘使能 + */ + private String commissionedHotspare; + + /** + * 清盘使能 + */ + private String clearAllData; + + private String badBlockTable; + + private String driveGroup; +} + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveBeanFilter.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveBeanFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..acaa91199479f94464639625e3cc3b71d562f028 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveBeanFilter.java @@ -0,0 +1,7 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import com.fasterxml.jackson.annotation.JsonFilter; + +@JsonFilter("deviceDriveBeanFilter") +public class DeviceDriveBeanFilter { +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveStatusEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..873fa7d283198fa0c3b1e0c08fbaa018e8441be9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDriveStatusEnum.java @@ -0,0 +1,39 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import com.inspur.cdc.commons.i18n.Languages; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; + +import java.util.Arrays; + +public enum DeviceDriveStatusEnum { + ONLINE("Online", "已配置为虚拟磁盘的成员盘,可正常使用", "The drive is a member drive of a virtual drive. It is online and is working properly."), + OFFLINE("Offline", "已配置为虚拟磁盘的成员盘,不可正常使用", "The drive is a member drive of a virtual drive. It cannot work properly and is offline."), + UGOOD("Unconfigured Good", "硬盘状态正常,但不是虚拟磁盘的成员盘或热备盘", "The drive is in a normal state but is not a member drive of a virtual drive or hot spare drive."), + UBAD("Unconfigured Bad", "\"Unconfigured Good\"或未初始化的硬盘出现无法恢复错误", "If an unrecoverable error occurs on a drive in the Unconfigured Good or uninitialized state, the drive enters the Unconfigured Bad state."), + HOT_SPARE("Hot Spare", "热备盘", "The drive is configured as a hot spare drive."), + REBUILD("Rebuild", "硬盘正在进行数据重构,以保持数据冗余性和完整性", "Data is being reconstructed on the drive to ensure data redundancy and integrity of the virtual drive."), + FAILED("Failed", "\"Online\"或\"Hot Spare\"状态的硬盘出现不可恢复错误时,显示为此状态", "If an unrecoverable error occurs on a drive in the Online or Hot Spare state, the drive enters the Failed state."), + MISSING("Missing", "\"Online\"状态的硬盘被拔出后,显示为此状态", "When a drive in the Online state is removed, the drive enters the Missing state."), + JBOD("JBOD", "硬盘以直通方式使用", "Drive works in passthrough mode."), + UNKOWN("Unknown", "硬盘状态未知", "The drive state is unknown."); + + @Getter + private String status; + private String descriptionZh; + private String descriptionEn; + + DeviceDriveStatusEnum(String status, String descriptionZh, String descriptionEn) { + this.status = status; + this.descriptionZh = descriptionZh; + this.descriptionEn = descriptionEn; + } + + public static DeviceDriveStatusEnum matchStatus(String status) { + return Arrays.stream(values()).filter(e -> StringUtils.equalsIgnoreCase(status, e.name())).findFirst().orElse(UNKOWN); + } + + public String getDescription() { + return "zh_CN".equals(Languages.getLocale2String()) ? descriptionZh : descriptionEn; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDropdownBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDropdownBean.java new file mode 100644 index 0000000000000000000000000000000000000000..a2556815edad8c36acfbd4cd0745c4ef36dd3c74 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceDropdownBean.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhangshuai17 + * @date 2023/8/8 + * @description + */ +@Data +public class DeviceDropdownBean implements Serializable { + private List modelList; + private List vendorList; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceQueryBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceQueryBean.java new file mode 100644 index 0000000000000000000000000000000000000000..fb1a6aa04426b95feff6bd4cb48ccaba412f59f9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceQueryBean.java @@ -0,0 +1,23 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import com.inspur.cdc.commons.lang.web.PageQuery; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DeviceQueryBean extends PageQuery implements Serializable { + private static final long serialVersionUID = 8244430337535077230L; + private String sn; + private String dhcpIp; + private String manageIp; + private DeviceStatusEnum status; + private IpmiStatusEnum ipmiStatus; + private ManageChannelEnum manageChannel; + private String networkDevice; + private String vendor; + private String model; + private ArchitectureEnum architecture; + private BootOptionEnum bootOption; + private String md5; +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStatusEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..65ab90e774fdda5fb315bfd2fc14aece1e9d5198 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStatusEnum.java @@ -0,0 +1,30 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import static com.inspur.cdc.commons.i18n.Languages.getLocale; + +/** + * 设备的状态 + */ +public enum DeviceStatusEnum { + Offline("离线", "Offline"), + Online("在线", "Online"), + Busy("忙碌", "Busy"); + + String statusNameCn; + String statusNameEn; + + DeviceStatusEnum(String statusNameCn, String statusNameEn) { + this.statusNameCn = statusNameCn; + this.statusNameEn = statusNameEn; + } + + public String getStatusName() { + final String lang = getLocale().toString(); + final String LANGUAGE_ZH_CN = "zh_CN"; + if (LANGUAGE_ZH_CN.equals(lang)) { + return this.statusNameCn; + } else { + return this.statusNameEn; + } + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStorageBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStorageBean.java new file mode 100644 index 0000000000000000000000000000000000000000..ad6565811deed22d5b619e6435d484e6f8996aea --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStorageBean.java @@ -0,0 +1,16 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +import java.util.List; + +/** + * @author zhangshuai17 + * @date 2023/8/21 + * @description + */ +@Data +public class DeviceStorageBean { + private List controllers; + private List drives; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStorageEntryBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStorageEntryBean.java new file mode 100644 index 0000000000000000000000000000000000000000..cc32f640575a528ecd06c6563eac97e5b507d78f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceStorageEntryBean.java @@ -0,0 +1,9 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +@Data +public class DeviceStorageEntryBean { + private String desc; + private Object value; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceSystemInfoBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceSystemInfoBean.java new file mode 100644 index 0000000000000000000000000000000000000000..546e46d32b7de571aca3dc5c85e914cb674c92d0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceSystemInfoBean.java @@ -0,0 +1,37 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + + +import lombok.Data; + +import java.util.List; + +@Data +public class DeviceSystemInfoBean { + private String serialNumber; + private String assetTag; + private String vendor; + private String model; + private String architecture; + private String processor; + private String mainboardSerialNumber; + /** + * 单位GB + */ + private String memoryCapacity; + /** + * 单位GB,保留一位有效数字 + */ + private String diskCapacity; + private String bmcVersion; + private String biosVersion; + private String mac; + private String network; + private String dhcpIP; + private String manageIP; + private String manageMask; + private String manageGateway; + private List logicDisk; + + private String bootOption; + private String manageChannel; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceSystemLogicDiskBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceSystemLogicDiskBean.java new file mode 100644 index 0000000000000000000000000000000000000000..1d68176725c19023c81f67a316104cbb58c0b909 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceSystemLogicDiskBean.java @@ -0,0 +1,19 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +/** + * @author zhangshuai17 + * @date 2023/8/22 + * @description fdisk和lsblk 命令输出信息 + */ +@Data +public class DeviceSystemLogicDiskBean { + private String name; + private String identifier; + /** + * 单位GB,保留一位有效数字 + */ + private String size; + private String partition; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceVolumeBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceVolumeBean.java new file mode 100644 index 0000000000000000000000000000000000000000..0bcaadab407aaf88b41f6c7162da7ec42d535493 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceVolumeBean.java @@ -0,0 +1,36 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +import java.util.List; + +/** + * @author zhangshuai17 + * @date 2023/8/21 + * @description + */ +@Data +public class DeviceVolumeBean { + private String vid; + private String name; + private String raidType; + /** + * 单位GB,保留一位有效数字 + */ + private String capacity; + private String slot; + private String hotSpareSlot; + private String driveGroup; + /** + * 单位KB + */ + private String strip; + private String cachePolicy; + private String readPolicy; + private String writePolicy; + private String accessPolicy; + private String ioPolicy; + private String boot; + private String backPlane; + private List drives; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceVolumeBeanFilter.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceVolumeBeanFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..39c133a37fec9ad91f0d3dcded932bb8fc8133d2 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DeviceVolumeBeanFilter.java @@ -0,0 +1,7 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import com.fasterxml.jackson.annotation.JsonFilter; + +@JsonFilter("deviceVolumeBeanFilter") +public class DeviceVolumeBeanFilter { +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DiskCloneMethodEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DiskCloneMethodEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..e445e984d780ccd1d8931cf68a2244ff6aeb324d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/DiskCloneMethodEnum.java @@ -0,0 +1,5 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +public enum DiskCloneMethodEnum { + BACKUP, RESTORE +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/IpmiFailEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/IpmiFailEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..8f0c4cfcf45be79ea617d3be1b8922c3096d980c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/IpmiFailEnum.java @@ -0,0 +1,10 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +/** + * @author zhangshuai17 + * @date 2023/8/10 + * @description + */ +public enum IpmiFailEnum { + NORMAL, NORMAL_IBOOT, CONFIGURATION, CONNECTION, CREDENTIALS +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/IpmiStatusEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/IpmiStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..5d1ab03adf7a8f12c1dd9bb79477f9ba51abf900 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/IpmiStatusEnum.java @@ -0,0 +1,10 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +/** + * @author zhangshuai17 + * @date 2023/8/8 + * @description + */ +public enum IpmiStatusEnum { + AVAILABLE, UNAVAILABLE +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ManageAccountEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ManageAccountEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..a92f32117e9492800d1cb2108009a5c495ca1adf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ManageAccountEnum.java @@ -0,0 +1,10 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +/** + * @author zhangshuai17 + * @date 2023/8/16 + * @description + */ +public enum ManageAccountEnum { + ON, OFF +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ManageChannelEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ManageChannelEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..62d0f160d24b7c1c32a1b60697a64dced47dce01 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ManageChannelEnum.java @@ -0,0 +1,10 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +/** + * @author zhangshuai17 + * @date 2023/8/8 + * @description + */ +public enum ManageChannelEnum { + DEDICATED, SHARELINK +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ServerManageNetworkBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ServerManageNetworkBean.java new file mode 100644 index 0000000000000000000000000000000000000000..4e3d8570900e13147f025fc4ed9cb117e7d006c4 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/ServerManageNetworkBean.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +import java.util.List; + +@Data +public class ServerManageNetworkBean { + private List ip; + private String dhcpIp; + private String dhcpRangeBegin; + private String dhcpRangeEnd; + private String nginxIp; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/TreeNode.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/TreeNode.java new file mode 100644 index 0000000000000000000000000000000000000000..65504424eba8d85a7a1f65155886d1ab10790106 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/device/TreeNode.java @@ -0,0 +1,27 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.device; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class TreeNode implements Serializable { + /** + * 序列化ID. + */ + private static final long serialVersionUID = 6021052740914459714L; + private String id; + private String name; + private boolean checked; + /** + * url的权重.1代表user可以访问的最高权重,2代表operator可以访问的最高权重,3代表管理员. + */ + private List childList; + + private String content; + + private String typeName; + + private String nodeStatus; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/Chunk.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/Chunk.java new file mode 100644 index 0000000000000000000000000000000000000000..72e845d2a80d98b87e853b93bf1161dc554ea95c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/Chunk.java @@ -0,0 +1,161 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import org.springframework.web.multipart.MultipartFile; + +import javax.persistence.Transient; +import java.io.Serializable; + +public class Chunk implements Serializable { + /** + * @Fields serialVersionUID: 序列化 + */ + private static final long serialVersionUID = 1L; + /** + * 主键id. 为后续断点续传做准备. + */ + private Long id; + /** + * 当前文件块,从1开始 + */ + private Integer chunkNumber; + /** + * 分块大小 + */ + private Long chunkSize; + /** + * 当前分块大小 + */ + private Long currentChunkSize; + /** + * 总大小 + */ + private Long totalSize; + /** + * 文件标识 + */ + private String identifier; + /** + * 文件名 + */ + private String filename; + /** + * 相对路径 + */ + private String relativePath; + /** + * 总块数 + */ + private Integer totalChunks; + /** + * 文件类型 + */ + private String type; + + /** + * 断点续传标记. + */ + private boolean renewalFlag; + + /** + * 文件对象. + */ + @Transient + private MultipartFile file; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Integer getChunkNumber() { + return chunkNumber; + } + + public void setChunkNumber(Integer chunkNumber) { + this.chunkNumber = chunkNumber; + } + + public Long getChunkSize() { + return chunkSize; + } + + public void setChunkSize(Long chunkSize) { + this.chunkSize = chunkSize; + } + + public Long getCurrentChunkSize() { + return currentChunkSize; + } + + public void setCurrentChunkSize(Long currentChunkSize) { + this.currentChunkSize = currentChunkSize; + } + + public Long getTotalSize() { + return totalSize; + } + + public void setTotalSize(Long totalSize) { + this.totalSize = totalSize; + } + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public String getRelativePath() { + return relativePath; + } + + public void setRelativePath(String relativePath) { + this.relativePath = relativePath; + } + + public Integer getTotalChunks() { + return totalChunks; + } + + public void setTotalChunks(Integer totalChunks) { + this.totalChunks = totalChunks; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public MultipartFile getFile() { + return file; + } + + public void setFile(MultipartFile file) { + this.file = file; + } + + public boolean isRenewalFlag() { + return renewalFlag; + } + + public void setRenewalFlag(boolean renewalFlag) { + this.renewalFlag = renewalFlag; + } +} + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ChunkFileModel.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ChunkFileModel.java new file mode 100644 index 0000000000000000000000000000000000000000..ea1de771bc151adb23d92ad5fbc68dc5f91180c7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ChunkFileModel.java @@ -0,0 +1,82 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ArchitectureEnum; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName: ChunkFileModel + * @Description: TODO + * + * @author: zhangchen + * @date: 2022年02月17日 下午6:31:16 + */ +@Data +public class ChunkFileModel implements Serializable { + /** + * @Fields serialVersionUID: 序列化. + */ + private static final long serialVersionUID = 4321148751282216742L; + /** + * 文件标识. + */ + private String identifier; + /** + * 文件名. + */ + private String fileName; + + /** + * 总块数 + */ + private Integer totalChunks; + + + /** + * 是否自定义. + */ + private Boolean customImage = false; + + + /** + * 文件源地址. + */ + private String sourcePath; + + /** + * 镜像类型(型号) + */ + private ImageTypeEnum imageType; + /** + * 架构 + */ + private ArchitectureEnum architecture; + + /** + * 版本. + */ + private String version; + /** + * md5值. + */ + private String md5; + + /** + * 镜像包含ks + * @return + */ + private boolean hasKS; + /** + * 是否加入镜像源 + * @return + */ + private boolean insource = false; + /** + * yum 名称 + * @return + */ + private String yumName; + +} + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/IBootOtherSupportedImageBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/IBootOtherSupportedImageBean.java new file mode 100644 index 0000000000000000000000000000000000000000..67cb2f49ae60ef98506f469dcbbbfe37f1e25b44 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/IBootOtherSupportedImageBean.java @@ -0,0 +1,89 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import java.io.Serializable; + +/** + * @author ryalii + * @description 辅助表,存储目前支持的安装镜像实体类 + * @date 2022/02/16 15:45:43 + */ +public class IBootOtherSupportedImageBean implements Serializable { + private long pk; + private String id; + /** + * 发行版 + */ + private String imageType; + /** + * 版本 + */ + private String version; + /** + * 表示该版本仅支持自带KS的情况,前端页面根据此字段设置是否有KS + */ + private Boolean needKs; + /** + * + */ + private String createTime; + /** + * + */ + private String updateTime; + + public String getImageType() { + return imageType; + } + + public void setImageType(String imageType) { + this.imageType = imageType; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public long getPk() { + return pk; + } + + public void setPk(long pk) { + this.pk = pk; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Boolean getNeedKs() { + return needKs; + } + + public void setNeedKs(Boolean needKs) { + this.needKs = needKs; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/IBootSupportedImageBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/IBootSupportedImageBean.java new file mode 100644 index 0000000000000000000000000000000000000000..4947d6a44a8008ced241f9701d5c7b0a56b67fd3 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/IBootSupportedImageBean.java @@ -0,0 +1,13 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + + +import lombok.Data; + +import java.util.List; + +@Data +public class IBootSupportedImageBean { + private String label; + private String value; + private List children; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageEnvironmentBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageEnvironmentBean.java new file mode 100644 index 0000000000000000000000000000000000000000..c904014ec993adfb559f796dd7c952b4ec68d12d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageEnvironmentBean.java @@ -0,0 +1,22 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import lombok.Data; + +import java.util.List; +import java.util.Set; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/17 + */ +@Data +public class ImageEnvironmentBean { + private String enName; + private String cnName; + private String id; + private String enDes; + private String cnDes; + private Set optionGroupSet; + private List groupIdList; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageGroupBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageGroupBean.java new file mode 100644 index 0000000000000000000000000000000000000000..fd808d0f45199b5ceed77af267548973f110529f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageGroupBean.java @@ -0,0 +1,18 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/17 + */ +@Data +public class ImageGroupBean { + private String groupId; + private String groupName; + private String cnDes; + private String enDes; + private String cnName; + private String enName; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageQueryBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageQueryBean.java new file mode 100644 index 0000000000000000000000000000000000000000..ca0e62c160914c197e606e229e26d388fc5179a8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageQueryBean.java @@ -0,0 +1,18 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + + +import com.inspur.cdc.commons.lang.web.PageQuery; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ImageQueryBean extends PageQuery implements Serializable { + + private String originalName; + private String name; + private ImageTypeEnum imageType; + private String customImage; + private String architecture; + private String osType; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageTypeEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..6d7b9e74b979f76740714d78a0560d98f853ea47 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageTypeEnum.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +/** + * @author ryalii + * @version v1.0 + * @date 2022/02/14 15:58:01 + * @description 来源枚举 + */ +public enum ImageTypeEnum { + CentOS, + RHEL, + ESXI, + Ubuntu, + NeoKylin, + Kylin, + Windows, + SUSE, + UOS, + KOS +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageXmlBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageXmlBean.java new file mode 100644 index 0000000000000000000000000000000000000000..2ceabff3a024351d408c7b651989e764189acc05 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageXmlBean.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import com.google.common.collect.Maps; +import lombok.Data; + +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/17 + */ +@Data +public class ImageXmlBean { + Map groupMap = Maps.newHashMap(); + Map envMap = Maps.newHashMap(); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageXmlBeans.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageXmlBeans.java new file mode 100644 index 0000000000000000000000000000000000000000..31d580977889af84da8da44a05ad3e67f1bf9289 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/ImageXmlBeans.java @@ -0,0 +1,23 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/17 + */ +@Data +public class ImageXmlBeans { + private List listZ = new ArrayList<>(); + private List listE = new ArrayList<>(); + private List ListI = new ArrayList<>(); + private Map mapZ = new HashMap<>(); + private Map mapE = new HashMap<>(); + private Map mapI = new HashMap<>(); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/KeyValueBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/KeyValueBean.java new file mode 100644 index 0000000000000000000000000000000000000000..f57776a95e360e7295ea0b1b7188a571bfd12ef8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/KeyValueBean.java @@ -0,0 +1,10 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + + +import lombok.Data; + +@Data +public class KeyValueBean { + private String label; + private String value; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/SpaceCheckEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/SpaceCheckEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..3d29071667100e9f295711ebb1a5cf22abb352ec --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/SpaceCheckEnum.java @@ -0,0 +1,12 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +/** + * @description + * @auther gengzhicheng + * @date 2023/5/25 + */ +public enum SpaceCheckEnum { + INSUFFICIENT, + WARNING, + AVALIVABLE +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/SpaceCheckResult.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/SpaceCheckResult.java new file mode 100644 index 0000000000000000000000000000000000000000..cc54e9a30dc2da4665956235c3f524b5ba295fa6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/image/SpaceCheckResult.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.image; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/5/26 + */ +@Data +public class SpaceCheckResult { + + private SpaceCheckEnum result; + private String message; + private String overSpace; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/DeviceShowBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/DeviceShowBean.java new file mode 100644 index 0000000000000000000000000000000000000000..114dd99b88a266549ca99f80d90d715079b84d55 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/DeviceShowBean.java @@ -0,0 +1,30 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.index; + +import lombok.Data; + +/** + * @author zhangchen + * @date 2023/11/07 + */ +@Data +public class DeviceShowBean { + + /** + * 设备总数 + */ + private int total; + /** + * 离线设备总数 + */ + private int offlineNum; + /** + * 忙碌设备树 + */ + private int busyNum; + /** + * 空闲设备数 + */ + private int freeNum; + + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/TemplateShowBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/TemplateShowBean.java new file mode 100644 index 0000000000000000000000000000000000000000..8e28fee01f4ced5b695f4c9ebb5e1b57e0f36e49 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/TemplateShowBean.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.index; + +import lombok.Data; + +/** + * @author zhangchen + * @date 2023/11/07 + */ +@Data +public class TemplateShowBean { + + /** + * 模板名称 + */ + private String name; + + /** + * 模板类型 + */ + private String type; + /** + * 执行次数 + */ + private int number; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/TotalBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/TotalBean.java new file mode 100644 index 0000000000000000000000000000000000000000..6c6a05390d89d656266a09a6954a09d12dcf4f8a --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/index/TotalBean.java @@ -0,0 +1,30 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.index; + +import lombok.Data; + +/** + * @author zhangchen + * @date 2023/11/07 + */ +@Data +public class TotalBean { + + /** + * 设备总数 + */ + private int deviceNum; + /** + * 任务总数 + */ + private int taskNum; + /** + * 模板总数 + */ + private int templateNum; + /** + * 镜像总数 + */ + private int imageNum; + + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/IBootRaidConfigBigTemplateBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/IBootRaidConfigBigTemplateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..32a0a0a59461f1eb34db92ed5deb717d776d543b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/IBootRaidConfigBigTemplateBean.java @@ -0,0 +1,28 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/*** + * @description + * @author zhangchen06 + * @date 2023/10/13 15:30 + */ +@Data +public class IBootRaidConfigBigTemplateBean implements Serializable { + + /** + * raid对应创建的逻辑盘 + */ + public IBootRaidConfigTemplateBean templateBean; + /** + * 需要提前进行的敏感操作 + */ + public List deleteVolume; + /** + * 前端提交的原始树,用来详情展示 + */ + public String origalTree; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/IBootRaidConfigTemplateBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/IBootRaidConfigTemplateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..1cf1a1d7da6330e5a10f184d7369122fbe2d7ca1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/IBootRaidConfigTemplateBean.java @@ -0,0 +1,75 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import cn.hutool.core.util.ObjectUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.LogicalDisk; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.PhysicalDisk; +import lombok.Data; +import lombok.Getter; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/*** + * @description + * @author zhangchen06 + * @date 2023/10/8 15:30 + */ +@Data +public class IBootRaidConfigTemplateBean implements Serializable { + + /** + * raid对应创建的逻辑盘 + */ + public Map> raidLogicalDisk; + /** + * 空闲盘 + */ + public Map> raidFreeDisk; + /** + * 是否jobd + */ + public Map jbodFlag; + /** + * 脚本使用的对象 + */ + @Getter + public Map jbodFlagnew; + /** + * 是否清空配置,map格式,哪一个卡需要清空配置 + */ + public Map clearFlag; + /** + * 需要删除的逻辑盘 + */ + public List deleteVolume; + + public void setJbodFlagnew() { + Map jbodMap = new HashMap<>(); + if (ObjectUtil.isNotEmpty(this.jbodFlag)) { + this.jbodFlag.forEach((key, value) -> { + if (value) { + jbodMap.put(key, "1"); + } else { + jbodMap.put(key, "0"); + } + }); + } + this.jbodFlagnew = jbodMap; + } + + public Map getJbodFlagnew() { + Map jbodMap = new HashMap<>(); + if (ObjectUtil.isNotEmpty(this.jbodFlag)) { + this.jbodFlag.forEach((key, value) -> { + if (value) { + jbodMap.put(key, "1"); + } else { + jbodMap.put(key, "0"); + } + }); + } + return jbodMap; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/LogicalDiskForDelete.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/LogicalDiskForDelete.java new file mode 100644 index 0000000000000000000000000000000000000000..ff5bf3d98615eab34d6847a9e7155b2f2112fbe5 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/LogicalDiskForDelete.java @@ -0,0 +1,45 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import lombok.Data; + + +/** + * @description + * @auther zhangchen06 + * @date 2023/10/08 + */ +@Data +public class LogicalDiskForDelete { + + /** + * 逻辑盘的Vid,删除逻辑盘用 + * 逻辑盘的DG,做局部热备用, + * 硬盘的slot号,删除全局热备用 + */ + private String vid; + private String dg; + private String sid; + + /*** + * raid卡id + */ + private String cid; + /*** + * 背板id + */ + private String eid; + /** + * 逻辑盘名称 + */ + private String name; + private String cardName; + /** + * 操作, + * 1,删除逻辑盘 delVolume + * 2,删除jbod delJobd + * 3,全局热备转UG ghotToUG + * 4,局部热备转UG dhotToUG + * 5,对现有逻辑盘做局部热备 dhotToOldLogic + */ + private String operation; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/LogicalTypeEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/LogicalTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..a0ee8d75828ba61c6314f91f947667c991f93004 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/LogicalTypeEnum.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +public enum LogicalTypeEnum { + logical("logical"), + globalhotspare("globalhotspare"), + dedicatedhotspare("dedicatedhotspare"), + //在旧的逻辑盘上,做局部热备 + dedicatedoldhotspare("dedicatedoldhotspare"), + deletehotspare("delhotspare"), + makejbod("makejbod"); + private String value; + + LogicalTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidAnalyResult.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidAnalyResult.java new file mode 100644 index 0000000000000000000000000000000000000000..65b4f94e8fe004d18d402b5bd873069c9dad9a5f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidAnalyResult.java @@ -0,0 +1,24 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import lombok.Data; + +import java.util.List; + + +/** + * @description + * @auther zhangchen06 + * @date 2023/10/12 + */ +@Data +public class RaidAnalyResult { + + /** + * 后台分析出的,做Raid前的敏感操作 + */ + private List operationList; + /** + * 后台分析出的,做Raid前的敏感操作,转化成前端直接展示的字符串 + */ + private List showList; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidConfigGrapgicConstant.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidConfigGrapgicConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..3af5503783f7902b9d95988c11c0f5af5f244425 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidConfigGrapgicConstant.java @@ -0,0 +1,24 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +/** + * @author :zhangchen + * @date :Created in 2022/9/06 14:24 + * 图形化raid配置参数 + */ +public class RaidConfigGrapgicConstant { + + /** + * 图形化raid配置参数 + */ + public static String create_raid = "python CreateRaid.py"; + public static String create_flag = "create"; + public static String delete_volume = "deleteVolume"; + public static String clear_jbod = "clearjbod"; + public static String cfg_flag = "pdCfg"; + public static String cfg_init = "raidInit"; + public static String cfg_clear = "clear"; + public static String op_raid = "op_raid"; + public static String title = "#!/bin/bash"; + public static String pyPath = "cd ./iboot_tool/"; + public static String fw_config = "python FwConfig.py"; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidConfigXmlBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidConfigXmlBean.java new file mode 100644 index 0000000000000000000000000000000000000000..7419c5332400c54b011ec279e8e5bffe16135922 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidConfigXmlBean.java @@ -0,0 +1,179 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.json.JSONUtil; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/4/14 + */ +@Data +public class RaidConfigXmlBean { + + private RangeBean logical; + private RangeBean global; + private RangeBean dedicated; + private RangeBean jbod; + + private Boolean bootDisk; + + private ValueBean raidLevel; + private ValueBean strip; + private ValueBean readPolicy; + private ValueBean writePolicy; + private ValueBean ioPolicy; + private ValueBean cachePolicy; + private ValueBean accessPolicy; + + private NumberBean RAID0; + private NumberBean RAID1; + private NumberBean RAID5; + private NumberBean RAID6; + private NumberBean RAID10; + private NumberBean RAID1E; + private NumberBean RAID50; + private NumberBean RAID60; + + public static void main(String[] args) { +// String content="[{\"controllerId\":\"0\",\"drives\":[{\"controllerId\":\"0\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"5\",\"status\":\"JBOD\"},{\"controllerId\":\"0\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"6\",\"status\":\"JBOD\"},{\"controllerId\":\"0\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"2\",\"status\":\"HOT_SPARE\"}],\"productName\":\"AVAGO MegaRAID SAS 9460-8i\",\"type\":\"LSI\",\"volumes\":[{\"accessPolicy\":\"\",\"backPlane\":\"\",\"boot\":\"\",\"cachePolicy\":\"Disk's Default\",\"capacity\":\"1.090TB\",\"driveGroup\":\"0\",\"drives\":[{\"controllerId\":\"0\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"0\",\"status\":\"ONLINE\"},{\"controllerId\":\"0\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"1\",\"status\":\"ONLINE\"},{\"controllerId\":\"0\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"4\",\"status\":\"HOT_SPARE\"}],\"ioPolicy\":\"\",\"name\":\"\",\"raidType\":\"RAID1\",\"readPolicy\":\"\",\"slot\":\"133:0,133:1\",\"strip\":\"256 KB\",\"vid\":\"0\",\"writePolicy\":\"\"}]}]"; + String content = "[{\"controllerId\":\"0\",\"drives\":[{\"controllerId\":\"0\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"5\",\"status\":\"JBOD\"},{\"controllerId\":\"0\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"6\",\"status\":\"JBOD\"},{\"controllerId\":\"0\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"2\",\"status\":\"HOT_SPARE\"}],\"productName\":\"AVAGO MegaRAID SAS 9460-8i\",\"type\":\"LSI\",\"volumes\":[{\"accessPolicy\":\"\",\"backPlane\":\"\",\"boot\":\"\",\"cachePolicy\":\"Disk's Default\",\"capacity\":\"1.090TB\",\"driveGroup\":\"0\",\"drives\":[{\"controllerId\":\"0\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"0\",\"status\":\"ONLINE\"},{\"controllerId\":\"0\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"1\",\"status\":\"ONLINE\"},{\"controllerId\":\"0\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"4\",\"status\":\"HOT_SPARE\"}],\"ioPolicy\":\"\",\"name\":\"\",\"raidType\":\"RAID1\",\"readPolicy\":\"\",\"slot\":\"133:0,133:1\",\"strip\":\"256 KB\",\"vid\":\"0\",\"writePolicy\":\"\"}]},{\"controllerId\":\"1\",\"drives\":[{\"controllerId\":\"1\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"5\",\"status\":\"JBOD\"},{\"controllerId\":\"1\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"6\",\"status\":\"JBOD\"},{\"controllerId\":\"1\",\"driveGroup\":\"-\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"2\",\"status\":\"HOT_SPARE\"}],\"productName\":\"AVAGO MegaRAID SAS 9461-8i\",\"type\":\"LSI\",\"volumes\":[{\"accessPolicy\":\"\",\"backPlane\":\"\",\"boot\":\"\",\"cachePolicy\":\"Disk's Default\",\"capacity\":\"1.090TB\",\"driveGroup\":\"0\",\"drives\":[{\"controllerId\":\"1\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"0\",\"status\":\"ONLINE\"},{\"controllerId\":\"1\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"1\",\"status\":\"ONLINE\"},{\"controllerId\":\"1\",\"driveGroup\":\"0\",\"enclosureId\":\"133\",\"mediaType\":\"HDD\",\"rawSize\":\"1.090TB\",\"slotNumber\":\"4\",\"status\":\"HOT_SPARE\"}],\"ioPolicy\":\"\",\"name\":\"\",\"raidType\":\"RAID1\",\"readPolicy\":\"\",\"slot\":\"133:0,133:1\",\"strip\":\"256 KB\",\"vid\":\"0\",\"writePolicy\":\"\"}]}]"; +// List raidSingeBeans= JSONUtil.toList(JSONUtil.parseArray(content),RaidSingeBean.class); + List raidTreeList = new ArrayList(); + if (StringUtils.isNotEmpty(content)) { + List raidSingeBeans = JSONUtil.toList(JSONUtil.parseArray(content), RaidSingeBean.class); + for (RaidSingeBean raidSingeBean : raidSingeBeans) {//第一层处理raid + RaidTreeBean raidTreeBean = new RaidTreeBean(); + String firstParantKey = "c" + raidSingeBean.getControllerId(); + raidTreeBean.setKey(firstParantKey); + raidTreeBean.setTitle("/c" + raidSingeBean.getControllerId() + ":" + raidSingeBean.getType().toUpperCase() + ":" + raidSingeBean.getProductName()); + raidTreeBean.setType("card"); + raidTreeBean.setParent(""); + raidTreeBean.setStatus(""); + raidTreeBean.setContent(""); + //处理第二层的逻辑盘 + List raidChildren = new ArrayList(); + List volumes = raidSingeBean.getVolumes(); + if (CollectionUtil.isNotEmpty(volumes)) { + for (RaidVolumeBean raidVolumeBean : volumes) { + RaidTreeBean volumeTree = new RaidTreeBean(); + String twoParantKey = firstParantKey + "v" + raidVolumeBean.getVid(); + volumeTree.setKey(twoParantKey); + volumeTree.setParent(firstParantKey); + volumeTree.setType("logical"); + volumeTree.setStatus(""); + volumeTree.setTitle(raidVolumeBean.getRaidType() + "-" + raidVolumeBean.getCapacity() + "-VID" + raidVolumeBean.getVid() + "-DG" + raidVolumeBean.getDriveGroup()); + volumeTree.setContent(JSONUtil.toJsonStr(raidVolumeBean)); + List volumeDiskTreeList = new ArrayList(); + if (CollectionUtil.isNotEmpty(raidVolumeBean.getDrives())) { + for (RaidDriveBean raidDriveBean : raidVolumeBean.getDrives()) { + RaidTreeBean diskTree = new RaidTreeBean(); + diskTree.setType("disk"); + diskTree.setParent(twoParantKey); + String threeParantKey = twoParantKey + "d" + raidDriveBean.getSlotNumber(); + diskTree.setKey(threeParantKey); + diskTree.setStatus(raidDriveBean.getStatus()); + diskTree.setTitle(raidDriveBean.getEnclosureId() + "-" + raidDriveBean.getSlotNumber() + "-" + raidDriveBean.getRawSize()); + diskTree.setContent(JSONUtil.toJsonStr(raidDriveBean)); + volumeDiskTreeList.add(diskTree); + } + } + volumeTree.setChildren(volumeDiskTreeList); + raidChildren.add(volumeTree); + } + } + //处理第二次的JBOD + List drives = raidSingeBean.getDrives(); + List jobdList = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(drives)) { + for (RaidDriveBean raidDriveBean : drives) { + if (raidDriveBean.getStatus().equals("JBOD")) { + jobdList.add(raidDriveBean); + } + } + } + if (CollectionUtil.isNotEmpty(jobdList)) { + RaidTreeBean jobdTree = new RaidTreeBean(); + jobdTree.setType("jbod"); + jobdTree.setTitle("JBOD"); + String twoParantKey = firstParantKey + "j0"; + jobdTree.setKey(twoParantKey); + jobdTree.setParent(firstParantKey); + List jbodChidredTreeList = new ArrayList(); + for (RaidDriveBean raidDriveBean : jobdList) { + RaidTreeBean diskTree = new RaidTreeBean(); + diskTree.setType("disk"); + diskTree.setParent(twoParantKey); + String threeParantKey = twoParantKey + "d" + raidDriveBean.getSlotNumber(); + diskTree.setKey(threeParantKey); + diskTree.setStatus(raidDriveBean.getStatus()); + diskTree.setTitle(raidDriveBean.getEnclosureId() + "-" + raidDriveBean.getSlotNumber() + "-" + raidDriveBean.getRawSize()); + diskTree.setContent(JSONUtil.toJsonStr(raidDriveBean)); + jbodChidredTreeList.add(diskTree); + } + jobdTree.setChildren(jbodChidredTreeList); + raidChildren.add(jobdTree); + } + //处理单个盘 + if (CollectionUtil.isNotEmpty(drives)) { + for (RaidDriveBean raidDriveBean : drives) { + if (!raidDriveBean.getStatus().equals("JBOD")) { + String twoParantKey = firstParantKey + "d" + raidDriveBean.getSlotNumber(); + RaidTreeBean diskTree = new RaidTreeBean(); + diskTree.setType("disk"); + diskTree.setParent(firstParantKey); + diskTree.setKey(twoParantKey); + if (raidDriveBean.getStatus().equals("HOT_SPARE")) { + diskTree.setStatus("SPARE"); + } else { + diskTree.setStatus(raidDriveBean.getStatus()); + } + diskTree.setTitle(raidDriveBean.getEnclosureId() + "-" + raidDriveBean.getSlotNumber() + "-" + raidDriveBean.getRawSize()); + diskTree.setContent(JSONUtil.toJsonStr(raidDriveBean)); + raidChildren.add(diskTree); + } + } + } + raidTreeBean.setChildren(raidChildren); + raidTreeList.add(raidTreeBean); + } + } + String result = JSONUtil.toJsonStr(raidTreeList); + } + + /** + * 创建的raid或者热备的个数限制 + */ + @Data + public static class RangeBean { + private Object range; + } + + /** + * raid等级、条带、策略的取值 + */ + @Data + public static class ValueBean { + private List value; + } + + /** + * 各raid等级的硬盘取值区间 + */ + @Data + public static class NumberBean { + private int lower; + private int upper; + private int pdperarraylow; + private int pdperarrayup; + private Boolean odd; + private Boolean even; + private Object multiple; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidDriveBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidDriveBean.java new file mode 100644 index 0000000000000000000000000000000000000000..9ae1ce04614eabc5161406055deb476fa45896a4 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidDriveBean.java @@ -0,0 +1,148 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + + +import lombok.Getter; + +public class RaidDriveBean { + + /** + * 磁盘框ID + */ + @Getter + private String enclosureId; + private String eid; + + /** + * 控制器ID, 多控制器情况下,可能需要此字段 + */ + @Getter + private String controllerId; + private String cid; + + /** + * 媒体类型 + */ + @Getter + private String mediaType; + /** + * 原始大小(单位:GB) + */ + @Getter + private String rawSize; + /** + * 槽位号 + */ + @Getter + private String slotNumber; + private String slot; + + /** + * 物理盘状态 + */ + @Getter + private String status; + + + @Getter + private String driveGroup; + /** + * 单位,前端使用 + */ + private String sizeUnit; + /** + * 容量,前端使用 + */ + private String size; + private String globalHot; + + public String getSizeUnit() { + if (this.rawSize != null && !this.rawSize.equals("")) { + if (this.rawSize.contains("T")) { + return "TB"; + } else if (rawSize.contains("G")) { + return "GB"; + } else { + return "MB"; + } + } else { + return "GB"; + } + } + + public void setSizeUnit(String sizeUnit) { + this.sizeUnit = sizeUnit; + } + + public String getSize() { + if (this.rawSize != null && !this.rawSize.equals("")) { + return this.rawSize.replaceAll("T", "").replaceAll("G", "").replaceAll("M", "").replaceAll("B", ""); + } else { + return ""; + } + } + + public void setSize(String size) { + this.size = size; + } + + public void setEnclosureId(String enclosureId) { + this.enclosureId = enclosureId; + } + + public void setControllerId(String controllerId) { + this.controllerId = controllerId; + } + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } + + public void setRawSize(String rawSize) { + this.rawSize = rawSize; + } + + public void setSlotNumber(String slotNumber) { + this.slotNumber = slotNumber; + } + + public void setStatus(String status) { + this.status = status; + } + + public void setDriveGroup(String driveGroup) { + this.driveGroup = driveGroup; + } + + public String getEid() { + return this.enclosureId; + } + + public void setEid(String eid) { + this.eid = this.enclosureId; + } + + public String getCid() { + return this.controllerId; + } + + public void setCid(String cid) { + this.cid = cid; + } + + public String getSlot() { + return this.slotNumber; + } + + public void setSlot(String slot) { + this.slot = slot; + } + + public String getGlobalHot() { + return globalHot; + } + + public void setGlobalHot(String globalHot) { + this.globalHot = globalHot; + } +} + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidSingeBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidSingeBean.java new file mode 100644 index 0000000000000000000000000000000000000000..9ae9f0b5a5cefc0ff0fff539fd067532fa7c73c1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidSingeBean.java @@ -0,0 +1,29 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + + +import lombok.Data; + +import java.util.List; + +@Data +public class RaidSingeBean { + + private static final long serialVersionUID = -4936995732278468539L; + + /** + * productName: 产品名称 + */ + private String productName; + /** + * controllerId: 控制器ID + */ + private String controllerId; + /** + * 设备类型:LSI、PMC + */ + private String type; + + private List volumes; + + private List drives; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidTreeBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidTreeBean.java new file mode 100644 index 0000000000000000000000000000000000000000..f5274e76559f81f47069e0578d14f2c78986e924 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidTreeBean.java @@ -0,0 +1,45 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import lombok.Data; + +import java.util.List; + + +/** + * @description + * @auther zhangchen06 + * @date 2023/10/10 + */ +@Data +public class RaidTreeBean { + + /** + * 子节点 + */ + private List children; + + /*** + * 唯一标识 raid卡是cid格式为c0,逻辑盘是vid,格式为v0,Jbod为J0,硬盘为D0,全局热备H0 + */ + private String key; + /** + * 父节点 + */ + private String parent; + /** + * 描述 + */ + private String title; + /** + * 类型 + */ + private String type; + /** + * 状态,只有硬盘这一级有值 + */ + private String status; + /** + * 内容,只有硬盘和逻辑盘有值,逻辑盘配置内容,和硬盘信息怎么传递 + */ + private String content; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidTypeEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..7060fa7a8cda3cdb2733463b5575eadda4396e67 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidTypeEnum.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +/** + * @author zhangchen + * @date 2022/09/06 11:26:26 + * @description raid卡类型枚举 + */ +public enum RaidTypeEnum { + LSI("LSI"), + PMC("PMC"); + private String value; + + RaidTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidVolumeBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidVolumeBean.java new file mode 100644 index 0000000000000000000000000000000000000000..e4cff9436d4c5417739df11263d456a77f7ecde0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidVolumeBean.java @@ -0,0 +1,43 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import lombok.Data; + +import java.util.List; + +/** + * @author zhangchen06 + * @date 2023/10/11 + * @description + */ +@Data +public class RaidVolumeBean { + private String vid; + private String raidType; + private String raidLevel; + /** + * 单位GB,保留一位有效数字 + */ + private String capacity; + private String slot; + private String driveGroup; + /** + * 单位KB + */ + private String strip; + private String cachePolicy; + private String readPolicy; + private String writePolicy; + private String accessPolicy; + private String ioPolicy; + private String boot; + private String backPlane; + private List drives; + + public String getRaidLevel() { + return this.raidType; + } + + public void setRaidLevel(String raidLevel) { + this.raidLevel = this.raidType; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidXmlBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidXmlBean.java new file mode 100644 index 0000000000000000000000000000000000000000..706e090bcf50e43733138f961deecb1cd0231453 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/raid/RaidXmlBean.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.raid; + +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * @author :zhangchen + * @date :Created in 2022/10/11 17:06 + */ +@Data +public class RaidXmlBean { + /** + * raid配置样板 + */ + private Map raidXml; + /** + * raid卡详情 + */ + private Map raidDetail; + /** + * 阵列卡列表 + */ + private List raidCardList; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/task/IBootTaskJobBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/task/IBootTaskJobBean.java new file mode 100644 index 0000000000000000000000000000000000000000..919e078740129ca86d5e2a11734a7d29903db6a3 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/task/IBootTaskJobBean.java @@ -0,0 +1,25 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.task; + +import lombok.Data; + +/** + * @author :zhangchen + * @date :Created in 2023/08/16 16:29 + */ +@Data +public class IBootTaskJobBean { + private int successNum; + private int failNum; + private int waitNum; + private int runningNum; + private long finishNum; + private long total; + + public long getFinishNum() { + return successNum + failNum; + } + + public long getTotal() { + return successNum + failNum + runningNum + waitNum; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/task/IBootTaskQueryBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/task/IBootTaskQueryBean.java new file mode 100644 index 0000000000000000000000000000000000000000..aa84a4baed0fc59cae124958a688356583492aae --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/task/IBootTaskQueryBean.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.task; + +import com.inspur.cdc.commons.lang.web.PageQuery; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import lombok.Data; + +@Data +public class IBootTaskQueryBean extends PageQuery { + private static final long serialVersionUID = 7254430337535077230L; + private String name; + private TaskHostStatusEnum taskStatus; + private TaskHostStatusEnum jobHostStatus; + private String templateName; + private String templateType; + private String taskId; + private String jobHostId; + private String sn; + private String ip; + private String status; +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/CustomTemplateFileBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/CustomTemplateFileBean.java new file mode 100644 index 0000000000000000000000000000000000000000..d41cebdb3fc72e75b1feb0f90a8ec602712a36f1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/CustomTemplateFileBean.java @@ -0,0 +1,16 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/9 + */ +@Data +public class CustomTemplateFileBean { + + private String id; + private String name; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBMCNetPreviewBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBMCNetPreviewBean.java new file mode 100644 index 0000000000000000000000000000000000000000..6ef56c619ba49ffed3ab6593062d6f9923062487 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBMCNetPreviewBean.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceStatusEnum; +import lombok.Data; + +@Data +public class IBootBMCNetPreviewBean { + + private Page iBootNetPreviewBeanPage; + + @Data + public static class IBootBMCNetBean { + private String dhcpIp; + private String sn; + private DeviceStatusEnum status; + /** + * IP配置 + */ + private String ip; + private String gateway; + private String netmask; + private String channel; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBondSetBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBondSetBean.java new file mode 100644 index 0000000000000000000000000000000000000000..0f95f79b7166352ad3210f0e957839ec54319c6e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBondSetBean.java @@ -0,0 +1,43 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/25 + */ +@Data +public class IBootBondSetBean { + + /** + * DHCP ip. + */ + private String dhcpIp; + + /** + * 序列号. + */ + private String sn; + + /** + * Bond名 + */ + private String bondName; + + /** + * IP + */ + private String bondIp; + + /** + * 网关 + */ + private String gateway; + + /** + * 主机名 + */ + private String hostname; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBondShellBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBondShellBean.java new file mode 100644 index 0000000000000000000000000000000000000000..5776831f68c175ab01bbe7bd048a7656885d83e4 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootBondShellBean.java @@ -0,0 +1,24 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/22 + */ +@Data +public class IBootBondShellBean { + + /** + * Bond类型 + */ + private String bond; + /** + * Bond网口 + */ + private List eths; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootCustomTemplateBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootCustomTemplateBean.java new file mode 100644 index 0000000000000000000000000000000000000000..41dc95547b0b09e88f68926abdc4cae4eabfcc95 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootCustomTemplateBean.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/9 + */ +@Data +public class IBootCustomTemplateBean { + + List exploreFiles; + String executeDir; + String executeShell; + String checkShell; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootIPSetBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootIPSetBean.java new file mode 100644 index 0000000000000000000000000000000000000000..719e827a480a6d1218ab8a558e641ae42c058722 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootIPSetBean.java @@ -0,0 +1,32 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +import java.util.Set; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/25 + */ +@Data +public class IBootIPSetBean { + + /** + * DHCP ip. + */ + private String dhcpIp; + /** + * 序列号. + */ + private String sn; + /*** + * os 网络配置 + */ + private Set osIpList; + /** + * 主机名. + */ + private String hostname; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootInstallParamBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootInstallParamBean.java new file mode 100644 index 0000000000000000000000000000000000000000..3c244a9341a0af5494843bc34cd90996c844b749 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootInstallParamBean.java @@ -0,0 +1,44 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import lombok.Data; + + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/25 + */ +@Data +public class IBootInstallParamBean { + + /** + * 系统安装模板ID + */ + private String templateId; + /** + * 网络配置文件ID + */ + private String fileId; + /** + * 设备查询 + */ + private DeviceQueryBean deviceQueryBean; + /** + * 判断是否是Bond + */ + private Boolean isBond; + /** + * 配置Bond的脚本内容 + */ + private String bondScript; + /** + * 系统安装参数 + */ + private IBootOsInstallBean iBootOsInstallBean; + /** + * 网络配置参数 + */ + private String networkBean; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootNetPreviewBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootNetPreviewBean.java new file mode 100644 index 0000000000000000000000000000000000000000..649954afb4297153ebdf0f677d433ab13e15c0e5 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootNetPreviewBean.java @@ -0,0 +1,32 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceStatusEnum; +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/28 + */ +@Data +public class IBootNetPreviewBean { + + private String dhcpIp; + private String sn; + private DeviceStatusEnum status; + private String hostname; + /** + * IP配置 + */ + private String ipconfig1; + private String ipconfig2; + private String ipconfig3; + private String ipconfig4; + /** + * Bond配置 + */ + private String bondName; + private String ip; + private String gateway; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootNetworkCfgBeans.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootNetworkCfgBeans.java new file mode 100644 index 0000000000000000000000000000000000000000..41e1e6c9b313ae77444c663f6da32eb06e72bf31 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootNetworkCfgBeans.java @@ -0,0 +1,27 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/8 + */ +@Data +public class IBootNetworkCfgBeans { + + private Map networkCfgBeans; + + @Data + public static class NetworkCfgBean { + + private String ip; + private String netmask; + private String gateway; + private String channel; + + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootOsInstallBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootOsInstallBean.java new file mode 100644 index 0000000000000000000000000000000000000000..a5a92f81c8a32faa70cc29260c0fd05fd92b93b0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootOsInstallBean.java @@ -0,0 +1,109 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ArchitectureEnum; +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/10 + */ +@Data +public class IBootOsInstallBean { + + /** + * 镜像类型 + */ + private String imageType; + + /** + * 镜像版本号 + */ + private String version; + + /** + * 镜像文件ID + */ + private String imageFileId; + + /** + * 是否包含ks 1不包含2包含 + */ + private String compressFlag; + + /** + * root密码 + */ + private String rootPw; + + /** + * 语言 + */ + private String language; + + /** + * 时区 + */ + private String timeZone; + + /** + * 磁盘分区 + */ + private String diskPartition; + + /** + * 磁盘分区 + */ + private String preDiskPartition; + + /** + * 安装环境 + */ + private String baseE; + + /*** + * ks 样式 + * 1 普通配置 + * 2 高级设置 + */ + private int ksType; + + /*** + * ks高级配置下 文件内容 + */ + private String ksContent; + + /*** + *ks 前置脚本 + */ + private String preScript; + + /*** + * ks 后置脚本 + */ + private String postScript; + + /*** + * 分区设置类别 + * 1 图形化设置 + * 2 命令行设置 + */ + private int diskPartitionType; + + /** + * 高级设置下上传ks文件 + */ + private boolean upload; + + /** + * 自定义分区 + */ + private boolean customPart; + + private ArchitectureEnum architecture; + + private String softwareSelected; + private String userName; + private String userPsw; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootOsIp.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootOsIp.java new file mode 100644 index 0000000000000000000000000000000000000000..abd692e7b2f5bcb2839df21e4c28110a000010b7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootOsIp.java @@ -0,0 +1,30 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/25 + */ +@Data +public class IBootOsIp { + + /** + * 系统ip. + */ + private String ip; + /** + * 子网掩码.monitor + */ + private String netmask; + /** + * 网关. + */ + private String gateway; + /** + * 网口名 + */ + private String netInterface; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootPartBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootPartBean.java new file mode 100644 index 0000000000000000000000000000000000000000..dbff47cb7ef66459f079aefa831bbd071052943a --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootPartBean.java @@ -0,0 +1,39 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/29 + */ +@Data +public class IBootPartBean { + + private String mountPoint; + + private Integer capacity; + + private String deviceType; + + private Boolean encryption; + + private String fsType; + + private String disk; + private String installType; + + private VolumeGroup volumeGroup; + + private String volume; + + private boolean grow; + + @Data + public class VolumeGroup { + private String name; + private Integer capacity; + private String disk; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootPreviewBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootPreviewBean.java new file mode 100644 index 0000000000000000000000000000000000000000..323c6b6d8b3340c36dd239955cc52df72e4fb630 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootPreviewBean.java @@ -0,0 +1,18 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.cdc.commons.lang.web.Page; +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/28 + */ +@Data +public class IBootPreviewBean { + + private IBootOsInstallBean iBootOsInstallBean; + + private Page iBootNetPreviewBeanPage; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootRaidCfgBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootRaidCfgBean.java new file mode 100644 index 0000000000000000000000000000000000000000..ddb17ba6263d12b669efb801f6a48cc1378a5f3c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootRaidCfgBean.java @@ -0,0 +1,31 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/10 + */ +@Data +public class IBootRaidCfgBean { + + /** + * raid对应创建的逻辑盘 + */ + Map> raidLogicalDisk; + + /** + * 是否有全局热备 + */ + private boolean wholeHot; + + /** + * 阵列卡列表 + */ + private List raidCardList; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStartTaskBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStartTaskBean.java new file mode 100644 index 0000000000000000000000000000000000000000..95dd09fd1148b2c879ee18d954dc66a451cd034d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStartTaskBean.java @@ -0,0 +1,43 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/14 + */ +@Data +public class IBootStartTaskBean { + + /** + * 任务ID + */ + private String taskId; + /** + * 开始时间 + */ + private Date startTime; + + /** + * 任务名称 + */ + private String taskName; + + /** + * 高级查询适配全选 + */ + private DeviceQueryBean deviceQueryBean; + + private List resourceIdList; + + /** + * 执行人 + */ + private String excuteUser; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressExportBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressExportBean.java new file mode 100644 index 0000000000000000000000000000000000000000..bfb230d4bdd3dfb87213413a606baeeeb897d24e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressExportBean.java @@ -0,0 +1,18 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +@Data +public class IBootStressExportBean { + + /** + * 文件内容 + */ + private byte[] by; + + /** + * 文件名称 + */ + private String fileName; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressHistoryBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressHistoryBean.java new file mode 100644 index 0000000000000000000000000000000000000000..40f7b2467d7a21a552d3a276ee7bf69d6a57c6bc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressHistoryBean.java @@ -0,0 +1,29 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import lombok.Data; + +import java.util.Date; + +@Data +public class IBootStressHistoryBean { + + private String taskId; + + private String taskName; + + private boolean cpuTest = false; + + private boolean memTest = false; + + private TaskHostStatusEnum status; + + private Date startTime; + + private Date endTime; + + private long costTime; + + private int num; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressTestBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressTestBean.java new file mode 100644 index 0000000000000000000000000000000000000000..4a057cede63eed9398fa578c93ede7d06ba2dab8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressTestBean.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/9 + */ +@Data +public class IBootStressTestBean { + + private boolean cpuTest; + private int cpuMinutes; + private int cpuPercent; + private boolean memoryTest; + private int memoryMinutes; + private int interval; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressTestReportBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressTestReportBean.java new file mode 100644 index 0000000000000000000000000000000000000000..4785315a2168df81a74bf81cdd7b27c552b32fe2 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootStressTestReportBean.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +@Data +public class IBootStressTestReportBean { + + //设备数量:查询所有设备 + int allServerNum; + + //正常设备:查询ecc_reason alarm_reason为空的数据 + int normalSeverNum; + + //ECC异常:查询ecc_reason非空数据部件告警:查询alarm_reason非空数据 + int exceptionNum; + + //无数据:查询所有设备去除以上设备(collectDateEntity有值的) + int noDataNum; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootUserCfgBeans.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootUserCfgBeans.java new file mode 100644 index 0000000000000000000000000000000000000000..c36fbe6de0f8956585657d9b8f8f8e916a96dba7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/IBootUserCfgBeans.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/8 + */ +@Data +public class IBootUserCfgBeans { + + private List userCfgBeans; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/LogicalDisk.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/LogicalDisk.java new file mode 100644 index 0000000000000000000000000000000000000000..0e923bb7690c4b91f092747d42c515269f393644 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/LogicalDisk.java @@ -0,0 +1,104 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.RaidLevelEnum; +import lombok.Data; + +import java.util.List; + + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/10 + */ +@Data +public class LogicalDisk { + + /** + * 序列号 + */ + private String vid; + + /*** + * 磁盘容量 + */ + private String size; + + /*** + * 磁盘单位 + */ + private String sizeUnit; + + /** + * 条带大小 + */ + private String strip; + + /** + * 读策略 + */ + private String readPolicy; + + /** + * 写策略 + */ + private String writePolicy; + + /** + * IO策略 + */ + private String ioPolicy; + + /** + * 访问策略 + */ + private String accessPolicy; + + /** + * PD缓存 + */ + private String cachePolicy; + + /** + * 逻辑盘名称 + */ + private String name; + + /*** + * eid 硬盘背板id + */ + private String eid; + + /*** + * 是否是启动盘 + */ + private boolean boot; + + /*** + * 逻辑磁盘类型 与 全局热备 + */ + private String type; + + /** + * Raid等级 + */ + private RaidLevelEnum raidLevel; + + /** + * 子组硬盘数 + */ + private String pdperarray; + + /** + * 关联硬盘 + */ + private List physicalDiskList; + + /** + * 局部热备 关联硬盘 + */ + private List partHotDisk; + + private String raidCardStr; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/PhysicalDisk.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/PhysicalDisk.java new file mode 100644 index 0000000000000000000000000000000000000000..c38ad72ca81d6dbc8ae80f2b22cca65f4cbb7564 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/PhysicalDisk.java @@ -0,0 +1,54 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/10 + */ +@Data +public class PhysicalDisk { + + /** + * physicalDisk 唯一标识 + */ + private String id; + + /** + * controllerId + */ + private String cid; + + /** + * 硬盘背板id + */ + private String eid; + + /*** + * 硬盘型号 SSD HDD + */ + private String type; + + /*** + * 硬盘槽位 + */ + private String slot; + + /** + * 当前状态 + */ + private String status; + + /** + * 硬盘大小 + */ + private String size; + + /** + * 硬盘容量单位 + */ + private String sizeUnit; + private String content; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/UserCfgBean.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/UserCfgBean.java new file mode 100644 index 0000000000000000000000000000000000000000..05fae1a03d4881ef51101935b6ba72f95fc31159 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/bean/template/UserCfgBean.java @@ -0,0 +1,24 @@ +package com.inspur.ispim.cosmos.iboot.base.api.bean.template; + +import lombok.Data; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/8 + */ +@Data +public class UserCfgBean { + + private String sn; + private String id; + private String username; + private String userPw; + private String privilege; + + /** + * 是否为删除 + */ + private boolean delete; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/DeviceEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/DeviceEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..3d7438bb0a07b80639cc3d65ba9fbd6e3f9e139c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/DeviceEntity.java @@ -0,0 +1,115 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.*; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; + +/** + * ryalii + * 资产 + */ +@Data +@Table(name = "cosmos_iboot_device") +public class DeviceEntity implements Serializable { + private static final long serialVersionUID = 6289515425494120993L; + + /** + * 主键id + */ + @Id + private Integer pk; + + @Column(name = "id") + private String id; + + @Column(name = "sn") + private String sn; + + @Column(name = "dhcp_ip") + private String dhcpIp; + + @Column(name = "manage_ip") + private String manageIp; + + @Column(name = "status") + private DeviceStatusEnum status; + + @Column(name = "ipmi_status") + private IpmiStatusEnum ipmiStatus; + + @Column(name = "ipmi_fail") + private IpmiFailEnum ipmiFail; + + @Column(name = "manage_channel") + private ManageChannelEnum manageChannel; + + @Column(name = "manage_user") + private String manageUser; + + @Column(name = "manage_password") + private String managePassword; + + @Column(name = "manage_id") + private String manageId; + + @Column(name = "manage_account") + private ManageAccountEnum manageAccount; + + @Column(name = "network_device") + private String networkDevice; + + @Column(name = "boot_option") + private BootOptionEnum bootOption; + + @Column(name = "architecture") + private ArchitectureEnum architecture; + + @Column(name = "vendor") + private String vendor; + + @Column(name = "model") + private String model; + + @Column(name = "system_info") + private String systemInfo; + + @Column(name = "storage_info") + private String storageInfo; + + @Column(name = "single_storage_info") + private String singleStorageInfo; + + @Column(name = "single_storage_md") + private String singleStorageMd; + + @Column(name = "create_user") + private String createUser; + + @Column(name = "update_user") + private String updateUser; + + @Column(name = "create_time") + private Date createTime; + + @Column(name = "update_time") + private Date updateTime; + + @Column(name = "heartbeat_time") + private Date heartbeatTime; + /** + * zhangchen 增加冗余字段,模型关联设备数量,其他功能无用 + */ + @Transient + private int deviceNum; + /** + * zhangchen 增加冗余字段,模型描述,其他功能无用 + */ + @Transient + private String raidmodel; +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootImageXmlEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootImageXmlEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..21603f546ce2f91b9fdb3afcf87cb77634197294 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootImageXmlEntity.java @@ -0,0 +1,35 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/17 + */ +@Data +@Table(name = "starlet_control_image_xml") +public class IBootImageXmlEntity { + /** + * 主键 + */ + @Id + @Column(name = "pk") + private long pk; + + /** + * id + */ + @Column(name = "id") + private String id; + + @Column(name = "image_id") + private String imageId; + + @Column(name = "enviroment") + private String enviroment; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootInbandFileEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootInbandFileEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..f52aba40ac85e426f1aa0c595a4126b0b7387d01 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootInbandFileEntity.java @@ -0,0 +1,54 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ArchitectureEnum; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/9 + */ +@Data +@Table(name = "cosmos_iboot_inband_file") +public class IBootInbandFileEntity { + + /** + * 逻辑主键 + */ + @Column(name = "pk") + @Id + private Long pk; + + /** + * 业务主键 + */ + @Column(name = "id") + private String id; + + @Column(name = "name") + private String name; + + @Column(name = "original_name") + private String originalName; + + @Column(name = "full_path") + private String fullPath; + + @Column(name = "md5") + private String md5; + + @Column(name = "architecture") + private ArchitectureEnum architecture; + + @Column(name = "create_time") + private Date createTime; + + @Column(name = "update_time") + private Date updateTime; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootRaidConfigXmlEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootRaidConfigXmlEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..a23d8bd14c315ed3c1c41203224d489612532e77 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootRaidConfigXmlEntity.java @@ -0,0 +1,40 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * @description + * @auther gengzhicheng + * @date 2023/4/14 + */ +@Table(name = "starlet_control_raid_config_xml") +@Data +public class IBootRaidConfigXmlEntity { + + @Id + @Column(name = "pk") + private long pk; + + @Column(name = "id") + private String id; + + @Column(name = "model") + private String model; + + @Column(name = "type") + private String type; + + @Column(name = "content") + private String content; + + @Column(name = "remark_cn") + private String remarkCn; + + @Column(name = "remark_en") + private String remarkEn; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootRepositoryImageEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootRepositoryImageEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..234f750ba8b6c4be4e1086e699642137113c10f0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootRepositoryImageEntity.java @@ -0,0 +1,237 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ArchitectureEnum; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; + +/** + * @author zhangchen + * @description 仓库镜像表,专门存储ISO镜像实体类 + * @date 2023/08/01 10:22:57 + */ +@Table(name = "starlet_control_repository_image") +public class IBootRepositoryImageEntity implements Serializable { + /** + * 主键 + */ + @Column(name = "pk") + @Id + private long pk; + /** + * 主键 + */ + @Column(name = "id") + private String id; + /** + * 名称,改名之后的 + */ + @Column(name = "name") + private String name; + /** + * 原始文件名,包括后缀名 + */ + @Column(name = "original_name") + private String originalName; + /** + * 绝对路径 + */ + @JsonIgnore + @Column(name = "full_path") + private String fullPath; + /** + * 是否包含自动引导文件 + */ + @Column(name = "is_has_ks") + private boolean hasKs; + /** + * 是否是自定义镜像 + */ + @Column(name = "is_custom_image") + private boolean customImage; + /** + * 镜像类型(型号) + */ + @Column(name = "image_type") + private String imageType; + @Column(name = "is_show") + private boolean show; + /** + * 版本 + */ + @Column(name = "version") + private String version; + /** + * 架构 + */ + @Column(name = "architecture") + private ArchitectureEnum architecture; + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; + /** + * 更新时间 + */ + @Column(name = "update_time") + private Date updateTime; + /** + * 存储创建用户的ID + */ + @Column(name = "create_user") + private String createUser; + /** + * 修改用户的ID + */ + @Column(name = "update_user") + private String updateUser; + /** + * 是否加入源 + */ + @Column(name = "insource") + private boolean insource; + @Transient + private boolean tempuse; + + public long getPk() { + return pk; + } + + public void setPk(long pk) { + this.pk = pk; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getOriginalName() { + return originalName; + } + + public void setOriginalName(String originalName) { + this.originalName = originalName; + } + + public String getFullPath() { + return fullPath; + } + + public void setFullPath(String fullPath) { + this.fullPath = fullPath; + } + + public boolean isHasKs() { + return hasKs; + } + + public void setHasKs(boolean hasKs) { + this.hasKs = hasKs; + } + + public boolean isCustomImage() { + return customImage; + } + + public void setCustomImage(boolean customImage) { + this.customImage = customImage; + } + + public String getImageType() { + return imageType; + } + + public void setImageType(String imageType) { + this.imageType = imageType; + } + + public boolean isShow() { + return show; + } + + public void setShow(boolean show) { + this.show = show; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public ArchitectureEnum getArchitecture() { + return architecture; + } + + public void setArchitecture(ArchitectureEnum architecture) { + this.architecture = architecture; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public String getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(String updateUser) { + this.updateUser = updateUser; + } + + public boolean isInsource() { + return insource; + } + + public void setInsource(boolean insource) { + this.insource = insource; + } + + public boolean isTempuse() { + return tempuse; + } + + public void setTempuse(boolean tempuse) { + this.tempuse = tempuse; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootStressDataEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootStressDataEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..f41a3763c8ed86752344af902ea83154a71b45c8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootStressDataEntity.java @@ -0,0 +1,124 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +@Data +@Table(name = "cosmos_iboot_stress_data") +public class IBootStressDataEntity { + + /** + * 逻辑主键 + */ + @Column(name = "pk") + @Id + private Long pk; + + /** + * 业务主键 + */ + @Column(name = "id") + private String id; + + @Column(name = "job_host_id") + private String jobHostId; + + /** + * 资产ip + */ + @Column(name = "ip") + private String ip; + + /** + * 资产SN + */ + @Column(name = "sn") + private String sn; + + /** + * 进风口温度 + */ + @Column(name = "inlet_temperature") + private String inletTemperature; + + /** + * 出风口温度 + */ + @Column(name = "outlet_temperature") + private String outletTemperature; + + /** + * 总功率 + */ + @Column(name = "total_power") + private String totalPower; + + /** + * cpu温度 + */ + @Column(name = "cpu_temperature") + private String cpuTemperature; + + /** + * cpu功率 + */ + @Column(name = "cpu_power") + private String cpuPower; + + /** + * cpu用户利用率 + */ + @Column(name = "cpu_rate_user") + private String cpuRateUser; + + /** + * cpu系统利用率 + */ + @Column(name = "cpu_rate_system") + private String cpuRateSystem; + + /** + * cpu空闲利用率 + */ + @Column(name = "cpu_rate_idle") + private String cpuRateIdle; + + /** + * 内存利用率 + */ + @Column(name = "memory_rate") + private String memoryRate; + + /** + * 内存功率 + */ + @Column(name = "memory_power") + private String memoryPower; + + /** + * ecc cpu0 + */ + @Column(name = "ecc_cpu0") + private String eccCPU0; + + /** + * ecc cpu1 + */ + @Column(name = "ecc_cpu1") + private String eccCPU1; + + /** + * ecc超过6000,需要存原因 + */ + @Column(name = "ecc_reason") + private String eccReason; + + + @Column(name = "create_time") + private Date createTime; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootStressTestServerEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootStressTestServerEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..e1cafe997d583e6a56c6e48790c4acbb4072599e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootStressTestServerEntity.java @@ -0,0 +1,61 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.util.Date; + +@Data +@Table(name = "cosmos_iboot_stress_server") +public class IBootStressTestServerEntity { + + /** + * 逻辑主键 + */ + @Column(name = "pk") + @Id + private Long pk; + + /** + * 业务主键 + */ + @Column(name = "id") + private String id; + + @Column(name = "task_id") + private String taskId; + + @Column(name = "job_host_id") + private String jobHostId; + + /** + * 资产ip + */ + @Column(name = "ip") + private String ip; + + /** + * 资产SN + */ + @Column(name = "sn") + private String sn; + + @Column(name = "num") + private int num; + + @Column(name = "status") + private String status; + + @Column(name = "update_time") + private Date updateTime; + + @Transient + private String result; + + @Transient + private String templateContent; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..d159548978c36322257986177dffcffcf16e5213 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskEntity.java @@ -0,0 +1,74 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; + +/** + * zhangchen + * 任务主表 + */ +@Data +@Table(name = "cosmos_iboot_task") +public class IBootTaskEntity implements Serializable { + private static final long serialVersionUID = 5989515425494120993L; + @Transient + IBootTaskJobBean iBootTaskJobBean; + /** + * 主键id + */ + @Id + private Integer pk; + @Column(name = "id") + private String id; + @Column(name = "name") + private String name; + @Column(name = "task_status") + private TaskHostStatusEnum taskStatus; + @Column(name = "cron") + private String cron; + @Column(name = "create_user") + private String createUser; + @Column(name = "execute_time") + private Date executeTime; + @Column(name = "execute_type") + private String executeType; + @Column(name = "start_time") + private Date startTime; + @Column(name = "end_time") + private Date endTime; + @Column(name = "create_time") + private Date createTime; + @Column(name = "update_time") + private Date updateTime; + @Column(name = "template_id") + private String templateId; + @Column(name = "template_name") + private String templateName; + @Column(name = "template_type") + private String templateType; + @Transient + private long costTime; + + public long getCostTime() { + if (BeanUtil.isNotEmpty(startTime)) { + return DateUtil.between(startTime, new Date(), DateUnit.MS); + } else { + return costTime; + } + } + + public void setCostTime(long costTime) { + this.costTime = costTime; + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHistoryEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHistoryEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..6918cde8498a63895d73e13d22a8e9a6efa154c8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHistoryEntity.java @@ -0,0 +1,74 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; + +/** + * zhangchen + * 历史任务主表 + */ +@Data +@Table(name = "cosmos_iboot_task_history") +public class IBootTaskHistoryEntity implements Serializable { + private static final long serialVersionUID = 5989515425494120993L; + IBootTaskJobBean iBootTaskJobBean; + /** + * 主键id + */ + @Id + private Integer pk; + @Column(name = "id") + private String id; + @Column(name = "name") + private String name; + @Column(name = "task_id") + private String taskId; + @Column(name = "task_status") + private TaskHostStatusEnum taskStatus; + @Column(name = "cron") + private String cron; + @Column(name = "excute_user") + private String excuteUser; + @Column(name = "execute_time") + private Date executeTime; + @Column(name = "execute_type") + private String executeType; + @Column(name = "start_time") + private Date startTime; + @Column(name = "end_time") + private Date endTime; + @Column(name = "create_time") + private Date createTime; + @Column(name = "update_time") + private Date updateTime; + @Column(name = "template_id") + private String templateId; + @Column(name = "template_name") + private String templateName; + @Column(name = "template_type") + private String templateType; + private long costTime; + + public long getCostTime() { + if (BeanUtil.isNotEmpty(startTime) && BeanUtil.isNotEmpty(endTime)) { + return DateUtil.between(startTime, endTime, DateUnit.MS); + } else { + return costTime; + } + } + + public void setCostTime(long costTime) { + this.costTime = costTime; + } + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..cf81d43d780ec7328b8e0b49fc02ed8194a6525d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostEntity.java @@ -0,0 +1,81 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; + +/** + * zhangchen + * 任务设备表 + */ +@Data +@Table(name = "cosmos_iboot_task_host") +public class IBootTaskHostEntity implements Serializable { + private static final long serialVersionUID = 5989515425494120993L; + /** + * 主键id + */ + @Id + private Integer pk; + + @Column(name = "id") + private String id; + @Column(name = "task_id") + private String taskId; + + @Column(name = "resource_id") + private String resourceId; + + @Column(name = "job_host_status") + private TaskHostStatusEnum jobHostStatus; + + @Column(name = "start_time") + private Date startTime; + @Column(name = "end_time") + private Date endTime; + + @Column(name = "create_time") + private Date createTime; + @Column(name = "update_time") + private Date updateTime; + + @Column(name = "process") + private int process; + @Column(name = "msg") + private String msg; + @Column(name = "param") + private String param; + @Column(name = "template_type") + private String templateType; + @Column(name = "template_id") + private String templateId; + @Column(name = "sn") + private String sn; + @Column(name = "resource_ip") + private String resourceIp; + @Column(name = "mac") + private String mac; + @Transient + private long costTime; + + public long getCostTime() { + if (BeanUtil.isNotEmpty(startTime)) { + return DateUtil.between(startTime, new Date(), DateUnit.MS); + } else { + return costTime; + } + } + + public void setCostTime(long costTime) { + this.costTime = costTime; + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostHistoryEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostHistoryEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..6132df00693ad8092889e9867dc6ed360586201f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostHistoryEntity.java @@ -0,0 +1,86 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * zhangchen + * 历史任务设备表 + */ +@Data +@Table(name = "cosmos_iboot_task_host_history") +public class IBootTaskHostHistoryEntity implements Serializable { + private static final long serialVersionUID = 5989515425494120993L; + /** + * 主键id + */ + @Id + private Integer pk; + + @Column(name = "id") + private String id; + + @Column(name = "task_id") + private String taskId; + @Column(name = "job_host_id") + private String jobHostId; + + @Column(name = "resource_id") + private String resourceId; + @Column(name = "resource_ip") + private String resourceIp; + @Column(name = "mac") + private String mac; + @Column(name = "sn") + private String sn; + @Column(name = "model") + private String model; + + @Column(name = "job_host_status") + private TaskHostStatusEnum jobHostStatus; + + @Column(name = "start_time") + private Date startTime; + @Column(name = "end_time") + private Date endTime; + + @Column(name = "create_time") + private Date createTime; + @Column(name = "update_time") + private Date updateTime; + + @Column(name = "process") + private int process; + @Column(name = "msg") + private String msg; + @Column(name = "param") + private String param; + + @Transient + private List stressDataEntityList; + + private long costTime; + + public long getCostTime() { + if (BeanUtil.isNotEmpty(startTime) && BeanUtil.isNotEmpty(endTime)) { + return DateUtil.between(startTime, endTime, DateUnit.MS); + } else { + return costTime; + } + } + + public void setCostTime(long costTime) { + this.costTime = costTime; + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostLogEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostLogEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..462a0e76732f66ebce1941f881ff68fa8bf4185f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTaskHostLogEntity.java @@ -0,0 +1,42 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; + +/** + * zhangchen + * 任务设备表 + */ +@Data +@Table(name = "cosmos_iboot_task_host_log") +public class IBootTaskHostLogEntity implements Serializable { + private static final long serialVersionUID = 5989515425494120993L; + /** + * 主键id + */ + @Id + private Integer pk; + + @Column(name = "id") + private String id; + @Column(name = "task_id") + private String taskId; + @Column(name = "resource_id") + private String resourceId; + @Column(name = "job_host_id") + private String jobHostId; + + @Column(name = "content") + private String content; + + @Column(name = "create_time") + private Date createTime; + @Column(name = "update_time") + private Date updateTime; + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTemplateEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTemplateEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..d009dac4cbdd087b6d7c9a19802ddd9ff366ee3f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTemplateEntity.java @@ -0,0 +1,105 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.TemplateTypeEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ArchitectureEnum; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; + +/** + * @description IBoot模板表,与控制模块通用模板表分开 + * @auther gengzhicheng + * @date 2023/8/7 + */ +@Data +@Table(name = "cosmos_iboot_template") +public class IBootTemplateEntity implements Serializable { + /** + * 逻辑主键 + */ + @Column(name = "pk") + @Id + private Long pk; + + /** + * 业务主键 + */ + @Column(name = "id") + private String id; + + @Column(name = "name") + private String name; + + @Column(name = "description") + private String description; + + /** + * 模板详情,为格式化数据,以json样式存储,不同的类型的模板结构不一样 + */ + @Column(name = "content") + private String content; + + @Column(name = "model") + private String model; + + @Column(name = "real_model") + private String realModel; + + /** + * 模板类型,一个模板是一个最小的业务单元 + */ + @Column(name = "template_type") + private TemplateTypeEnum templateType; + + @Column(name = "vendor") + private String vendor; + + @Column(name = "create_user") + private String createUser; + + @Column(name = "create_time") + private Date createTime; + + @Column(name = "update_user") + private String updateUser; + + @Column(name = "update_time") + private Date updateTime; + + /** + * 考虑到假删除 + */ + @Column(name = "is_show") + private Boolean show; + + /** + * 资产raid信息(模板查看使用),保存String 对应raidModelLst + */ + @Column(name = "raid_models") + private String raidModels; + + /** + * 是否清空配置 + */ + @Column(name = "is_clear") + private Boolean clear; + + @Column(name = "architecture") + private ArchitectureEnum architecture; + + /** + * 模板配置信息 + */ + @Transient + private Object templateBean; + /** + * 敏感信息,raid配置专用 + */ + @Transient + private String mgOper; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTimezoneEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTimezoneEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..d8864145cd905d48b2d2851283187a7193740c9c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/IBootTimezoneEntity.java @@ -0,0 +1,53 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/15 + */ +@Data +@Table(name = "starlet_control_timezone") +public class IBootTimezoneEntity { + + @Column(name = "pk") + @Id + private Long pk; + /** + * id + */ + @Column(name = "id") + private String id; + /** + * 时区key内容 + */ + @Column(name = "timezone_key") + private String timezoneKey; + /** + * 时区的value值 + */ + @Column(name = "timezone_value") + private String timezoneValue; + /** + * 系统类型 + */ + @Column(name = "system_type") + private String systemType; + /** + * 创建时间 + */ + @Column(name = "create_time") + private Date createTime; + /** + * 更新时间 + */ + @Column(name = "update_time") + private Date updateTime; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/TaskHostEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/TaskHostEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..bd9dbb919c41e43f55e3a50883ef05590402a5e1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/entity/TaskHostEntity.java @@ -0,0 +1,116 @@ +package com.inspur.ispim.cosmos.iboot.base.api.entity; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; + +/** + * ryalii + * 资产 + */ +@Table(name = "cosmos_iboot_task_host") +public class TaskHostEntity implements Serializable { + private static final long serialVersionUID = 5989515425494120993L; + + /** + * 主键id + */ + @Id + private Integer pk; + + @Column(name = "id") + private String id; + + @Column(name = "sn") + private String sn; + + @Column(name = "para") + private String para; + + @Column(name = "status") + private TaskHostStatusEnum status; + + @Column(name = "creator") + private String creator; + + @Column(name = "updater") + private String updater; + + @Column(name = "create_time") + private Date createTime; + + @Column(name = "update_time") + private Date updateTime; + + public Integer getPk() { + return pk; + } + + public void setPk(Integer pk) { + this.pk = pk; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getPara() { + return para; + } + + public void setPara(String para) { + this.para = para; + } + + public void setStatus(TaskHostStatusEnum status) { + this.status = status; + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/DeviceAssetService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/DeviceAssetService.java new file mode 100644 index 0000000000000000000000000000000000000000..fa86047dbbf07e0debe935786d704c431850d99e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/DeviceAssetService.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; + +/** + * 处理和资产相关的接口功能 + */ +public interface DeviceAssetService extends DeviceService { + + int deviceAssetSyncProgress(); + + ResultBean deviceAssetSync(DeviceQueryBean queryBean); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/DeviceService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/DeviceService.java new file mode 100644 index 0000000000000000000000000000000000000000..150fece8d3c913f0d701ca9c403af71d03d96b12 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/DeviceService.java @@ -0,0 +1,66 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.*; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; + +import java.util.List; + +public interface DeviceService { + List getAll(); + + Page deviceList(DeviceQueryBean queryBean); + + DeviceDropdownBean deviceDropdown(); + + List deviceModelList(String vendor); + + ResultBean deviceDelete(DeviceQueryBean queryBean); + + ResultBean devicePowerManage(DeviceQueryBean queryBean, String mode); + + ResultBean deviceRefresh(DeviceQueryBean queryBean); + + ResultBean deviceHeartbeat(String sn, String ip); + + ResultBean deviceReport(DeviceDetailBean detailBean); + + ResultBean addDevice(DeviceEntity deviceEntity); + + ResultBean updateDevice(DeviceEntity deviceEntity); + + ResultBean getDeviceDetail(String id); + + ResultBean getDeviceSystemDetail(String id); + + ResultBean getDeviceStorageDetail(String id); + + ResultBean updateDeviceBySn(DeviceEntity deviceEntity); + + byte[] deviceTemplateDownload(); + + ResultBean deviceTemplateUpload(byte[] content); + + void deviceStatusRefreshTimer(); + + void deviceIpmiStatusRefreshTimer(); + + ResultBean getServiceState(); + + ResultBean changeServiceState(String name, String mode); + + ResultBean getManageNetwork(); + + ResultBean getManageNetworkRange(String ip); + + ResultBean setManageNetwork(ServerManageNetworkBean serverManageNetworkBean); + + ResultBean deviceDetection(DeviceQueryBean queryBean, String mode); + + ResultBean deviceDiskBackup(DeviceDiskCloneBean diskCloneBean); + + ResultBean deviceDiskRestore(DeviceQueryBean queryBean, String imageId); + + ResultBean deviceLogicDisk(String id); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootOsInstallService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootOsInstallService.java new file mode 100644 index 0000000000000000000000000000000000000000..eb9812d7e88fefde6bfa24eef0d55ed58f223abc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootOsInstallService.java @@ -0,0 +1,63 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootInstallParamBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootOsInstallBean; + +import java.io.IOException; +import java.io.InputStream; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/16 + */ +public interface IBootOsInstallService { + + /** + * 系统默认ks内容 + */ + ResultBean getDefaultKs(); + + /** + * 配置网络 + */ + String configNetwork(InputStream inputStream, IBootInstallParamBean iBootInstallParamBean, String taskId); + + /** + * 系统分区设置 + */ + String diskPartition(IBootOsInstallBean iBootOsInstallBean); + + String autoPartition(); + + /** + * 普通设置创建ks文件 + */ + String createKsFileByUI(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac); + + /** + * 高级设置创建ks文件 + */ + String createKsFile(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) throws IOException; + + /** + * 配置网络 + */ + String[] osNetConfig(IBootInstallParamBean iBootInstallParamBean, String sn); + + /** + * 复制文件 + */ + void copyFile(IBootOsInstallBean iBootOsInstallBean, String sn); + + /** + * 写入MAC.INI文件 + */ + void insertMacIni(String imageFileId, String ksPath, String mac, String sn, String boodMode); + + String queryKsFileName(); + + String startSh(String iBootIp, String taskHostId); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootRepositoryImageService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootRepositoryImageService.java new file mode 100644 index 0000000000000000000000000000000000000000..a6348a2726b0a5a14bf6f4c2ca61f77cc33e9338 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootRepositoryImageService.java @@ -0,0 +1,74 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.cdc.combo.mybatis.page.bean.PageResult; +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.*; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRepositoryImageEntity; + +import java.util.List; + +/** + * @author ryalii + * @description 仓库镜像表,专门存储ISO镜像数据访问层接口 + * @date 2022/02/15 10:22:57 + */ +public interface IBootRepositoryImageService { + + PageResult getByConditionPage(ImageQueryBean queryBean); + + List getByCondition(ImageQueryBean queryBean); + + List getYumImageList(); + + IBootRepositoryImageEntity getByFileName(String fileName); + + /** + *

判断文件是否存在.

+ * + * @param fileName 文件名称 + * @return + */ + boolean checkfileExist(String fileName); + + /** + * @param chunk + * @return + * @Title: saveFragmentedFile + * @author: zhangchen + */ + boolean uploadFragmentedFile(Chunk chunk, byte[] filebytes); + + /** + * @param chunkFileModel + * @return + * @Title: mergeFragmentedFile + * @Description: 文件合并. + */ + ResultBean mergeFragmentedFile(ChunkFileModel chunkFileModel, String userName); + + /** + * @param pathId + * @Title: deleteFragmentedFile + * @Description:删除分片脏数据. + */ + ResultBean deleteFragmentedFile(String pathId, String fileName); + + ApiResult deleteOsRepositoryFileById(List ids); + + String getMerginFlag(String fileId); + + double getUsableSpace(); + + List getAllSupportImages(); + + List getImageTypeList(); + + /** + * 校验NFS可用的空间 + * + * @return + */ + SpaceCheckResult checkNFSAvaliableSpace(String size, String type); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootTemplateService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootTemplateService.java new file mode 100644 index 0000000000000000000000000000000000000000..f8e04762d3c4c903de591b3192b82ae66058794f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/IBootTemplateService.java @@ -0,0 +1,111 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.ispim.cosmos.iboot.base.api.bean.IBootTemplateQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageXmlBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.IBootRaidConfigTemplateBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidAnalyResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidTreeBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidXmlBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.*; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressDataEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressTestServerEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTemplateEntity; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/7 + */ +public interface IBootTemplateService { + + Page queryTemplateByCondition(IBootTemplateQueryBean queryBean); + + IBootTemplateEntity addTemplateWithEntity(IBootTemplateEntity iBootTemplateEntity); + + boolean deleteTemplateByIds(List templateIds); + + boolean updateTemplate(IBootTemplateEntity iBootTemplateEntity); + + List select(IBootTemplateEntity iBootTemplateEntity); + + IBootTemplateEntity queryTemplateDetail(Long templatePk); + + IBootTemplateEntity queryTemplateDetailById(String templateId); + + ResultBean duplicateTemplate(IBootTemplateEntity iBootTemplateEntity); + + /** + * 仅提供系统探测保存模板所需文件 + * + * @param file + * @param fileName + * @return + */ + ResultBean addInbandFile(byte[] file, String fileName); + + ResultBean deleteInbandFile(String fileId); + + ResultBean checkGraphicRaid(IBootTemplateEntity controlTemplateEntity); + + boolean startIBootTemplate(Long templatePk, IBootStartTaskBean iBootStartTaskBean); + + /** + * 直接传参起任务 + * + * @param param + * @param templateType + * @param deviceEntities + * @param customTaskName 自定义任务名称,可缺省 + * @return + */ + boolean startIBootTask(String param, String templateType, List deviceEntities, String customTaskName); + + boolean osInstalled(IBootInstallParamBean iBootInstallParamBean, String executeUser); + + boolean networkConfig(DeviceQueryBean deviceQueryBean, String fileId, String executeUser); + + List> getTimezoneBySysType(String systemType); + + ResultBean getDefaultKs(String id); + + ImageXmlBean getXmlAnalyse(String imageId); + + RaidAnalyResult raidAnalyseResult(IBootRaidConfigTemplateBean iBootRaidConfigTemplateBean, String md5); + + Page getRaidConfigPage(DeviceQueryBean query); + + RaidXmlBean getRaidXml(String md5); + + List getRaidTree(String md5); + + ResultBean getBondScript(IBootBondShellBean bondShellBean) throws IOException; + + IBootPreviewBean osInstallPreviewResult(IBootInstallParamBean iBootInstallParamBean) throws Exception; + + IBootBMCNetPreviewBean netConfigPreviewResult(DeviceQueryBean deviceQueryBean, String fileId) throws Exception; + + /** + * 1 BMC 2 IP 3 BOND + */ + byte[] downloadNetConfigExcel(DeviceQueryBean deviceQueryBean, int type); + + Page getStressHistory(IBootTaskQueryBean iBootTaskQueryBean); + + Page queryPageStressTestServerData(IBootTaskQueryBean iBootTaskQueryBean); + + IBootStressTestReportBean getStressTestReportData(String taskId); + + IBootStressExportBean export(IBootTaskQueryBean query); + + void addStressData(IBootStressDataEntity iBootStressDataEntity); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/InnerService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/InnerService.java new file mode 100644 index 0000000000000000000000000000000000000000..2b570675480de773b2c2d58785a4136199d99cf1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/InnerService.java @@ -0,0 +1,42 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDetailBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressDataEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostLogEntity; + +/** + * 面向设备的服务 + */ +public interface InnerService { + + ApiResult getAll(); + + /** + * 接受任务状态接口说明, + * 必传项:id必传,TaskHostStatusEnum必传,需要修改的状态, + * 不需要传递项,开始时间和结束时间不传递由任务框架统一处理时间, + * 按需传递项,msg,进度等根据需要传递 + * + * @param iBootTaskHostEntity + */ + void acceptStatusChangeBean(IBootTaskHostEntity iBootTaskHostEntity); + + /** + * 日志插入接口说明, + * 必传项:jobHostId必传,content必传,content只需要传需要上报什么即可,哪个设备什么时间等信息由任务框架自动填充 + * + * @param iBootTaskHostLogEntity + */ + void acceptTaskHostLogBean(IBootTaskHostLogEntity iBootTaskHostLogEntity); + + ResultBean deviceHeartbeat(String sn, String ip); + + ResultBean deviceReport(DeviceDetailBean detailBean); + + IBootTaskHostEntity getTaskHost(String jobHostId); + + void addStressData(IBootStressDataEntity iBootStressDataEntity); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/OuterAssetService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/OuterAssetService.java new file mode 100644 index 0000000000000000000000000000000000000000..e0c5cf486cf62049ad758716e7615a8258c22744 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/OuterAssetService.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; + +/** + * 面向用户的服务 + */ +public interface OuterAssetService extends OuterService { + ResultBean deviceAssetSync(DeviceQueryBean queryBean); + + ResultBean deviceAssetSyncProgress(); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/OuterService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/OuterService.java new file mode 100644 index 0000000000000000000000000000000000000000..5a236764527d1a861998549629d4be8c27cdea03 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/OuterService.java @@ -0,0 +1,206 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.cdc.combo.mybatis.page.bean.PageResult; +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.ispim.cosmos.iboot.base.api.bean.IBootTemplateQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDiskCloneBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ServerManageNetworkBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.*; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.DeviceShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TemplateShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TotalBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.IBootRaidConfigTemplateBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidAnalyResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidTreeBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidXmlBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.*; +import com.inspur.ispim.cosmos.iboot.base.api.entity.*; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * 面向用户的服务 + */ +public interface OuterService { + ApiResult getAllDevices(); + + ResultBean deviceList(DeviceQueryBean queryBean); + + ResultBean deviceDropdown(); + + ResultBean deviceModelList(String vendor); + + ResultBean deviceDelete(DeviceQueryBean queryBean); + + ResultBean devicePowerManage(DeviceQueryBean queryBean, String mode); + + ResultBean deviceRefresh(DeviceQueryBean queryBean); + + ResultBean addDevice(DeviceEntity deviceEntity); + + ResultBean updateDevice(DeviceEntity deviceEntity); + + ResultBean getDeviceDetail(String id); + + ResultBean getDeviceSystemDetail(String id); + + ResultBean getDeviceStorageDetail(String id); + + byte[] deviceTemplateDownload(); + + ResultBean deviceTemplateUpload(byte[] content); + + ResultBean getServiceState(); + + ResultBean changeServiceState(String name, String mode); + + ResultBean getManageNetwork(); + + ResultBean getManageNetworkRange(String ip); + + ResultBean setManageNetwork(ServerManageNetworkBean serverManageNetworkBean); + + ResultBean deviceDetection(DeviceQueryBean queryBean, String mode); + + ResultBean deviceLogicDisk(String id); + + ResultBean deviceDiskBackup(DeviceDiskCloneBean diskBackupBean); + + ResultBean deviceDiskRestore(DeviceQueryBean queryBean, String imageId); + + ApiResult getTaskHosts(String taskID); + + /**************************镜像关联相关接口 开始***********************/ + PageResult getIBootRepositoryImagePageByCondition(ImageQueryBean queryBean); + + List getByCondition(ImageQueryBean queryBean); + + IBootRepositoryImageEntity getByFileName(String fileName); + + boolean uploadFragmentedFile(Chunk chunk, byte[] filebytes); + + ResultBean mergeFragmentedFile(ChunkFileModel chunkFileModel, String userName); + + ResultBean deleteFragmentedFile(String pathId, String fileName); + + ApiResult deleteOsRepositoryFileById(List ids); + + String getMerginFlag(String fileId); + + double getUsableSpace(); + + List getAllSupportImages(); + + List getImageTypeList(); + /**************************镜像关联相关接口 结束***********************/ + + /**************************任务相关接口 开始***********************/ + Page getTaskList(IBootTaskQueryBean iBootTaskQueryBean); + + Page getTaskHostList(IBootTaskQueryBean iBootTaskQueryBean); + + List getTaskHostLogList(IBootTaskQueryBean iBootTaskQueryBean); + + Page getTaskHistoryList(IBootTaskQueryBean iBootTaskQueryBean); + + Page getTaskHostHistoryList(IBootTaskQueryBean iBootTaskQueryBean); + + void insertTask(IBootTaskEntity iBootTaskEntity); + + void insertTaskHost(IBootTaskHostEntity iBootTaskHostEntity); + + void insertTaskHostList(List iBootTaskHostEntityList); + + void stopTaskByTaskHostId(String taskHostId); + + void stopTaskByTaskId(String taskId); + + void deleteTaskByTaskId(String taskId); + + void deleteTaskByTaskIds(List taskIds); + + ResultBean retryTaskByTaskHostId(String taskHostId); + + ResultBean retryTaskByTaskId(String taskId); + + TotalBean getTotal(); + + DeviceShowBean getDeviceShow(); + + List getTemplateShow(); + + List getTaskHistoryListTopten(); + + List getImageShow(); + /**************************任务相关接口 结束***********************/ + + /**************************模板关联相关接口 开始***********************/ + ResultBean checkGraphicRaid(IBootTemplateEntity controlTemplateEntity); + + SpaceCheckResult checkNFSAvaliableSpace(String size, String type); + + Page queryTemplateByCondition(IBootTemplateQueryBean queryBean); + + IBootTemplateEntity addTemplateWithEntity(IBootTemplateEntity iBootTemplateEntity); + + boolean deleteTemplateByIds(List templateIds); + + boolean updateTemplate(IBootTemplateEntity iBootTemplateEntity); + + List select(IBootTemplateEntity iBootTemplateEntity); + + IBootTemplateEntity queryTemplateDetail(Long templatePk); + + IBootTemplateEntity queryTemplateDetailById(String templateId); + + ResultBean duplicateTemplate(IBootTemplateEntity iBootTemplateEntity); + + ResultBean addInbandFile(byte[] file, String fileName); + + ResultBean deleteInbandFile(String fileId); + + boolean startIBootTemplate(Long templatePk, IBootStartTaskBean iBootStartTaskBean); + + boolean osInstalled(IBootInstallParamBean iBootInstallParamBean, String executeUser); + + boolean networkConfig(DeviceQueryBean deviceQueryBean, String fileId, String executeUser); + + List searchTemplateIsInTask(String templateId); + + List> getTimezoneBySysType(String systemType); + + ResultBean getDefaultKs(String id); + + ImageXmlBean getXmlAnalyse(String imageId); + + RaidAnalyResult raidAnalyseResult(IBootRaidConfigTemplateBean iBootRaidConfigTemplateBean, String md5); + + RaidXmlBean getRaidXml(String md5); + + Page getRaidConfigPage(DeviceQueryBean query); + + List getRaidTree(String md5); + + ResultBean getBondScript(IBootBondShellBean bondShellBean) throws IOException; + + IBootPreviewBean osInstallPreviewResult(IBootInstallParamBean iBootInstallParamBean) throws Exception; + + IBootBMCNetPreviewBean netConfigPreviewResult(DeviceQueryBean deviceQueryBean, String fileId) throws Exception; + + byte[] downloadNetConfigExcel(DeviceQueryBean deviceQueryBean, int type); + + Page getStressHistory(IBootTaskQueryBean iBootTaskQueryBean); + + Page queryPageStressTestServerData(IBootTaskQueryBean iBootTaskQueryBean); + + IBootStressTestReportBean getStressTestReportData(String taskId); + + IBootStressExportBean export(IBootTaskQueryBean query); + /**************************模板关联相关接口 开始***********************/ +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/TaskService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/TaskService.java new file mode 100644 index 0000000000000000000000000000000000000000..9ef992c76b1a1146727588aa1ad2eab14caf7ff7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/TaskService.java @@ -0,0 +1,99 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.DeviceShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TemplateShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TotalBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.*; + +import java.util.List; + +public interface TaskService { + Page getTaskList(IBootTaskQueryBean iBootTaskQueryBean); + + Page getTaskHostList(IBootTaskQueryBean iBootTaskQueryBean); + + List getTaskHostLogList(IBootTaskQueryBean iBootTaskQueryBean); + + Page getTaskHistoryList(IBootTaskQueryBean iBootTaskQueryBean); + + IBootTaskHistoryEntity getTaskHistory(String taskId); + + Page getTaskHostHistoryList(IBootTaskQueryBean iBootTaskQueryBean); + + List getTaskHostHistoryList(String taskId); + + /** + * 任务主表,需要将能回插入的数据都插入, + * 必传项:id,name,taskStatus请默认成WAITING,templateId,templateName,templateType,createUser,createTime,updateTime + * + * @param iBootTaskEntity + */ + void insertTask(IBootTaskEntity iBootTaskEntity); + + /** + * 任务设备表,需要将能回插入的数据都插入 + * 必传项:id,taskId,resourceId,sn,resourceIp,jobHostStatus请默认成WAITING, + * templateId,templateName,templateType,createTime(很关键,任务框架根据创建时间触发任务),updateTime + * 其中param必须填,这个是任务触发时,生成执行脚本的关键 + * + * @param iBootTaskHostEntity + */ + void insertTaskHost(IBootTaskHostEntity iBootTaskHostEntity); + + void insertTaskHostList(List iBootTaskHostEntityList); + + void triggerTask(); + + void stopTaskByTaskHostId(String taskHostId); + + ResultBean retryTaskByTaskHostId(String taskHostId); + + ResultBean retryTaskByTaskId(String taskId); + + void stopTaskByTaskId(String taskId); + + void deleteTaskByTaskId(String taskId); + + void deleteTaskByTaskIds(List taskIds); + + /** + * 接受任务状态接口说明, + * 必传项:id必传,TaskHostStatusEnum必传,需要修改的状态, + * 不需要传递项,开始时间和结束时间不传递由任务框架统一处理时间, + * 按需传递项,msg,进度等根据需要传递 + * + * @param iBootTaskHostEntity + */ + void acceptStatusChangeBean(IBootTaskHostEntity iBootTaskHostEntity); + + /** + * 日志插入接口说明, + * 必传项:jobHostId必传,content必传,content只需要传需要上报什么即可,哪个设备什么时间等信息由任务框架自动填充 + * + * @param iBootTaskHostLogEntity + */ + void acceptTaskHostLogBean(IBootTaskHostLogEntity iBootTaskHostLogEntity); + + /** + * 查询当前模板是否被任务占用 + * + * @param templateId + * @return + */ + List searchTemplateIsInTask(String templateId); + + IBootTaskHostEntity getTaskHost(String jobHostId); + + TotalBean getTotal(); + + DeviceShowBean getDeviceShow(); + + List getTemplateShow(); + + List getTaskHistoryListTopten(); + + List getImageShow(); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/TemplateCreateService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/TemplateCreateService.java new file mode 100644 index 0000000000000000000000000000000000000000..42385dc69ca9e9263ef3647958e1e8b6e1d0014e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/service/TemplateCreateService.java @@ -0,0 +1,30 @@ +package com.inspur.ispim.cosmos.iboot.base.api.service; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; + +/** + * 每个模板类型,生成sh的实现类 + */ +public interface TemplateCreateService { + /*** + * + * destPath,目标路径,不同模板,根据参数param,去生成对应的模板sh,包含start.sh 和single.sh,start.sh为入口,真正的逻辑在single.sh中 + * @return + */ + ResultBean createTemplateShFile(String destPath, String taskHostId, String param); + + /*** + * + * destPath,目标路径,在此路径下放置,不同模板所需要的工具包 + * @return + */ + ResultBean putTools(String destPath); + + /*** + * + * destPath,目标路径,在此路径下放置,不同模板所需要的工具包 + * @return + */ + ResultBean execute(String destPath, IBootTaskHostEntity iBootTaskHostEntity); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/CommonUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/CommonUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..9e52ed56e5fe928296f259fca7b13c38204379d1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/CommonUtil.java @@ -0,0 +1,402 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + + +import cn.hutool.core.util.StrUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.lang3.StringUtils; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@Slf4j +public class CommonUtil { + private static HashSet bmcWhiteList = new HashSet<>(); + private static HashSet biosWhiteList = new HashSet<>(); + //解决Path Manipulation漏洞 + private static HashMap hashMap; + + static { + bmcWhiteList.add(".ima"); + bmcWhiteList.add(".hpm"); + bmcWhiteList.add(".bin"); + bmcWhiteList.add(".tar"); + biosWhiteList.add(".bin"); + biosWhiteList.add(".hpm"); + biosWhiteList.add(".tar"); + } + + static { + hashMap = new HashMap<>(); + hashMap.put("a", "a"); + hashMap.put("b", "b"); + hashMap.put("c", "c"); + hashMap.put("d", "d"); + hashMap.put("e", "e"); + hashMap.put("f", "f"); + hashMap.put("g", "g"); + hashMap.put("h", "h"); + hashMap.put("i", "i"); + hashMap.put("j", "j"); + hashMap.put("k", "k"); + hashMap.put("l", "l"); + hashMap.put("m", "m"); + hashMap.put("n", "n"); + hashMap.put("o", "o"); + hashMap.put("p", "p"); + hashMap.put("q", "q"); + hashMap.put("r", "r"); + hashMap.put("s", "s"); + hashMap.put("t", "t"); + hashMap.put("u", "u"); + hashMap.put("v", "v"); + hashMap.put("w", "w"); + hashMap.put("x", "x"); + hashMap.put("y", "y"); + hashMap.put("z", "z"); + + hashMap.put("A", "A"); + hashMap.put("B", "B"); + hashMap.put("C", "C"); + hashMap.put("D", "D"); + hashMap.put("E", "E"); + hashMap.put("F", "F"); + hashMap.put("G", "G"); + hashMap.put("H", "H"); + hashMap.put("I", "I"); + hashMap.put("J", "J"); + hashMap.put("K", "K"); + hashMap.put("L", "L"); + hashMap.put("M", "M"); + hashMap.put("N", "N"); + hashMap.put("O", "O"); + hashMap.put("P", "P"); + hashMap.put("Q", "Q"); + hashMap.put("R", "R"); + hashMap.put("S", "S"); + hashMap.put("T", "T"); + hashMap.put("U", "U"); + hashMap.put("V", "V"); + hashMap.put("W", "W"); + hashMap.put("X", "X"); + hashMap.put("Y", "Y"); + hashMap.put("Z", "Z"); + + hashMap.put(":", ":"); + hashMap.put("/", "/"); + hashMap.put(File.separator, File.separator); + hashMap.put(".", "."); + hashMap.put("-", "-"); + hashMap.put("_", "_"); + + hashMap.put("0", "0"); + hashMap.put("1", "1"); + hashMap.put("2", "2"); + hashMap.put("3", "3"); + hashMap.put("4", "4"); + hashMap.put("5", "5"); + hashMap.put("6", "6"); + hashMap.put("7", "7"); + hashMap.put("8", "8"); + hashMap.put("9", "9"); + } + + public static String isfmformatVersion(String version) { + String[] versionArray = version.split("_"); + String returnstr = ""; + for (String str : versionArray) { + String[] evstr = str.split("\\."); + if (evstr.length == 3) {//找到三个点的,认为是版本字符串 + returnstr = formatVersion(str); + } + } + return returnstr; + } + + public static Boolean setSysBoot(String host, String username, String password, String bootType) { + ExecCommand cmdUtil = new ExecCommand(); + String cmd; + if (OperationSystemUtil.isWindows()) { + cmd = String.join(" ", IBootPathConstant.IPMI_TOOL_WINDOWS, "-H", host, "-I lanplus", "-U", username, "-P", password, "chassis bootdev", bootType); + } else { + cmd = "ipmitool" + " -H" + host + " -I lanp " + " -U" + username + " -P" + password + " chassis bootdev " + bootType; + } + String[] cmdArray = cmd.split("\\s+"); + String result = null; + try { + result = cmdUtil.runLocal(cmdArray); + if (result.toLowerCase().contains("set boot device to")) { + return true; + } else { + return false; + } + } catch (Exception e) { + return false; + } + } + + public static String getPowerStatus(String host, String username, String password) { + ExecCommand cmdUtil = new ExecCommand(); + String cmd; + if (OperationSystemUtil.isWindows()) { + cmd = String.join(" ", IBootPathConstant.IPMI_TOOL_WINDOWS, "-H", host, "-I lanplus", "-U", username, "-P", password, "power status"); + } else { + cmd = "ipmitool" + " -H" + host + " -I lanp " + " -U" + username + " -P" + password + " power status "; + } + String[] cmdArray = cmd.split("\\s+"); + String result = null; + try { + result = cmdUtil.runLocal(cmdArray); + if (result.toLowerCase().contains("chassis power is")) { + String[] results = result.strip().split(" "); + if (results.length >= 4) { + return results[3]; + } else { + return ""; + } + } else { + return ""; + } + } catch (Exception e) { + return ""; + } + } + + public static Boolean powerControl(String host, String username, String password, String order) { + ExecCommand cmdUtil = new ExecCommand(); + String cmd; + if (OperationSystemUtil.isWindows()) { + cmd = String.join(" ", IBootPathConstant.IPMI_TOOL_WINDOWS, "-H", host, "-I lanplus", "-U", username, "-P", password, "power", order); + } else { + cmd = "ipmitool" + " -H" + host + " -I lanp " + " -U" + username + " -P" + password + " power " + order; + } + String[] cmdArray = cmd.split("\\s+"); + try { + return cmdUtil.runLocal(cmdArray).toLowerCase().contains("chassis power control:"); + } catch (Exception e) { + return false; + } + } + + public static List findFilesForWindows(String directory, String target, boolean ignoreCase) { + List path = new ArrayList<>(); + if (StringUtils.isBlank(directory)) { + return path; + } + File dir = new File(directory); + if (!dir.exists() || !dir.isDirectory()) { + return path; + } + try { + Files.walkFileTree(dir.toPath(), new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + String fileName = file.getFileName().toString(); + if (StringUtils.equalsIgnoreCase(fileName, target)) { + if (ignoreCase) { + path.add(file.toString()); + } else if (StringUtils.equals(fileName, target)) { + path.add(file.toString()); + } + } + return FileVisitResult.CONTINUE; + } + }); + } catch (IOException e) { + log.error("查找失败:{}", e.getMessage()); + } + return path; + } + + public static String formatVersion(String version) { + if (StrUtil.isNotEmpty(version) && version.contains(".")) { + String[] strArray = version.split("\\."); + StringBuffer ver = new StringBuffer(); + for (int i = 0; i < strArray.length; i++) { + if (strArray[i].length() == 1) { + ver.append("0" + strArray[i]); + } else { + ver.append(strArray[i]); + } + if (i < strArray.length - 1) { + ver.append("."); + } + } + version = ver.toString(); + } + return version; + } + + public static String getExtName(String fileName) { + if (fileName.length() > 4) { + fileName = fileName.substring(fileName.length() - 5); + } + String[] arr = fileName.split("\\."); + if (arr.length > 1) { + return "." + arr[arr.length - 1]; + } + return ""; + } + + public static String pathManipulation(String path) { + String temp = ""; + for (int i = 0; i < path.length(); i++) { + if (hashMap.get(path.charAt(i) + "") != null) { + temp += hashMap.get(path.charAt(i) + ""); + } + } + return temp; + } + + public static String md5(InputStream fis) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] buffer = new byte[102400]; + int length; + while ((length = fis.read(buffer)) != -1) { + md.update(buffer, 0, length); + } + return new String(Hex.encodeHex(md.digest())); + } catch (Exception e) { + return null; + } finally { + try { + if (fis != null) { + fis.close(); + } + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + + public static String md5(File file) { + InputStream inputStream = null; + try { + inputStream = new FileInputStream(file); + String md5 = md5(inputStream); + return md5; + } catch (Exception e) { + return null; + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + } + + public static String md5(byte[] bytes) { + InputStream inputStream = null; + try { + inputStream = new ByteArrayInputStream(bytes); + String md5 = md5(inputStream); + return md5; + } catch (Exception e) { + return null; + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + } + + /** + * @param ipAddress + * @return + * @Title isIPv4 + * @Description 判断是否为IPv4地址 + */ + public static boolean isIPv4(String ipAddress) { + String ipv4Pattern = "^(([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])$"; + Pattern pattern = Pattern.compile(ipv4Pattern); + Matcher matcher = pattern.matcher(ipAddress); + return matcher.matches(); + } + + /** + * @param ipAddress + * @return + * @Title isIPv6 + * @Description 判断是否为IPv6地址 + */ + public static boolean isIPv6(String ipAddress) { + String ipv6Pattern = "^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d{2}|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}|:))|(([0-9A-Fa-f]{1,4}:){4}((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[0-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}))|:))|((([0-9A-Fa-f]{1,4}:){1}((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$"; + Pattern pattern = Pattern.compile(ipv6Pattern); + Matcher matcher = pattern.matcher(ipAddress); + return matcher.matches(); + } + + public static void main(String[] args) { + String version = "06.00.03_Standard_20220128.hpm"; + String newversion = isfmformatVersion(version); + String ss = ""; + } + + /** + * 获取iboot dhcp ip + */ + public static String getDHCPIp() { + File file = new File(IBootPathConstant.dhcpIpFile); + String dhcpIp = ""; + if (file.exists()) { + try { + dhcpIp = IBootFileUtil.readFileStr(file).trim(); + } catch (Exception e) { + log.error(e.getMessage()); + } + } + return dhcpIp; + } + + /** + * 获取iboot 文件ip + */ + public static String getWebServerIp() { + File file = new File(IBootPathConstant.webServerIpFile); + String webServerIp = ""; + if (file.exists()) { + try { + webServerIp = IBootFileUtil.readFileStr(file).trim(); + } catch (Exception e) { + log.error(e.getMessage()); + } + } + return webServerIp; + } + + public static String strToMd5(String content) { + try { + MessageDigest md5 = MessageDigest.getInstance("MD5"); + if (Objects.nonNull(content)) { + byte[] bytes = md5.digest(content.getBytes(StandardCharsets.UTF_8)); + StringBuilder builder = new StringBuilder(); + for (byte aby : bytes) { + builder.append(Integer.toHexString((0x000000FF & aby) | 0xFFFFFF00).substring(6)); + } + return builder.toString(); + } + } catch (NoSuchAlgorithmException e) { + log.error(e.getMessage()); + } + return null; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/DateDeserializer.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/DateDeserializer.java new file mode 100644 index 0000000000000000000000000000000000000000..c3a8db954498d01fcf74d0c547807dbbe9aa5d32 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/DateDeserializer.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; + +import java.lang.reflect.Type; +import java.util.Date; + + +public class DateDeserializer implements JsonDeserializer { + + public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + return new Date(json.getAsJsonPrimitive().getAsLong()); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/DateSerializer.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/DateSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..ad162c61dc575500baf1f1aedb0ef80eb015f1cd --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/DateSerializer.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; + +import java.lang.reflect.Type; +import java.util.Date; + + +public class DateSerializer implements JsonSerializer { + @Override + public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { + return new JsonPrimitive(src.getTime()); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/ExecCommand.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/ExecCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..439007909420380ab38a7a696d2b6216dceff50f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/ExecCommand.java @@ -0,0 +1,445 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.trilead.ssh2.Connection; +import com.trilead.ssh2.SCPClient; +import com.trilead.ssh2.Session; +import com.trilead.ssh2.StreamGobbler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +public class ExecCommand implements Serializable { + /** + * 记录日志. + */ + public static final Logger LOG = LoggerFactory.getLogger(ExecCommand.class); + /** + * 测试标志. + */ + // String debugflg = PropertiesUtil.getProperty("debugflg"); + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * scpGet(java.lang.String, java.lang.String, java.lang.String, + * java.lang.String, java.lang.String) + * + * @param host host。 + * @param username username + * @param password password + * @param remoteFile remoteFile + * @param localDir localDir + * @throws IOException IOException + */ + public void scpGet(String host, String username, String password, String remoteFile, String localDir) + throws IOException { + Connection conn = getOpenedConnection(host, username, password); + SCPClient client = new SCPClient(conn); + client.get(remoteFile, localDir); + conn.close(); + } + + /** + * scpPut(java.lang.String, java.lang.String, java.lang.String, + * java.lang.String, java.lang.String)。 + * + * @param host host + * @param username username + * @param password password + * @param localFile localFile + * @param remoteDir remoteDir + * @throws IOException IOException + */ + public void scpPut(String host, String username, String password, String localFile, String remoteDir) + throws IOException { + Connection conn = getOpenedConnection(host, username, password); + SCPClient client = new SCPClient(conn); + client.put(localFile, remoteDir); + conn.close(); + } + + /** + * runSSH(java.lang.String, java.lang.String, java.lang.String, + * java.lang.String) + * + * @param host host + * @param username username + * @param password password + * @param cmd cmd + * @return List + * @throws IOException IOException + */ + public List runSSH(String host, String username, String password, List cmd) throws IOException { + // logger.debug("running SSH cmd [" + cmd + "]"); + // int value = 0; + Connection conn = getOpenedConnection(host, username, password); + List result = new ArrayList(); + if (null != cmd) { + for (String str : cmd) { + if (null != str && !"".equals(cmd)) { + Session sess = conn.openSession(); + sess.execCommand(str); + InputStream stdout = new StreamGobbler(sess.getStdout()); + @SuppressWarnings("resource") + BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); + + while (true) { + // attention: do not comment this block, or you will hit + // NullPointerException + // when you are trying to read exit status + String line = br.readLine(); + if (line == null) { + break; + } else { + // logger.info(line); + // System.out.println(line); + // resultbuf += line + "\n"; + result.add(line); + } + } + /* + * if (null != sess && null != sess.getExitStatus()) { value + * = sess.getExitStatus().intValue(); } else { value = -1; } + */ + sess.close(); + } + } + } + conn.close(); + if (result.isEmpty()) { + result = null; + } + return result; + } + + /** + * 远程SSH(单命令发送). + * + * @param host 服务端ip地址 + * @param username 服务端username + * @param password 服务端password + * @param cmd 执行命令 + * @return List + * @throws IOException IOException + */ + public List runSSHOneCmd(String host, String username, String password, String cmd) throws IOException { + LOG.debug("running SSH cmd [" + cmd + "]"); + Connection conn = getOpenedConnection(host, username, password); + List result = new ArrayList(); + if (null != cmd) { + Session sess = conn.openSession(); + sess.execCommand(cmd); + InputStream stdout = new StreamGobbler(sess.getStdout()); + @SuppressWarnings("resource") + BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); + while (true) { + // attention: do not comment this block, or you will hit + // NullPointerException + // when you are trying to read exit status + String line = br.readLine(); + if (line == null) { + break; + } else { + result.add(line); + } + } + } + conn.close(); + return result; + } + + /** + * return a opened Connection. + * + * @param host host + * @param username username + * @param password password + * @return Connection + * @throws IOException IOException + */ + private Connection getOpenedConnection(String host, String username, String password) throws IOException { + Connection conn = new Connection(host); + conn.connect(); // make sure the connection is opened + boolean isAuthenticated = conn.authenticateWithPassword(username, password); + if (!isAuthenticated) { + throw new IOException("Authentication failed."); + } + return conn; + } + + /** + * (java.lang.String) + * + * @param cmd cmd + * @return List + * @throws IOException IOException + */ + public String runLocal(String cmd) throws IOException { + // logger.debug("running local cmd [" + cmd + "]"); + // System.out.println("running local cmd [" + cmd + "]"); + // Runtime rt = Runtime.getRuntime(); + String[] cmds = new String[]{"/bin/sh", "-c", cmd}; // edit by lufeng + Process p = null; + String result = new String(); + try { + ProcessBuilder processBuilder = new ProcessBuilder(cmds); + processBuilder.redirectErrorStream(true); + p = processBuilder.start(); + InputStream pInput = p.getInputStream(); + InputStream stdout = new StreamGobbler(pInput); + @SuppressWarnings("resource") + BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); + String resultbuf = ""; + while (true) { + String line = br.readLine(); + if (line == null) { + break; + } else { + resultbuf += line + "\n"; + } + } + result = resultbuf; + br.close(); + stdout.close(); + pInput.close(); + p.destroy(); + } finally { + if (null != p) { + p.destroy(); + } + } + // result.add(Integer.toString(p.exitValue())); + return result; + } + + /** + * @param cmd + * @return Map + * @throws IOException IOException + * @throws InterruptedException + */ + public Map runLocalForResult(String cmd) throws IOException, InterruptedException { + Map resultMap = new HashMap(); + String[] cmds = new String[]{"/bin/sh", "-c", cmd}; + int rtnVal = -999; + String message = ""; + Process p = null; + try { + ProcessBuilder processBuilder = new ProcessBuilder(cmds); + processBuilder.redirectErrorStream(true); + p = processBuilder.start(); + InputStream pInput = p.getInputStream(); + InputStream stdout = new StreamGobbler(pInput); + @SuppressWarnings("resource") + BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); + StringBuffer resultbuf = new StringBuffer(); + while (true) { + String line = br.readLine(); + if (line == null) { + break; + } else { + resultbuf.append(line + "\n"); + } + } + rtnVal = p.waitFor(); + message = resultbuf.toString(); + br.close(); + stdout.close(); + pInput.close(); + p.destroy(); + } finally { + if (null != p) { + p.destroy(); + } + } + resultMap.put("code", rtnVal); + resultMap.put("message", message); + return resultMap; + } + + /** + * (java.lang.String) + * + * @param cmd cmd + * @return List + * @throws IOException IOException + */ + public String runLocaln(String cmd) throws IOException { + // logger.debug("running local cmd [" + cmd + "]"); + Runtime rt = Runtime.getRuntime(); + Process p = null; + String result = new String(); + try { + p = rt.exec(cmd); + InputStream pInput = p.getInputStream(); + InputStream stdout = new StreamGobbler(pInput); + @SuppressWarnings("resource") + BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); + String resultbuf = ""; + while (true) { + String line = br.readLine(); + if (line == null) { + break; + } else { + resultbuf += line; + } + } + result = resultbuf; + br.close(); + stdout.close(); + pInput.close(); + p.destroy(); + } finally { + if (null != p) { + p.destroy(); + } + } + return result; + } + + /** + * (java.lang.String) + * + * @param cmd cmd + * @return List + * @throws IOException IOException + */ + public List runCmd(String cmd) throws IOException { + ProcessBuilder processBuilder = new ProcessBuilder(cmd); + processBuilder.redirectErrorStream(true); + Process p = processBuilder.start(); + List result = null; + if (p != null) { + InputStream pInput = p.getErrorStream(); + InputStream stdout = new StreamGobbler(pInput); + @SuppressWarnings("resource") + BufferedReader br = new BufferedReader(new InputStreamReader(stdout)); + result = new ArrayList<>(); + while (true) { + String line = br.readLine(); + if (line == null) { + break; + } else { + result.add(line); + } + } + br.close(); + stdout.close(); + pInput.close(); + p.destroy(); + } else { + System.out.println("no pid\r\n"); + } + return result; + } + + /** + * (java.lang.String) + * + * @param cmd cmd + * @return List + * @throws IOException IOException + */ + public List runLocallist(String cmd) throws IOException { + BufferedReader bufferedReader = null; + List result = null; + Runtime rt = Runtime.getRuntime(); + Process p = rt.exec(cmd); + if (p != null) { + bufferedReader = new BufferedReader(new InputStreamReader(p.getInputStream())); + result = new ArrayList(); + while (true) { + String line = bufferedReader.readLine(); + if (line == null) { + break; + } else { + result.add(line); + } + } + try { + p.waitFor(); + } catch (InterruptedException e) { + throw new IOException("run command failed!" + e.toString(), e); + } + bufferedReader.close(); + p.destroy(); + return result; + } else { + System.out.println("no pid\r\n"); + return null; + } + } + + /** + * 复杂linux命令执行,需要在命令前加入“\bash\sh, -c”. + * + * @param opscmd cmd + * @return List + * @throws IOException IOException + * @see + */ + public String runLocal(String... opscmd) throws IOException { + ProcessBuilder processBuilder = new ProcessBuilder(opscmd); + processBuilder.redirectErrorStream(true); + Process process = processBuilder.start(); + BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); + String result = new String(); + String resultbuf = ""; + while (true) { + String line = br.readLine(); + if (line == null) { + break; + } else { + resultbuf += line + "\n"; + } + } + result = resultbuf; + if (null != br) { + br.close(); + } + return result; + } + + /** + * 只为监控设计的特殊进程执行方法 + * + * @param cmd + * @return + * @throws IOException + */ + public void runMointorShell(String cmd, int timeout) throws IOException { + Runtime rt = Runtime.getRuntime(); + Process p = rt.exec(cmd); + try { + p.waitFor(timeout, TimeUnit.MINUTES); + } catch (InterruptedException e) { + throw new IOException("run command failed!" + e.toString(), e); + } finally { + if (null != p) { + p.destroy(); + } + } + + } + + public void runAsyncCmd(String cmd) { + Runtime rt = Runtime.getRuntime(); + Process p = null; + try { + p = rt.exec(cmd); + } catch (IOException e) { + } finally { + if (null != p) { + p.destroy(); + } + } + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/GsonUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/GsonUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..b5c8ab0196b8e4ce5eb65de04d2ad35eea566909 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/GsonUtil.java @@ -0,0 +1,173 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.google.gson.*; + +import java.io.Reader; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.Array; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.List; + +public class GsonUtil { + private static Gson gson = null; + + static { + GsonBuilder gb = new GsonBuilder(); + gb.registerTypeAdapter(java.util.Date.class, new DateDeserializer()).setDateFormat(DateFormat.LONG); + gb.registerTypeAdapter(Double.class, new DoubleDeserializer()); + gson = gb.setExclusionStrategies(new SetterExclusionStrategy()).disableHtmlEscaping().create(); + } + + public static T fromJson(String json, Class classOfT) { + return gson.fromJson(json, classOfT); + } + + public static T fromJson(String json, Class classOfT, Type... classOfU) { + Type objectType = type(classOfT, classOfU); + return gson.fromJson(json, objectType); + } + + public static T fromJson(String json, Type type) { + return gson.fromJson(json, type); + } + + public static T fromJson(Reader json, Class classOfT) { + return gson.fromJson(json, classOfT); + } + + public static T[] toArray(String json, Class classOfT) { + Class aClass = Array.newInstance(classOfT, 0).getClass(); + return (T[]) gson.fromJson(json, aClass); + } + + public static List toList(String json, Class classOfT) { + T[] array = toArray(json, classOfT); + return Arrays.asList(array); + } + + public static String toJson(Object src) { + return gson.toJson(src); + } + + public static String toJsonAndExclude(Object src, final String... fieldList) { + if (fieldList == null || fieldList.length == 0) { + return toJson(src); + } + + Gson gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() { + @Override + public boolean shouldSkipField(FieldAttributes f) { + for (String field : fieldList) { + if (field.equals(f.getName())) { + return true; + } + } + return false; + } + + @Override + public boolean shouldSkipClass(Class clazz) { + return false; + } + }).create(); + return gson.toJson(src); + } + + + private static ParameterizedType type(final Class raw, final Type... args) { + return new ParameterizedType() { + @Override + public Type getRawType() { + return raw; + } + + @Override + public Type[] getActualTypeArguments() { + return args; + } + + @Override + public Type getOwnerType() { + return null; + } + }; + } + + // 将Json数据解析成相应的映射对象 + public static T parseJsonWithGson(String jsonData, Class clazz) { + Gson gson = new Gson(); + T result = gson.fromJson(jsonData, clazz); + return result; + } + + // 将Json数组解析成相应的映射对象列表 + public static List parseJsonArrayWithGson(String jsonData, + Class clazz) { + Gson gson = new Gson(); + Type type = new ParameterizedTypeImpl(clazz); + List result = gson.fromJson(jsonData, type); + return result; + } + + @Target(ElementType.FIELD) + @Retention(RetentionPolicy.RUNTIME) + public @interface Exclude { + + } + + private static class SetterExclusionStrategy implements ExclusionStrategy { + + @Override + public boolean shouldSkipField(FieldAttributes f) { + Exclude exclude = f.getAnnotation(Exclude.class); + return exclude != null; + } + + @Override + public boolean shouldSkipClass(Class clazz) { + return false; + } + } + + private static class DoubleDeserializer implements JsonDeserializer { + + @Override + public Double deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + String str = json.getAsString(); + if (str != null && !"".equals(str)) { + return Double.valueOf(str); + } + return null; + } + } + + private static class ParameterizedTypeImpl implements ParameterizedType { + Class clazz; + + public ParameterizedTypeImpl(Class clz) { + clazz = clz; + } + + @Override + public Type[] getActualTypeArguments() { + return new Type[]{clazz}; + } + + @Override + public Type getRawType() { + return List.class; + } + + @Override + public Type getOwnerType() { + return null; + } + } +} + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootExcelReaderUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootExcelReaderUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..25f80333d8488d8023bd0400f52fb650e1a98f1e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootExcelReaderUtil.java @@ -0,0 +1,316 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import cn.hutool.core.util.StrUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootBMCNetPreviewBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootBondSetBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootIPSetBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootOsIp; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +import java.io.IOException; +import java.io.InputStream; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * 读取excel内容工具类. + */ +@Slf4j +public class IBootExcelReaderUtil { + + private HSSFWorkbook hwb; + + private HSSFSheet hsheet; + + private HSSFRow hrow; + + /** + * 根据HSSFCell类型设置数据. + * + * @param cell 列内容 + * @return String + */ + @SuppressWarnings("deprecation") + private static String getCellFormatValue(HSSFCell cell) { + String cellvalue = ""; + Object obj = null; + if (cell != null) { + switch (cell.getCellTypeEnum()) { + case BOOLEAN: + obj = cell.getBooleanCellValue(); + break; + case ERROR: + obj = cell.getErrorCellValue(); + break; + case STRING: + obj = cell.getStringCellValue(); + break; + case NUMERIC: + obj = new DecimalFormat("0").format(cell.getNumericCellValue()); + //obj = cell.getNumericCellValue(); + //整数会解析成double,去掉整数后.0 + if (null != obj) { + String val = String.valueOf(obj); + if (val.contains(".")) { + String[] arry = val.split("\\."); + if (arry != null && arry.length >= 1) { + if (Integer.parseInt(arry[1]) == 0) { + Integer vaa = Integer.parseInt(arry[0]); + obj = vaa; + } + + } + } + } + break; + default: + break; + } + } + if (null == obj) { + cellvalue = ""; + } else { + cellvalue = obj.toString(); + } + return cellvalue; + } + + /** + * 获取单元格数据内容为字符串类型的数据. + * + * @param cell Excel单元格 + * @return String 单元格数据内容 + */ + @SuppressWarnings("deprecation") + private String getStringCellValue(HSSFCell cell) { + String strCell = ""; + switch (cell.getCellType()) { + case HSSFCell.CELL_TYPE_STRING: + strCell = cell.getStringCellValue(); + break; + case HSSFCell.CELL_TYPE_NUMERIC: + strCell = String.valueOf(cell.getNumericCellValue()); + break; + case HSSFCell.CELL_TYPE_BOOLEAN: + strCell = String.valueOf(cell.getBooleanCellValue()); + break; + default: + strCell = ""; + break; + } + if ("".equals(strCell) || strCell == null) { + return ""; + } + return strCell; + } + + /** + * 读取excel内容. + * + * @param is 文件流 + * @param titlenum 从第几列还是读取列名 + * @param startnum 从第几行开始获取内容数据 + * @return Map 单元格map对象 + */ + public List readExcelAssetImport(InputStream is, int titlenum, int startnum) { + List contentList = new ArrayList<>(); + try { + hwb = new HSSFWorkbook(is); + hsheet = hwb.getSheetAt(0); + // 获取模板标题 + hrow = hsheet.getRow(0); + // 得到总行数 + int rowNum = hsheet.getLastRowNum(); + hrow = hsheet.getRow(titlenum); + int colNum = hrow.getPhysicalNumberOfCells(); + // 循环遍历获取excel内容 + for (int i = startnum; i <= rowNum; i++) { + Set osIps = new HashSet<>(); + IBootIPSetBean content = new IBootIPSetBean(); + hrow = hsheet.getRow(i); + if (null != hrow) { + int j = 0; + while (j < colNum) { // 获取单元格内容 + if (j == 0) { + String str = getCellFormatValue(hrow.getCell((short) j)).trim(); + if (StrUtil.isNotEmpty(str)) { + content.setDhcpIp(str); + } + j++; + } else if (j == 1) { + String str = getCellFormatValue(hrow.getCell((short) j)).trim(); + if (StrUtil.isNotEmpty(str)) { + content.setSn(str); + } + j++; + } else if (j == 2) { + String str = getCellFormatValue(hrow.getCell((short) j)).trim(); + if (StrUtil.isNotEmpty(str)) { + content.setHostname(str); + } + j++; + } else if (j % 4 == 3) { + String str = getCellFormatValue(hrow.getCell((short) j)).trim(); + if (StrUtil.isNotEmpty(str)) { + IBootOsIp osIp = new IBootOsIp(); + for (int k = 0; k < 4; k++) { + str = getCellFormatValue(hrow.getCell((short) j + k)).trim(); + if (StrUtil.isNotEmpty(str)) { + if (k == 0) { + osIp.setIp(str); + } else if (k == 1) { + osIp.setNetmask(str); + } else if (k == 2) { + osIp.setGateway(str); + } else { + osIp.setNetInterface(str); + } + } + } + j = j + 4; + osIps.add(osIp); + } else { + j = j + 4; + } + } + + } + content.setOsIpList(osIps); + } + contentList.add(content); + } + is.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } finally { + try { + is.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + return contentList; + } + + public List readExcelBondImport(InputStream is, int titlenum, int startnum) { + List contentList = new ArrayList<>(); + try { + hwb = new HSSFWorkbook(is); + hsheet = hwb.getSheetAt(0); + // 获取模板标题 + hrow = hsheet.getRow(0); + // 得到总行数 + int rowNum = hsheet.getLastRowNum(); + hrow = hsheet.getRow(titlenum); + int colNum = hrow.getPhysicalNumberOfCells(); + // 循环遍历获取excel内容 + for (int i = startnum; i <= rowNum; i++) { + IBootBondSetBean content = new IBootBondSetBean(); + hrow = hsheet.getRow(i); + if (null != hrow) { + int j = 0; + while (j < colNum) { // 获取单元格内容 + String str = getCellFormatValue(hrow.getCell((short) j)).trim(); + if (j == 0) { + if (StrUtil.isNotEmpty(str)) { + content.setDhcpIp(str); + } + } else if (j == 1) { + if (StrUtil.isNotEmpty(str)) { + content.setSn(str); + } + } else if (j == 2) { + if (StrUtil.isNotEmpty(str)) { + content.setHostname(str); + } + } else if (j == 3) { + if (StrUtil.isNotEmpty(str)) { + content.setBondName(str); + } + } else if (j == 4) { + if (StrUtil.isNotEmpty(str)) { + content.setBondIp(str); + } + } else { + if (StrUtil.isNotEmpty(str)) { + content.setGateway(str); + } + } + j++; + } + } + contentList.add(content); + } + is.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } finally { + try { + is.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + return contentList; + } + + public List readExcelBMCImport(InputStream is, int titlenum, int startnum) { + List contentList = new ArrayList<>(); + try { + hwb = new HSSFWorkbook(is); + hsheet = hwb.getSheetAt(0); + // 得到总行数 + int rowNum = hsheet.getLastRowNum(); + hrow = hsheet.getRow(titlenum); + int colNum = hrow.getPhysicalNumberOfCells(); + // 循环遍历获取excel内容 + for (int i = startnum; i <= rowNum; i++) { + IBootBMCNetPreviewBean.IBootBMCNetBean content = new IBootBMCNetPreviewBean.IBootBMCNetBean(); + hrow = hsheet.getRow(i); + boolean isComplete = true; + if (null != hrow) { + int j = 0; + while (j < colNum) { // 获取单元格内容 + String str = getCellFormatValue(hrow.getCell((short) j)).trim(); + if (StringUtils.isEmpty(str)) { + isComplete = false; + break; + } + switch (j) { + case 0 -> content.setDhcpIp(str); + case 1 -> content.setSn(str); + case 2 -> content.setIp(str); + case 3 -> content.setNetmask(str); + case 4 -> content.setGateway(str); + default -> content.setChannel(str); + } + j++; + } + } + // 信息不全直接跳过 + if (isComplete) { + contentList.add(content); + } + } + is.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } finally { + try { + is.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + return contentList; + } + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootExcelUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootExcelUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..abca6e47c33e3f88dcbc51c493f032e444112d13 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootExcelUtil.java @@ -0,0 +1,506 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; +import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.inspur.cdc.commons.i18n.Languages.getLocale; + +public class IBootExcelUtil { + + public static boolean isNumberic(String str) { + Matcher isNum = Pattern.compile("^[1-9][0-9]*(\\.[0-9][1-9]*)?$").matcher(str); + return isNum.matches(); + } + + public static byte[] generateStressTest(InputStream inputStream, List leftData, List> data, List> infos) throws Exception { + XSSFWorkbook workbook = new XSSFWorkbook(inputStream); + XSSFSheet sheetAt = workbook.getSheetAt(0); + XSSFSheet sheetInfo = workbook.getSheetAt(1); + int target = 0; + for (int i = 2; i < 2 + leftData.size(); i++) { + XSSFRow row = sheetAt.getRow(i); + XSSFCell cell = row.getCell(1); + if (!isNumberic(leftData.get(target))) { + cell.setCellValue(leftData.get(target)); + } else { + cell.setCellValue(Integer.parseInt(leftData.get(target))); + } + target++; + } + //第一个sheet下面数据 + XSSFRow errorRow = null; + for (int i = 11; i < data.size() + 11; i++) { + List list = data.get(i - 11); + errorRow = sheetAt.getRow(i); + if (errorRow == null) { + errorRow = sheetAt.createRow(i); + } + for (int j = 0; j < list.size(); j++) { + Cell cell = errorRow.getCell(j); + if (cell == null) { + cell = errorRow.createCell(j); + } + if (StringUtils.isNotEmpty(list.get(j))) { + cell.setCellValue(list.get(j)); + } + } + } + + XSSFRow infoRow = null; + for (int i = 2; i < infos.size() + 2; i++) { + List list = infos.get(i - 2); + infoRow = sheetInfo.getRow(i); + if (infoRow == null) { + infoRow = sheetInfo.createRow(i); + } + for (int j = 0; j < list.size(); j++) { + Cell cell = infoRow.getCell(j); + if (cell == null) { + cell = infoRow.createCell(j); + } + if (StringUtils.isNotEmpty(list.get(j))) { + cell.setCellValue(list.get(j)); + } + } + } + ByteArrayOutputStream byteo = null; + try { + byteo = new ByteArrayOutputStream(); + workbook.write(byteo); + return byteo.toByteArray(); + } catch (IOException e) { + return null; + } finally { + try { + byteo.close(); + } catch (IOException e) { + } + } + } + + public boolean createOSExcel(String filePath, List deviceEntityList) throws IOException { + File file = new File(filePath); + if (!file.exists()) { + file.createNewFile(); + } + try { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("IPConfig"); + sheet.setDefaultColumnWidth(20); + HSSFCellStyle cellStyle = workbook.createCellStyle(); + HSSFFont font = workbook.createFont(); + font.setColor(HSSFColor.WHITE.index); + font.setFontHeightInPoints((short) 13); + cellStyle.setFont(font); + cellStyle.setAlignment(HorizontalAlignment.CENTER); + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + cellStyle.setFillForegroundColor(HSSFColor.GREEN.index); + cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + HSSFCellStyle cellStyle1 = workbook.createCellStyle(); + cellStyle1.setAlignment(HorizontalAlignment.CENTER); + cellStyle1.setVerticalAlignment(VerticalAlignment.CENTER); + // 提示栏 + HSSFRow row = sheet.createRow(0); + row.setHeight((short) (40 * 20)); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 18)); + HSSFCell cell = row.createCell(0); + cell.setCellValue(Languages.getString("iboot.excel.os.tip")); + cell.setCellStyle(cellStyle1); + // 标题栏 + row = sheet.createRow(1); + row.setHeight((short) (20 * 20)); + createTitle(row, 2, cellStyle); + // 数据栏 + int index = 2; + for (DeviceEntity deviceEntity : deviceEntityList) { + row = sheet.createRow(index); + cell = row.createCell(0); + cell.setCellValue(deviceEntity.getDhcpIp()); + cell = row.createCell(1); + cell.setCellValue(deviceEntity.getSn()); + cell = row.createCell(2); + cell.setCellValue(""); + cell = row.createCell(3); + cell.setCellValue(""); + cell = row.createCell(4); + cell.setCellValue(""); + cell = row.createCell(5); + cell.setCellValue(""); + cell = row.createCell(6); + cell.setCellValue(""); + cell = row.createCell(7); + cell.setCellValue(""); + cell = row.createCell(8); + cell.setCellValue(""); + cell = row.createCell(9); + cell.setCellValue(""); + cell = row.createCell(10); + cell.setCellValue(""); + cell = row.createCell(11); + cell.setCellValue(""); + cell = row.createCell(12); + cell.setCellValue(""); + cell = row.createCell(13); + cell.setCellValue(""); + cell = row.createCell(14); + cell.setCellValue(""); + cell = row.createCell(15); + cell.setCellValue(""); + cell = row.createCell(16); + cell.setCellValue(""); + cell = row.createCell(17); + cell.setCellValue(""); + cell = row.createCell(18); + cell.setCellValue(""); + index++; + } + workbook.write(file); + } catch (Exception e) { + if (file.exists()) { + file.delete(); + } + return false; + } + return true; + } + + public boolean createBondExcel(String filePath, List deviceEntityList) throws IOException { + File file = new File(filePath); + if (!file.exists()) { + file.createNewFile(); + } + try { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("IPConfig"); + sheet.setDefaultColumnWidth(20); + HSSFCellStyle cellStyle = workbook.createCellStyle(); + HSSFFont font = workbook.createFont(); + font.setColor(HSSFColor.WHITE.index); + font.setFontHeightInPoints((short) 13); + cellStyle.setFont(font); + cellStyle.setAlignment(HorizontalAlignment.CENTER); + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + cellStyle.setFillForegroundColor(HSSFColor.GREEN.index); + cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + HSSFCellStyle cellStyle1 = workbook.createCellStyle(); + cellStyle1.setAlignment(HorizontalAlignment.CENTER); + cellStyle1.setVerticalAlignment(VerticalAlignment.CENTER); + // 提示栏 + HSSFRow row = sheet.createRow(0); + row.setHeight((short) (40 * 20)); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 5)); + HSSFCell cell = row.createCell(0); + cell.setCellValue(Languages.getString("iboot.excel.bond.tip")); + cell.setCellStyle(cellStyle1); + // 标题栏 + row = sheet.createRow(1); + row.setHeight((short) (20 * 20)); + createTitle(row, 3, cellStyle); + // 数据栏 + int index = 2; + for (DeviceEntity deviceEntity : deviceEntityList) { + row = sheet.createRow(index); + cell = row.createCell(0); + cell.setCellValue(deviceEntity.getDhcpIp()); + cell = row.createCell(1); + cell.setCellValue(deviceEntity.getSn()); + cell = row.createCell(2); + cell.setCellValue(""); + cell = row.createCell(3); + cell.setCellValue(""); + cell = row.createCell(4); + cell.setCellValue(""); + cell = row.createCell(5); + cell.setCellValue(""); + index++; + } + workbook.write(file); + } catch (Exception e) { + if (file.exists()) { + file.delete(); + } + return false; + } + return true; + } + + public boolean createBMCExcel(String filePath, List deviceEntityList) throws IOException { + File file = new File(filePath); + if (!file.exists()) { + file.createNewFile(); + } + try { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("NetConfig"); + sheet.setDefaultColumnWidth(20); + HSSFCellStyle cellStyle = workbook.createCellStyle(); + HSSFFont font = workbook.createFont(); + font.setColor(HSSFColor.WHITE.index); + font.setFontHeightInPoints((short) 13); + cellStyle.setFont(font); + cellStyle.setAlignment(HorizontalAlignment.CENTER); + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + cellStyle.setFillForegroundColor(HSSFColor.GREEN.index); + cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + HSSFCellStyle cellStyle1 = workbook.createCellStyle(); + cellStyle1.setAlignment(HorizontalAlignment.CENTER); + cellStyle1.setVerticalAlignment(VerticalAlignment.CENTER); + // 提示栏 + HSSFRow row = sheet.createRow(0); + row.setHeight((short) (40 * 20)); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 5)); + HSSFCell cell = row.createCell(0); + cell.setCellValue(Languages.getString("iboot.excel.net.tip")); + cell.setCellStyle(cellStyle1); + // 标题栏 + row = sheet.createRow(1); + row.setHeight((short) (20 * 20)); + createTitle(row, 1, cellStyle); + // 数据栏 + int index = 2; + for (DeviceEntity deviceEntity : deviceEntityList) { + row = sheet.createRow(index); + cell = row.createCell(0); + cell.setCellValue(deviceEntity.getDhcpIp()); + cell = row.createCell(1); + cell.setCellValue(deviceEntity.getSn()); + cell = row.createCell(2); + cell.setCellValue(""); + cell = row.createCell(3); + cell.setCellValue(""); + cell = row.createCell(4); + cell.setCellValue(""); + cell = row.createCell(5); + cell.setCellValue(""); + index++; + } + workbook.write(file); + } catch (Exception e) { + if (file.exists()) { + file.delete(); + } + return false; + } + return true; + } + + private void createTitle(HSSFRow row, int type, HSSFCellStyle cellStyle) { + final String lang = getLocale().toString(); + final String LANGUAGE_ZH_CN = "zh_CN"; + HSSFCell cell = row.createCell(0); + if (type == 1) { + if (LANGUAGE_ZH_CN.equals(lang)) { + cell.setCellValue("设备IP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue("设备SN"); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue("IP设置"); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue("子网掩码"); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue("网关"); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue("通道(1/8)"); + cell.setCellStyle(cellStyle); + } else { + cell.setCellValue("DeviceIP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue("DeviceSN"); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue("IPConfig"); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue("NetMask"); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue("Gateway"); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue("Channel(1/8)"); + cell.setCellStyle(cellStyle); + } + } else if (type == 2) { + if (LANGUAGE_ZH_CN.equals(lang)) { + cell.setCellValue("设备IP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue("设备SN"); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue("主机名"); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue("IP1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue("子网掩码1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue("网关1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(6); + cell.setCellValue("网口名1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(7); + cell.setCellValue("IP2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(8); + cell.setCellValue("子网掩码2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(9); + cell.setCellValue("网关2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(10); + cell.setCellValue("网口名2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(11); + cell.setCellValue("IP3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(12); + cell.setCellValue("子网掩码3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(13); + cell.setCellValue("网关3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(14); + cell.setCellValue("网口名3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(15); + cell.setCellValue("IP4"); + cell.setCellStyle(cellStyle); + cell = row.createCell(16); + cell.setCellValue("子网掩码4"); + cell.setCellStyle(cellStyle); + cell = row.createCell(17); + cell.setCellValue("网关4"); + cell.setCellStyle(cellStyle); + cell = row.createCell(18); + cell.setCellValue("网口名4"); + cell.setCellStyle(cellStyle); + } else { + cell.setCellValue("DeviceIP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue("DeviceSN"); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue("Hostname"); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue("IP1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue("Netmask1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue("Gateway1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(6); + cell.setCellValue("EthName1"); + cell.setCellStyle(cellStyle); + cell = row.createCell(7); + cell.setCellValue("IP2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(8); + cell.setCellValue("Netmask2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(9); + cell.setCellValue("Gateway2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(10); + cell.setCellValue("EthName2"); + cell.setCellStyle(cellStyle); + cell = row.createCell(11); + cell.setCellValue("IP3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(12); + cell.setCellValue("Netmask3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(13); + cell.setCellValue("Gateway3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(14); + cell.setCellValue("EthName3"); + cell.setCellStyle(cellStyle); + cell = row.createCell(15); + cell.setCellValue("IP4"); + cell.setCellStyle(cellStyle); + cell = row.createCell(16); + cell.setCellValue("Netmask4"); + cell.setCellStyle(cellStyle); + cell = row.createCell(17); + cell.setCellValue("Gateway4"); + cell.setCellStyle(cellStyle); + cell = row.createCell(18); + cell.setCellValue("EthName4"); + cell.setCellStyle(cellStyle); + } + } else if (type == 3) { + if (LANGUAGE_ZH_CN.equals(lang)) { + cell.setCellValue("设备IP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue("设备SN"); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue("主机名"); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue("Bond名"); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue("BondIP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue("Bond网关"); + cell.setCellStyle(cellStyle); + } else { + cell.setCellValue("DeviceIP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(1); + cell.setCellValue("DeviceSN"); + cell.setCellStyle(cellStyle); + cell = row.createCell(2); + cell.setCellValue("Hostname"); + cell.setCellStyle(cellStyle); + cell = row.createCell(3); + cell.setCellValue("BondName"); + cell.setCellStyle(cellStyle); + cell = row.createCell(4); + cell.setCellValue("BondIP"); + cell.setCellStyle(cellStyle); + cell = row.createCell(5); + cell.setCellValue("BondGateway"); + cell.setCellStyle(cellStyle); + } + } + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootFileUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootFileUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..6fa3c3e6ff9f74e1d55ba14896ff807de461cac9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootFileUtil.java @@ -0,0 +1,392 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootBondSetBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootIPSetBean; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; + +import java.io.*; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/11 + */ +@Slf4j +public class IBootFileUtil { + + /** + * 在指定目录下创建指定文件 + * + * @param newContent + * @param destPath + * @param name + * @return + */ + public static void createFile(String newContent, String destPath, String name) { + OutputStreamWriter osw = null; + String filePath = destPath + File.separator + name; + try { + File file = new File(filePath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + file.createNewFile(); + osw = new OutputStreamWriter(new FileOutputStream(filePath), "UTF-8"); + osw.write(newContent); + } catch (Exception e) { + log.error("fail to create file!\n" + newContent); + } finally { + if (null != osw) { + try { + osw.flush(); + } catch (IOException e) { + log.error("file flush exception:" + e); + } + } + if (null != osw) { + try { + osw.close(); + } catch (IOException e) { + log.error("file close exception:" + e); + } + } + } + } + + /** + * 读取文件内容 + * + * @param file + * @return + * @throws IOException + */ + public static String readFileStr(File file) throws IOException { + BufferedReader bufferedReader = null; + FileReader fileReader = null; + try { + fileReader = new FileReader(file); + bufferedReader = new BufferedReader(fileReader); + StringBuffer sb = new StringBuffer(); + String str = null; + while ((str = bufferedReader.readLine()) != null) { + sb.append(str).append("\r\n"); + } + return sb.toString(); + } finally { + if (fileReader != null) { + fileReader.close(); + } + if (bufferedReader != null) { + bufferedReader.close(); + } + } + } + + /** + * Java文件操作 获取文件扩展名 + */ + public static String getExtensionName(String filename) { + if (StringUtils.isNotEmpty(filename)) { + int dot = filename.lastIndexOf('.'); + if (dot != -1 && dot < (filename.length() - 1)) { + return filename.substring(dot + 1); + } + } + return ""; + } + + /** + * 实体类数据写入文件中 + * 实体类 + * + * @param fileName 文件名(带后缀) + * @param fileDir 文件夹路径,不包括文件名及后缀 + * @return + */ + public static String beanToFile(List iPSetBeans, String fileName, String fileDir) { + boolean bl = false; + try { + // 取得类中所有属性 + IBootIPSetBean iPSetBean = new IBootIPSetBean(); + Class clazz = iPSetBean.getClass(); + Field[] fields = clazz.getDeclaredFields(); + // 判断文件夹是否存在,不存在则创建 + File fileDir2 = new File(fileDir); + if (!fileDir2.exists()) { + fileDir2.mkdirs(); + } + // 文件 + File file = new File(fileDir, fileName); + // 需要封装的list + List list = new ArrayList(); + // header数组,用来设置数据字符串,使其一一按顺序对应 + String[] titles = null; + if (!file.exists()) {// 如果文件不存在,则创建文件并加header + file.createNewFile(); + // header字符串设置 + StringBuilder titleStr = new StringBuilder(); + for (int i = 0; i < fields.length; i++) { + if (i > 2) { + titleStr.append(" "); + } + if (i == 0 || i == 1) { + continue; + } else { + titleStr.append(fields[i].getName()); + } + } + list.add(titleStr.toString()); + titles = titleStr.toString().split(" "); + } else {// 如果文件存在,则覆盖原有数据 + // 读取文件第一行获得header + String firstLine = readFirstLine(file); + list.add(firstLine); + titles = firstLine.replace("\"", "").split(" "); + } + // 封装数据字符串,与header按顺序对于设置 + for (IBootIPSetBean iPSet : iPSetBeans) { + StringBuffer stringBuffer = new StringBuffer(""); + stringBuffer.append(iPSet.getSn()).append(" ").append(iPSet.getHostname()).append(" "); + iPSet.getOsIpList().forEach(osIp -> { + stringBuffer.append(osIp.getIp()).append(" ").append(osIp.getNetmask()).append(" ").append(osIp.getGateway()).append(" ").append(osIp.getNetInterface()).append(" "); + }); + list.add(stringBuffer.toString()); + } + bl = listToFile(list, file); + } catch (Exception e) { + log.error(e.getMessage()); + } + if (bl) { + return fileDir + File.separator + fileName; + } else { + return ""; + } + } + + /** + * Bond配置文件 + * + * @param bondSetBeans + * @param fileName + * @param fileDir + * @return + */ + public static String beanToFileForBond(List bondSetBeans, String fileName, String fileDir) { + boolean bl = false; + try { + // 取得类中所有属性 + IBootBondSetBean bondSetBean = new IBootBondSetBean(); + Class clazz = bondSetBean.getClass(); + Field[] fields = clazz.getDeclaredFields(); + // 判断文件夹是否存在,不存在则创建 + File fileDir2 = new File(fileDir); + if (!fileDir2.exists()) { + fileDir2.mkdirs(); + } + // 文件 + File file = new File(fileDir, fileName); + // 需要封装的list + List list = new ArrayList(); + // header数组,用来设置数据字符串,使其一一按顺序对应 + if (!file.exists()) {// 如果文件不存在,则创建文件并加header + file.createNewFile(); + // header字符串设置 + StringBuilder titleStr = new StringBuilder(); + for (int i = 0; i < fields.length; i++) { + if (i > 1) { + titleStr.append(" "); + } + if (i != 0) { + titleStr.append(fields[i].getName()); + } + } + list.add(titleStr.toString()); + } else {// 如果文件存在,则覆盖原有数据 + // 读取文件第一行获得header + String firstLine = readFirstLine(file); + list.add(firstLine); + } + // 封装数据字符串,与header按顺序对于设置 + for (IBootBondSetBean bondSet : bondSetBeans) { + StringBuffer stringBuffer = new StringBuffer(""); + stringBuffer.append(bondSet.getSn()).append(" ").append(bondSet.getBondName()).append(" ").append(bondSet.getBondIp()).append(" ").append(bondSet.getGateway()); + list.add(stringBuffer.toString()); + } + bl = listToFile(list, file); + } catch (Exception e) { + log.error(e.getMessage()); + } + if (bl) { + return fileDir + File.separator + fileName; + } else { + return ""; + } + } + + /** + * 读取文件第一行 + * + * @param file + * @return + */ + private static String readFirstLine(File file) { + String res = null; + InputStream is = null; + BufferedReader buffer = null; + InputStreamReader isr = null; + try { + is = new FileInputStream(file); + isr = new InputStreamReader(is, "UTF-8"); + buffer = new BufferedReader(isr); + res = buffer.readLine(); + } catch (Exception e) { + log.error(e.getMessage()); + } finally { + if (buffer != null) { + try { + buffer.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (isr != null) { + try { + isr.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + return res; + } + + /** + * list 写入文件 + * + * @param list + * @param file + * @return + */ + private static boolean listToFile(List list, File file) { + boolean bl = true; + Writer writer = null; + BufferedWriter buffer = null; + FileOutputStream fos = null; + try { + fos = new FileOutputStream(file.getPath()); + writer = new OutputStreamWriter(fos, "UTF-8"); + buffer = new BufferedWriter(writer); + if (list != null && !list.isEmpty()) { + for (String str : list) { + buffer.write(str); + buffer.newLine(); + } + } + } catch (Exception e) { + bl = false; + } finally { + if (buffer != null) { + try { + buffer.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (writer != null) { + try { + writer.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + return bl; + } + + public static void writeFile(String fileName, byte[] content) throws IOException { + File file = new File(FilenameUtils.normalize(fileName)); + File parent = file.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + BufferedOutputStream writer = null; + FileOutputStream fos = null; + try { + fos = new FileOutputStream(file); + writer = new BufferedOutputStream(fos); + writer.write(content); + writer.flush(); + } finally { + if (writer != null) { + writer.close(); + } + if (fos != null) { + fos.close(); + } + } + } + + public static void deleteFile(String path) { + File file = new File(FilenameUtils.normalize(path)); + if (file.isFile() && file.exists()) { + file.delete(); + } + } + + public static byte[] readFile(File file) throws IOException { + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + return readFile(fis); + } finally { + if (fis != null) { + fis.close(); + } + } + } + + public static byte[] readFile(InputStream fileInputStream) throws IOException { + ByteArrayOutputStream swapStream = null; + try { + if (fileInputStream == null) { + return null; + } + swapStream = new ByteArrayOutputStream(); + byte[] buff = new byte[1024]; + int rc = 0; + while ((rc = fileInputStream.read(buff, 0, 1024)) > 0) { + swapStream.write(buff, 0, rc); + } + fileInputStream.close(); + byte[] in2b = swapStream.toByteArray(); + return in2b; + } finally { + if (fileInputStream != null) { + fileInputStream.close(); + } + if (swapStream != null) { + swapStream.close(); + } + } + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootMacFileUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootMacFileUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..8815984ff64978d61833dae3696fd1373c83200b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootMacFileUtil.java @@ -0,0 +1,542 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import cn.hutool.core.io.FileUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.io.*; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; +import java.util.Properties; + +/** + * @author ryalii + * @version 1.0 + * @date 2020/9/13 11:35 + * @description + */ +@Slf4j +public class IBootMacFileUtil { + private static final String PROPERTY_FILE = "application.properties"; + + public static boolean isSymlink(File file) throws IOException { + if (file == null) + throw new NullPointerException("File must not be null"); + File canon; + if (file.getParent() == null) { + canon = file; + } else { + File canonDir = file.getParentFile().getCanonicalFile(); + canon = new File(canonDir, file.getName()); + } + return !canon.getCanonicalFile().equals(canon.getAbsoluteFile()); + } + + public static String read(String filePath) { + File file = new File(filePath); + if (!file.exists()) { + return ""; + } + String filepath = file.getAbsolutePath(); + //用来存放txt中的内容 + StringBuilder contents = new StringBuilder(); + try (FileReader reader = new FileReader(filepath); + BufferedReader br = new BufferedReader(reader);) { + String line; + while ((line = br.readLine()) != null) { + contents.append(line).append("\n"); + } + } catch (Exception e) { + return ""; + } + return contents.toString(); + } + + public static String readData(String filePath, String key) throws IOException { + Properties props = new Properties(); + InputStream in = null; + try { + in = new BufferedInputStream(new FileInputStream( + filePath)); + props.load(in); + String value = props.getProperty(key); + return value; + } catch (Exception e) { + return null; + } finally { + if (null != in) { + in.close(); + } + } + } + + /** + * 从MAC.ini文件里移除对应的设备pxe配置 + */ + public static synchronized boolean stringRemoveFromFile(String mac, String fileName) { + BufferedReader bReader = null; + try { + File file = new File(fileName); + bReader = new BufferedReader(new FileReader(file)); + StringBuffer content = new StringBuffer(); + String line; + boolean flag = true; + while ((line = bReader.readLine()) != null) { + if (line.equalsIgnoreCase(mac)) { + flag = false; + } + if (flag) { + content.append(line + "\n"); + } + if (line.isEmpty()) { + flag = true; + } + } + bReader.close(); + String str = content.toString(); + string2File(str, fileName); + return true; + } catch (IOException e) { + log.error("FileOperationUtil stringRemoveFromFile exception:" + e); + return false; + } finally { + try { + if (bReader != null) { + bReader.close(); + } + } catch (IOException e) { + log.error("FileOperationUtil stringRemoveFromFile finally exception:" + e); + } + } + } + + /** + * Java文件操作 获取文件扩展名 + */ + public static String getExtensionName(String filename) { + if (StringUtils.isNotEmpty(filename)) { + int dot = filename.lastIndexOf('.'); + if (dot != -1 && dot < (filename.length() - 1)) { + return filename.substring(dot + 1); + } + } + return ""; + } + + /** + * jar包根目录下的文件转成字符串 + * + * @param file + * @return + */ + public static String file2String(String file) { + InputStream is = null; + BufferedReader reader = null; + try { + StringBuffer buffer = new StringBuffer(); + is = IBootMacFileUtil.class.getResourceAsStream(file); + String line; + reader = new BufferedReader(new InputStreamReader(is)); + line = reader.readLine(); + while (line != null) { + buffer.append(line); + buffer.append("\n"); + line = reader.readLine(); + } + reader.close(); + is.close(); + return buffer.toString(); + } catch (IOException e) { + log.error("FileOperationUtil file2String exception:" + e); + return null; + } finally { + try { + if (is != null) { + is.close(); + } + if (reader != null) { + reader.close(); + } + } catch (IOException e) { + log.error("FileOperationUtil file2String finally exception:" + e); + } + } + } + + public static String fileToString(String filePath) { + FileInputStream fis = null; + BufferedReader reader = null; + try { + StringBuffer buffer = new StringBuffer(); + File file = new File(filePath); + fis = new FileInputStream(file); + String line; + reader = new BufferedReader(new InputStreamReader(fis)); + line = reader.readLine(); + while (line != null) { + buffer.append(line); + buffer.append("\n"); + line = reader.readLine(); + } + reader.close(); + fis.close(); + return buffer.toString(); + } catch (IOException e) { + log.error("FileOperationUtil file2String exception:" + e); + return null; + } finally { + try { + if (fis != null) { + fis.close(); + } + if (reader != null) { + reader.close(); + } + } catch (IOException e) { + log.error("FileOperationUtil file2String finally exception:" + e); + } + } + } + + public static boolean deleteFile(String filePath) { + try { + File file = new File(filePath); + if (file.exists() && file.isFile()) { + return file.delete(); + } else { + return false; + } + } catch (Exception e) { + log.error("FileOperationUtil deleteFile exception:" + e); + return false; + } + } + + /** + * 删除文件或文件夹 + * + * @param path + * @return + */ + public static boolean deleteDir(String path) { + String regex = "-[A-Za-z0-9]+\\.[a-z]+$"; + if (path.matches(regex)) { + File f = new File(path); + if (f.isDirectory()) { + String children[] = f.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(path + File.separator + children[i]); + if (!success) { + return false; + } + } + } + if (!f.exists()) { + return true; + } + return f.delete(); + } else { + return false; + } + } + + /** + * 获取运行环境中的文件转成字符串 + * + * @return + */ + public static String sysFile2String(String path) { + BufferedReader reader = null; + try { + reader = new BufferedReader(new FileReader(path)); + String line; + StringBuilder sb = new StringBuilder(); + while ((line = reader.readLine()) != null) { + sb.append(line); + sb.append("\n"); + } + return sb.toString(); + } catch (IOException e) { + log.error("FileOperationUtil sysFile2String exception:" + e); + return null; + } finally { + try { + if (reader != null) { + reader.close(); + } + } catch (IOException e) { + log.error("FileOperationUtil sysFile2String finally exception:" + e); + } + } + } + + /** + * 修改或添加键值对 如果key存在,修改 反之,添加。 + * + * @param key + * @param value + */ + public static void writeData(String filePath, String key, String value) throws IOException { + Properties prop = new Properties(); + OutputStream fos = null; + InputStream fis = null; + try { + File file = new File(filePath); + if (!file.exists()) + file.createNewFile(); + fis = new FileInputStream(file); + prop.load(fis); + fis.close();//一定要在修改值之前关闭fis + fos = new FileOutputStream(filePath); + prop.setProperty(key, value); + prop.store(fos, "Update '" + key + "' value"); + prop.store(fos, "admin user do it"); + + fos.close(); + } catch (IOException e) { + System.err.println("Visit " + filePath + " for updating " + + value + " value error"); + } finally { + if (null != fos) { + fos.close(); + } + if (null != fis) { + fis.close(); + } + } + } + + + public static void createFile(String pathWithFileName, String content) { + String regex = "-[A-Za-z0-9]+\\.[a-z]+$"; + FileWriter fw = null; + BufferedWriter bw = null; + if (pathWithFileName.matches(regex)) { + File file = new File(pathWithFileName); + try { + if (!file.exists()) { + file.createNewFile(); + } else { + file.delete(); + file.createNewFile(); + } + fw = new FileWriter(file, true); + bw = new BufferedWriter(fw); + bw.write(content); + bw.flush(); + } catch (Exception e) { + log.error(e.getMessage()); + } finally { + if (null != bw) { + try { + bw.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + if (null != fw) { + try { + fw.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + } + } + + /** + * 将字符串写入指定文件(当指定的父路径中文件夹不存在时,会最大限度去创建,以保证保存成功!). + * + * @param res 原字符串 + * @param filePath 文件路径 + * @return null + * @throws IOException + */ + public static synchronized boolean string2File(String res, String filePath) { + boolean flag = true; + BufferedReader bufferedReader = null; + BufferedWriter bufferedWriter = null; + FileLock lock = null; + try { + File distFile = new File(FileUtil.normalize(filePath)); + if (!distFile.getParentFile().exists()) { + distFile.getParentFile().mkdirs(); + } + FileChannel channel = new FileOutputStream(FileUtil.normalize(filePath)).getChannel(); + // 文件独占锁 + lock = channel.lock(); + bufferedReader = new BufferedReader(new StringReader(res)); + bufferedWriter = new BufferedWriter(new FileWriter(distFile)); + char[] buf = new char[1024]; // 字符缓冲区 + int len; + if (bufferedReader != null && bufferedWriter != null) { + while ((len = bufferedReader.read(buf)) != -1) { + bufferedWriter.write(buf, 0, len); + } + } + channel.close(); + } catch (IOException e) { + log.error("string2File exception : " + e); + flag = false; + return flag; + } finally { + try { + if (bufferedWriter != null) { + bufferedWriter.flush(); + bufferedReader.close(); + } + if (bufferedWriter != null) { + bufferedWriter.close(); + } + if (lock != null) { + lock.release(); + } + } catch (IOException e) { + log.error("string2File close exception : " + e); + } + } + return flag; + } + + + public static File getString2File(String content, String filePath) { + FileOutputStream fileOutputStream = null; + try { + File file = new File(filePath); + if (file.exists()) { + file.delete(); + } + file.createNewFile(); + fileOutputStream = new FileOutputStream(file); + String fileContent = new String(content); + if (fileOutputStream != null) { + fileOutputStream.write(fileContent.getBytes()); + } + return file; + } catch (Exception e) { + // TODO Auto-generated catch block + log.error("getString2File exception:" + e); + } finally { + try { + if (fileOutputStream != null) { + fileOutputStream.close(); + } + } catch (IOException e) { + log.error("getString2File close fileOutputStream exception:" + e); + } + } + return null; + } + + public static String readFileStr(File file) throws IOException { + BufferedReader bufferedReader = null; + FileReader fileReader = null; + try { + fileReader = new FileReader(file); + bufferedReader = new BufferedReader(fileReader); + StringBuffer sb = new StringBuffer(); + String str = null; + while ((str = bufferedReader.readLine()) != null) { + sb.append(str).append("\r\n"); + } + return sb.toString(); + } finally { + if (fileReader != null) { + fileReader.close(); + } + if (bufferedReader != null) { + bufferedReader.close(); + } + } + } + + public synchronized static boolean stringAddFile(String content, String fileName) { + FileWriter writer = null; + try { + writer = new FileWriter(fileName, true); + writer.write(content); + writer.close(); + return true; + } catch (IOException e) { + log.error("FileOperationUtil stringAddFile exception:" + e); + return false; + } finally { + try { + if (writer != null) { + writer.close(); + } + } catch (IOException e) { + log.error("FileOperationUtil stringAddFile finally exception:" + e); + } + } + } + + /** + * 获取${PROPERTY_FILE}里面的key对应的内容 + * + * @param key + * @return + */ + public static String getValue(String key) { + return getValue(PROPERTY_FILE, key, null); + } + + /** + * 获取资源文件里面的key对应的内容 + * + * @param propertiesFilePath + * @param key + * @return + */ + public static String getValue(String propertiesFilePath, String key) { + return getValue(propertiesFilePath, key, null); + } + + /** + * 获取资源文件里面的key对应的内容 + * + * @param propertiesFilePath + * @param key + * @return + */ + public static String getValue(String propertiesFilePath, String key, String encode) { + String value = null; + try { + Properties pros = getProperties(propertiesFilePath, encode); + value = pros.getProperty(key); + } catch (IOException e) { + log.error("PropertyUtil.getValue(String propertiesFilePath:" + propertiesFilePath + ",String key:" + key + + ") exception ,return null", e); + } + return value; + } + + private static Properties getProperties(String propertiesFilePath, String encode) + throws IOException { + Properties pros = new Properties(); + InputStream in = null; + InputStreamReader inputStreamReader = null; + try { + in = IBootMacFileUtil.class.getResourceAsStream("/" + propertiesFilePath); + if (StringUtils.isNotEmpty(encode)) { + inputStreamReader = new InputStreamReader(in, encode); + pros.load(inputStreamReader); + } else { + pros.load(in); + } + } finally { + if (null != inputStreamReader) { + inputStreamReader.close(); + } + if (in != null) { + try { + in.close(); + } catch (IOException e) { + log.error("PropertyUtil getProperties IOException:" + e.getMessage()); + } + } + } + return pros; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootMaintenanceCache.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootMaintenanceCache.java new file mode 100644 index 0000000000000000000000000000000000000000..3c19244873076c509cf2c82004ce81db88414028 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootMaintenanceCache.java @@ -0,0 +1,98 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; + +public class IBootMaintenanceCache { + /** + * 保存进行中的基线自动更新的任务设备资源ID + */ + public static final Cache BASELINERUNNING = CacheBuilder.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).build(); + /** + * 暂存升级流程http请求过程参数. + */ + public static final ConcurrentMap> PARAMLIST = new ConcurrentHashMap>(); + /** + * 保存固件升级结果的缓存. + */ + public static final ConcurrentMap> FIRMUPRESULT = new ConcurrentHashMap>(); + /** + * 获取进度接口. + */ + public static final ConcurrentMap BIOSGETPROCESS = new ConcurrentHashMap(); + /** + * 保存BMC配置结果的缓存. + */ + public static final ConcurrentMap> BMCRESULT = new ConcurrentHashMap>(); + /** + * 保存BIOS配置结果的缓存. + */ + public static final ConcurrentMap> BIOSRESULT = new ConcurrentHashMap>(); + /** + * 操作系统安装结果缓存. + */ + public static final ConcurrentMap> OSINSTALLRESULT = new ConcurrentHashMap>(); + /** + * liveCD镜像制作. + */ + public static final ConcurrentMap> LIVECDCREATERESULT = new ConcurrentHashMap<>(); + /** + * liveCD配置Raid. + */ + public static final ConcurrentMap> LIVECDRAIDRESULT = new ConcurrentHashMap<>(); + /** + * bmc获取进度接口. + */ + public static final ConcurrentMap BMCGETPROCESS = new ConcurrentHashMap(); + /** + * 镜像文件上传flag. + */ + public static final ConcurrentMap IMAGEUPLOADFLAG = new ConcurrentHashMap(); + /** + * bios取消升级 + */ + public static final ConcurrentMap BIOSCANCELUPDATE = new ConcurrentHashMap(); + /** + * key:resourceID value:自动更新参数 + */ + public static ConcurrentMap BaselineAutoUpdate = new ConcurrentHashMap(); + /** + * 基线任务状态 key:resourceId value:taskId + */ + public static ConcurrentMap BaselineAutoUpdateTaskInfo = new ConcurrentHashMap(); + /** + * + */ + public static ConcurrentMap POWERRESULT = new ConcurrentHashMap(); + /** + * 软件安装任务状态缓存 + */ + public static ConcurrentMap SoftwareInstallTaskInfo = new ConcurrentHashMap(); + + + /** + * 构造函数. + */ + private IBootMaintenanceCache() { + } + + /** + * 清空缓存. + */ + public static void cleanCache() { + IBootMaintenanceCache.PARAMLIST.clear(); + IBootMaintenanceCache.FIRMUPRESULT.clear(); + IBootMaintenanceCache.BIOSGETPROCESS.clear(); + IBootMaintenanceCache.BMCRESULT.clear(); + IBootMaintenanceCache.BIOSRESULT.clear(); + IBootMaintenanceCache.BIOSCANCELUPDATE.clear(); + IBootMaintenanceCache.POWERRESULT.clear(); + IBootMaintenanceCache.SoftwareInstallTaskInfo.clear(); + } + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootPathConstant.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootPathConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..d09bc43a19bb020d8a701c244634399623143d16 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/IBootPathConstant.java @@ -0,0 +1,151 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import cn.hutool.core.bean.BeanUtil; +import com.inspur.cdc.commons.lang.deployUtil.bean.PimDeployBean; +import com.inspur.cdc.commons.lang.deployUtil.utils.PimDeployUtil; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; + + +public class IBootPathConstant { + + public static String nfsPath = PimDeployUtil.getFullInstallPath() + File.separator + "data" + File.separator; + public static String ibootBasePath = nfsPath + "iboot" + File.separator; + public static String ibootWindowsBatPath = ibootBasePath + "init" + File.separator + "windows" + File.separator + "bat" + File.separator; + public static String TaskTmpPath = ibootBasePath + "task" + File.separator; + public static String RaidConfigToolPath = ibootBasePath + "templateCreate" + File.separator + "raidConfig" + File.separator + "iboot_tool"; + /** + * 系统安装镜像存储地址 + */ + public static String OsPath = ibootBasePath + "os_install"; + /** + * 带内文件存储地址 + */ + public static String InbandFile = ibootBasePath + "repo" + File.separator + "inband"; + /** + * 磁盘克隆镜像存储地址 + */ + public static String ImageFile = ibootBasePath + "images"; + /** + * 任务脚本所需模板目录 + */ + public static String TemplateFile = ibootBasePath + "templateCreate"; + /** + * 压力测试 + */ + public static String StressTestFile = TemplateFile + File.separator + "stressTest"; + + + /*** + * 安装操作系统ks模板文件地址 + */ + + /**************************Mr.G专属区域开始 ***********************/ + /** + * 自定义模板 + */ + public static String CustomTemplateFile = TemplateFile + File.separator + "customTemplate"; + /** + * raid配置 + */ + public static String RaidConfigFile = TemplateFile + File.separator + "raidConfig"; + /** + * 用户配置 + */ + public static String UserConfigFile = TemplateFile + File.separator + "userConfig"; + /** + * 网络配置 + */ + public static String NetworkConfigFile = TemplateFile + File.separator + "netConfig"; + /** + * 磁盘克隆 + */ + public static final String DISK_CLONE_FILE = TemplateFile + File.separator + "diskClone"; + public static final String STRSS_TEMPLATE_ZH = ibootBasePath + "excel" + File.separator + "collectSample.xlsx"; + public static final String STRSS_TEMPLATE_EN = ibootBasePath + "excel" + File.separator + "collectSampleEn.xlsx"; + public static String webserviceBasePath = nfsPath + "webservice" + File.separator; + public static String NginxPushPath = webserviceBasePath; + /** + * 业务ip + */ + public static String dhcpIpFile = NginxPushPath + "dhcpip"; + public static String webServerIpFile = NginxPushPath + "webserverip"; + /** + * 系统安装 + */ + public static String OsInstallFile = NginxPushPath + "osInstall"; + /** + * ks模板目录 + */ + public static String KsTemplateFile = OsInstallFile + File.separator + "ks"; + public static String IBootKsExamplePathDefault = KsTemplateFile + File.separator + "ks_example.cfg"; + /** + * kylin模板目录 + */ + public static String KylinTemplateFile = OsInstallFile + File.separator + "ks" + File.separator + "kylin"; + public static String IBootKylinExamplePathDefault = KylinTemplateFile + File.separator + "kylin_example.cfg"; + /** + * esxi模板目录 + */ + public static String EsxiTemplateFile = OsInstallFile + File.separator + "ks" + File.separator + "esxi"; + public static String IBootEsxiExamplePathDefault = EsxiTemplateFile + File.separator + "esxi_example.cfg"; + /** + * uos模板目录 + */ + public static String UosTemplateFile = OsInstallFile + File.separator + "ks" + File.separator + "uos"; + public static String IBootUosExamplePathDefault = UosTemplateFile + File.separator + "setting_example.ini"; + /** + * Suse模板目录 + */ + public static String SuseTemplateFile = OsInstallFile + File.separator + "ks" + File.separator + "suse"; + public static String IBootSuseExamplePathDefault = SuseTemplateFile + File.separator + "autoinst_example.xml"; + /** + * Suse15模板目录 + */ + public static String Suse15TemplateFile = OsInstallFile + File.separator + "ks" + File.separator + "suse15"; + public static String IBootSuse15ExamplePathDefault = Suse15TemplateFile + File.separator + "autoinst_example.xml"; + /** + * windowsks模板目录 + */ + public static String WindowsKsTemplateFile = OsInstallFile + File.separator + "ks" + File.separator + "windows" + File.separator + "sn-example"; + /** + * 镜像mount目录 + */ + public static String MountImageFile = OsInstallFile + File.separator + "mount"; + /** + * Bond文件目录 + */ + public static String IBootBondFile = OsInstallFile + File.separator + "bond" + File.separator; + /** + * MAC.INI文件 + */ + public static String MacIniFile = NginxPushPath + "MAC.ini"; + public static String IPMI_TOOL_WINDOWS = webserviceBasePath + "windowstool" + File.separator + "ipmitool" + File.separator + "ipmitool.exe"; + /** + * 上传分片临时目录 + */ + public static String OstmpPath = nfsPath + File.separator + "control" + File.separator + "upload" + File.separator + "tmp"; + public static String InRootFile = File.separator + "oem" + File.separator + "hooks" + File.separator + "in_chroot" + File.separator; + public static String AfterRootFile = File.separator + "oem" + File.separator + "hooks" + File.separator + "after_chroot" + File.separator; + /** + * Samba挂载点 + */ + public static String MountImageFileSamba = File.separator + "usr" + File.separator + "local" + File.separator +"samba"+File.separator+ "image"; + + public static String getIBootPort() { + PimDeployBean deployBean = PimDeployUtil.get(); + if (BeanUtil.isNotEmpty(deployBean) && StringUtils.isNotEmpty(deployBean.getInmanageInstallMode())) { + if (deployBean.getInmanageInstallMode().equalsIgnoreCase("cloud")) { + return "32411"; + } else { + return "30100"; + } + } else { + return "30100"; + } + } + + /**************************Mr.G专属区域结束 ***********************/ + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/InbandPathUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/InbandPathUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..a293c7f9b1d4fd16967f6a95be2bedfd01c59206 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/InbandPathUtil.java @@ -0,0 +1,49 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.io.FilenameUtils; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; + +/** + * @author zhangshuai17 + * @date 2023/4/12 + * @description 带内文件分析工具类 + */ +public class InbandPathUtil { + + private static ObjectMapper objectMapper = new ObjectMapper(); + + /** + * 删除文件或目录 + * + * @param filePath + */ + public static void deleteFile(String filePath) throws IOException { + File file = new File(FilenameUtils.normalize(filePath)); + if (!file.exists()) { + throw new FileNotFoundException(String.format("File not exists: %s", filePath)); + } + Files.walkFileTree(Paths.get(FilenameUtils.normalize(filePath)), new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + Files.delete(dir); + return FileVisitResult.CONTINUE; + } + }); + } + + public static void main(String[] args) throws IOException { + System.out.println(3); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/MagicNumber.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/MagicNumber.java new file mode 100644 index 0000000000000000000000000000000000000000..df1f647da43f00484634b5596c6e2b20c9710bd2 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/MagicNumber.java @@ -0,0 +1,507 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +public class MagicNumber { + + /** + * 十分钟对应秒数. + */ + public static final int MAGIC_TEN_MINUTE = 10 * 60; + /** + * 一小时对应秒数. + */ + public static final int MAGIC_ONE_HOUR = 60 * 60; + /** + * 一天对应秒数. + */ + public static final int MAGIC_ONE_DAY_MINUTE = 24 * 60 * 60; + /** + * 时间转换. + */ + public static final int TIMETRANS = 1000; + /** + * 整型数字0. + */ + public static final int MAGIC_ZERO = 0; + //魔法数字 + /** + * 整型数字1. + */ + public static final int MAGIC_ONE = 1; + /** + * 整型数字2. + */ + public static final int MAGIC_TWO = 2; + /** + * 整型数字3. + */ + public static final int MAGIC_THREE = 3; + /** + * 整型数字4. + */ + public static final int MAGIC_FOUR = 4; + /** + * 整型数字5. + */ + public static final int MAGIC_FIVE = 5; + /** + * 整型数字6. + */ + public static final int MAGIC_SIX = 6; + /** + * 整型数字7. + */ + public static final int MAGIC_SEVEN = 7; + /** + * 整型数字8. + */ + public static final int MAGIC_EIGHT = 8; + /** + * 整型数字9. + */ + public static final int MAGIC_NINE = 9; + /** + * 整型数字10. + */ + public static final int MAGIC_TEN = 10; + /** + * 整型数字11. + */ + public static final int MAGIC_ELEVEN = 11; + /** + * 整型数字12. + */ + public static final int MAGIC_TWELVE = 12; + /** + * 整型数字13. + */ + public static final int MAGIC_THIRTEEN = 13; + /** + * 整型数字14. + */ + public static final int MAGIC_FOURTEEN = 14; + /** + * 整型数字15. + */ + public static final int MAGIC_FIFTEEN = 15; + /** + * 整型数字0. + */ + public static final int M0 = 0; + /** + * 整型数字1. + */ + public static final int M1 = 1; + /** + * 整型数字2. + */ + public static final int M2 = 2; + /** + * 整型数字3. + */ + public static final int M3 = 3; + /** + * 整型数字4. + */ + public static final int M4 = 4; + /** + * 整型数字5. + */ + public static final int M5 = 5; + /** + * 整型数字6. + */ + public static final int M6 = 6; + /** + * 整型数字7. + */ + public static final int M7 = 7; + /** + * 整型数字8. + */ + public static final int M8 = 8; + /** + * 整型数字9. + */ + public static final int M9 = 9; + /** + * 整型数字10. + */ + public static final int M10 = 10; + /** + * 整型数字11. + */ + public static final int M11 = 11; + /** + * 整型数字12. + */ + public static final int M12 = 12; + /** + * 整型数字13. + */ + public static final int M13 = 13; + /** + * 整型数字14. + */ + public static final int M14 = 14; + /** + * 整型数字15. + */ + public static final int M15 = 15; + /** + * 整型数字16. + */ + public static final int M16 = 16; + /** + * 整型数字17. + */ + public static final int M17 = 17; + /** + * 整型数字18. + */ + public static final int M18 = 18; + /** + * 整型数字19. + */ + public static final int M19 = 19; + /** + * 整型数字20. + */ + public static final int M20 = 20; + /** + * 整型数字21. + */ + public static final int M21 = 21; + /** + * 整型数字22. + */ + public static final int M22 = 22; + /** + * 整型数字23. + */ + public static final int M23 = 23; + /** + * 整型数字24. + */ + public static final int M24 = 24; + /** + * 整型数字25. + */ + public static final int M25 = 25; + /** + * 整型数字26. + */ + public static final int M26 = 26; + /** + * 整型数字27. + */ + public static final int M27 = 27; + /** + * 整型数字28. + */ + public static final int M28 = 28; + /** + * 整型数字29. + */ + public static final int M29 = 29; + /** + * 整型数字30. + */ + public static final int M30 = 30; + /** + * 整型数字31. + */ + public static final int M31 = 31; + /** + * 整型数字32. + */ + public static final int M32 = 32; + /** + * 整型数字33. + */ + public static final int M33 = 33; + /** + * 整型数字34. + */ + public static final int M34 = 34; + /** + * 整型数字35. + */ + public static final int M35 = 35; + /** + * 整型数字36. + */ + public static final int M36 = 36; + /** + * 整型数字37. + */ + public static final int M37 = 37; + /** + * 整型数字38. + */ + public static final int M38 = 38; + /** + * 整型数字39. + */ + public static final int M39 = 39; + /** + * 整型数字40. + */ + public static final int M40 = 40; + /** + * 整型数字41. + */ + public static final int M41 = 41; + /** + * 整型数字42. + */ + public static final int M42 = 42; + /** + * 整型数字43. + */ + public static final int M43 = 43; + /** + * 整型数字44. + */ + public static final int M44 = 44; + /** + * 整型数字45. + */ + public static final int M45 = 45; + /** + * 整型数字46. + */ + public static final int M46 = 46; + /** + * 整型数字47. + */ + public static final int M47 = 47; + /** + * 整型数字48. + */ + public static final int M48 = 48; + /** + * 整型数字49. + */ + public static final int M49 = 49; + /** + * 整型数字50. + */ + public static final int M50 = 50; + /** + * 整型数字51. + */ + public static final int M51 = 51; + /** + * 整型数字52. + */ + public static final int M52 = 52; + /** + * 整型数字53. + */ + public static final int M53 = 53; + /** + * 整型数字54. + */ + public static final int M54 = 54; + /** + * 整型数字55. + */ + public static final int M55 = 55; + /** + * 整型数字56. + */ + public static final int M56 = 56; + /** + * 整型数字57. + */ + public static final int M57 = 57; + /** + * 整型数字58. + */ + public static final int M58 = 58; + /** + * 整型数字59. + */ + public static final int M59 = 59; + /** + * 整型数字60. + */ + public static final int M60 = 60; + /** + * 整型数字61. + */ + public static final int M61 = 61; + /** + * 整型数字62. + */ + public static final int M62 = 62; + /** + * 整型数字66. + */ + public static final int M66 = 66; + /** + * 整型数字80. + */ + public static final int M80 = 80; + /** + * 整型数字100. + */ + public static final int M100 = 100; + /** + * 整型数字111. + */ + public static final int M111 = 111; + /** + * 整型数字115. + */ + public static final int M115 = 115; + /** + * 整型数字120. + */ + public static final int M120 = 120; + /** + * 整型数字161. + */ + public static final int M161 = 161; + /** + * 整型数字191. + */ + public static final int M191 = 191; + /** + * 整型数字240. + */ + public static final int M240 = 240; + /** + * 整型数字1900. + */ + public static final int M1900 = 1900; + /** + * 整型数字1024. + */ + public static final int M1024 = 1024; + /** + * 5000. + */ + public static final int FIVE_THOUSAND = 5000; + /** + * 65535. + */ + public static final int M65535 = 65535; + /** + * 255. + */ + public static final int M255 = 255; + /** + * 256. + */ + public static final int M256 = 256; + /** + * 128. + */ + public static final int M128 = 128; + /** + * 整型数字192. + */ + public static final int M192 = 192; + /** + * 整型数字223. + */ + public static final int M223 = 223; + /** + * 整型数字224. + */ + public static final int M224 = 224; + /** + * 整型数字400. + */ + public static final int M400 = 400; + /** + * 整型数字1000. + */ + public static final int M1000 = 1000; + /** + * 10000. + */ + public static final int M10000 = 10000; + /** + * 3600. + */ + public static final int M3600 = 3600; + /** + * 365. + */ + public static final int M365 = 365; + /** + * 172800. + */ + public static final int M172800 = 172800; + /** + * 86400. + */ + public static final int M86400 = 86400; + /** + * 538. + */ + public static final int M538 = 538; + /** + * 999. + */ + public static final int M999 = 999; + /** + * 0.8. + */ + public static final float M08 = 0.80f; + /** + * 0.2. + */ + public static final float M02 = 0.20f; + /** + * 0.001. + */ + public static final float M0001 = 0.001f; + /** + * 0.6. + */ + public static final float M06 = 0.60f; + /** + * 10f. + */ + public static final float M10F = 10f; + /** + * 20f. + */ + public static final float M20F = 20f; + /** + * 32f. + */ + public static final float M32F = 32f; + /** + * 30f. + */ + public static final float M30F = 30f; + /** + * 1100. + */ + public static final int M1100 = 1100; + /** + * 8192. + */ + public static final int M8192 = 8192; + /** + * 90f. + */ + public static final float M90F = 90f; + /** + * 90f. + */ + public static final float M100F = 100f; + /** + * 43200. + */ + public static final int M43200 = 43200; + /** + * 私有构造函数. + */ + private MagicNumber() { + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/ReplaceUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/ReplaceUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..464e3016b26be8c99761dbcc94fdcc9664d32c16 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-api/src/main/java/com/inspur/ispim/cosmos/iboot/base/api/util/ReplaceUtil.java @@ -0,0 +1,104 @@ +package com.inspur.ispim.cosmos.iboot.base.api.util; + +import cn.hutool.core.io.FileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import lombok.extern.slf4j.Slf4j; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; + +/** + * @author :zhangchen + * @date :Created in 2023/8/10 15:41 + */ +@Slf4j +public class ReplaceUtil { + /** + * 替换文件流的关键字 + * + * @param filePath + * @param replaceBeanList + */ + public static void autoReplace(String filePath, List replaceBeanList) { + File file = new File(filePath); + Long fileLength = file.length(); + byte[] fileContext = new byte[fileLength.intValue()]; + FileInputStream in = null; + PrintWriter out = null; + try { + in = new FileInputStream(filePath); + in.read(fileContext); + // 避免出现中文乱码 + String str = new String(fileContext, "utf-8"); + for (ReplaceBean replaceBean : replaceBeanList) { + str = str.replace(replaceBean.getOldStr(), replaceBean.getNewStr()); + } + out = new PrintWriter(filePath); + // 将linux文件转成utf-8格式 + out.write(str); + } catch (IOException e) { + log.error("Update file error:" + e.getMessage()); + } finally { + try { + if (null != out) { + out.flush(); + out.close(); + } + if (null != in) { + in.close(); + } + } catch (IOException e) { + log.error("Update file error:" + e.getMessage()); + } + } + } + + /** + * 替换文件流的关键字 + * + * @param filePath + * @param replaceBeanList + */ + public static void autoReplaceNew(String filePath, String newPath, List replaceBeanList) { + File file = new File(FileUtil.normalize(filePath)); + File newFile = new File(FileUtil.normalize(newPath)); + Long fileLength = file.length(); + byte[] fileContext = new byte[fileLength.intValue()]; + FileInputStream in = null; + PrintWriter out = null; + try { + if (!newFile.getParentFile().exists()) { + newFile.getParentFile().mkdirs(); + } + newFile.createNewFile(); + in = new FileInputStream(filePath); + in.read(fileContext); + // 避免出现中文乱码 + String str = new String(fileContext, "utf-8"); + for (ReplaceBean replaceBean : replaceBeanList) { + str = str.replace(replaceBean.getOldStr(), replaceBean.getNewStr()); + } + out = new PrintWriter(newPath); + // 将linux文件转成utf-8格式 + out.write(str); + } catch (IOException e) { + log.error("Update file error:" + e.getMessage()); + } finally { + try { + if (null != out) { + out.flush(); + out.close(); + } + if (null != in) { + in.close(); + } + } catch (IOException e) { + log.error("Update file error:" + e.getMessage()); + } + } + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/pom.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..547512cc51394e8a4a2408c5fc5d69f3615c80eb --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/pom.xml @@ -0,0 +1,155 @@ + + + + cosmos-biz-iboot-base + com.inspur.cosmos.biz.iboot.base + ${revision} + + 4.0.0 + cosmos-biz-iboot-base-application + Cosmos Biz Iboot Base Application + + + org.springframework.boot + spring-boot-starter-actuator + + + logback-classic + ch.qos.logback + + + + + com.baomidou + mybatis-plus-boot-starter + 3.5.3 + + + org.slf4j + slf4j-api + + + com.inspur.cdc.commons + cdc-commons-flyway + + + com.inspur.cosmos.biz.iboot.base + cosmos-biz-iboot-base-api + + + com.inspur.cosmos.biz.iboot.base + cosmos-biz-iboot-base-core + + + ch.qos.logback + logback-classic + compile + + + logback-core + ch.qos.logback + + + + + ch.qos.logback + logback-core + + + org.springframework.boot + spring-boot-test + test + + + com.alibaba + druid + 1.2.18 + + + mysql + mysql-connector-java + 8.0.27 + + + org.springframework.security + spring-security-core + + + org.springframework.boot + spring-boot-starter-security + + + com.github.ulisesbocchio + jasypt-spring-boot + + + io.jsonwebtoken + jjwt + + + org.jboss.spec.javax.xml.bind + jboss-jaxb-api_2.3_spec + 1.0.1.Final + + + + + + + thinjar + + true + + + + + org.springframework.boot + spring-boot-maven-plugin + 3.1.2 + + + org.springframework + springloaded + 1.2.6.RELEASE + + + + + + repackage + + + + + ZIP + + + org.github.bean-manes.caffeine + caffeine + + + none + none + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + java.base/java.lang + + + + + + + + + \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/IBootApplication.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/IBootApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..1e98d6029a0daa222e95e906cc6b94ddef7543c6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/IBootApplication.java @@ -0,0 +1,28 @@ +package com.inspur.ispim.cosmos.iboot.base.application; + +import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + *

Iboot独立部署服务启动类

+ * + * @date 2021/11/25 17:26 + */ +@SpringBootApplication(exclude = {LdapAutoConfiguration.class}) +@ComponentScan({"com.inspur.ispim"}) +@EnableEncryptableProperties +@EnableScheduling +@Slf4j +public class IBootApplication implements WebMvcConfigurer { + + public static void main(String[] args) { + SpringApplication.run(IBootApplication.class, args); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/BaseEntity.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/BaseEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..591283395d2f4591512adf625109878bc74547e5 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/BaseEntity.java @@ -0,0 +1,40 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.bean; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +@Data +public class BaseEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + private Long createUser; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.UPDATE) + private Long updateUser; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/BaseParam.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/BaseParam.java new file mode 100644 index 0000000000000000000000000000000000000000..ad76bd62b05e9678acca4a708b3b87f1cb8d48e8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/BaseParam.java @@ -0,0 +1,112 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.bean; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +@Data +public class BaseParam implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 搜索值 + */ + private String searchValue; + + /** + * 数据权限 + */ + private List dataScope; + + /** + * 开始时间 + */ + private String searchBeginTime; + + /** + * 结束时间 + */ + private String searchEndTime; + + /** + * 参数校验分组:增加 + */ + public @interface add { + } + + /** + * 参数校验分组:编辑 + */ + public @interface edit { + } + + /** + * 参数校验分组:更新信息 + */ + public @interface updateInfo { + } + + /** + * 参数校验分组:修改密码 + */ + public @interface updatePwd { + } + + /** + * 参数校验分组:重置密码 + */ + public @interface resetPwd { + } + + /** + * 参数校验分组:修改头像 + */ + public @interface updateAvatar { + } + + /** + * 参数校验分组:删除 + */ + public @interface delete { + } + + /** + * 参数校验分组:详情 + */ + public @interface detail { + } + + /** + * 参数校验分组:授权角色 + */ + public @interface grantRole { + } + + /** + * 参数校验分组:授权数据 + */ + public @interface grantData { + } + + /** + * 参数校验分组:停用 + */ + public @interface stop { + } + + /** + * 参数校验分组:启用 + */ + public @interface start { + } + + /** + * 参数校验分组:修改状态 + */ + public @interface changeStatus { + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/ErrorResponseData.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/ErrorResponseData.java new file mode 100644 index 0000000000000000000000000000000000000000..b44e4497a740e2f8a3c50b679e341e1faddc5ef4 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/ErrorResponseData.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.bean; + +import lombok.Data; +import lombok.EqualsAndHashCode; + + +@EqualsAndHashCode(callSuper = true) +@Data +public class ErrorResponseData extends ResponseData { + + /** + * 异常的具体类名称 + */ + private String exceptionClazz; + + public ErrorResponseData(Integer code, String message) { + super(false, code, message, null); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/JwtPayLoad.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/JwtPayLoad.java new file mode 100644 index 0000000000000000000000000000000000000000..1b9671deb33f0787e380142056a4fd157663707a --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/JwtPayLoad.java @@ -0,0 +1,33 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.bean; + +import cn.hutool.core.util.IdUtil; +import lombok.Data; + + +@Data +public class JwtPayLoad { + + /** + * 用户id + */ + private Long userId; + + /** + * 账号 + */ + private String account; + + /** + * 唯一表示id, 用于缓存登录用户的唯一凭证 + */ + private String uuid; + + public JwtPayLoad() { + } + + public JwtPayLoad(Long userId, String account) { + this.userId = userId; + this.account = account; + this.uuid = IdUtil.fastUUID(); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/ResponseData.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/ResponseData.java new file mode 100644 index 0000000000000000000000000000000000000000..ad49acd1e6bdea661b7d01b2a709feef618e07ca --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/ResponseData.java @@ -0,0 +1,47 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.bean; + +import lombok.Data; + + +@Data +public class ResponseData { + + public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功"; + + public static final String DEFAULT_ERROR_MESSAGE = "网络异常"; + + public static final Integer DEFAULT_SUCCESS_CODE = 0; + + public static final Integer DEFAULT_ERROR_CODE = 500; + + /** + * 请求是否成功 + */ + private Boolean success; + + /** + * 响应状态码 + */ + private Integer code; + + /** + * 响应信息 + */ + private String message; + + /** + * 响应对象 + */ + private T data; + + public ResponseData() { + } + + public ResponseData(Boolean success, Integer code, String message, T data) { + this.success = success; + this.code = code; + this.message = message; + this.data = data; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/SuccessResponseData.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/SuccessResponseData.java new file mode 100644 index 0000000000000000000000000000000000000000..8d399d6407e186d4482042ea3bf9c042b2a43584 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/SuccessResponseData.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.bean; + + +public class SuccessResponseData extends ResponseData { + + public SuccessResponseData() { + super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, null); + } + + public SuccessResponseData(T object) { + super(true, DEFAULT_SUCCESS_CODE, DEFAULT_SUCCESS_MESSAGE, object); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/SysLoginUser.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/SysLoginUser.java new file mode 100644 index 0000000000000000000000000000000000000000..b17749abd0fc249e3d2c23e8c7bb7aeeec5e314e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/bean/SysLoginUser.java @@ -0,0 +1,171 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.bean; + +import cn.hutool.core.lang.Dict; +import lombok.Data; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import java.io.Serializable; +import java.util.Collection; +import java.util.Date; +import java.util.List; + + +@Data +public class SysLoginUser implements UserDetails, Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private Long id; + + /** + * 账号 + */ + private String account; + + /** + * 昵称 + */ + private String nickName; + + /** + * 姓名 + */ + private String name; + + /** + * 头像 + */ + private String avatar; + + /** + * 生日 + */ + private Date birthday; + + /** + * 性别(字典 1男 2女) + */ + private Integer sex; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机 + */ + private String phone; + + /** + * 电话 + */ + private String tel; + + /** + * 管理员类型(0超级管理员 1非管理员) + */ + private Integer adminType; + + /** + * 最后登陆IP + */ + private String lastLoginIp; + + /** + * 最后登陆时间 + */ + private String lastLoginTime; + + /** + * 最后登陆地址 + */ + private String lastLoginAddress; + + /** + * 最后登陆所用浏览器 + */ + private String lastLoginBrowser; + + /** + * 最后登陆所用系统 + */ + private String lastLoginOs; + + /** + * 具备应用信息 + */ + private List apps; + + /** + * 角色信息 + */ + private List roles; + + /** + * 权限信息 + */ + private List permissions; + + /** + * 数据范围信息 + */ + private List dataScopes; + + /** + * 租户信息 + */ + private Dict tenants; + + /** + * 客服对接,数据来源 01本地02客服系统 + */ + private String sourceType; + + @Override + public Collection getAuthorities() { + return null; + } + + /** + * 角色名称集合 + */ + + @Override + public String getPassword() { + return null; + } + + @Override + public String getUsername() { + return this.account; + } + + @Override + public boolean isAccountNonExpired() { + //能生成loginUser就是jwt解析成功,没锁定 + return true; + } + + @Override + public boolean isAccountNonLocked() { + //能生成loginUser就是jwt解析成功,没锁定 + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + //能生成loginUser就是jwt解析成功,没锁定 + return true; + } + + @Override + public boolean isEnabled() { + //能生成loginUser就是jwt解析成功,没锁定 + return true; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/controller/SysLoginController.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/controller/SysLoginController.java new file mode 100644 index 0000000000000000000000000000000000000000..633b1bb9beb9ad10d4db86a89cf7568395c91eac --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/controller/SysLoginController.java @@ -0,0 +1,44 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.controller; + +import cn.hutool.core.lang.Dict; +import cn.hutool.core.util.StrUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.ResponseData; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SuccessResponseData; +import com.inspur.ispim.cosmos.iboot.base.application.auth.service.AuthService; +import jakarta.annotation.Resource; +import org.springframework.web.bind.annotation.*; + + +@RestController +public class SysLoginController { + + @Resource + private AuthService authService; + + @PostMapping("/iboot/sys/login") + public ResponseData sysLogin(@RequestBody Dict dict, @RequestHeader(value = "Cert-Subject", required = false) String subject) { + boolean certAuth = false; + String account = dict.getStr("account"); + String password = dict.getStr("password"); + if (StrUtil.isNotEmpty(subject) && StrUtil.isNotEmpty(account) && StrUtil.isEmpty(password)) { + String[] subjects = subject.split(","); + for (String sub : subjects) { + if (sub.contains("CN=")) { + account = sub.substring(sub.indexOf("=") + 1); + certAuth = true; + break; + } + } + } + String token = authService.login(account, password, certAuth); + return new SuccessResponseData(token); + } + + @GetMapping("/logout") + public SuccessResponseData logout() { + authService.logout(); + return new SuccessResponseData(true); + } + + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/AuthException.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/AuthException.java new file mode 100644 index 0000000000000000000000000000000000000000..1028eb8361af52870396075f379e9fed056538d8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/AuthException.java @@ -0,0 +1,19 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.exception; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AbstractBaseExceptionEnum; +import lombok.Getter; + +@Getter +public class AuthException extends RuntimeException { + + private final Integer code; + + private final String errorMessage; + + public AuthException(AbstractBaseExceptionEnum exception) { + super(exception.getMessage()); + this.code = exception.getCode(); + this.errorMessage = exception.getMessage(); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/DemoException.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/DemoException.java new file mode 100644 index 0000000000000000000000000000000000000000..365eb1a21428544500c1306a0311a6d13734b6d6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/DemoException.java @@ -0,0 +1,16 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.exception; + +import lombok.Getter; + +@Getter +public class DemoException extends ServiceException { + + private static final int DEMO_EXP_CODE = 14000; + + private static final String DEMO_EXP_ERROR_MESSAGE = "演示环境,无法操作!"; + + public DemoException() { + super(DEMO_EXP_CODE, DEMO_EXP_ERROR_MESSAGE); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/PermissionException.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/PermissionException.java new file mode 100644 index 0000000000000000000000000000000000000000..f4f167cdd614ba2f2dc3aa4c1b0edf13e408cb52 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/PermissionException.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.exception; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AbstractBaseExceptionEnum; +import lombok.Getter; + + +@Getter +public class PermissionException extends RuntimeException { + + private final Integer code; + + private final String errorMessage; + + public PermissionException(AbstractBaseExceptionEnum exception) { + super(exception.getMessage()); + this.code = exception.getCode(); + this.errorMessage = exception.getMessage(); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/ServiceException.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/ServiceException.java new file mode 100644 index 0000000000000000000000000000000000000000..d328c2315d2beb1bde90861756364754d83ae23f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/exception/ServiceException.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.exception; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AbstractBaseExceptionEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class ServiceException extends RuntimeException { + + private Integer code; + + private String errorMessage; + + public ServiceException(Integer code, String errorMessage) { + super(errorMessage); + this.code = code; + this.errorMessage = errorMessage; + } + + public ServiceException(AbstractBaseExceptionEnum exception) { + super(exception.getMessage()); + this.code = exception.getCode(); + this.errorMessage = exception.getMessage(); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/factory/LoginUserFactory.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/factory/LoginUserFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..6ceee534551c68e8af810765bca79ef717109d33 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/factory/LoginUserFactory.java @@ -0,0 +1,28 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.factory; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.util.ObjectUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SysLoginUser; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.ServiceException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.HttpServletUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.IpAddressUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.UaUtil; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.ServerExceptionEnum; +import jakarta.servlet.http.HttpServletRequest; + + +public class LoginUserFactory { + + public static void fillLoginUserInfo(SysLoginUser sysLoginUser) { + HttpServletRequest request = HttpServletUtil.getRequest(); + if (ObjectUtil.isNotNull(request)) { + sysLoginUser.setLastLoginIp(IpAddressUtil.getIp(request)); + sysLoginUser.setLastLoginTime(DateTime.now().toString()); + sysLoginUser.setLastLoginAddress(IpAddressUtil.getIp(request)); + sysLoginUser.setLastLoginBrowser(UaUtil.getBrowser(request)); + sysLoginUser.setLastLoginOs(UaUtil.getOs(request)); + } else { + throw new ServiceException(ServerExceptionEnum.REQUEST_EMPTY); + } + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/service/AuthService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/service/AuthService.java new file mode 100644 index 0000000000000000000000000000000000000000..1116cd170c8f0c50a43a92c274c5311aed2f3324 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/service/AuthService.java @@ -0,0 +1,19 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.service; + + +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SysLoginUser; +import jakarta.servlet.http.HttpServletRequest; + +public interface AuthService { + + String login(String account, String password, boolean certAuth); + + String getTokenFromRequest(HttpServletRequest request); + + SysLoginUser getLoginUserByToken(String token); + + void logout(); + + void setSpringSecurityContextAuthentication(SysLoginUser sysLoginUser); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/service/impl/AuthServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/service/impl/AuthServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f233b95b7e248ef44468c3a4ed25301eded238ca --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/service/impl/AuthServiceImpl.java @@ -0,0 +1,321 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.JwtPayLoad; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SysLoginUser; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.AuthException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.ServiceException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.factory.LoginUserFactory; +import com.inspur.ispim.cosmos.iboot.base.application.auth.service.AuthService; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.ConstantContextHolder; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.HttpServletUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.IpAddressUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.JwtTokenUtil; +import com.inspur.ispim.cosmos.iboot.base.application.cache.UserCache; +import com.inspur.ispim.cosmos.iboot.base.application.constant.CommonConstant; +import com.inspur.ispim.cosmos.iboot.base.application.constant.Constant; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AdminTypeEnum; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AuthExceptionEnum; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.CommonStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.ServerExceptionEnum; +import com.inspur.ispim.cosmos.iboot.base.application.user.entity.SysUser; +import com.inspur.ispim.cosmos.iboot.base.application.user.service.SysUserService; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; +import lombok.extern.slf4j.Slf4j; +import org.apache.logging.log4j.Logger; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.crypto.bcrypt.BCrypt; +import org.springframework.stereotype.Service; + +import javax.crypto.Cipher; +import java.security.KeyFactory; +import java.security.interfaces.RSAPrivateKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Base64; +import java.util.Map; + +@Slf4j +@Service +public class AuthServiceImpl implements AuthService, UserDetailsService { + + private static final Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(AuthServiceImpl.class); + + @Resource + private SysUserService sysUserService; + + @Resource + private UserCache userCache; + + @Override + public String login(String account, String password, boolean certAuth) { + if (!certAuth) { + if (ObjectUtil.hasEmpty(account, password)) { + throw new AuthException(AuthExceptionEnum.ACCOUNT_PWD_EMPTY); + } + try { + // RAS2048解密 + account = new String(decrypt(Base64.getDecoder().decode(account), Constant.PRIVATE_KEY)); + password = new String(decrypt(Base64.getDecoder().decode(password), Constant.PRIVATE_KEY)); + } catch (Exception e) { + throw new AuthException(AuthExceptionEnum.DECRYPT_ERROR); + } + } + SysUser sysUser = sysUserService.getUserByCount(account); + + //用户不存在,账号或密码错误 + if (ObjectUtil.isEmpty(sysUser)) { +// throw new AuthException(AuthExceptionEnum.NO_LOGIN_USER); + //用户登录时对每个登录错误尝试发出相同的报错信息(比如:提示"输入的用户名或者密码错误!"),不能提示具体的错误原因(比如:口令必须是8位、用户不存在、密码错误等) +// Integer loginFailCount = sysUser.getLoginFailCount(); + throw new AuthException(AuthExceptionEnum.ACCOUNT_PWD_ERROR); + } + + if (!certAuth) { + String passwordBcrypt = sysUser.getPassword(); + //验证账号密码是否正确 + if (ObjectUtil.isEmpty(passwordBcrypt) || !BCrypt.checkpw(password, passwordBcrypt)) { + //判断用户是否到达锁定逻辑 + this.judgeUserLoginCount(sysUser); + throw new AuthException(AuthExceptionEnum.ACCOUNT_PWD_ERROR); + } + } + return this.doLogin(sysUser); + } + + + private byte[] decrypt(byte[] str, String privateKey) throws Exception { + byte[] decoded = Base64.getDecoder().decode(privateKey); + RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded)); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(2, priKey); + return cipher.doFinal(str); + } + + @Override + public String getTokenFromRequest(HttpServletRequest request) { + String authToken = request.getHeader(CommonConstant.AUTHORIZATION); + if (ObjectUtil.isEmpty(authToken)) { + return null; + } else { + //token不是以Bearer打头,则响应回格式不正确 + if (!authToken.startsWith(CommonConstant.TOKEN_TYPE_BEARER)) { + throw new AuthException(AuthExceptionEnum.REQUEST_TOKEN_ERROR); + } + try { + authToken = authToken.substring(CommonConstant.TOKEN_TYPE_BEARER.length() + 1); + } catch (StringIndexOutOfBoundsException e) { + throw new AuthException(AuthExceptionEnum.REQUEST_TOKEN_ERROR); + } + } + + return authToken; + } + + @Override + public SysLoginUser getLoginUserByToken(String token) { + SysLoginUser sysLoginUser = null; + JwtPayLoad jwtPayLoad = null; + //校验token,错误则抛异常 + this.checkToken(token); + //根据token获取JwtPayLoad部分 + jwtPayLoad = JwtTokenUtil.getJwtPayLoad(token); + //从内存中获取登录用户 + sysLoginUser = userCache.get(jwtPayLoad.getUuid()); + //用户存在, 无痛刷新缓存,在登录过期前活动的用户自动刷新缓存时间 + this.cacheLoginUser(jwtPayLoad, sysLoginUser, token); + //返回用户 + return sysLoginUser; + } + + @Override + public void logout() { + JwtPayLoad jwtPayLoad = null; + HttpServletRequest request = HttpServletUtil.getRequest(); + if (ObjectUtil.isNotNull(request)) { + //获取token + String token = this.getTokenFromRequest(request); + //如果token为空直接返回 + if (ObjectUtil.isEmpty(token)) { + return; + } + + try { + //校验token,错误则抛异常,待确定 + this.checkToken(token); + //根据token获取JwtPayLoad部分 + jwtPayLoad = JwtTokenUtil.getJwtPayLoad(token); + } catch (Exception e) { + LOGGER.error("logout Exception", e); + } + + if (ObjectUtil.isNotEmpty(jwtPayLoad)) { + //获取缓存的key + String loginUserCacheKey = jwtPayLoad.getUuid(); + this.clearUser(loginUserCacheKey, jwtPayLoad.getAccount(), token); + } else { + this.clearUser(null, null, token); + } + } else { + throw new ServiceException(ServerExceptionEnum.REQUEST_EMPTY); + } + } + + @Override + public void setSpringSecurityContextAuthentication(SysLoginUser sysLoginUser) { + UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken = + new UsernamePasswordAuthenticationToken( + sysLoginUser, + null, + sysLoginUser.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(usernamePasswordAuthenticationToken); + } + + private void checkToken(String token) { + //校验token是否正确 + Boolean tokenCorrect = JwtTokenUtil.checkToken(token); + if (!tokenCorrect) { + throw new AuthException(AuthExceptionEnum.REQUEST_TOKEN_ERROR); + } + //校验token是否失效 + Boolean tokenExpired = JwtTokenUtil.isTokenExpired(token); + if (tokenExpired) { + throw new AuthException(AuthExceptionEnum.REQUEST_TOKEN_ERROR); + } + } + + @Override + public SysLoginUser loadUserByUsername(String account) throws UsernameNotFoundException { + SysLoginUser sysLoginUser = new SysLoginUser(); + SysUser user = sysUserService.getUserByCount(account); + BeanUtil.copyProperties(user, sysLoginUser); + return sysLoginUser; + } + + private void clearUser(String loginUserKey, String account, String token) { + try { + if (StrUtil.isNotEmpty(loginUserKey)) { + //获取缓存的用户 + Object cacheObject = userCache.get(loginUserKey); + //如果缓存的用户存在,清除会话,否则表示该会话信息已失效,不执行任何操作 + if (ObjectUtil.isNotEmpty(cacheObject)) { + //清除登录会话 + userCache.remove(loginUserKey); + //创建退出登录日志 + } + } + } catch (Exception e) { + LOGGER.error("clearUser remove userCache error: ", e); + } + } + + private String doLogin(SysUser sysUser) { + Integer sysUserStatus = sysUser.getStatus(); + //验证账号是否被冻结 + if (CommonStatusEnum.DISABLE.getCode().equals(sysUserStatus)) { + throw new AuthException(AuthExceptionEnum.ACCOUNT_FREEZE_ERROR); + } + + //构造SysLoginUser + SysLoginUser sysLoginUser = this.genSysLoginUser(sysUser); + + //构造jwtPayLoad + JwtPayLoad jwtPayLoad = new JwtPayLoad(sysUser.getId(), sysUser.getAccount()); + + //生成token + String token = JwtTokenUtil.generateToken(jwtPayLoad); + + //缓存token与登录用户信息对应, 默认2个小时 + this.cacheLoginUser(jwtPayLoad, sysLoginUser, token); + + //设置最后登录ip和时间 + sysUser.setLastLoginIp(IpAddressUtil.getIp(HttpServletUtil.getRequest())); + sysUser.setLastLoginTime(DateTime.now()); + + //更新用户登录信息 + sysUserService.updateById(sysUser); + + //登录成功,设置SpringSecurityContext上下文,方便获取用户 + this.setSpringSecurityContextAuthentication(sysLoginUser); + + //如果开启限制单用户登陆,则踢掉原来的用户 + Boolean enableSingleLogin = ConstantContextHolder.getEnableSingleLogin(); + if (enableSingleLogin) { + //获取所有的登陆用户 + Map allLoginUsers = userCache.getAllKeyValues(); + for (Map.Entry loginedUserEntry : allLoginUsers.entrySet()) { + String loginedUserKey = loginedUserEntry.getKey(); + SysLoginUser loginedUser = loginedUserEntry.getValue(); + + //如果账号名称相同,并且redis缓存key和刚刚生成的用户的uuid不一样,则清除以前登录的 + if (loginedUser.getName().equals(sysUser.getName()) + && !loginedUserKey.equals(jwtPayLoad.getUuid())) { + this.clearUser(loginedUserKey, loginedUser.getAccount(), token); + } + } + } + return token; + } + + private SysLoginUser genSysLoginUser(SysUser sysUser) { + SysLoginUser sysLoginUser = new SysLoginUser(); + BeanUtil.copyProperties(sysUser, sysLoginUser); + LoginUserFactory.fillLoginUserInfo(sysLoginUser); + return sysLoginUser; + } + + private void cacheLoginUser(JwtPayLoad jwtPayLoad, SysLoginUser sysLoginUser, String token) { + if (ObjectUtil.isNotEmpty(jwtPayLoad)) { + String redisLoginUserKey = jwtPayLoad.getUuid(); + userCache.put(redisLoginUserKey, sysLoginUser); + } + } + + /** + * 判断用户登录失败次数, 先获取失败次数若大于5次则将该用户锁定 + * + * @param sysUser 用户 + * @return 结果 true 在范围内 + */ + private void judgeUserLoginCount(SysUser sysUser) { + + //不支持锁定超级管理员 + if (AdminTypeEnum.SUPER_ADMIN.getCode().equals(sysUser.getAdminType())) { + return; + } + String account = sysUser.getAccount(); + + //判断是否连续登录失败, 主要判断第一次登录时间与当前时间比较 + if (isInLoginFailTimeScope(sysUser)) { + log.info(">>> [{}] 用户符合锁定条件, 已被锁定!", account); + throw new AuthException(AuthExceptionEnum.USER_LOCKED); + } else { + log.info(">>> [{}] 用户不符合连续时间内登录失败次数条件, 已清除锁定标志!", account); + } + } + + + /** + * 判断用户登录失败时间在规定范围内 + * + * @param sysUser 用户 + * @return 结果 true 在范围内 + */ + private boolean isInLoginFailTimeScope(SysUser sysUser) { + if (ObjectUtil.isNull(sysUser.getFirstLoginFailTime())) { + return false; + } + return false; + //todo判断是否联系登录失败.先跳过 +// String account = sysUser.getAccount(); +// String lastLoginFailTimeStr = ""; +// Date lastLoginFailTime = DateUtil.parse(lastLoginFailTimeStr); +// return DateUtil.between(lastLoginFailTime, DateUtil.date().toJdkDate(), DateUnit.SECOND) <= CommonConstant.LOGIN_FAILED_CYCLE; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/ConstantContextHolder.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/ConstantContextHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..fdceb3f559cbf6b306fdef682cec1f251bbf407c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/ConstantContextHolder.java @@ -0,0 +1,46 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.util; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.log.Log; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ConstantContext; + + +public class ConstantContextHolder { + + private static final Log log = Log.get(); + + public static String getJwtSecret() { + return getSysConfigWithDefault("IBOOT_JWT_SECRET", String.class, RandomUtil.randomString(32)); + } + + public static Long getSessionTokenExpireSec() { + return getSysConfigWithDefault("IBOOT_SESSION_EXPIRE", Long.class, 2 * 60 * 60L); + } + + public static Long getTokenExpireSec() { + return getSysConfigWithDefault("IBOOT_TOKEN_EXPIRE", Long.class, 86400L); + } + + public static Boolean getEnableSingleLogin() { + return getSysConfigWithDefault("IBOOT_ENABLE_SINGLE_LOGIN", Boolean.class, false); + } + + public static T getSysConfigWithDefault(String configCode, Class clazz, T defaultValue) { + String configValue = ConstantContext.me().getStr(configCode); + if (ObjectUtil.isEmpty(configValue)) { + // 将默认值加入到缓存常量 + log.warn(">>> 系统配置sys_config表中存在空项,configCode为:{},系统采用默认值:{}", configCode, defaultValue); + ConstantContext.me().put(configCode, defaultValue); + return defaultValue; + } else { + try { + return Convert.convert(clazz, configValue); + } catch (Exception e) { + return defaultValue; + } + } + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/HttpServletUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/HttpServletUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..b848fe977965f42baefa3510979f2c54a5123e9f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/HttpServletUtil.java @@ -0,0 +1,22 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.util; + +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.ServiceException; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.ServerExceptionEnum; +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + + +public class HttpServletUtil { + + + public static HttpServletRequest getRequest() { + ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + if (requestAttributes == null) { + throw new ServiceException(ServerExceptionEnum.REQUEST_EMPTY); + } else { + return requestAttributes.getRequest(); + } + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/IpAddressUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/IpAddressUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..10843b45bf8ab7456f41f0748802e13ff219c9a0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/IpAddressUtil.java @@ -0,0 +1,24 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.util; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.extra.servlet.JakartaServletUtil; +import com.inspur.ispim.cosmos.iboot.base.application.constant.Constant; +import jakarta.servlet.http.HttpServletRequest; + +public class IpAddressUtil { + + private static final String LOCAL_IP = "127.0.0.1"; + + private static final String LOCAL_REMOTE_HOST = "0:0:0:0:0:0:0:1"; + + public static String getIp(HttpServletRequest request) { + if (ObjectUtil.isEmpty(request)) { + return Constant.DASH; + } else { + String remoteHost = JakartaServletUtil.getClientIPByHeader(request, "X-Real-IP", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR"); + return LOCAL_REMOTE_HOST.equals(remoteHost) ? LOCAL_IP : remoteHost; + } + } + + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/JwtTokenUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/JwtTokenUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..f50a0d38eaa689051f5b206b2a94bffcdd150a31 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/JwtTokenUtil.java @@ -0,0 +1,57 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.util; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.JwtPayLoad; +import io.jsonwebtoken.*; + +import java.util.Date; + +public class JwtTokenUtil { + + public static String generateToken(JwtPayLoad jwtPayLoad) { + + DateTime expirationDate = DateUtil.offsetMillisecond(new Date(), + Convert.toInt(ConstantContextHolder.getTokenExpireSec()) * 1000); + return Jwts.builder() + .setClaims(BeanUtil.beanToMap(jwtPayLoad)) + .setSubject(jwtPayLoad.getUserId().toString()) + .setIssuedAt(new Date()) + .setExpiration(expirationDate) + .signWith(SignatureAlgorithm.HS512, ConstantContextHolder.getJwtSecret()) + .compact(); + } + + private static Claims getClaimsFromToken(String token) { + return Jwts.parser() + .setSigningKey(ConstantContextHolder.getJwtSecret()) + .parseClaimsJws(token) + .getBody(); + } + + public static JwtPayLoad getJwtPayLoad(String token) { + Claims claims = getClaimsFromToken(token); + return BeanUtil.mapToBean(claims, JwtPayLoad.class, false); + } + + public static Boolean checkToken(String token) { + try { + getClaimsFromToken(token); + return true; + } catch (JwtException jwtException) { + return false; + } + } + + public static Boolean isTokenExpired(String token) { + try { + Claims claims = getClaimsFromToken(token); + final Date expiration = claims.getExpiration(); + return expiration.before(new Date()); + } catch (ExpiredJwtException expiredJwtException) { + return true; + } + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/ResponseUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/ResponseUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..6b33b8d9927cb9ac286794f40d50dc37bc11a826 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/ResponseUtil.java @@ -0,0 +1,30 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.util; + +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.http.ContentType; +import com.alibaba.fastjson.JSON; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.ErrorResponseData; +import jakarta.servlet.http.HttpServletResponse; + +import java.io.IOException; + +public class ResponseUtil { + + public static void responseExceptionError(HttpServletResponse response, + Integer code, + String message, + String exceptionClazz) throws IOException { + response.setCharacterEncoding(CharsetUtil.UTF_8); + response.setContentType(ContentType.JSON.toString()); + ErrorResponseData errorResponseData = new ErrorResponseData(code, message); + errorResponseData.setExceptionClazz(exceptionClazz); + String errorResponseJsonData = JSON.toJSONString(errorResponseData); + response.getWriter().write(errorResponseJsonData); + } + + public static ErrorResponseData responseDataError(Integer code, String message, String exceptionClazz) { + ErrorResponseData errorResponseData = new ErrorResponseData(code, message); + errorResponseData.setExceptionClazz(exceptionClazz); + return errorResponseData; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/UaUtil.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/UaUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..63f288394163663b42da19877359d85e7454b400 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/auth/util/UaUtil.java @@ -0,0 +1,48 @@ +package com.inspur.ispim.cosmos.iboot.base.application.auth.util; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.extra.servlet.JakartaServletUtil; +import cn.hutool.http.useragent.Browser; +import cn.hutool.http.useragent.UserAgent; +import cn.hutool.http.useragent.UserAgentUtil; +import com.inspur.ispim.cosmos.iboot.base.application.constant.CommonConstant; +import com.inspur.ispim.cosmos.iboot.base.application.constant.Constant; +import jakarta.servlet.http.HttpServletRequest; + + +public class UaUtil { + + public static String getBrowser(HttpServletRequest request) { + UserAgent userAgent = getUserAgent(request); + if (ObjectUtil.isEmpty(userAgent)) { + return Constant.DASH; + } else { + String browser = userAgent.getBrowser().toString(); + return CommonConstant.UNKNOWN.equals(browser) ? Constant.DASH : browser; + } + } + + public static String getOs(HttpServletRequest request) { + UserAgent userAgent = getUserAgent(request); + if (ObjectUtil.isEmpty(userAgent)) { + return Constant.DASH; + } else { + String os = userAgent.getOs().toString(); + return CommonConstant.UNKNOWN.equals(os) ? Constant.DASH : os; + } + } + + private static UserAgent getUserAgent(HttpServletRequest request) { + String userAgentStr = JakartaServletUtil.getHeaderIgnoreCase(request, CommonConstant.USER_AGENT); + UserAgent userAgent = UserAgentUtil.parse(userAgentStr); + //判空 + if (ObjectUtil.isNotEmpty(userAgentStr)) { + //如果根本没获取到浏览器 + if (CommonConstant.UNKNOWN.equals(userAgent.getBrowser().getName())) { + //则将ua设置为浏览器 + userAgent.setBrowser(new Browser(userAgentStr, null, "")); + } + } + return userAgent; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/business/InnerController.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/business/InnerController.java new file mode 100644 index 0000000000000000000000000000000000000000..d95f72c2c76dc8f6db4b739a5c15c33b61c605a8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/business/InnerController.java @@ -0,0 +1,134 @@ +package com.inspur.ispim.cosmos.iboot.base.application.business; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.UUID; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDetailBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressDataEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostLogEntity; +import com.inspur.ispim.cosmos.iboot.base.api.service.InnerService; +import jakarta.servlet.ServletRequest; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.Objects; + + +/** + * @author lisong01 + * @date 2023/07/27 14:42 + */ +@RestController +@RequestMapping(value = "/v1/iboot") +@Slf4j +public class InnerController { + + @Autowired + private InnerService innerService; + + @RequestMapping(value = "/all", method = RequestMethod.GET) + public ApiResult getDeviceList(ServletRequest req) { + try { + log.error("getting all device list " + req.getRemoteAddr()); + return innerService.getAll(); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(); + } + } + + @RequestMapping(value = "/taskStatusChange", method = RequestMethod.POST) + public ApiResult acceptStatusChangeBean(@RequestBody IBootTaskHostEntity iBootTaskHostEntity) { + try { + log.error("getting taskStatusChange param " + iBootTaskHostEntity.toString()); + innerService.acceptStatusChangeBean(iBootTaskHostEntity); + return ApiResult.success(); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(); + } + } + + @RequestMapping(value = "/taskLogAccept", method = RequestMethod.POST) + public ApiResult acceptTaskHostLogBean(@RequestBody IBootTaskHostLogEntity iBootTaskHostLogEntity) { + try { + log.error("getting taskLogAccept param " + iBootTaskHostLogEntity.toString()); + // 规范日志内容 +// iBootTaskHostLogEntity.setContent(iBootTaskHostLogEntity.getContent().replace("#", " ")); + innerService.acceptTaskHostLogBean(iBootTaskHostLogEntity); + return ApiResult.success(); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(); + } + } + + /** + * 采集压力测试数据 + * + * @param iBootStressDataEntity + * @return + */ + @RequestMapping(value = "/stressDataAccept", method = RequestMethod.POST) + public ApiResult acceptStressTestData(@RequestBody IBootStressDataEntity iBootStressDataEntity) { + try { + log.error("getting stressDataAccept param " + iBootStressDataEntity.toString()); + if (iBootStressDataEntity.getEccCPU0().matches("\\d+") && iBootStressDataEntity.getEccCPU1().matches("\\d+")) { + if (Integer.parseInt(iBootStressDataEntity.getEccCPU0()) > 6000 || Integer.parseInt(iBootStressDataEntity.getEccCPU1()) > 6000) { + iBootStressDataEntity.setEccReason(Languages.getString("STRESSECCREASON")); + } else { + iBootStressDataEntity.setEccReason(""); + } + } else { + iBootStressDataEntity.setEccReason(Languages.getString("STRESSECCEXCEP")); + } + // 补充数据,忽略内存告警 + iBootStressDataEntity.setId(UUID.fastUUID().toString(true)); + iBootStressDataEntity.setCreateTime(new Date()); + IBootTaskHostEntity iBootTaskHostEntity = innerService.getTaskHost(iBootStressDataEntity.getJobHostId()); + if (BeanUtil.isNotEmpty(iBootTaskHostEntity)) { + iBootStressDataEntity.setIp(iBootTaskHostEntity.getResourceIp()); + iBootStressDataEntity.setSn(iBootTaskHostEntity.getSn()); + } + innerService.addStressData(iBootStressDataEntity); + return ApiResult.success(); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(); + } + } + + /** + * 心跳上报 + * + * @param sn + * @return + */ + @GetMapping("/device/heartbeat/{sn}/{ip}") + public ApiResult deviceHeartbeat(@PathVariable("sn") String sn, @PathVariable("ip") String ip) { + innerService.deviceHeartbeat(sn, ip); + return ApiResult.success(sn); + } + + /** + * 信息上报 + * + * @param detailBean + * @return + */ + @PostMapping("/device/all") + public ApiResult deviceReport(@RequestBody DeviceDetailBean detailBean) { + if (Objects.isNull(detailBean) || Objects.isNull(detailBean.getSystem()) || StringUtils.isBlank(detailBean.getSystem().getSerialNumber())) { + return ApiResult.fail("序列号为空"); + } else { + ResultBean resultBean = innerService.deviceReport(detailBean); + return resultBean.isFlag() ? ApiResult.success(detailBean.getSystem().getSerialNumber()) : ApiResult.fail(resultBean.getMessage()); + } + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/business/OuterController.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/business/OuterController.java new file mode 100644 index 0000000000000000000000000000000000000000..e1de418e5bee128173f1f9b5f415c12789beb7cf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/business/OuterController.java @@ -0,0 +1,1025 @@ +package com.inspur.ispim.cosmos.iboot.base.application.business; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.IBootTemplateQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDiskCloneBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ServerManageNetworkBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.Chunk; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ChunkFileModel; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageXmlBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.IBootRaidConfigTemplateBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootBondShellBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootInstallParamBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootStartTaskBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootStressExportBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRepositoryImageEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTemplateEntity; +import com.inspur.ispim.cosmos.iboot.base.api.service.OuterService; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.servlet.http.HttpServletResponse; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.*; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.*; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +import static com.inspur.cdc.commons.i18n.Languages.getString; + +/** + * ISIB控制层,给前端用户用的 + * + * @author lisong01 + * @date 2023-07-21 + */ +@Slf4j +@RestController +@RequestMapping("/v2/iboot") +public class OuterController { + @Autowired + private OuterService outerService; + + @Operation(summary = "查询所有设备列表", description = "查询所有设备列表") + @RequestMapping(value = "/all-device", method = RequestMethod.GET) + public ApiResult getByCondition() { + return outerService.getAllDevices(); + } + + @Operation(summary = "设备列表", description = "设备列表") + @PostMapping("/device/list") + public ApiResult deviceList(@RequestBody DeviceQueryBean deviceQueryBean) { + ResultBean resultBean = outerService.deviceList(deviceQueryBean); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(getString("CONTROL_PARAMETER_IS_NULL_OR_ERROR")); + } + + @Operation(summary = "设备列表下拉框", description = "设备列表下拉框") + @GetMapping("/device/dropdown") + public ApiResult deviceDropdown() { + ResultBean resultBean = outerService.deviceDropdown(); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(getString("cosmos.control.asset.resource.get.model.list.failed")); + } + + @Operation(summary = "设备列表下拉框机型", description = "设备列表下拉框机型") + @GetMapping("/device/model") + public ApiResult deviceModelList(@RequestParam(required = false) String vendor) { + ResultBean resultBean = outerService.deviceModelList(vendor); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(getString("cosmos.control.asset.resource.get.model.list.failed")); + } + + @Operation(summary = "设备更新", description = "设备更新") + @PostMapping("/device/update") + public ApiResult updateDevice(@RequestBody DeviceEntity deviceEntity) { + ResultBean resultBean = outerService.updateDevice(deviceEntity); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "新增设备", description = "新增设备") + @PostMapping("/device") + public ApiResult addDevice(@RequestBody DeviceEntity deviceEntity) { + if (Objects.nonNull(deviceEntity)) { + deviceEntity.setCreateUser(getCurrentUserName()); + } + ResultBean resultBean = outerService.addDevice(deviceEntity); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备详情", description = "设备详情") + @GetMapping("/device") + public ApiResult getDeviceDetail(@RequestParam String id) { + ResultBean resultBean = outerService.getDeviceDetail(id); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备基础信息", description = "设备基础信息") + @GetMapping("/device/system") + public ApiResult getDeviceSystemDetail(@RequestParam String id) { + ResultBean resultBean = outerService.getDeviceSystemDetail(id); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备存储信息", description = "设备存储信息") + @GetMapping("/device/storage") + public ApiResult getDeviceStorageDetail(@RequestParam String id) { + ResultBean resultBean = outerService.getDeviceStorageDetail(id); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备删除", description = "设备删除") + @PostMapping("/device/delete") // 使用DeleteMapping报错,待回归 + public ApiResult deviceDelete(@RequestBody DeviceQueryBean deviceQueryBean) { + ResultBean resultBean = outerService.deviceDelete(deviceQueryBean); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备电源管理-关机", description = "设备电源管理-关机") + @PostMapping("/device/power/{mode}") + public ApiResult devicePowerManage(@PathVariable("mode") String mode, @RequestBody DeviceQueryBean deviceQueryBean) { + ResultBean resultBean = outerService.devicePowerManage(deviceQueryBean, mode); + return resultBean.isFlag() ? ApiResult.success(mode) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备刷新", description = "设备刷新") + @PostMapping("/device/refresh") + public ApiResult deviceRefresh(@RequestBody DeviceQueryBean deviceQueryBean) { + ResultBean resultBean = outerService.deviceRefresh(deviceQueryBean); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "download", description = "模板下载") + @PostMapping(value = "/device/template/download") + public ResponseEntity deviceTemplateDownload() { + ResponseEntity responseEntity = null; + try { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); + Charset charset = Charset.forName("UTF-8"); + ContentDisposition.Builder disposition = ContentDisposition.builder("form-data").name("attachment") + .filename("template.xlsx", charset); + headers.setContentDisposition(disposition.build()); + responseEntity = new ResponseEntity(outerService.deviceTemplateDownload(), headers, + HttpStatus.CREATED); + } catch (Exception e) { + log.error(e.getMessage()); + } + return responseEntity; + } + + @Operation(summary = "upload", description = "模板上传") + @PostMapping(value = "/device/template/upload") + public ApiResult deviceTemplateUpload(@RequestBody MultipartFile file) { + try { + byte[] content = file.getBytes(); + if (content.length >> 20 > 1) { + return ApiResult.fail(Languages.getString("iboot.device.file.oversize", 1)); + } + ResultBean resultBean = outerService.deviceTemplateUpload(content); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } catch (IOException e) { + return ApiResult.fail(getString("CONTROL_PARAMETER_IS_NULL_OR_ERROR")); + } + } + + @Operation(summary = "服务状态查询", description = "服务状态查询") + @GetMapping(value = "/service/state") + public ApiResult getServiceState() { + ResultBean resultBean = outerService.getServiceState(); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "服务状态管理", description = "服务状态管理") + @GetMapping(value = "/service/manage/{name}/{mode}") + public ApiResult changeServiceState(@PathVariable("name") String name, @PathVariable("mode") String mode) { + ResultBean resultBean = outerService.changeServiceState(name, mode); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "管理网络范围", description = "管理网络范围") + @GetMapping(value = "/manageNetworkRange") + public ApiResult getManageNetworkRange(@RequestParam String ip) { + ResultBean resultBean = outerService.getManageNetworkRange(ip); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + @Operation(summary = "管理网络查询", description = "管理网络查询") + @GetMapping(value = "/manageNetwork") + public ApiResult getManageNetwork() { + ResultBean resultBean = outerService.getManageNetwork(); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "校验是否配置dhcp", description = "校验是否配置dhcp") + @GetMapping(value = "/checkDhcpConfig") + public ApiResult checkDhcpConfig() { + ResultBean resultBean = outerService.getManageNetwork(); + boolean check = false; + if (resultBean.isFlag()) { + if (resultBean.getData() != null) { + ServerManageNetworkBean serverManageNetworkBean = (ServerManageNetworkBean) resultBean.getData(); + if (StringUtils.isNotEmpty(serverManageNetworkBean.getDhcpIp())) { + check = true; + } + } + } + return ApiResult.success(check); + } + + @Operation(summary = "管理网络设置", description = "管理网络设置") + @PostMapping(value = "/manageNetwork") + public ApiResult setManageNetwork(@RequestBody ServerManageNetworkBean serverManageNetworkBean) { + ResultBean resultBean = outerService.setManageNetwork(serverManageNetworkBean); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备系统探测", description = "设备系统探测") + @PostMapping("/device/detection/{mode}") + public ApiResult deviceDetection(@PathVariable("mode") String mode, @RequestBody DeviceQueryBean deviceQueryBean) { + ResultBean resultBean = outerService.deviceDetection(deviceQueryBean, mode); + return resultBean.isFlag() ? ApiResult.success(mode) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "设备逻辑磁盘信息", description = "设备逻辑磁盘信息") + @GetMapping("/device/logicDisk") + public ApiResult getDevicelogicDisk(@RequestParam String id) { + ResultBean resultBean = outerService.deviceLogicDisk(id); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "磁盘备份", description = "磁盘备份") + @PostMapping("/device/diskBackup") + public ApiResult deviceDiskBackup(@RequestBody DeviceDiskCloneBean diskCloneBean) { + ResultBean resultBean = outerService.deviceDiskBackup(diskCloneBean); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } + + @Operation(summary = "磁盘恢复", description = "磁盘恢复") + @PostMapping("/device/diskRestore/{id}") + public ApiResult deviceDiskRestore(@PathVariable("id") String id, @RequestBody DeviceQueryBean deviceQueryBean) { + ResultBean resultBean = outerService.deviceDiskRestore(deviceQueryBean, id); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } + + /**************************zhangchen专属区域开始 ***********************/ + + /**************************镜像关联相关接口 ***********************/ + @Operation(summary = "校验NFS可用空间", description = "校验NFS可用空间") + @PostMapping("/checkNFSAvaliableSpace") + public ApiResult checkNFSAvaliableSpace(@RequestParam(value = "size") String size, @RequestParam(value = "type") String type) { + return ApiResult.success(outerService.checkNFSAvaliableSpace(size, type)); + } + + @RequestMapping(value = "/getImagePage", method = RequestMethod.POST) + public ApiResult getImageListByCondition(@RequestBody ImageQueryBean query) { + return ApiResult.success(outerService.getIBootRepositoryImagePageByCondition(query)); + } + + @RequestMapping(value = "/getImageList", method = RequestMethod.POST) + public ApiResult getImageList(@RequestBody ImageQueryBean query) { + return ApiResult.success(outerService.getByCondition(query)); + } + + @Operation(summary = "文件分片上传", description = "文件分片上传") + @PostMapping(value = "/fragmented/file/upload") + public ApiResult uploadFragmentedFile(Chunk chunk) { + try { + if (null != chunk) { + String filename = chunk.getFilename(); + boolean flag = false; + if (filename.endsWith(".iso") || filename.endsWith(".ISO") || filename.endsWith(".img") || filename.endsWith(".IMG")) { + flag = true; + } + if (filename.contains("/") || filename.contains("\\") || filename.contains("..") + || !flag) { + return ApiResult.fail(getString("CONTROL_UPLOAD_FILE_FAIL")); + } + //如果文件存在,查库确认 + ImageQueryBean queryBean = new ImageQueryBean(); + queryBean.setOriginalName(filename); + queryBean.setField("id"); + List fileList = outerService.getByCondition(queryBean); + if (CollectionUtil.isNotEmpty(fileList)) { + return ApiResult.fail(getString("CONTROL_UPLOAD_FILE_EXIST")); + } else { + MultipartFile file = chunk.getFile(); + outerService.uploadFragmentedFile(chunk, file.getBytes()); + return ApiResult.success(); + } + } else { + return ApiResult.fail(getString("CONTROL_PARAMETER_IS_NULL_OR_ERROR")); + } + } catch (Exception e) { + return ApiResult.fail(getString("CONTROL_UPLOAD_FILE_FAIL")); + } + } + + @Operation(summary = "文件分片合并", description = "文件分片合并") + @RequestMapping(value = "/fragmented/file/merge", method = RequestMethod.POST) + public ApiResult mergeFragmentedFile(@RequestBody ChunkFileModel chunkFileModel) { + String fileName = chunkFileModel.getFileName(); + boolean flag = false; + if (fileName.endsWith(".iso") || fileName.endsWith(".ISO") || fileName.endsWith(".img") || fileName.endsWith(".IMG")) { + flag = true; + } + if (fileName.contains("/") || fileName.contains("\\") || fileName.contains("..") + || !flag) { + return ApiResult.fail(getString("CONTROL_UPLOAD_FILE_FAIL")); + } + try { + String userName = getCurrentUserName(); + ResultBean resultBean = outerService.mergeFragmentedFile(chunkFileModel, userName); + return ApiResult.success(resultBean.getData()); + } catch (Exception e) { + return ApiResult.fail(getString("CONTROL_UPLOAD_FILE_FAIL")); + } + } + + @Operation(summary = "分片文件是否完成", description = "分片文件是否完成") + @RequestMapping(value = "/fragmented/flag", method = RequestMethod.GET) + public ApiResult checkFragmentedFile(@RequestParam(value = "fileName") String fileId) { + if (StringUtils.isEmpty(fileId)) {//处理前几次,前端拿不到merge返回结果,先默认返回合并中 + return ApiResult.success("0"); + } + String flag = outerService.getMerginFlag(fileId); + return ApiResult.success(flag); + } + + /** + * 镜像上传后,校验md5值是否一致 + * + * @return res + */ + @Operation(summary = "校验文件得md5是否一致", description = "校验文件得md5是否一致") + @RequestMapping(value = "/checkFileIsKeeping", method = RequestMethod.GET) + public ApiResult checkFileIsKeeping(@RequestParam(value = "filename", required = true) String filename, @RequestParam(value = "md5", required = true) String md5) { + //根据文件名称,查询镜像文件信息 + IBootRepositoryImageEntity controlRepositoryImageEntity = outerService.getByFileName(filename); + if (controlRepositoryImageEntity == null) { + return ApiResult.fail(Languages.getString("iboot_MD5_ERROR")); + } + String filePath = controlRepositoryImageEntity.getFullPath(); + File file = new File(filePath); + String filemd5 = CommonUtil.md5(file); + if (!filemd5.equalsIgnoreCase(md5)) {//如果不一致,则删除文件和删除数据库 + List ids = new ArrayList(); + ids.add(controlRepositoryImageEntity.getId()); + outerService.deleteOsRepositoryFileById(ids); + return ApiResult.fail(Languages.getString("iboot_MD5_ERROR")); + } + return ApiResult.success(); + } + + /** + * 删除分片碎片--装机. + * + * @return res + */ + @Operation(summary = "删除分片碎片", description = "删除分片碎片") + @RequestMapping(value = "{pathId}/fragmented/file", method = RequestMethod.DELETE) + public ApiResult deleteFragmentedFile(@PathVariable(value = "pathId", required = true) String pathId, + @RequestParam(value = "fileName", required = true) String fileName) { + ResultBean resultBean = outerService.deleteFragmentedFile(pathId, fileName); + if (resultBean.isFlag()) { + return ApiResult.success(getString("CONTROL_OPER_SUCCESS")); + } else { + return ApiResult.fail(getString("CONTROL_OPER_FAIL")); + } + } + + /** + * @param ids + * @return + * @Description: 删除单个或多个数据. + */ + @Operation(summary = "删除单个或多个操作系统库数据", description = "删除单个或多个数据") + @RequestMapping(value = "image/delete", method = RequestMethod.DELETE) + public ApiResult batchDeleteOsFileList(@RequestBody List ids) { + ApiResult res = null; + try { + res = outerService.deleteOsRepositoryFileById(ids); + } catch (Exception e) { + return ApiResult.fail(getString("CONTROL_DATA_OP_EXCEPTION")); + } + return res; + } + + @Operation(summary = "获取支持镜像类型树状结构", description = "获取支持镜像类型树状结构") + @PostMapping("/supported-images") + public ApiResult getSupportedLists() { + return ApiResult.success(outerService.getAllSupportImages()); + } + + @Operation(summary = "获取镜像类型list形式", description = "获取镜像类型list形式") + @PostMapping("/getImageTypeList") + public ApiResult getImageTypeList() { + return ApiResult.success(outerService.getImageTypeList()); + } + + @Operation(summary = "获取文件上传路径可用空间大小", description = "获取文件上传路径可用空间大小") + @GetMapping("/getUsableSpace") + public ApiResult getUsableSpace() { + return ApiResult.success(outerService.getUsableSpace()); + } + + /**************************任务相关接口 ***********************/ + @Operation(summary = "获取iboot任务列表", description = "获取iboot任务列表") + @PostMapping("/getTaskList") + public ApiResult getTaskList(@RequestBody IBootTaskQueryBean iBootTaskQueryBean) { + return ApiResult.success(outerService.getTaskList(iBootTaskQueryBean)); + } + + @Operation(summary = "获取iboot任务设备列表,taskId为必填项", description = "获取iboot任务设备列表,taskId为必填项") + @PostMapping("/getTaskHostList") + public ApiResult getTaskHostList(@RequestBody IBootTaskQueryBean iBootTaskQueryBean) { + return ApiResult.success(outerService.getTaskHostList(iBootTaskQueryBean)); + } + + @Operation(summary = "获取某个设备的执行日志", description = "获取某个设备的执行日志") + @PostMapping("/getTaskHostLogList") + public ApiResult getTaskHostLogList(@RequestParam(value = "jobHostId", required = true) String jobHostId) { + IBootTaskQueryBean iBootTaskQueryBean = new IBootTaskQueryBean(); + iBootTaskQueryBean.setJobHostId(jobHostId); + return ApiResult.success(outerService.getTaskHostLogList(iBootTaskQueryBean)); + } + + @Operation(summary = "获取iboot历史任务列表", description = "获取iboot历史任务列表") + @PostMapping("/getTaskHistoryList") + public ApiResult getTaskHistoryList(@RequestBody IBootTaskQueryBean iBootTaskQueryBean) { + return ApiResult.success(outerService.getTaskHistoryList(iBootTaskQueryBean)); + } + + @Operation(summary = "获取iboot历史任务设备列表", description = "获取iboot历史任务列表") + @PostMapping("/getTaskHostHistoryList") + public ApiResult getTaskHostHistoryList(@RequestBody IBootTaskQueryBean iBootTaskQueryBean) { + return ApiResult.success(outerService.getTaskHostHistoryList(iBootTaskQueryBean)); + } + + @Operation(summary = "根据taskId作业强制终止", description = "根据taskId作业强制终止") + @GetMapping("stopTaskByTaskId") + public ApiResult stopTaskByTaskId(@RequestParam(value = "taskId", required = true) String taskId) { + try { + outerService.stopTaskByTaskId(taskId); + return ApiResult.success(); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "根据taskHostId作业强制终止", description = "根据taskHostId作业强制终止") + @GetMapping("stopTaskByTaskHostId") + public ApiResult stopTaskByTaskHostId(@RequestParam(value = "taskHostId", required = true) String taskHostId) { + try { + outerService.stopTaskByTaskHostId(taskHostId); + return ApiResult.success(); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "根据taskId删除历史作业", description = "根据taskId删除历史作业") + @GetMapping("deleteTaskByTaskId") + public ApiResult deleteTaskByTaskId(@RequestParam(value = "taskId", required = true) String taskId) { + try { + outerService.deleteTaskByTaskId(taskId); + return ApiResult.success(); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "根据taskIds批量删除历史作业", description = "根据taskIds批量删除历史作业") + @PostMapping("deleteTaskByTaskIds") + public ApiResult deleteTaskByTaskIds(@RequestBody List taskIds) { + try { + outerService.deleteTaskByTaskIds(taskIds); + return ApiResult.success(); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "根据taskId重试任务", description = "根据taskId重试任务") + @GetMapping("retryTaskByTaskId") + public ApiResult retryTaskByTaskId(@RequestParam(value = "taskId", required = true) String taskId) { + try { + ResultBean resultBean = outerService.retryTaskByTaskId(taskId); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getData()); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "根据taskHostId重试任务", description = "根据taskHostId重试任务") + @GetMapping("retryTaskByTaskHostId") + public ApiResult retryTaskByTaskHostId(@RequestParam(value = "taskHostId", required = true) String taskHostId) { + try { + ResultBean resultBean = outerService.retryTaskByTaskHostId(taskHostId); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getData()); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "获取设备,任务,模板,镜像总数", description = "获取设备,任务,模板,镜像总数") + @GetMapping("getTotal") + public ApiResult getTotal() { + try { + return ApiResult.success(outerService.getTotal()); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "获取设备状态占比情况", description = "获取设备状态占比情况") + @GetMapping("getDeviceShow") + public ApiResult getDeviceShow() { + try { + return ApiResult.success(outerService.getDeviceShow()); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "获取高频模板执行的设备数量top5", description = "获取高频模板执行的设备数量top5") + @GetMapping("getTemplateShow") + public ApiResult getTemplateShow() { + try { + return ApiResult.success(outerService.getTemplateShow()); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "获取镜像类型占比情况", description = "获取镜像类型占比情况") + @GetMapping("getImageShow") + public ApiResult getImageShow() { + try { + return ApiResult.success(outerService.getImageShow()); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + @Operation(summary = "获取近期执行的任务top10", description = "获取近期执行的任务top10") + @GetMapping("getTaskHistoryListTopten") + public ApiResult getTaskHistoryListTopten() { + try { + return ApiResult.success(outerService.getTaskHistoryListTopten()); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(); + } + } + + /**************************zhangchen专属区域结束 ***********************/ + public String getCurrentUserName() { + return "admin"; + } + + + /**************************Mr.G专属区域开始 ***********************/ + + @Operation(summary = "获取模板集合高级查询", description = "获取模板集合高级查询") + @PostMapping("/template/list") + public ApiResult listIBootTemplate(@RequestBody IBootTemplateQueryBean iBootTemplateQueryBean) { + try { + return ApiResult.success(outerService.queryTemplateByCondition(iBootTemplateQueryBean)); + } catch (Exception e) { + log.error("模板列表查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.get.list.failed")); + } + } + + @Operation(summary = "新增模板,templateBean对应操作所需参数", description = "新增模板") + @PostMapping("/template/add") + public ApiResult addIBootTemplate(@RequestBody IBootTemplateEntity iBootTemplateEntity) { + IBootTemplateEntity templateEntity = new IBootTemplateEntity(); + iBootTemplateEntity.setCreateUser(getCurrentUserName()); + templateEntity.setShow(true); + templateEntity.setTemplateType(iBootTemplateEntity.getTemplateType()); + try { + if (StringUtils.isEmpty(iBootTemplateEntity.getName())) { + return ApiResult.fail(Languages.getString("cosmos.iboot.template.save.param_error")); + } + List templateEntities = outerService.select(templateEntity); + if (CollUtil.isNotEmpty(templateEntities)) { + //名称重复不能添加 + if (templateEntities.stream().anyMatch(template -> iBootTemplateEntity.getName().equals(template.getName()))) { + return ApiResult.fail(Languages.getString("cosmos.iboot.template.name.not.duplicate", iBootTemplateEntity.getName())); + } + } + IBootTemplateEntity entity = outerService.addTemplateWithEntity(iBootTemplateEntity); + return ObjectUtil.isNotNull(entity) ? ApiResult.success(entity) : ApiResult.fail(Languages.getString("cosmos.iboot.template.save.failed")); + } catch (Exception e) { + log.error("模板新增异常: {}, 模板: {}", e, iBootTemplateEntity); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.save.failed")); + } + } + + @Operation(summary = "获取raid配置模型", description = "获取raid配置模型") + @PostMapping("/raid/configlist") + public ApiResult listIBootRaidConfig(@RequestBody DeviceQueryBean deviceQueryBean) { + try { + return ApiResult.success(outerService.getRaidConfigPage(deviceQueryBean)); + } catch (Exception e) { + log.error("模板列表查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.raid.get.list.failed")); + } + } + + @PostMapping("/raid/raidAnalyseResult") + public ApiResult raidAnalyseResult(@RequestParam("md5") String md5, @RequestBody IBootRaidConfigTemplateBean iBootRaidConfigTemplateBean) { + try { + return ApiResult.success(outerService.raidAnalyseResult(iBootRaidConfigTemplateBean, md5)); + } catch (Exception e) { + log.error("模板列表查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.raid.get.list.failed")); + } + } + + @Operation(summary = "根据md5值获取raid树", description = "根据md5值获取raid树") + @GetMapping("/raid/tree") + public ApiResult getRaidTree(@RequestParam("md5") String md5) { + try { + return ApiResult.success(outerService.getRaidTree(md5)); + } catch (Exception e) { + log.error("模板详情查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.get.base.info.failed")); + } + } + + @Operation(summary = "根据md5值获取raid支持项", description = "根据md5值获取raid支持项") + @GetMapping("/raid/raidxml") + public ApiResult getRaidXml(@RequestParam("md5") String md5) { + try { + return ApiResult.success(outerService.getRaidXml(md5)); + } catch (Exception e) { + log.error("模板详情查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.get.base.info.failed")); + } + } + + @Operation(summary = "新增raid模板,templateBean对应操作所需参数", description = "新增raid模板") + @PostMapping("/template/raidadd") + public ApiResult addIBootRaidTemplate(@RequestBody IBootTemplateEntity iBootTemplateEntity) { + IBootTemplateEntity templateEntity = new IBootTemplateEntity(); + iBootTemplateEntity.setCreateUser(getCurrentUserName()); + templateEntity.setShow(true); + templateEntity.setTemplateType(iBootTemplateEntity.getTemplateType()); + try { + if (StringUtils.isEmpty(iBootTemplateEntity.getName())) { + return ApiResult.fail(Languages.getString("cosmos.iboot.template.save.param_error")); + } + List templateEntities = outerService.select(templateEntity); + if (CollUtil.isNotEmpty(templateEntities)) { + //名称重复不能添加 + if (templateEntities.stream().anyMatch(template -> iBootTemplateEntity.getName().equals(template.getName()))) { + return ApiResult.fail(Languages.getString("cosmos.iboot.template.name.not.duplicate", iBootTemplateEntity.getName())); + } + } + //校验raid配置,结构是否满足条件 + ResultBean res = outerService.checkGraphicRaid(iBootTemplateEntity); + if (!res.isFlag()) { + return ApiResult.fail(res.getMessage()); + } + IBootTemplateEntity entity = outerService.addTemplateWithEntity(iBootTemplateEntity); + return ObjectUtil.isNotNull(entity) ? ApiResult.success(entity) : ApiResult.fail(Languages.getString("cosmos.control.template.save.failed")); + } catch (Exception e) { + log.error("模板新增异常: {}, 模板: {}", e, iBootTemplateEntity); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.save.failed")); + } + } + + + @Operation(summary = "修改模板", description = "修改模板") + @PatchMapping("/template/edit") + public ApiResult updateIBootTemplate(@RequestBody IBootTemplateEntity iBootTemplateEntity) { + try { + iBootTemplateEntity.setUpdateUser(getCurrentUserName()); + return outerService.updateTemplate(iBootTemplateEntity) ? ApiResult.success() : ApiResult.fail(Languages.getString("cosmos.control.template.update.failed")); + } catch (Exception e) { + log.error("模板修改异常: {}, 模板: {}", e, iBootTemplateEntity); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.update.failed")); + } + } + + @Operation(summary = "删除模板,如果当前模板被某个任务占用提示不能删除", description = "删除模板") + @DeleteMapping("/template/{templateId}") + public ApiResult deleteIBootTemplate(@PathVariable("templateId") String templateId) { + try { + if (CollectionUtil.isNotEmpty(outerService.searchTemplateIsInTask(templateId))) { + return ApiResult.fail(Languages.getString("cosmos.iboot.template.delete.intask.failed")); + } + return outerService.deleteTemplateByIds(Collections.singletonList(templateId)) ? ApiResult.success() : ApiResult.fail(Languages.getString("cosmos.control.template.delete.failed")); + } catch (Exception e) { + log.error("模板删除异常: {}, 模板ID: {}", e, templateId); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.delete.failed")); + } + } + + @Operation(summary = "获取模板详情,包含模板对应操作参数", description = "获取模板详情") + @GetMapping("/template/{templatePk}") + public ApiResult queryIBootTemplateDetail(@PathVariable("templatePk") Long templatePk) { + try { + return ApiResult.success(outerService.queryTemplateDetail(templatePk)); + } catch (Exception e) { + log.error("模板详情查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.get.base.info.failed")); + } + } + + @Operation(summary = "获取模板详情,包含模板对应操作参数", description = "获取模板详情") + @GetMapping("/template/detail") + public ApiResult queryIBootTemplateDetailById(@RequestParam("templateId") String templateId) { + try { + return ApiResult.success(outerService.queryTemplateDetailById(templateId)); + } catch (Exception e) { + log.error("模板详情查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.get.base.info.failed")); + } + } + + @Operation(summary = "复制模板", description = "复制模板") + @PostMapping("/template/duplicate") + public ApiResult duplicateTemplate(@RequestBody IBootTemplateEntity templateEntity) { + try { + templateEntity.setCreateUser(getCurrentUserName()); + ResultBean resultBean = outerService.duplicateTemplate(templateEntity); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(resultBean.getMessage()); + } catch (Exception e) { + log.error("复制模板异常: ", e); + return ApiResult.fail(Languages.getString("iboot_DATA_EXCEPTION")); + } + } + + @Operation(summary = "带内文件上传", description = "带内文件上传") + @PostMapping("/inband/upload") + public ApiResult iBootInbandAdd(@RequestParam("file") MultipartFile file) throws IOException { + ResultBean resultBean = outerService.addInbandFile(file.getBytes(), file.getOriginalFilename()); + if (resultBean.isFlag()) { + return ApiResult.success(resultBean.getData()); + } else { + String errorStr = (String) resultBean.getData(); + return ApiResult.fail(errorStr); + } + } + + @Operation(summary = "带内文件删除", description = "带内文件删除") + @DeleteMapping("/inband/delete") + public ApiResult iBootInbandDelete(@RequestParam("fileId") String fileId) { + ResultBean resultBean = outerService.deleteInbandFile(fileId); + return resultBean.isFlag() ? ApiResult.success() : ApiResult.fail(); + } + + @Operation(summary = "应用模板,生成任务", description = "应用模板") + @PostMapping("/template/start/{templatePk}") + public ApiResult startTemplate(@PathVariable("templatePk") Long templatePk, @RequestBody IBootStartTaskBean iBootStartTaskBean) { + try { + if (ObjectUtil.isNotEmpty(iBootStartTaskBean) && CollUtil.isEmpty(iBootStartTaskBean.getResourceIdList()) && !iBootStartTaskBean.getDeviceQueryBean().getSelectAll()) { + return ApiResult.fail(Languages.getString("cosmos.iboot.arrange.resource.null")); + } + iBootStartTaskBean.setExcuteUser(getCurrentUserName()); + return outerService.startIBootTemplate(templatePk, iBootStartTaskBean) ? ApiResult.success() : ApiResult.fail(Languages.getString("cosmos.control.template.start.failed")); + } catch (Exception e) { + log.error("模板应用异常: {}, 模板ID: {}, 任务内容: {}", e, templatePk, iBootStartTaskBean); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.start.failed")); + } + } + + @Operation(summary = "批量装机", description = "批量装机") + @RequestMapping(value = "/template/os/installed", method = RequestMethod.POST) + public ApiResult ibootOsInstalled(@RequestBody IBootInstallParamBean iBootInstallParamBean) { + try { + if (BeanUtil.isEmpty(iBootInstallParamBean) || BeanUtil.isEmpty(iBootInstallParamBean.getDeviceQueryBean())) { + return ApiResult.fail(Languages.getString("cosmos.iboot.arrange.resource.null")); + } + return outerService.osInstalled(iBootInstallParamBean, getCurrentUserName()) ? ApiResult.success() : ApiResult.fail(Languages.getString("cosmos.control.template.os.install.failed")); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.os.install.failed")); + } + } + + @Operation(summary = "网络配置", description = "网络配置") + @RequestMapping(value = "/template/net/config", method = RequestMethod.POST) + public ApiResult networkConfig(@RequestBody DeviceQueryBean deviceQueryBean, @RequestParam(value = "fileId") String fileId) { + try { + if (BeanUtil.isEmpty(deviceQueryBean) || StringUtils.isEmpty(fileId)) { + return ApiResult.fail(Languages.getString("cosmos.iboot.arrange.resource.null")); + } + return outerService.networkConfig(deviceQueryBean, fileId, getCurrentUserName()) ? ApiResult.success() : ApiResult.fail(Languages.getString("cosmos.control.template.net.config.failed")); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(Languages.getString("cosmos.iboot.template.net.config.failed")); + } + } + + @Operation(summary = "根据系统类型查询时区列表", description = "根据系统类型查询时区列表") + @RequestMapping(value = "/template/getTimezoneListByType", method = RequestMethod.GET) + public ApiResult getTimezoneListByType(@RequestParam(value = "systemType", required = true) String systemType) { + try { + return ApiResult.success(outerService.getTimezoneBySysType(systemType)); + } catch (Exception e) { + return ApiResult.fail(Languages.getString("iboot_PARAMETER_IS_NULL_OR_ERROR")); + } + } + + @Operation(summary = "根据镜像类型获取默认ks", description = "根据镜像类型获取默认ks") + @RequestMapping(value = "/template/getDefaultKs", method = RequestMethod.POST) + public ApiResult getDefaultKs(@RequestParam(name = "id", required = true) String id) { + try { + ResultBean resultBean = outerService.getDefaultKs(id); + return resultBean.isFlag() ? ApiResult.success(resultBean.getData()) : ApiResult.fail(Languages.getString("control.iboot.default.ks")); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(Languages.getString("iboot.default.ks")); + } + } + + /** + * 文件预览 + * + * @param file 密钥文件 + * @return result + */ + @Operation(summary = "预览上传的ks文件内容", description = "预览上传的ks文件内容") + @RequestMapping(value = "/template/script/preview", method = RequestMethod.POST) + public ApiResult getPreview(@RequestParam("file") MultipartFile file) { + try { + InputStream inputStream = file.getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + StringBuffer stringBuffer = new StringBuffer(); + String str; + while ((str = reader.readLine()) != null) { + stringBuffer.append(str).append("\r\n"); + } + ScriptPreviewBean scriptPreviewBean = new ScriptPreviewBean(); + scriptPreviewBean.setFileByte(file.getBytes()); + scriptPreviewBean.setFileName(file.getOriginalFilename()); + scriptPreviewBean.setMd5(CommonUtil.md5(file.getInputStream())); + scriptPreviewBean.setContent(stringBuffer.toString()); + return ApiResult.success(scriptPreviewBean); + } catch (Exception e) { + log.error(e.getMessage(), e); + return ApiResult.fail(Languages.getString("iboot.script.preview")); + } + } + + /** + * 选择镜像,当镜像不包含ks时进行解析base environment + */ + @Operation(summary = "安装环境解析", description = "安装环境解析") + @RequestMapping(value = "/template/xmlAnalyse", method = RequestMethod.GET) + public ApiResult getXmlAnalyse(@RequestParam(value = "imageFileId") String imageId) { + try { + ImageXmlBean xmlEBeans = outerService.getXmlAnalyse(imageId); + return ApiResult.success(xmlEBeans); + } catch (Exception e) { + log.error(Languages.getString("cosmos.iboot.osinstall_template_query.baseE.failed")); + // 分析失败了也返回 + ImageXmlBean xmlEBeans = new ImageXmlBean(); + return ApiResult.success(xmlEBeans); + } + } + + @Operation(summary = "获取BOND脚本", description = "获取BOND脚本") + @RequestMapping(value = "/template/bondScript", method = RequestMethod.POST) + public ApiResult getBondScript(@RequestBody IBootBondShellBean bondShellBean) { + try { + ResultBean resultBean = outerService.getBondScript(bondShellBean); + if (resultBean.isFlag()) { + return ApiResult.success(resultBean.getData()); + } else { + return ApiResult.fail(resultBean.getMessage()); + } + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(Languages.getString("control.iboot.bond.script")); + } + } + + @Operation(summary = "网络配置批量导入模板下载", description = "网络配置批量导入模板下载") + @RequestMapping(value = "/template/excel/download", method = RequestMethod.POST) + public ResponseEntity downloadExcel(@RequestBody DeviceQueryBean deviceQueryBean, @RequestParam(value = "type") int type) { + byte[] bytes = outerService.downloadNetConfigExcel(deviceQueryBean, type); + try { + if (bytes != null) { + String fileName = "NetworkConfig.xls"; + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); + Charset charset = Charset.forName("UTF-8"); + ContentDisposition.Builder disposition = ContentDisposition.builder("form-data").name("attachment") + .filename(fileName, charset); + headers.setContentDisposition(disposition.build()); + ResponseEntity responseEntity = new ResponseEntity(bytes, headers, + HttpStatus.CREATED); + return responseEntity; + } else { + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @Operation(summary = "系统安装预览", description = "系统安装预览") + @RequestMapping(value = "/template/os/preview", method = RequestMethod.POST) + public ApiResult osInstallPreview(@RequestBody IBootInstallParamBean iBootInstallParamBean) { + try { + return ApiResult.success(outerService.osInstallPreviewResult(iBootInstallParamBean)); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(Languages.getString("control.iboot.os.preview")); + } + } + + @Operation(summary = "网络配置预览", description = "网络配置预览") + @RequestMapping(value = "/template/net/preview", method = RequestMethod.POST) + public ApiResult netWorkConfigPreview(@RequestBody DeviceQueryBean deviceQueryBean, @RequestParam(value = "fileId") String fileId) { + try { + return ApiResult.success(outerService.netConfigPreviewResult(deviceQueryBean, fileId)); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(Languages.getString("control.iboot.net.preview")); + } + } + + @Operation(summary = "获取压力测试历史", description = "获取压力测试历史") + @RequestMapping(value = "/template/stress/history", method = RequestMethod.POST) + public ApiResult stressTestHistory(@RequestBody IBootTaskQueryBean iBootTaskQueryBean) { + try { + return ApiResult.success(outerService.getStressHistory(iBootTaskQueryBean)); + } catch (Exception e) { + log.error(e.getMessage()); + return ApiResult.fail(Languages.getString("control.iboot.stress.history")); + } + } + + @Operation(summary = "压力测试报告图表数据获取", description = "压力测试报告图表数据获取") + @PostMapping(value = "/template/stress/report/{taskId}") + public ApiResult stressTestReportData(@PathVariable("taskId") String taskId) { + try { + return ApiResult.success(outerService.getStressTestReportData(taskId)); + } catch (Exception e) { + log.error("压测数据获取图表数据异常,异常信息为{} ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.stress.data.report.failed")); + } + + } + + //根据图表数据分页高级查询结果数据 原因 + @Operation(summary = "按条件分页查询所有压测数据", description = "分页查询当前设备下所有压测数据") + @PostMapping("/template/stress/page") + public ApiResult pageListStressTestServerByTaskId(@RequestBody IBootTaskQueryBean iBootTaskQueryBean) { + try { + return ApiResult.success(outerService.queryPageStressTestServerData(iBootTaskQueryBean)); + } catch (Exception e) { + log.error("压测数据查询异常: ", e); + return ApiResult.fail(Languages.getString("cosmos.iboot.stress.data.get.list.failed")); + } + } + + @Operation(summary = "压测报表导出") + @PostMapping(value = "/export") + public void exportAlarmReport(@RequestBody IBootTaskQueryBean query, HttpServletResponse response) { + try { + OutputStream out = response.getOutputStream(); + response.setHeader("Content-Type", "application/octet-stream"); + IBootStressExportBean stressExportBean = outerService.export(query); + response.setHeader("Content-Disposition", + "attachment;filename=" + URLEncoder.encode(stressExportBean.getFileName(), "UTF-8")); + byte[] by = stressExportBean.getBy(); + try { + out.write(by); + out.close(); + } catch (Exception e) { + log.error("export stress report fail:" + e.getMessage()); + } finally { + out.close(); + } + } catch (Exception e) { + log.error("Failed to get stress statistics info, error: ", e); + } + } + + @Data + public class ScriptPreviewBean { + String md5; + byte[] fileByte; + String fileName; + String content; + + } + + /**************************Mr.G专属区域结束 ***********************/ + +} + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/AbstractMemoryCacheOperator.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/AbstractMemoryCacheOperator.java new file mode 100644 index 0000000000000000000000000000000000000000..c19b138e11eed6df54b7d9fb6182c9c05326397b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/AbstractMemoryCacheOperator.java @@ -0,0 +1,53 @@ +package com.inspur.ispim.cosmos.iboot.base.application.cache; + +import cn.hutool.cache.impl.CacheObj; +import cn.hutool.cache.impl.TimedCache; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; + +import java.util.*; + +public abstract class AbstractMemoryCacheOperator implements CacheOperator { + + private final TimedCache timedCache; + + public AbstractMemoryCacheOperator(TimedCache timedCache) { + this.timedCache = timedCache; + } + + public void put(String key, T value) { + timedCache.put(getCommonKeyPrefix() + key, value); + } + + public T get(String key) { + // 如果用户在超时前调用了get(key)方法,会重头计算起始时间,false的作用就是不从头算 + return timedCache.get(getCommonKeyPrefix() + key, true); + } + + public void remove(String... key) { + for (String itemKey : key) { + timedCache.remove(getCommonKeyPrefix() + itemKey); + } + } + + private Collection getAllKeys() { + Iterator> cacheObjIterator = timedCache.cacheObjIterator(); + ArrayList keys = CollectionUtil.newArrayList(); + while (cacheObjIterator.hasNext()) { + // 去掉缓存key的common prefix前缀 + String key = cacheObjIterator.next().getKey(); + keys.add(StrUtil.removePrefix(key, getCommonKeyPrefix())); + } + return keys; + } + + public Map getAllKeyValues() { + Collection allKeys = this.getAllKeys(); + HashMap results = MapUtil.newHashMap(); + for (String key : allKeys) { + results.put(key, this.get(key)); + } + return results; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/CacheOperator.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/CacheOperator.java new file mode 100644 index 0000000000000000000000000000000000000000..e1b475753aeeb0156d082c531eca6f78b59adf4d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/CacheOperator.java @@ -0,0 +1,7 @@ +package com.inspur.ispim.cosmos.iboot.base.application.cache; + +public interface CacheOperator { + + String getCommonKeyPrefix(); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/RequestNoContext.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/RequestNoContext.java new file mode 100644 index 0000000000000000000000000000000000000000..e296a9da6881454244f88952dadac077344967bc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/RequestNoContext.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.application.cache; + +public class RequestNoContext { + + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + public static void set(String requestNo) { + CONTEXT_HOLDER.set(requestNo); + } + + public static String get() { + return CONTEXT_HOLDER.get(); + } + public static void clear() { + CONTEXT_HOLDER.remove(); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/UserCache.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/UserCache.java new file mode 100644 index 0000000000000000000000000000000000000000..42ef266cb590159b3f634b86b66a7570904fbe0a --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/cache/UserCache.java @@ -0,0 +1,21 @@ +package com.inspur.ispim.cosmos.iboot.base.application.cache; + +import cn.hutool.cache.impl.TimedCache; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SysLoginUser; + +public class UserCache extends AbstractMemoryCacheOperator { + + /** + * 登录用户缓存前缀 + */ + public static final String LOGIN_USER_CACHE_PREFIX = "LOGIN_USER_"; + + public UserCache(TimedCache timedCache) { + super(timedCache); + } + + @Override + public String getCommonKeyPrefix() { + return LOGIN_USER_CACHE_PREFIX; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/CacheConfig.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/CacheConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..a8ddc37891c4ab5eb152627599b510953474a2f7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/CacheConfig.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.application.config; + +import cn.hutool.cache.CacheUtil; +import cn.hutool.cache.impl.TimedCache; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SysLoginUser; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.ConstantContextHolder; +import com.inspur.ispim.cosmos.iboot.base.application.cache.UserCache; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +@Configuration +public class CacheConfig { + + @Bean + public UserCache userCache() { + TimedCache timedCache = + CacheUtil.newTimedCache(ConstantContextHolder.getSessionTokenExpireSec() * 1000); + + //定时清理缓存,间隔1秒 + timedCache.schedulePrune(1000); + + return new UserCache(timedCache); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/GlobalExceptionHandler.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/GlobalExceptionHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..ff456064c6de78530c78a6d9679362e63fa3d69f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/GlobalExceptionHandler.java @@ -0,0 +1,199 @@ +package com.inspur.ispim.cosmos.iboot.base.application.config; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.servlet.JakartaServletUtil; +import cn.hutool.log.Log; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.ErrorResponseData; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.AuthException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.DemoException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.PermissionException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.ServiceException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.ResponseUtil; +import com.inspur.ispim.cosmos.iboot.base.application.cache.RequestNoContext; +import com.inspur.ispim.cosmos.iboot.base.application.constant.CommonConstant; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.*; +import jakarta.servlet.http.HttpServletRequest; +import org.apache.ibatis.exceptions.PersistenceException; +import org.mybatis.spring.MyBatisSystemException; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.validation.BindException; +import org.springframework.validation.BindingResult; +import org.springframework.web.HttpMediaTypeNotSupportedException; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.MissingServletRequestParameterException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.servlet.NoHandlerFoundException; + + +@Order(-120) +@ControllerAdvice +public class GlobalExceptionHandler { + + private static final Log log = Log.get(); + + @ExceptionHandler(MissingServletRequestParameterException.class) + @ResponseBody + public ErrorResponseData missParamException(MissingServletRequestParameterException e) { + log.error(">>> 请求参数异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + String parameterType = e.getParameterType(); + String parameterName = e.getParameterName(); + String message = StrUtil.format(">>> 缺少请求的参数{},类型为{}", parameterName, parameterType); + return renderJson(500, message); + } + + @ExceptionHandler(HttpMessageNotReadableException.class) + @ResponseBody + public ErrorResponseData httpMessageNotReadable(HttpMessageNotReadableException e) { + log.error(">>> 参数格式传递异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + return renderJson(RequestTypeExceptionEnum.REQUEST_JSON_ERROR); + } + + @ExceptionHandler(HttpMediaTypeNotSupportedException.class) + @ResponseBody + public ErrorResponseData httpMediaTypeNotSupport(HttpMediaTypeNotSupportedException e) { + log.error(">>> 参数格式传递异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + return renderJson(RequestTypeExceptionEnum.REQUEST_TYPE_IS_JSON); + } + + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + @ResponseBody + public ErrorResponseData methodNotSupport(HttpServletRequest request) { + if (JakartaServletUtil.isPostMethod(request)) { + log.error(">>> 请求方法异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), RequestMethodExceptionEnum.REQUEST_METHOD_IS_GET.getMessage()); + return renderJson(RequestMethodExceptionEnum.REQUEST_METHOD_IS_GET); + } + if (JakartaServletUtil.isGetMethod(request)) { + log.error(">>> 请求方法异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), RequestMethodExceptionEnum.REQUEST_METHOD_IS_POST.getMessage()); + return renderJson(RequestMethodExceptionEnum.REQUEST_METHOD_IS_POST); + } + return null; + } + + @ExceptionHandler(NoHandlerFoundException.class) + @ResponseStatus(HttpStatus.NOT_FOUND) + @ResponseBody + public ErrorResponseData notFound(NoHandlerFoundException e) { + log.error(">>> 资源不存在异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + return renderJson(PermissionExceptionEnum.URL_NOT_EXIST); + } + + @ExceptionHandler(MethodArgumentNotValidException.class) + @ResponseBody + public ErrorResponseData methodArgumentNotValidException(MethodArgumentNotValidException e) { + String argNotValidMessage = getArgNotValidMessage(e.getBindingResult()); + log.error(">>> 参数校验错误异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), argNotValidMessage); + return renderJson(ParamExceptionEnum.PARAM_ERROR.getCode(), argNotValidMessage); + } + + @ExceptionHandler(BindException.class) + @ResponseBody + public ErrorResponseData paramError(BindException e) { + String argNotValidMessage = getArgNotValidMessage(e.getBindingResult()); + log.error(">>> 参数校验错误异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), argNotValidMessage); + return renderJson(ParamExceptionEnum.PARAM_ERROR.getCode(), argNotValidMessage); + } + @ExceptionHandler(AuthException.class) + @ResponseBody + public ErrorResponseData authFail(AuthException e) { + log.error(">>> 认证异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + return renderJson(e.getCode(), e.getErrorMessage()); + } + + @ExceptionHandler(PermissionException.class) + @ResponseBody + public ErrorResponseData noPermission(PermissionException e) { + log.error(">>> 权限异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + return renderJson(e.getCode(), e.getErrorMessage()); + } + + @ExceptionHandler(ServiceException.class) + @ResponseBody + public ErrorResponseData businessError(ServiceException e) { + log.error(">>> 业务异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + return renderJson(e.getCode(), e.getErrorMessage(), e); + } + + @ExceptionHandler(MyBatisSystemException.class) + @ResponseBody + public ErrorResponseData persistenceException(MyBatisSystemException e) { + log.error(">>> mybatis操作出现异常,请求号为:{},具体信息为:{}", RequestNoContext.get(), e.getMessage()); + Throwable cause = e.getCause(); + if (cause instanceof PersistenceException) { + Throwable secondCause = cause.getCause(); + if (secondCause instanceof DemoException) { + DemoException demoException = (DemoException) secondCause; + return ResponseUtil.responseDataError(demoException.getCode(), demoException.getErrorMessage(), e.getStackTrace()[0].toString()); + } + } + return ResponseUtil.responseDataError(ServerExceptionEnum.SERVER_ERROR.getCode(), ServerExceptionEnum.SERVER_ERROR.getMessage(), e.getStackTrace()[0].toString()); + } + + @ExceptionHandler(Throwable.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ResponseBody + public ErrorResponseData serverError(Throwable e) { + log.error(">>> 服务器运行异常,请求号为:{}", RequestNoContext.get()); + return renderJson(e); + } + + private ErrorResponseData renderJson(Integer code, String message) { + return renderJson(code, message, null); + } + + private ErrorResponseData renderJson(AbstractBaseExceptionEnum baseExceptionEnum) { + return renderJson(baseExceptionEnum.getCode(), baseExceptionEnum.getMessage(), null); + } + + private ErrorResponseData renderJson(Throwable throwable) { + return renderJson(((AbstractBaseExceptionEnum) ServerExceptionEnum.SERVER_ERROR).getCode(), + ((AbstractBaseExceptionEnum) ServerExceptionEnum.SERVER_ERROR).getMessage(), throwable); + } + + private ErrorResponseData renderJson(Integer code, String message, Throwable e) { + if (ObjectUtil.isNotNull(e)) { + + //获取所有堆栈信息 + StackTraceElement[] stackTraceElements = e.getStackTrace(); + + //默认的异常类全路径为第一条异常堆栈信息的 + String exceptionClassTotalName = stackTraceElements[0].toString(); + + for (StackTraceElement stackTraceElement : stackTraceElements) { + if (stackTraceElement.toString().contains(CommonConstant.DEFAULT_PACKAGE_NAME)) { + exceptionClassTotalName = stackTraceElement.toString(); + break; + } + } + return ResponseUtil.responseDataError(code, message, null); + } else { + return ResponseUtil.responseDataError(code, message, null); + } + } + + private String getArgNotValidMessage(BindingResult bindingResult) { + /*if (bindingResult == null) { + return ""; + } + StringBuilder stringBuilder = new StringBuilder(); + + //多个错误用逗号分隔 + List allErrorInfos = bindingResult.getAllErrors(); + for (ObjectError error : allErrorInfos) { + stringBuilder.append(SymbolConstant.COMMA).append(error.getDefaultMessage()); + } + + //最终把首部的逗号去掉 + return StrUtil.removePrefix(stringBuilder.toString(), SymbolConstant.COMMA);*/ + + //因为安全扫描, 此处返回的错误信息太多, 修改为返回参数错误 + return ParamExceptionEnum.PARAM_ERROR.getMessage(); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/IBootWebFacadeConfiguration.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/IBootWebFacadeConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..44f5b88a1c334cbb95f3ce342b297fd7ce241b43 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/IBootWebFacadeConfiguration.java @@ -0,0 +1,76 @@ +/* + *

Copyright © 2018 Inspur Group Co.,Ltd. 版权所有 浪潮集团有限公司

. + */ +package com.inspur.ispim.cosmos.iboot.base.application.config; + +import com.inspur.ispim.cosmos.iboot.base.api.service.*; +import com.inspur.ispim.cosmos.iboot.base.core.impl.*; +import com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall.IBootOsInstallFactory; +import com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate.TaskTemplateFactory; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.*; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author lisong01 + * @date 2023/7/26 17:35 + */ +@Configuration(proxyBeanMethods = false) +@ConditionalOnClass(OuterServiceImpl.class) +public class IBootWebFacadeConfiguration { + + @Bean + public DeviceService deviceService(DeviceMapper deviceMapper, IBootTemplateService iBootTemplateService, IBootRepositoryImageMapper iBootRepositoryImageMapper) { + return new DeviceServiceImpl(deviceMapper, iBootTemplateService, iBootRepositoryImageMapper); + } + + @Bean + public IBootRepositoryImageService iBootRepositoryImageService(IBootRepositoryImageMapper iBootRepositoryImageMapper) { + return new IBootRepositoryImageServiceImpl(iBootRepositoryImageMapper); + } + + @Bean + public TaskTemplateFactory TaskTemplateFactory(IBootTaskHostMapper iBootTaskHostMapper, + IBootOsInstallFactory iBootOsInstallFactory, + IBootInabndFileMapper iBootInabndFileMapper, + DeviceMapper deviceMapper) { + return new TaskTemplateFactory(iBootTaskHostMapper, iBootOsInstallFactory, iBootInabndFileMapper, deviceMapper); + } + + @Bean + public IBootTaskMessageHandler iBootTaskMessageHandler(IBootTaskMapper iBootTaskMapper, IBootTaskHostMapper iBootTaskHostMapper, IBootTaskHostLogMapper iBootTaskHostLogMapper, + IBootTaskHistoryMapper iBootTaskHistoryMapper, IBootTaskHostHistoryMapper iBootTaskHostHistoryMapper, TaskTemplateFactory taskTemplateFactory, DeviceMapper deviceMapper, IBootTemplateMapper templateMapper, IBootRepositoryImageMapper iBootRepositoryImageMapper) { + return new IBootTaskMessageHandler(iBootTaskMapper, iBootTaskHostMapper, iBootTaskHostLogMapper, iBootTaskHistoryMapper, iBootTaskHostHistoryMapper, taskTemplateFactory, deviceMapper, templateMapper, iBootRepositoryImageMapper); + } + + @Bean + public TaskService taskService(IBootTaskMapper iBootTaskMapper, IBootTaskHostMapper iBootTaskHostMapper, IBootTaskHostLogMapper iBootTaskHostLogMapper, + IBootTaskHistoryMapper iBootTaskHistoryMapper, IBootTaskHostHistoryMapper iBootTaskHostHistoryMapper, IBootTaskMessageHandler iBootTaskMessageHandler, DeviceMapper deviceMapper) { + return new TaskServiceImpl(iBootTaskMapper, iBootTaskHostMapper, iBootTaskHostLogMapper, iBootTaskHistoryMapper, iBootTaskHostHistoryMapper, iBootTaskMessageHandler, deviceMapper); + } + + @Bean + public IBootTemplateService iBootTemplateService(TaskService taskService, IBootTemplateMapper iBootTemplateMapper, + IBootInabndFileMapper iBootInabndFileMapper, DeviceMapper deviceMapper, + IBootTimezoneMapper iBootTimezoneMapper, IBootRepositoryImageMapper iBootRepositoryImageMapper, + IBootImageXmlMapper iBootImageXmlMapper, IBootOsInstallFactory iBootOsInstallFactory, + IBootRaidConfigXmlMapper iBootRaidConfigXmlMapper, IBootStressDataMapper iBootStressDataMapper, + IBootStressTessServerMapper iBootStressTessServerMapper) { + return new IBootTemplateServiceImpl(taskService, iBootTemplateMapper, iBootInabndFileMapper, deviceMapper, iBootTimezoneMapper, iBootRepositoryImageMapper, iBootImageXmlMapper, iBootOsInstallFactory, iBootRaidConfigXmlMapper, iBootStressDataMapper, iBootStressTessServerMapper); + } + + + @Bean + public InnerService innerService(DeviceService deviceService, TaskService taskService, IBootTemplateService iBootTemplateService) { + return new InnerServiceImpl(deviceService, taskService, iBootTemplateService); + } + + @Bean + public OuterService outerService(DeviceService deviceService, + IBootTemplateService iBootTemplateService, + TaskService taskService, IBootRepositoryImageService iBootRepositoryImageService) { + return new OuterServiceImpl(deviceService, iBootTemplateService, taskService, iBootRepositoryImageService); + } + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/SecurityConfigration.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/SecurityConfigration.java new file mode 100644 index 0000000000000000000000000000000000000000..71188bf08e5f45df43ac1c0bdc6db78b19919378 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/config/SecurityConfigration.java @@ -0,0 +1,116 @@ +package com.inspur.ispim.cosmos.iboot.base.application.config; + +import cn.hutool.core.util.StrUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.service.impl.AuthServiceImpl; +import com.inspur.ispim.cosmos.iboot.base.application.constant.Constant; +import com.inspur.ispim.cosmos.iboot.base.application.filter.JwtAuthenticationEntryPoint; +import com.inspur.ispim.cosmos.iboot.base.application.filter.JwtAuthenticationTokenFilter; +import jakarta.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +import static org.springframework.security.config.Customizer.withDefaults; + +@Configuration +@EnableWebSecurity +public class SecurityConfigration { + + @Resource + private AuthServiceImpl authService; + + @Resource + private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; + + @Resource + private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; + + @Autowired + private Environment env; + + @Bean + public CorsFilter corsFilter() { + CorsConfiguration corsConfiguration = new CorsConfiguration(); + String allowOrigin = env.getProperty("allow-origin"); + if (StrUtil.isEmpty(allowOrigin)) { + allowOrigin = "*"; + } + corsConfiguration.addAllowedOrigin(allowOrigin); + corsConfiguration.addAllowedHeader("*"); + corsConfiguration.addAllowedMethod("*"); + + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", corsConfiguration); + return new CorsFilter(source); + } + + @Bean + SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { + //开启模拟请求,比如API POST测试工具的测试,不开启时,API POST为报403错误 +// Customizer.withDefaults(); +// httpSecurity.csrf(csrf -> csrf.disable()); +// httpSecurity.csrf().disable(); + httpSecurity.csrf(AbstractHttpConfigurer::disable); + + //开启跨域访问 +// httpSecurity.cors(); + httpSecurity.cors(httpSecurityCorsConfigurer -> corsFilter()); + + //不使用默认退出,自定义退出 +// httpSecurity.logout().disable(); + httpSecurity.logout(AbstractHttpConfigurer::disable); + + + //未授权时访问须授权的资源端点 +// httpSecurity.exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint); + httpSecurity + // sample exception handling customization + .exceptionHandling((exceptionHandling) -> + exceptionHandling + .authenticationEntryPoint(jwtAuthenticationEntryPoint) + ); + + //放开一些接口的权限校验 + for (String notAuthResource : Constant.NONE_SECURITY_URL_PATTERNS) { + httpSecurity.authorizeRequests().requestMatchers(new AntPathRequestMatcher(notAuthResource)).permitAll(); + } + + //其余的都需授权访问 + httpSecurity.authorizeRequests().anyRequest().authenticated(); + + //前置token过滤器 + httpSecurity.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + + //用户详情service + httpSecurity.userDetailsService(authService); + + //全局不创建session +// httpSecurity.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); + httpSecurity.sessionManagement(withDefaults()); + + //禁用页面缓存,返回的都是json + httpSecurity + .headers((headers) -> + headers + .contentTypeOptions(withDefaults()) + .xssProtection(withDefaults()) + .cacheControl(withDefaults()) + .httpStrictTransportSecurity(withDefaults()) + // 禁用iframe嵌入网页 + .frameOptions(HeadersConfigurer.FrameOptionsConfig::disable) +// .frameOptions(withDefaults()) + ); + return httpSecurity.build(); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/CommonConstant.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/CommonConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..9c0aa0a470a21b5ca5298d2c8bdb4d90c58661f5 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/CommonConstant.java @@ -0,0 +1,45 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant; + +public interface CommonConstant { + + /** + * 用户代理 + */ + String USER_AGENT = "User-Agent"; + + /** + * 请求头token表示 + */ + String AUTHORIZATION = "Authorization"; + + /** + * token类型 + */ + String TOKEN_TYPE_BEARER = "Bearer"; + + /** + * 未知标识 + */ + String UNKNOWN = "Unknown"; + + /** + * 默认包名 + */ + String DEFAULT_PACKAGE_NAME = "com.inspur"; + + /** + * 用户锁定时间,单位为秒 + */ + long USER_LOCKED_TIME = 5 * 60L; + + /** + * 用户锁定时间,单位为秒 + */ + long USER_LOCKED_TIME_MIN = USER_LOCKED_TIME / 60L; + + /** + * 连续登陆失败次数锁定 + */ + int MAX_LOGIN_FAILED_LOCK_COUNT = 5; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/Constant.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/Constant.java new file mode 100644 index 0000000000000000000000000000000000000000..0ebf9e7adf70d160414fdceb0435b517067279f5 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/Constant.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant; + +/** + * @Description 常量 + * @Author zhanggq + * @Date 2022/9/21 14:57 + * @Version 1.0 + **/ +public class Constant { + /** + * 用户密码加密私钥 + */ + public static String PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCSvNdu64j4R5lW//j8qR6J9k5YbpwGpELcwEe9PWMdqNSNtrvU07b1fSTokUltTwDxdUbeXHBLDm62JxxZ18zC7m0wo898rQJO95z1Kl5fdFqbgzm38deYjDxeIvv5mw+abkoDax3ewM+k4pMKb/3F8zMWEi9RfOxKS/nBu5OueG3qilAKSQFa7OyphNG0H7CMxeQqjPnBl+d/yBD8mV+fQeURBFcgwhrxxln4oIPoQxv18aahQfG9Yj82MsQMhx4JfoqzDqVBSPV1A58sl0yShmel03ILvGycEA5/v3NXqZ0OoMlkd0K6o2t5D3EYp0JQHr2jX76er2Wk71balXx9AgMBAAECggEAOSlrWwBSGTX7HBMXMYXIKcJTfsuH6GZwzYHx8FxLkjBErPf0b9IRwcwAZsDCM9zE50riUpj7/aEfq8HMn4sbbwxmaL5Hg6/56D05XaAlp1WyPkZ+Y5PIgtqOYbWLJw8qouQ33OELf8zolrjUwwohd81npz9qQ3pAqiiyoK+rthkIRiD1BKjRA71z84s4s2OVc8jjHvfQnmaJtVWABS7WbrZTohfSvsEa0wQcG02RoknM5vBPzHJtKeecZ3aLc6zgvW9NQknLG08Arjf9xB+Fy1BF5oayrR2B/P0ZmlNUuiSs4++Kve5TLgxaOBAmY2mnuWnhFQJmu8FtHYDcIRX3QQKBgQDUViwZb8KbWZ8iuKeMy2OeWTd6jXE+sSqT/88gWxS0X3HTgwFLNqL6RGtVot3Ogq2EdtwPK3OOsYi4JMbf/Bb96TlgnkziPihd4tHcNapx+E18AHdlyCO5YBpMCQ7OAhFUrHyg9lcr/gI4CnTUvs5UIJUbK7z7m6KCesjmNcsqNQKBgQCw6WiCjhzaZdWF56W8IQaWIOHAWjItHSZ4qayjRcdgDFMLEqPWe4+PLZjLbN30JltrurcbHNIUtXIaCgghAjc+7Vm70t2+jIq+EGmss9lSQuICvbheSkr/IwVbOiKWPQN8TJkXRL3UOzNRWYXKD3GJTJS9c8U38zm4o5o9hkQSKQKBgH9tX3W8bkuQk0HhExwZiyUiYXr4mzeGVwkOgZznTBubE9JdUk9y8IfEu61e2kHuhndyZUntR6IgxO3NlFQjEyE576ceGQHFT7BYSJ0gz7Mp0kZSeVTpsRa0p9NttCbJcuEfyoNGkrXh8C71h3uNLoGqNBFkRDuzAOnRCfOt4MjpAoGAf0AksGPQVTeSkrLA/8Uxm6MjPtyh4tlo5roFN5vlgSzcPsa1mn1eEbrWgNxZ+lfswlyXgKUGZ2bsH9a/ah7R5i2LshJG9dzZn0Tm/haPZyA8uYQFraz6rPJf0/LJFg/lBe+C3r3PXW0HyKgAGAtruzqecndnkIsfJbRoKYD+TaECgYB9efZ8U+EkN/5fXumkL5iEu08xqnCOS80tuDliZFguZ8RQZPtoOQZZEJbQhnpQ7riikRXXsfRAX+tOJYMsOEd6IKnS8mUSE62oiRy5q3T07Lp+wQLVyvoFdbuTYw0mbFA6HgquaF76BU9E8bLe+sXziRhZb+sTxxx53ywn9UUJZQ=="; + + public static String DASH = "-"; + + + public static String[] NONE_SECURITY_URL_PATTERNS = { + + "/favicon.ico", + "/index.html", + "/iboot/sys/login", + "/v1/iboot/**", + "/logout" + }; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ConstantContext.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ConstantContext.java new file mode 100644 index 0000000000000000000000000000000000000000..c2507c8bc880c43842fb020dd4299169093ec9e6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ConstantContext.java @@ -0,0 +1,15 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant; + +import cn.hutool.core.lang.Dict; + +public class ConstantContext { + + /** + * 所有的常量,可以增删改查 + */ + private static final Dict CONSTANTS_HOLDER = Dict.create(); + + public static Dict me() { + return CONSTANTS_HOLDER; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ExpEnumConstant.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ExpEnumConstant.java new file mode 100644 index 0000000000000000000000000000000000000000..c8369112611bb3a962bbab55ce235e3875310b7e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ExpEnumConstant.java @@ -0,0 +1,43 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant; + +public interface ExpEnumConstant { + + int IBOOT_CORE_MODULE_EXP_CODE = 10; + + /* 分类编码(4位) */ + /** + * 认证异常枚举 + */ + int AUTH_EXCEPTION_ENUM = 1100; + + /** + * 参数校验异常枚举 + */ + int PARAM_EXCEPTION_ENUM = 1200; + + /** + * 授权和鉴权异常的枚举 + */ + int PERMISSION_EXCEPTION_ENUM = 1300; + + /** + * 请求方法相关异常枚举 + */ + int REQUEST_METHOD_EXCEPTION_ENUM = 1400; + + /** + * 请求类型相关异常枚举 + */ + int REQUEST_TYPE_EXCEPTION_ENUM = 1500; + + /** + * 服务器内部相关异常枚举 + */ + int SERVER_EXCEPTION_ENUM = 1600; + + /** + * 状态相关异常枚举 + */ + int STATUS_EXCEPTION_ENUM = 1700; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AbstractBaseExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AbstractBaseExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..026044e4e1ca54bed955ef5181be21bcaf3a473f --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AbstractBaseExceptionEnum.java @@ -0,0 +1,10 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + + +public interface AbstractBaseExceptionEnum { + + Integer getCode(); + + String getMessage(); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AdminTypeEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AdminTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..b308e7fb7b8a92280efe5faf4d9899ac1e4ebb2c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AdminTypeEnum.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import lombok.Getter; + +@Getter +public enum AdminTypeEnum { + + /** + * 超级管理员 + */ + SUPER_ADMIN(1, "超级管理员"), + + /** + * 非管理员 + */ + NONE(2, "非管理员"); + + private final Integer code; + + private final String message; + + AdminTypeEnum(int code, String message) { + this.code = code; + this.message = message; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AuthExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AuthExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..9dc61ffe60163678bb2c68bef9c66f2c0a1bfc97 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/AuthExceptionEnum.java @@ -0,0 +1,59 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.CommonConstant; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ExpEnumConstant; + +@ExpEnumType(module = ExpEnumConstant.IBOOT_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.AUTH_EXCEPTION_ENUM) +public enum AuthExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 账号或密码为空 + */ + ACCOUNT_PWD_EMPTY(1, "用户名或密码为空"), + + /** + * 账号密码错误 + */ + ACCOUNT_PWD_ERROR(2, "用户名或密码错误,失败" + CommonConstant.MAX_LOGIN_FAILED_LOCK_COUNT + "次后会被锁定," + CommonConstant.USER_LOCKED_TIME_MIN + "分钟后解锁"), + + /** + * 请求token错误 + */ + REQUEST_TOKEN_ERROR(401, "请求token错误"), + + /** + * 账号被冻结 + */ + ACCOUNT_FREEZE_ERROR(7, "账号被冻结,请联系管理员"), + + /** + * 失败次数过多锁定 + */ + USER_LOCKED(10, "用户名或密码错误,失败" + CommonConstant.MAX_LOGIN_FAILED_LOCK_COUNT + "次后会被锁定," + CommonConstant.USER_LOCKED_TIME_MIN + "分钟后解锁"), + + /** + * 解密错误 + */ + DECRYPT_ERROR(14, "用户名密码解密错误"); + + + private final Integer code; + + private final String message; + + AuthExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return code; + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/CommonStatusEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/CommonStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..d6779894d77c63d900727bf792c841feb3dacb23 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/CommonStatusEnum.java @@ -0,0 +1,38 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import lombok.Getter; + + +@Getter +public enum CommonStatusEnum { + + /** + * 正常 + */ + ENABLE(0, "正常"), + + /** + * 停用 + */ + DISABLE(1, "停用"), + + /** + * 删除 + */ + DELETED(2, "删除"), + + /** + * 锁定 + */ + LOCKED(3, "锁定"); + + private final Integer code; + + private final String message; + + CommonStatusEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ExpEnumCodeFactory.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ExpEnumCodeFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..2b129b6bd5788950f0f0817a48e1fa3e6cf06d18 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ExpEnumCodeFactory.java @@ -0,0 +1,22 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +public class ExpEnumCodeFactory { + + public static Integer getExpEnumCode(Class clazz, int code) { + + // 默认的异常响应码 + Integer defaultCode = Integer.valueOf("" + 99 + 9999 + 9); + + if (clazz == null) { + return defaultCode; + } else { + ExpEnumType expEnumType = clazz.getAnnotation(ExpEnumType.class); + if (expEnumType == null) { + return defaultCode; + } + return Integer.valueOf("" + expEnumType.module() + expEnumType.kind() + code); + } + + } + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ExpEnumType.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ExpEnumType.java new file mode 100644 index 0000000000000000000000000000000000000000..8c5210746ba4a20475b979bd2b02c730c969e2a7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ExpEnumType.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import java.lang.annotation.*; + +@Inherited +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE}) +public @interface ExpEnumType { + + /** + * 模块编码 + */ + int module() default 99; + + /** + * 分类编码 + */ + int kind() default 9999; + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ParamExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ParamExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..ad8181f0fbaef392f2ffad40bebcb05ff8153f55 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ParamExceptionEnum.java @@ -0,0 +1,31 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ExpEnumConstant; + +@ExpEnumType(module = ExpEnumConstant.IBOOT_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.PARAM_EXCEPTION_ENUM) +public enum ParamExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 参数错误 + */ + PARAM_ERROR(1, "参数错误"); + + private final Integer code; + + private final String message; + + ParamExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/PermissionExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/PermissionExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..099ae0384ba3623d6718dfc04cfc8d11ea54825b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/PermissionExceptionEnum.java @@ -0,0 +1,32 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ExpEnumConstant; + +@ExpEnumType(module = ExpEnumConstant.IBOOT_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.PERMISSION_EXCEPTION_ENUM) +public enum PermissionExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 资源路径不存在 + */ + URL_NOT_EXIST(1, "资源路径不存在,请检查请求地址"); + + private final Integer code; + + private final String message; + + PermissionExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/RequestMethodExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/RequestMethodExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..4ba7cbad5effd09af3712e96bdc47d2e64c64785 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/RequestMethodExceptionEnum.java @@ -0,0 +1,37 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ExpEnumConstant; + +@ExpEnumType(module = ExpEnumConstant.IBOOT_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.REQUEST_METHOD_EXCEPTION_ENUM) +public enum RequestMethodExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 不支持该请求方法,请求方法应为POST + */ + REQUEST_METHOD_IS_POST(1, "不支持该请求方法,请求方法应为POST"), + + /** + * 不支持该请求方法,请求方法应为GET + */ + REQUEST_METHOD_IS_GET(2, "不支持该请求方法,请求方法应为GET"); + + private final Integer code; + + private final String message; + + RequestMethodExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/RequestTypeExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/RequestTypeExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..f60df4595497958b267503233ba909ca9b57aecf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/RequestTypeExceptionEnum.java @@ -0,0 +1,37 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ExpEnumConstant; + +@ExpEnumType(module = ExpEnumConstant.IBOOT_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.REQUEST_TYPE_EXCEPTION_ENUM) +public enum RequestTypeExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 参数传递格式不支持 + */ + REQUEST_TYPE_IS_JSON(1, "参数传递格式不支持,请使用JSON格式传参"), + + /** + * 请求JSON参数格式不正确 + */ + REQUEST_JSON_ERROR(2, "请求JSON参数格式不正确,请检查参数格式"); + + private final Integer code; + + private final String message; + + RequestTypeExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ServerExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ServerExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..05fee1fb8c3167ae541d72ec04d15f199ceaba00 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/ServerExceptionEnum.java @@ -0,0 +1,37 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ExpEnumConstant; + +@ExpEnumType(module = ExpEnumConstant.IBOOT_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.SERVER_EXCEPTION_ENUM) +public enum ServerExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 当前请求参数为空或数据缺失 + */ + REQUEST_EMPTY(1, "当前请求参数为空或数据缺失,请联系管理员"), + + /** + * 服务器出现未知异常 + */ + SERVER_ERROR(2, "服务器出现异常,请联系管理员"); + + private final Integer code; + + private final String message; + + ServerExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/StatusExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/StatusExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..b3d68e0e3c134d4898d4edf9f4fd5ff4ef32c770 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/constant/ienum/StatusExceptionEnum.java @@ -0,0 +1,37 @@ +package com.inspur.ispim.cosmos.iboot.base.application.constant.ienum; + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ExpEnumConstant; + +@ExpEnumType(module = ExpEnumConstant.IBOOT_CORE_MODULE_EXP_CODE, kind = ExpEnumConstant.STATUS_EXCEPTION_ENUM) +public enum StatusExceptionEnum implements AbstractBaseExceptionEnum { + + + /** + * 请求状值为非正确状态值 + */ + NOT_WRITE_STATUS(2, "请求状态值不合法"); + + private final Integer code; + + private final String message; + + StatusExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + public static void main(String[] args) { + System.out.println(StatusExceptionEnum.NOT_WRITE_STATUS.getCode()); + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/filter/JwtAuthenticationEntryPoint.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/filter/JwtAuthenticationEntryPoint.java new file mode 100644 index 0000000000000000000000000000000000000000..586050978b8e521829c7bcec5744dca61242e8f4 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/filter/JwtAuthenticationEntryPoint.java @@ -0,0 +1,24 @@ +package com.inspur.ispim.cosmos.iboot.base.application.filter; + +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.ResponseUtil; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AuthExceptionEnum; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.io.Serializable; + +@Component +public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint, Serializable { + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException { + ResponseUtil.responseExceptionError(response, + AuthExceptionEnum.REQUEST_TOKEN_ERROR.getCode(), + AuthExceptionEnum.REQUEST_TOKEN_ERROR.getMessage(), + ""); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/filter/JwtAuthenticationTokenFilter.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/filter/JwtAuthenticationTokenFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..17620a22a73a45118e7779d8dedc523e1141d24d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/filter/JwtAuthenticationTokenFilter.java @@ -0,0 +1,61 @@ +package com.inspur.ispim.cosmos.iboot.base.application.filter; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SysLoginUser; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.AuthException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.service.AuthService; +import com.inspur.ispim.cosmos.iboot.base.application.auth.util.ResponseUtil; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.ServerExceptionEnum; +import jakarta.annotation.Resource; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import java.io.IOException; + + +@Component +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { + + @Resource + private AuthService authService; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException { + try { + doFilter(request, response, filterChain); + } catch (Exception e) { + ResponseUtil.responseExceptionError(response, ServerExceptionEnum.SERVER_ERROR.getCode(), + ServerExceptionEnum.SERVER_ERROR.getMessage(), e.getStackTrace()[0].toString()); + } + } + + private void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException { + + // 1.如果当前请求带了token,判断token时效性,并获取当前登录用户信息 + SysLoginUser sysLoginUser = null; + try { + String token = authService.getTokenFromRequest(request); + if (StrUtil.isNotEmpty(token)) { + sysLoginUser = authService.getLoginUserByToken(token); + } + } catch (AuthException ae) { + //token过期或者token失效的情况,响应给前端 + ResponseUtil.responseExceptionError(response, ae.getCode(), ae.getErrorMessage(), ""); + return; + } + + // 2.如果当前登录用户不为空,就设置spring security上下文 + if (ObjectUtil.isNotNull(sysLoginUser)) { + authService.setSpringSecurityContextAuthentication(sysLoginUser); + } + + // 3.其他情况放开过滤 + filterChain.doFilter(request, response); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/controller/SysUserController.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/controller/SysUserController.java new file mode 100644 index 0000000000000000000000000000000000000000..0c08d6c3b3855408d4bade5690053d5225f0b9fc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/controller/SysUserController.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.controller; + +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.ResponseData; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.SuccessResponseData; +import com.inspur.ispim.cosmos.iboot.base.application.user.param.SysUserParam; +import com.inspur.ispim.cosmos.iboot.base.application.user.service.SysUserService; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class SysUserController { + + @Resource + private SysUserService sysUserService; + + @PostMapping("/sysUser/updatePwd") + public ResponseData updatePwd(@RequestBody @Validated(SysUserParam.updatePwd.class) SysUserParam sysUserParam) { + sysUserParam.setId(1569511062206742530L); + sysUserService.updatePwd(sysUserParam); + return new SuccessResponseData(); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/entity/SysUser.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/entity/SysUser.java new file mode 100644 index 0000000000000000000000000000000000000000..2869b279e21d31a58cc612501aea5ab2a8555e70 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/entity/SysUser.java @@ -0,0 +1,83 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + + +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("cosmos_iboot_sys_user") +public class SysUser extends BaseEntity { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + + /** + * 账号 + */ + private String account; + + /** + * 密码 + */ + private String password; + + /** + * 姓名 + */ + private String name; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机 + */ + private String phone; + + /** + * 最后登陆IP + */ + private String lastLoginIp; + + /** + * 最后登陆时间 + */ + private Date lastLoginTime; + + /** + * 登录失败次数 + */ + private Integer loginFailCount; + + /** + * 最后登录失败时间 + */ + private Date firstLoginFailTime; + + /** + * 最近一次修改密码时间 + */ + private Date lastUpdPwdTime; + + /** + * 状态(字典 0正常 1停用 2删除) + */ + private Integer status; + + /** + * 管理员类型(1超级管理员 2非管理员) + */ + private Integer adminType; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/enums/SysUserExceptionEnum.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/enums/SysUserExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..0cd947fee0b7709eee8bbcb4ea4b12f14d463677 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/enums/SysUserExceptionEnum.java @@ -0,0 +1,57 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.enums; + + +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AbstractBaseExceptionEnum; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.ExpEnumCodeFactory; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.ExpEnumType; + + +@ExpEnumType(module = 20, kind = 2000) +public enum SysUserExceptionEnum implements AbstractBaseExceptionEnum { + + /** + * 用户不存在 + */ + USER_NOT_EXIST(1, "用户不存在"), + + /** + * 原密码错误 + */ + USER_PWD_ERROR(3, "原密码错误,请检查!"), + + /** + * 新密码与原密码相同 + */ + USER_PWD_REPEAT(4, "新密码与原密码相同,请检查!"), + + + /** + * 新密码与用户名相同 + */ + USER_PWD_REPEAT_ACCOUNT(7, "新密码与用户名相同,请重新设置"), + + /** + * 新密码与用户名倒写相同 + */ + USER_PWD_REPEAT_ACCOUNT_REVERSE(7, "新密码与用户名倒写相同,请重新设置"); + + private final Integer code; + + private final String message; + + SysUserExceptionEnum(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); + } + + @Override + public String getMessage() { + return message; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/mapper/SysUserMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/mapper/SysUserMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e70443e5d7580095a2f7d4d4acfdc53c320d0faf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/mapper/SysUserMapper.java @@ -0,0 +1,26 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.inspur.ispim.cosmos.iboot.base.application.user.entity.SysUser; +import com.inspur.ispim.cosmos.iboot.base.application.user.result.SysUserResult; +import org.apache.ibatis.annotations.Param; + + +public interface SysUserMapper extends BaseMapper { + + + Page page(@Param("page") Page page, @Param("ew") QueryWrapper queryWrapper); + + Integer getPageTotal(@Param("ew") QueryWrapper queryWrapper); + + SysUser findLoginUserInfoById(Long userId); + + void userLoginFailCountIncrement(String account); + + SysUser getOneVSysUser(String account); + + // 客服对接 + SysUser getOneVSysUserById(Long userId); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/param/SysUserParam.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/param/SysUserParam.java new file mode 100644 index 0000000000000000000000000000000000000000..d0dfdad07bf38616299dba7e6cf5bf9bd792fb81 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/param/SysUserParam.java @@ -0,0 +1,66 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.param; + +import com.inspur.ispim.cosmos.iboot.base.application.auth.bean.BaseParam; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +@EqualsAndHashCode(callSuper = true) +@Data +public class SysUserParam extends BaseParam { + + /** + * 主键 + */ + @NotNull(message = "id不能为空,请检查id参数", + groups = {BaseParam.edit.class, delete.class, detail.class, start.class, + stop.class, grantRole.class, grantData.class, updateInfo.class, + updatePwd.class, resetPwd.class, changeStatus.class, updateAvatar.class}) + private Long id; + + /** + * 账号 + */ + @NotBlank(message = "账号不能为空,请检查account参数", groups = {add.class, edit.class}) + private String account; + + /** + * 密码 + */ + @NotBlank(message = "密码不能为空,请检查password参数", groups = {updatePwd.class}) + private String password; + + /** + * 新密码 + */ + @NotBlank(message = "新密码不能为空,请检查newPassword参数", groups = {updatePwd.class}) + private String newPassword; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空,请检查name参数", groups = {add.class, edit.class}) + private String name; + + /** + * 邮箱 + */ + @Email(message = "邮箱格式错误,请检查email参数", groups = {updateInfo.class}) + private String email; + + /** + * 手机 + */ + @NotNull(message = "手机号码不能为空,请检查phone参数", groups = {add.class, edit.class, updateInfo.class}) + @Size(min = 11, max = 11, message = "手机号码格式错误,请检查phone参数", groups = {add.class, edit.class, updateInfo.class}) + private String phone; + /** + * 状态(字典 0正常 1停用 2删除) + */ + @NotNull(message = "状态不能为空,请检查status参数", groups = changeStatus.class) + private Integer status; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/result/SysUserResult.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/result/SysUserResult.java new file mode 100644 index 0000000000000000000000000000000000000000..883231c17ae013c9384c21309cdb55a58ebd2003 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/result/SysUserResult.java @@ -0,0 +1,38 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.result; + +import lombok.Data; + +import java.util.Date; + +@Data +public class SysUserResult { + + /** + * 主键 + */ + private Long id; + + /** + * 账号 + */ + private String account; + + /** + * 姓名 + */ + private String name; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机 + */ + private String phone; + + private Date createTime; + + private Date updateTime; +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/service/SysUserService.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/service/SysUserService.java new file mode 100644 index 0000000000000000000000000000000000000000..bfc394bdd62511ddf6ffe5262535dd044794c909 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/service/SysUserService.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.inspur.ispim.cosmos.iboot.base.application.user.entity.SysUser; +import com.inspur.ispim.cosmos.iboot.base.application.user.param.SysUserParam; + +public interface SysUserService extends IService { + + SysUser getUserByCount(String account); + + + void updatePwd(SysUserParam sysUserParam); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/service/impl/SysUserServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..22a49e615ece2281348a8148bb6c81958a528d56 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/java/com/inspur/ispim/cosmos/iboot/base/application/user/service/impl/SysUserServiceImpl.java @@ -0,0 +1,95 @@ +package com.inspur.ispim.cosmos.iboot.base.application.user.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.digest.BCrypt; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.AuthException; +import com.inspur.ispim.cosmos.iboot.base.application.auth.exception.ServiceException; +import com.inspur.ispim.cosmos.iboot.base.application.constant.Constant; +import com.inspur.ispim.cosmos.iboot.base.application.constant.ienum.AuthExceptionEnum; +import com.inspur.ispim.cosmos.iboot.base.application.user.entity.SysUser; +import com.inspur.ispim.cosmos.iboot.base.application.user.enums.SysUserExceptionEnum; +import com.inspur.ispim.cosmos.iboot.base.application.user.mapper.SysUserMapper; +import com.inspur.ispim.cosmos.iboot.base.application.user.param.SysUserParam; +import com.inspur.ispim.cosmos.iboot.base.application.user.service.SysUserService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; + +import javax.crypto.Cipher; +import java.security.KeyFactory; +import java.security.interfaces.RSAPrivateKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Base64; +import java.util.Date; +@Service +public class SysUserServiceImpl extends ServiceImpl implements SysUserService { + + + @Resource + private SysUserMapper sysUserMapper; + + public static byte[] decrypt(byte[] str, String privateKey) throws Exception { + byte[] decoded = Base64.getDecoder().decode(privateKey); + RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded)); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(2, priKey); + return cipher.doFinal(str); + } + + @Override + public SysUser getUserByCount(String account) { + return sysUserMapper.getOneVSysUser(account); + } + + private SysUser getUserByUserId(Long userId) { + return sysUserMapper.getOneVSysUserById(userId); + } + + @Override + public void updatePwd(SysUserParam sysUserParam) { + String password = sysUserParam.getPassword(); + String newPassword = sysUserParam.getNewPassword(); + try { + if (StrUtil.isNotEmpty(password)) { + password = new String(decrypt(Base64.getDecoder().decode(password), Constant.PRIVATE_KEY)); + sysUserParam.setPassword(password); + } + + if (StrUtil.isNotEmpty(newPassword)) { + newPassword = new String(decrypt(Base64.getDecoder().decode(newPassword), Constant.PRIVATE_KEY)); + sysUserParam.setNewPassword(newPassword); + } + } catch (Exception e) { + throw new AuthException(AuthExceptionEnum.DECRYPT_ERROR); + } + + SysUser sysUser = this.querySysUser(sysUserParam); + //密码与用户名相同 + if (sysUserParam.getNewPassword().equals(sysUser.getAccount())) { + throw new ServiceException(SysUserExceptionEnum.USER_PWD_REPEAT_ACCOUNT); + } + //密码与用户名倒写相同 + if (sysUserParam.getNewPassword().equals(StrUtil.reverse(sysUser.getAccount()))) { + throw new ServiceException(SysUserExceptionEnum.USER_PWD_REPEAT_ACCOUNT_REVERSE); + } + //新密码与原密码相同 + if (sysUserParam.getNewPassword().equals(sysUserParam.getPassword())) { + throw new ServiceException(SysUserExceptionEnum.USER_PWD_REPEAT); + } + if (!BCrypt.checkpw(sysUserParam.getPassword(), sysUser.getPassword())) { + throw new ServiceException(SysUserExceptionEnum.USER_PWD_ERROR); + } + sysUser.setPassword(BCrypt.hashpw(sysUserParam.getNewPassword(), BCrypt.gensalt())); + sysUser.setLastUpdPwdTime(new Date()); + this.updateById(sysUser); + } + + private SysUser querySysUser(SysUserParam sysUserParam) { + SysUser sysUser = this.getUserByUserId(sysUserParam.getId()); + if (ObjectUtil.isNull(sysUser)) { + throw new ServiceException(SysUserExceptionEnum.USER_NOT_EXIST); + } + return sysUser; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/META-INF/spring.factories b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000000000000000000000000000000000000..9f2cdb1c7af790263f57c536395ca01805f76631 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/META-INF/spring.factories @@ -0,0 +1 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.inspur.ispim.cosmos.iboot.base.application.config.IBootWebFacadeConfiguration diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000000000000000000000000000000000..4b30bd779bc960514a83eb7331d8a1420308d3c1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.inspur.ispim.cosmos.iboot.base.application.config.IBootWebFacadeConfiguration diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/application.properties b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..7bd65f5b0d11846c87dde9930079f6e8ca029a6c --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/application.properties @@ -0,0 +1,75 @@ +# ****************************************[Spring][START]************************************************ +spring.application.name=MonoIbootService +spring.jackson.default-property-inclusion=always +# circular reference switch +spring.main.allow-circular-references=true +spring.main.allow-bean-definition-overriding=true +# application port +server.port=32411 +server.tomcat.accept-count=100 +server.tomcat.max-connections=1000 +server.tomcat.threads.max=200 +server.tomcat.threads.min-spare=10 +server.servlet.context-path=/ +#1000Mb +spring.servlet.multipart.max-file-size=2048MB +#1000Mb +spring.servlet.multipart.max-request-size=2048MB +jasypt.encryptor.password=8pz9cMMTfugYgLqCOn2rgzNb2v+pRK3W +jasypt.encryptor.algorithm=PBEWithMD5AndDES +jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator +# ****************************************[Spring][END]************************************************ +# ****************************************[MySQL][START]************************************************ +spring.datasource.type=com.alibaba.druid.pool.DruidDataSource +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://address=(protocol=tcp)(host=100.2.74.193)(port=3306)/inmanagedb?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true +spring.datasource.username=root +spring.datasource.password=Inspur1! +#ENC(9MYWiSn2/0+KFBQ5STSP4E3sxJXd6Rcu) +mybatis-plus.configuration.map-underscore-to-camel-case=true +mybatis-plus.mapper-locations=classpath*:mapper/**/*.xml +mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl +#\u5FAA\u73AF\u68C0\u6D4BminEvictableIdleTimeMillis\u7684\u65F6\u95F4\u95F4\u9694\uFF0C\u9ED8\u8BA4\u662F1min +spring.datasource.druid.timeBetweenEvictionRunsMillis=60000 +#\u8FDE\u63A5\u4FDD\u6301\u7A7A\u95F2\u800C\u4E0D\u88AB\u9A71\u9010\u7684\u6700\u5C0F\u65F6\u95F4\uFF0C\u9ED8\u8BA45\u5206\u949F +spring.datasource.druid.minEvictableIdleTimeMillis=300000 +spring.datasource.druid.min-idle=200 +spring.datasource.druid.max-active=200 +#\u7528\u6765\u68C0\u6D4B\u8FDE\u63A5\u662F\u5426\u6709\u6548\u7684sql +spring.datasource.druid.validationQuery=SELECT 'x' +#\u5982\u679C\u7A7A\u95F2\u65F6\u95F4\u5927\u4E8EtimeBetweenEvictionRunsMillis\uFF0C\u6267\u884CvalidationQuery\u68C0\u6D4B\u8FDE\u63A5\u662F\u5426\u6709\u6548 +spring.datasource.druid.testWhileIdle=true +#\u7533\u8BF7\u8FDE\u63A5\u65F6\u68C0\u6D4B\u8FDE\u63A5\u662F\u5426\u6709\u6548 +spring.datasource.druid.testOnBorrow=false +#\u5F52\u8FD8\u8FDE\u63A5\u65F6\uFF0C\u68C0\u6D4B\u8FDE\u63A5\u662F\u5426\u6709\u6548 +spring.datasource.druid.testOnReturn=false +#\u662F\u5426\u7F13\u5B58poolPreparedStatements\uFF0C\u5BF9\u652F\u6301\u6E38\u6807\u7684\u6570\u636E\u5E93\u6027\u80FD\u63D0\u5347\u5DE8\u5927\uFF0Cmysql\u4E0B\u5EFA\u8BAE\u5173\u95ED +spring.datasource.druid.poolPreparedStatements=false +#\u4E0EpoolPreparedStatements\u914D\u5408\uFF0C-1\u9ED8\u8BA4\u4E0D\u542F\u7528 +spring.datasource.druid.maxPoolPreparedStatementPerConnectionSize=-1 +#\u53EA\u6709\u914D\u7F6E\u4E0Aconfig\u8FC7\u6EE4\u5668\uFF0C\u8BBE\u7F6E\u7684\u6570\u636E\u5E93\u52A0\u5BC6\u673A\u5236\u624D\u80FD\u751F\u6548\uFF0C\u540C\u65F6\u542F\u7528stat\u76D1\u63A7sql\uFF0C\u4EE5\u53CAwall sql\u9632\u706B\u5899 +spring.datasource.druid.filters=stat,config,wall +#\u6570\u636E\u5E93\u5BC6\u7801\u91C7\u7528\u975E\u5BF9\u79F0\u52A0\u5BC6\u65B9\u5F0F\uFF0C\u5177\u4F53\u5BC6\u7801\u751F\u6210\u65B9\u5F0F\u53EF\u4EE5\u53C2\u8003druid\u5B98\u65B9\u65B9\u6848\uFF0C\u9700\u8981\u5C06\u516C\u94A5\u914D\u7F6E\u5230connectionProperties\u5C5E\u6027\u4E2D\uFF0C\u79C1\u94A5\u9ED8\u8BA4\u5185\u7F6E\u4E8Ejvm +spring.datasource.druid.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000; +logging.file.name=../logs/cosmos-mono-iboot.log +# ****************************************[MySQL][END]************************************************ +# ****************************************[LogBack][START]************************************************ +# SUPPORT THREE LEVEL(DEBUG/INFO/ERROR) +debug=true +logging.level.root=info +logging.file.path=../logs +isMainNode=1 +# ****************************************[LogBack][END]************************************************ +#flyway +spring.flyway.enabled=true +spring.flyway.locations=classpath:db +spring.flyway.sql-migration-prefix=V +spring.flyway.sql-migration-separator=__ +spring.flyway.out-of-order=true +spring.flyway.validate-on-migrate=false +spring.flyway.url=${spring.datasource.url} +spring.flyway.user=${spring.datasource.username} +spring.flyway.password=${spring.datasource.password} +spring.flyway.baselineOnMigrate=true +#\u670D\u52A1\u90E8\u7F72\u7248\u672Cmono | cloud + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231225181701__iboot_user.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231225181701__iboot_user.sql new file mode 100644 index 0000000000000000000000000000000000000000..8baf6b35d9f1f8133bf8d657313000cf145931cc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231225181701__iboot_user.sql @@ -0,0 +1,87 @@ +DROP TABLE IF EXISTS `cosmos_iboot_sys_user`; +CREATE TABLE `cosmos_iboot_sys_user` +( + `id` bigint NOT NULL COMMENT '主键', + `account` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '账号', + `password` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '密码', + `name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '姓名', + `email` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '邮箱', + `phone` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '手机', + `last_login_ip` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '最后登陆IP', + `last_login_time` datetime DEFAULT NULL COMMENT '最后登陆时间', + `admin_type` tinyint DEFAULT '1' COMMENT '管理员类型(1超级管理员 2非管理员)', + `status` tinyint DEFAULT '0' COMMENT '状态(字典 0正常 1冻结 2删除)', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `create_user` bigint DEFAULT NULL COMMENT '创建人', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `update_user` bigint DEFAULT NULL COMMENT '更新人', + `login_fail_count` tinyint DEFAULT '0' COMMENT '登录失败次数', + `first_login_fail_time` datetime DEFAULT NULL, + `last_upd_pwd_time` datetime DEFAULT NULL COMMENT '最近一次修改密码时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='系统用户表'; + +-- ---------------------------- +-- Records of cosmos_iboot_sys_user +-- ---------------------------- +INSERT INTO `cosmos_iboot_sys_user` +VALUES ('1569511062206742530', 'admin', '$2a$10$VGEQ.Ug1AtPjLMsJKeXpyeyTkKVrracUHvU.RKXi95EzSwncL/w8W', 'admin', + '10252152154@qq.com', '11111111111', '100.17.130.87', '2023-12-12 15:12:57', '2', '0', '2022-09-13 10:19:32', + '1265476890672672808', '2023-12-12 15:12:57', '-1', '0', null, null); + +CREATE TABLE IF NOT EXISTS `starlet_control_repository_image` +( + `name` varchar +( + 128 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '名称,改名之后的', + `original_name` varchar +( + 128 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '原始文件名,包括后缀名', + `full_path` varchar +( + 512 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '绝对路径', + `is_has_ks` tinyint unsigned DEFAULT NULL COMMENT '是否包含ks文件', + `is_custom_image` tinyint unsigned DEFAULT NULL COMMENT '是否自定义文件', + `is_show` tinyint unsigned DEFAULT NULL COMMENT '是否展示', + `image_type` varchar +( + 64 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '镜像类型(型号)', + `version` varchar +( + 64 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '版本', + `architecture` enum +( + 'mips', + 'arm', + 'x86_64' +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT 'x86_64' COMMENT '架构', + `create_user` varchar +( + 64 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '存储创建用户的ID', + `update_user` varchar +( + 64 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改用户的ID', + `pk` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char +( + 64 +) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '业务主键', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `insource` tinyint DEFAULT NULL COMMENT '是否在yum源中,1是 0否', + PRIMARY KEY +( + `pk` +), + UNIQUE KEY `id` +( + `id` +) USING BTREE + ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb3 COLLATE =utf8mb3_bin COMMENT='仓库镜像表,专门存储ISO镜像'; diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231228150301__iboot_image.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231228150301__iboot_image.sql new file mode 100644 index 0000000000000000000000000000000000000000..2018afe3688c5ef2bc5bc6ef7798a14e42f989bc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231228150301__iboot_image.sql @@ -0,0 +1,66 @@ +DROP TABLE IF EXISTS `starlet_control_other_supported_image`; +CREATE TABLE `starlet_control_other_supported_image` ( + `pk` bigint(0) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '业务主键', + `image_type` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '发行版', + `version` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '版本', + `is_need_ks` tinyint(0) UNSIGNED NULL DEFAULT NULL COMMENT '表示该版本仅支持自带KS的情况', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`pk`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 49 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin COMMENT = '辅助表,存储目前支持的安装镜像' ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS `starlet_control_image_xml`; +CREATE TABLE `starlet_control_image_xml` ( + `id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, + `pk` bigint(0) NOT NULL AUTO_INCREMENT, + `image_id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL, + `enviroment` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL, + PRIMARY KEY (`pk`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_bin ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of starlet_control_other_supported_image +-- ---------------------------- +INSERT INTO `starlet_control_other_supported_image` VALUES (1, 'e3b91ffad62811eca4b900163ec66df0', 'CentOS', 'CentOS7U3', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (2, 'e3191ffad62811eca4b900163ec66df0', 'CentOS', 'CentOS7U4', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (3, 'e3291ffad62811eca4b900163ec66df0', 'CentOS', 'CentOS7U5', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (4, 'e3111ffad62811eca4b900163ec66df0', 'CentOS', 'CentOS7U6', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (5, 'e3121ffad62811eca4b900163ec66df0', 'CentOS', 'CentOS7U7', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (6, 'e3131ffad62811eca4b900163ec66df0', 'CentOS', 'CentOS7U8', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (7, 'e3191ffad12811eca4b900163ec66df0', 'CentOS', 'CentOS7U9', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (8, 'e3191ffad22811eca4b900163ec66df0', 'CentOS', 'CentOS8U1', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (9, 'e3191ffad32811eca4b900163ec66df0', 'CentOS', 'CentOS8U2', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (10, 'e3191ffad42811eca4b900163e3c66df0', 'CentOS', 'CentOS8U3', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (11, 'e3191ffad52811eca4b900162ec66df0', 'CentOS', 'CentOS8U4', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (12, 'e3191ffad72811eca4b90016ec664df0', 'RHEL', 'RHEL7U3', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (13, 'e3191ffad82811eca4b900163ec66df0', 'RHEL', 'RHEL7U4', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (14, 'e3191ffad92811eca4b900163ec66df0', 'RHEL', 'RHEL7U5', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (15, 'e3191ffad62811eca4b900113ec66df0', 'RHEL', 'RHEL7U6', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (16, 'e3191ffad62811eca4b900123ec66df0', 'RHEL', 'RHEL7U7', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (17, 'e3191ffad62811eca4b900133ec66df0', 'RHEL', 'RHEL7U8', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (18, 'e3191ffad62811eca4b900143ec66df0', 'RHEL', 'RHEL7U9', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (19, 'e3191ffad62811eca4b900153ec66df0', 'RHEL', 'RHEL8U1', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (20, 'e3191ffad62811eca4b900763ec66df0', 'RHEL', 'RHEL8U2', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (21, 'e3191ffad62811eca4b900163ec16df0', 'RHEL', 'RHEL8U3', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (22, 'e3191ffad62811eca4b900163ec26df0', 'RHEL', 'RHEL8U4', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (23, 'e3191ffad62811eca4b900163ec36df0', 'RHEL', 'RHEL8U0', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (24, 'e3191ffad62811eca4b900163ec46df0', 'ESXI', 'ESXI6.7', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (25, 'e3191ffad62811eca4b900163ec56df0', 'ESXI', 'ESXI7.0', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (26, 'e3191ffad62811eca4b900163ec76df0', 'Ubuntu', 'Ubuntu-18.04.4-server', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (27, 'e3191ffad62811eca4b900163ec86df0', 'Ubuntu', 'Ubuntu-20.04-server', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (28, 'e3191ffad62811eca4b910163ec66df0', 'NeoKylin', 'NeoKylin7U6', 0, '2022-05-18 05:38:35', '2022-05-18 05:38:35'); +INSERT INTO `starlet_control_other_supported_image` VALUES (31, 'e3191ffad62811eca4b904163ec66df0', 'SUSE', 'SLES12', 0, '2022-05-18 05:39:56', '2022-05-18 05:39:56'); +INSERT INTO `starlet_control_other_supported_image` VALUES (32, 'e3191ffad62811eca4b905163ec66df0', 'SUSE', 'SLES15', 0, '2022-05-18 05:39:56', '2022-05-18 05:39:56'); +INSERT INTO `starlet_control_other_supported_image` VALUES (33, 'e3191ffad62811eca4b908163ec66df0', 'Kylin', 'KylinV10', 0, '2022-05-18 05:39:56', '2022-05-18 05:39:56'); +INSERT INTO `starlet_control_other_supported_image` VALUES (34, 'e9191ffad62811eca4b900163ec66df0', 'UOS', 'U20', 0, '2022-05-18 05:39:56', '2022-05-18 05:39:56'); +INSERT INTO `starlet_control_other_supported_image` VALUES (35, 'e8191ffad62811eca4b900163ec66df0', 'Windows', 'Windows2016', 0, '2022-05-18 05:39:56', '2022-05-18 05:39:56'); +INSERT INTO `starlet_control_other_supported_image` VALUES (36, 'e8191ffad62811eca4b900163ec66d33', 'Windows', 'Windows2019', 0, '2022-05-23 02:24:44', '2022-05-23 10:35:27'); +INSERT INTO `starlet_control_other_supported_image` VALUES (37, 'e8191ffad62811eca4b900163ec99df0', 'KOS', 'KOS5.6', 0, '2022-09-14 02:24:44', '2022-09-14 10:35:27'); +INSERT INTO `starlet_control_other_supported_image` VALUES (38, 'e8147yhad62811eca4b900163ec99df0', 'CentOS', 'CentOS8U5', 0, '2023-03-13 03:30:00', '2023-03-13 03:30:00'); +INSERT INTO `starlet_control_other_supported_image` VALUES (40, 'e8147yhad62811eca4b543265r7f9df0', 'RHEL', 'RHEL8U5', 0, '2023-03-13 03:30:00', '2023-03-13 03:30:00'); +INSERT INTO `starlet_control_other_supported_image` VALUES (42, 'e8147ghft64248yca4b543265r7f9df0', 'Windows', 'Windows2022', 0, '2023-03-13 03:30:00', '2023-03-13 03:30:00'); +INSERT INTO `starlet_control_other_supported_image` VALUES (43, 'e8147ghft64248yca4b543265r7f2gf3', 'Ubuntu', 'Ubuntu-22.04-server', 0, '2023-03-13 03:30:00', '2023-03-13 03:30:00'); +INSERT INTO `starlet_control_other_supported_image` VALUES (44, 'e8147ghft64248yca4b559125r7f2gf3', 'ESXI', 'ESXI8.0', 0, '2023-03-29 10:30:00', '2023-03-29 10:30:00'); +INSERT INTO `starlet_control_other_supported_image` VALUES (48, 'e8147ghft62811eca4b543265r7f9df0', 'RHEL', 'RHEL9U0', 0, '2023-03-13 03:30:00', '2023-03-13 03:30:00'); \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231228161701__iboot_user.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231228161701__iboot_user.sql new file mode 100644 index 0000000000000000000000000000000000000000..2bb0f0bc6b6673670ce585be57ac8f3aa3d6fcff --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/db/V20231228161701__iboot_user.sql @@ -0,0 +1,1846 @@ +DROP TABLE IF EXISTS `starlet_control_raid_config_xml`; +CREATE TABLE `starlet_control_raid_config_xml` +( + `id` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '业务主键', + `pk` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `model` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT 'RAID卡型号', + `type` enum('PMC','9230','LSI') CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT 'LSI' COMMENT 'RAID卡类型', + `content` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT '详细配置内容', + `remark_cn` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT '中文备注', + `remark_en` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin COMMENT '英文备注', + PRIMARY KEY (`pk`), + UNIQUE KEY `id` (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Records of starlet_control_raid_config_xml +-- ---------------------------- +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('0deb592af675494e9826df8dea7a548c', '1', '3408IT', 'LSI', 0x7B7D, + 0x7B226C6F676963616C223A22E4B88DE694AFE68C81222C22676C6F62616C223A22E4B88DE694AFE68C81222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22227D, + 0x7B226C6F676963616C223A226E6F7420737570706F7274222C22676C6F62616C223A226E6F7420737570706F7274222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A22227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('5gt7592af675494e9826df8dea7a548c', '2', '9361-8I', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D2C225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('87hg592af675494e9826df8dea7a548c', '3', '9361-16I', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D2C225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('87hg592fg125494e9826df8dea7a548c', '4', '9460-8I', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D2C225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('87hg592fg125494e9826df8dea7ajdh7', '5', '9460-16I', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D2C225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('47gh592fg125494e9826df8dea7ajdh7', '6', '3108', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D2C225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('47gh512dg125494e9826df8dea7ajdh7', '7', '3508', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D2C225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('47gh512dg125494e9826df8dea7ahy85', '8', '3516', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D2C225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('2d7t512dg125494e9826df8dea7ahy85', '9', '2208', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B2238222C20223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A31367D2C20225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A31367D2C22524149443130223A7B226C6F776572223A342C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A31367D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A620382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F72742073657420737472697020382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('2d7t512dg125494e9826df8dea7a54df', '10', '9305-24I', 'LSI', 0x7B7D, + 0x7B226C6F676963616C223A22E4B88DE694AFE68C81222C22676C6F62616C223A22E4B88DE694AFE68C81222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22227D, + 0x7B226C6F676963616C223A226E6F7420737570706F7274222C22676C6F62616C223A226E6F7420737570706F7274222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A22227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('2d7t512dg125494e9826df8dea7a51ff', '11', '3408IMR', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634225D2C2264656661756C74223A223634227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A31367D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F31305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C74222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F31305C725C6E737570706F7274207365742073747269702036345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C74222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('54j554rf125494e9826df8dea7a54df', '12', '3416IMR', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634225D2C2264656661756C74223A223634227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A31367D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F31305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C74222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F31305C725C6E737570706F7274207365742073747269702036345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C74222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('54j554rf125494e9826df8dea7aijht', '13', '9440-8I', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634225D2C2264656661756C74223A223634227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A31367D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F31305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C74222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F31305C725C6E737570706F7274207365742073747269702036345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C74222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('35f454rf125494e9826df8dea7aijht', '14', '3004IMR', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634225D2C2264656661756C74223A223634227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F315C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C74222C22676C6F62616C223A22E4B88DE694AFE68C81222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E4B880E4B8AAE68896E4B8A4E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F315C725C6E737570706F7274207365742073747269702036345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C74222C22676C6F62616C223A226E6F7420737570706F7274222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206F6E65206F722074776F206469736B735C725C6E5241494431206E656564732074776F206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('35f454rf125494e9826df8dea7aiubf', '15', '3008IR', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A327D2C22676C6F62616C223A7B2272616E6765223A327D2C22626F6F744469736B223A66616C73652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C22524149443130222C22524149443145225D2C2264656661756C74223A225241494430227D2C225241494430223A7B226C6F776572223A322C227570706572223A31302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A31302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C22524149443145223A7B226C6F776572223A332C227570706572223A392C226F6464223A747275652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F31302F3145222C22676C6F62616C223A22E694AFE68C815C725C6EE694AFE68C81E69C80E5A49AE5889BE5BBBAE4B8A4E4B8AAE585A8E5B180E783ADE5A487222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B8A4E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944314520E99C80E8A681E4B889E588B0E4B99DE4B8AAE5A587E695B0E79B985C725C6EE694AFE68C81E69C80E5A49AE5889BE5BBBAE4B8A4E4B8AA52414944EFBC8CE4B880E4B8AA52414944E69C80E5A49AE4BDBFE794A8E58D81E59D97E79B98EFBC8CE68980E69C89E783ADE5A487E5928C52414944E79B98E887B3E5A49A3134E59D97227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F31302F3145222C22676C6F62616C223A22737570706F72745C725C6E737570706F7274206372656174652074776F20676C6F62616C686F74737061726573206174206D6F7374222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C656173742074776F206469736B735C725C6E5241494431206E656564732074776F206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E524149443145206E6565647320746872656520746F206E696E6520616E64206F6464206469736B735C725C6E737570706F7274206372656174652074776F2052414944206174206D6F73742C6F6E65205241494420737570706F7274207573652074656E206469736B73206174206D6F73742C616C6C205241494420616E6420686F7473706172652075736520666F75727465656E206469736B73206174206D6F7374227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('1fg754rf125494e9826df8dea7aiubf', '16', '2308', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A327D2C22676C6F62616C223A7B2272616E6765223A327D2C22626F6F744469736B223A66616C73652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C22524149443130222C22524149443145225D2C2264656661756C74223A225241494430227D2C225241494430223A7B226C6F776572223A322C227570706572223A31302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A31302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C22524149443145223A7B226C6F776572223A332C227570706572223A392C226F6464223A747275652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F31302F3145222C22676C6F62616C223A22E694AFE68C815C725C6EE694AFE68C81E69C80E5A49AE5889BE5BBBAE4B8A4E4B8AAE585A8E5B180E783ADE5A487222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B8A4E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944314520E99C80E8A681E4B889E588B0E4B99DE4B8AAE5A587E695B0E79B985C725C6EE694AFE68C81E69C80E5A49AE5889BE5BBBAE4B8A4E4B8AA52414944EFBC8CE4B880E4B8AA52414944E69C80E5A49AE4BDBFE794A8E58D81E59D97E79B98EFBC8CE68980E69C89E783ADE5A487E5928C52414944E79B98E887B3E5A49A3134E59D97227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F31302F3145222C22676C6F62616C223A22737570706F72745C725C6E737570706F7274206372656174652074776F20676C6F62616C686F74737061726573206174206D6F7374222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C656173742074776F206469736B735C725C6E5241494431206E656564732074776F206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E524149443145206E6565647320746872656520746F206E696E65206469736B735C725C6E737570706F7274206372656174652074776F2052414944206174206D6F73742C6F6E65205241494420737570706F7274207573652074656E206469736B73206174206D6F73742C616C6C205241494420616E6420686F7473706172652075736520666F75727465656E206469736B73206174206D6F7374227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('1fg754rf125494e9826df8dea7aiy7f', '17', '3008IT', 'LSI', 0x7B7D, + 0x7B226C6F676963616C223A22E4B88DE694AFE68C81222C22676C6F62616C223A22E4B88DE694AFE68C81222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22227D, + 0x7B226C6F676963616C223A226E6F7420737570706F7274222C22676C6F62616C223A226E6F7420737570706F7274222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A22227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('74g754rf125494e9826df8dea7aiy7f', '18', '3416IT', 'LSI', 0x7B7D, + 0x7B226C6F676963616C223A22E4B88DE694AFE68C81222C22676C6F62616C223A22E4B88DE694AFE68C81222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22227D, + 0x7B226C6F676963616C223A226E6F7420737570706F7274222C22676C6F62616C223A226E6F7420737570706F7274222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A22227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('74g754rf125494e9826df8dea7autj1', '19', 'PM8060', 'PMC', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A66616C73652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B22726F6E222C2022726F6666225D2C2264656661756C74223A22726F6E227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022776262225D2C2264656661756C74223A227774227D2C225241494430223A7B226C6F776572223A312C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C20225241494436223A7B226C6F776572223A342C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A382C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62036342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F776262287772697465206261636B20776974682062617474657279295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A520726F6E2872656164206361636865206F6E292F726F66662872656164206361636865206F666629222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E524149443520E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E524149443620E99C80E8A681E887B3E5B091E59B9BE4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B985C725C6E52414944363020E99C80E8A681E887B3E5B091E585ABE4B8AAE79B98227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F7274207365742073747269702036342F3132382F3235362F3531322F313032345C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F776262287772697465206261636B20776974682062617474657279295C725C6E737570706F7274207365742072656164706F6C69637920726F6E2872656164206361636865206F6E292F726F66662872656164206361636865206F666629222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E656564732074776F206469736B735C725C6E5241494435206E65656473206174206C65617374207468726565206469736B735C725C6E5241494436206E65656473206174206C6561737420666F7572206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E524149443530206E65656473206174206C6561737420736978206469736B735C725C6E524149443630206E65656473206174206C65617374206569676874206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('24r754rf125494e9826df8dea7autj1', '20', 'PM8068', 'PMC', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A66616C73652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B2238222C20223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B22726F6E222C2022726F6666225D2C2264656661756C74223A22726F6E227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022776262225D2C2264656661756C74223A227774227D2C225241494430223A7B226C6F776572223A312C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F31305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A620382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F776262287772697465206261636B20776974682062617474657279295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A520726F6E2872656164206361636865206F6E292F726F66662872656164206361636865206F666629222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E524149443520E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F31305C725C6E737570706F72742073657420737472697020382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F776262287772697465206261636B20776974682062617474657279295C725C6E737570706F7274207365742072656164706F6C69637920726F6E2872656164206361636865206F6E292F726F66662872656164206361636865206F666629222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E656564732074776F206469736B735C725C6E5241494435206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('24r754rf125494e9826df8dea7ajb4t', '21', 'PM8204', 'PMC', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C225241494430223A7B226C6F776572223A312C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C20225241494436223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A382C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62031362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B98222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E524149443520E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E524149443620E99C80E8A681E887B3E5B091E59B9BE4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B985C725C6E52414944363020E99C80E8A681E887B3E5B091E585ABE4B8AAE79B98227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F31302F35302F36305C725C6E737570706F7274207365742073747269702031362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E656564732074776F206469736B735C725C6E5241494435206E65656473206174206C65617374207468726565206469736B735C725C6E5241494436206E65656473206174206C6561737420666F7572206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E524149443530206E65656473206174206C6561737420736978206469736B735C725C6E524149443630206E65656473206174206C6561737420656967687474206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('91g754rf125494e9826df8dea7ajb4t', '22', 'PM8222', 'PMC', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C225241494430223A7B226C6F776572223A312C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F31305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62031362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B98222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B98227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F31305C725C6E737570706F7274207365742073747269702031362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E656564732074776F206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('91g754rf125494e9826df8dea7ajg73', '23', '3152-8I', 'PMC', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C225241494430223A7B226C6F776572223A312C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C20225241494436223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A382C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62031362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B98222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E524149443520E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E524149443620E99C80E8A681E887B3E5B091E59B9BE4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B985C725C6E52414944363020E99C80E8A681E887B3E5B091E585ABE4B8AAE79B98227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F31302F35302F36305C725C6E737570706F7274207365742073747269702031362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E656564732074776F206469736B735C725C6E5241494435206E65656473206174206C65617374207468726565206469736B735C725C6E5241494436206E65656473206174206C6561737420666F7572206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E524149443530206E65656473206174206C6561737420736978206469736B735C725C6E524149443630206E65656473206174206C6561737420656967687474206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('24gf54rf125494e9826df8dea7ajg73', '24', '2100-8I', 'PMC', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C225241494430223A7B226C6F776572223A312C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F31305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A62031362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B98222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B98227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F31305C725C6E737570706F7274207365742073747269702031362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E656564732074776F206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('24gf54rf125494e9826df8dea7akdhf', '25', '9230', '9230', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A66616C73652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494431225D2C2264656661756C74223A225241494431227D2C227374726970223A7B2276616C7565223A5B223332222C20223634225D2C2264656661756C74223A223634227D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420315C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A633322F3634222C22676C6F62616C223A22E4B88DE694AFE68C81222C22646564696361746564223A22E4B88DE694AFE68C81222C226A626F64223A22E4B88DE694AFE68C81222C2272656D61726B223A22524149443120E99C80E8A681E4B8A4E4B8AAE79B98227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420315C725C6E737570706F7274207365742073747269702033322F3634222C22676C6F62616C223A226E6F7420737570706F7274222C22646564696361746564223A226E6F7420737570706F7274222C226A626F64223A226E6F7420737570706F7274222C2272656D61726B223A225241494431206E656564732074776F206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('59dc54rf125494e9826df8dea7akdhf', '26', 'LSI', 'LSI', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B2238222C20223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B227261222C20226E6F7261225D2C2264656661756C74223A227261227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022617762225D2C2264656661756C74223A227774227D2C22696F506F6C696379223A7B2276616C7565223A5B22646972656374222C2022636163686564225D2C2264656661756C74223A22646972656374227D2C226361636865506F6C696379223A7B2276616C7565223A5B226F6E222C226F6666222C2264656661756C74225D2C2264656661756C74223A226F6E227D2C22616363657373506F6C696379223A7B2276616C7565223A5B227277222C22626C6F636B6564222C22726F225D2C2264656661756C74223A227277227D2C225241494430223A7B226C6F776572223A312C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A33322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C20225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3234302C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A332C22706470657261727261797570223A33327D2C22524149443130223A7B226C6F776572223A342C227570706572223A3234302C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73652C22706470657261727261796C6F77223A322C22706470657261727261797570223A33327D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A620382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE8AEBFE997AEE7AD96E795A52072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6EE694AFE68C81E8AEBEE7BDAEE7A381E79B98E7BC93E5AD98206F6E2F6F66662F64656661756C745C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A52072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6EE694AFE68C81E8AEBEE7BDAE494FE7AD96E795A5206469726563742F636163686564222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E887B3E5B091E4B8A4E4B8AAE581B6E695B0E79B985C725C6E524149443520E5928C20524149443620E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E5928C2052414944363020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B98227D, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F72742073657420737472697020382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F72742073657420616363657373706F6C792072772872656164207772697465292F626C6F636B65642F726F2872656164206F6E6C79295C725C6E737570706F7274207365742070646361636865206F6E2F6F66662F64656661756C745C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F61776228616C77617973207772697465206261636B295C725C6E737570706F7274207365742072656164706F6C6963792072612872656164206168656164292F6E6F7261286E6F742072656164206168656164295C725C6E737570706F72742073657420696F706F6C696379206469726563742F636163686564222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E65656473206174206C656173742074776F20616E64206576656E206469736B735C725C6E524149443520616E64205241494436206E65656473206174206C65617374207468726565206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E52414944353020616E6420524149443630206E65656473206174206C6561737420736978206469736B73227D); +INSERT INTO `starlet_control_raid_config_xml` +VALUES ('59dc54rf125494e9826df8dea7ajb5w', '27', 'PMC', 'PMC', + 0x7B226C6F676963616C223A7B2272616E6765223A66616C73657D2C22676C6F62616C223A7B2272616E6765223A66616C73657D2C22646564696361746564223A7B2272616E6765223A66616C73657D2C226A626F64223A7B2272616E6765223A66616C73657D2C22626F6F744469736B223A747275652C22636C656172223A747275652C22726169644C6576656C223A7B2276616C7565223A5B225241494430222C225241494431222C225241494435222C22524149443530222C225241494436222C22524149443630222C22524149443130225D2C2264656661756C74223A225241494430227D2C227374726970223A7B2276616C7565223A5B2238222C20223136222C20223332222C20223634222C2022313238222C2022323536222C2022353132222C202231303234225D2C2264656661756C74223A22323536227D2C2272656164506F6C696379223A7B2276616C7565223A5B22726F6E222C2022726F6666225D2C2264656661756C74223A22726F6E227D2C227772697465506F6C696379223A7B2276616C7565223A5B227774222C20227762222C2022776262225D2C2264656661756C74223A227774227D2C225241494430223A7B226C6F776572223A312C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C225241494431223A7B226C6F776572223A322C227570706572223A322C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D2C225241494435223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443530223A7B226C6F776572223A362C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C20225241494436223A7B226C6F776572223A332C227570706572223A33322C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443630223A7B226C6F776572223A362C227570706572223A3132382C226F6464223A66616C73652C226576656E223A66616C73652C226D756C7469706C65223A66616C73657D2C22524149443130223A7B226C6F776572223A342C227570706572223A3132382C226F6464223A66616C73652C226576656E223A747275652C226D756C7469706C65223A66616C73657D7D, + 0x7B226C6F676963616C223A22E694AFE68C81E5889BE5BBBA5241494420302F312F352F362F31302F35302F36305C725C6EE694AFE68C81E8AEBEE7BDAEE69DA1E5B8A620382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6EE694AFE68C81E8AEBEE7BDAEE590AFE58AA8E79B985C725C6EE694AFE68C81E8AEBEE7BDAEE58699E585A5E7AD96E795A5207774287772697465207468726F756768292F7762287772697465206261636B292F776262287772697465206261636B20776974682062617474657279295C725C6EE694AFE68C81E8AEBEE7BDAEE8AFBBE58F96E7AD96E795A520726F6E2872656164206361636865206F6E292F726F66662872656164206361636865206F666629222C22676C6F62616C223A22E694AFE68C81222C22646564696361746564223A22E694AFE68C81222C226A626F64223A22E694AFE68C81222C2272656D61726B223A22524149443020E99C80E8A681E887B3E5B091E4B880E4B8AAE79B985C725C6E524149443120E99C80E8A681E4B8A4E4B8AAE79B985C725C6E524149443520E99C80E8A681E887B3E5B091E4B889E4B8AAE79B985C725C6E524149443620E99C80E8A681E887B3E5B091E59B9BE4B8AAE79B985C725C6E52414944313020E99C80E8A681E887B3E5B091E59B9BE4B8AAE581B6E695B0E79B985C725C6E52414944353020E99C80E8A681E887B3E5B091E585ADE4B8AAE79B985C725C6E52414944363020E99C80E8A681E887B3E5B091E585ABE4B8AAE79B98227D0D0A, + 0x7B226C6F676963616C223A22737570706F727420637265617465205241494420302F312F352F362F31302F35302F36305C725C6E737570706F72742073657420737472697020382F31362F33322F36342F3132382F3235362F3531322F313032345C725C6E737570706F7274207365742073746172747570206469736B5C725C6E737570706F727420736574207772697465706F6C696379207774287772697465207468726F756768292F7762287772697465206261636B292F776262287772697465206261636B20776974682062617474657279295C725C6E737570706F7274207365742072656164706F6C69637920726F6E2872656164206361636865206F6E292F726F66662872656164206361636865206F666629222C22676C6F62616C223A22737570706F7274222C22646564696361746564223A22737570706F7274222C226A626F64223A22737570706F7274222C2272656D61726B223A225241494430206E65656473206174206C65617374206F6E65206469736B5C725C6E5241494431206E656564732074776F206469736B735C725C6E5241494435206E65656473206174206C65617374207468726565206469736B735C725C6E5241494436206E65656473206174206C6561737420666F7572206469736B735C725C6E524149443130206E65656473206174206C6561737420666F757220616E64206576656E206469736B735C725C6E524149443530206E65656473206174206C6561737420736978206469736B735C725C6E524149443630206E65656473206174206C65617374206569676874206469736B73227D); + + +DROP TABLE IF EXISTS `starlet_control_timezone`; +CREATE TABLE `starlet_control_timezone` +( + `pk` bigint NOT NULL AUTO_INCREMENT, + `id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'id', + `timezone_key` varchar(256) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '时区key内容', + `timezone_value` varchar(256) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '时区的value值', + `system_type` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '系统类型', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`pk`, `id`) +) ENGINE=InnoDB AUTO_INCREMENT=562 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin; + +-- ---------------------------- +-- Records of starlet_control_timezone +-- ---------------------------- +INSERT INTO `starlet_control_timezone` +VALUES ('1', '1fe864fbd6dc11eca4b900163ec66df0', 'Europe/Andorra', 'Europe/Andorra', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('2', '1de864fbd6dc21eca4b910161ec66df1', 'Europe/Tirane', 'Europe/Tirane', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('3', '1fe864fbd6dc11eca4b900163ec66df1', 'Europe/Vienna', 'Europe/Vienna', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('4', '1de864fbd6dc21eca4b910163ec66df2', 'Europe/Brussels', 'Europe/Brussels', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('5', '1fe864fbd6dc11eca4b900163ec66df2', 'Europe/Sofia', 'Europe/Sofia', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('6', '1de864fbd6dc21eca4b910163ec66df3', 'Europe/Minsk', 'Europe/Minsk', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('7', '1fe864fbd6dc11eca4b900163ec66df3', 'Europe/Zurich', 'Europe/Zurich', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('8', '1de864fbd6dc21eca4b910163ec66df4', 'Europe/Prague', 'Europe/Prague', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('9', '1fe864fbd6dc11eca4b900163ec66df4', 'Europe/Berlin', 'Europe/Berlin', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('10', '1de864fbd6dc21eca4b910163ec66df5', 'Europe/Copenhagen', 'Europe/Copenhagen', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('11', '1fe864fbd6dc11eca4b900163ec66df5', 'Europe/Tallinn', 'Europe/Tallinn', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('12', '1de864fbd6dc21eca4b910163ec66df6', 'Europe/Madrid', 'Europe/Madrid', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('13', '1fe864fbd6dc11eca4b900163ec66df6', 'Europe/Helsinki', 'Europe/Helsinki', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('14', '1de864fbd6dc21eca4b910163ec66df7', 'Europe/Paris', 'Europe/Paris', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('15', '1fe864fbd6dc11eca4b900163ec66df7', 'Europe/London', 'Europe/London', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('16', '1de864fbd6dc21eca4b910163ec66df8', 'Europe/Gibraltar', 'Europe/Gibraltar', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('17', '1fe864fbd6dc11eca4b900163ec66df8', 'Europe/Athens', 'Europe/Athens', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('18', '1de864fbd6dc21eca4b910163ec66df9', 'Europe/Budapest', 'Europe/Budapest', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('19', '1fe864fbd6dc11eca4b900163ec66df9', 'Europe/Dublin', 'Europe/Dublin', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('20', '1de864fbd6dc21ecab910163ec66df10', 'Europe/Rome', 'Europe/Rome', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('21', '1fe864fbd6dc11eca4b90016ec66df10', 'Europe/Vilnius', 'Europe/Vilnius', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('22', '1de864fbd6dc21eca4b910163ec66df11', 'Europe/Luxembourg', 'Europe/Luxembourg', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('23', '1fe864fbd6dc11eca4b900163ec66df11', 'Europe/Riga', 'Europe/Riga', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('24', '1de864fbd6dc21ca4b910163ec66df12', 'Europe/Monaco', 'Europe/Monaco', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('25', '1fe864fbd6dc11eca4b900163ec66df12', 'Europe/Chisinau', 'Europe/Chisinau', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('26', '1de864fbd6dc21eca4b910163ec66df13', 'Europe/Malta', 'Europe/Malta', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('27', '1fe864fbd6dc11eca4b900163ec66df13', 'Europe/Amsterdam', 'Europe/Amsterdam', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('28', '1de864fbd6dc21eca4b910163ec66df14', 'Europe/Oslo', 'Europe/Oslo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('29', '1fe864fbd6dc11eca4b900163ec66df14', 'Europe/Warsaw', 'Europe/Warsaw', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('30', '1de864fbd6dc21eca4b910163ec66df15', 'Europe/Lisbon', 'Europe/Lisbon', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('31', '1fe864fbd6dc11eca4b900163ec66df15', 'Europe/Bucharest', 'Europe/Bucharest', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('32', '1de864fbd6dc21eca4b910163ec66df16', 'Europe/Belgrade', 'Europe/Belgrade', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('33', '1fe864fbd6dc11eca4b900163ec66df16', 'Europe/Kaliningrad', 'Europe/Kaliningrad', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('34', '1de864fbd6dc21eca4b910163ec66df17', 'Europe/Moscow', 'Europe/Moscow', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('35', '1fe864fbd6dc11eca4b900163ec66df17', 'Europe/Simferopol', 'Europe/Simferopol', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('36', '1de864fbd6dc21eca4b910163ec66df18', 'Europe/Volgograd', 'Europe/Volgograd', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('37', '1fe864fbd6dc11eca4b900163ec66df18', 'Europe/Samara', 'Europe/Samara', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('38', '1fe864fbd6dc11eca4b900163ec66df1', 'Europe/Stockholm', 'Europe/Stockholm', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('39', '1de864fbd6dc21eca4b910161ec66df2', 'Europe/Istanbul', 'Europe/Istanbul', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('40', '1fe864fbd6dc11eca4b900163ec66df2', 'Europe/Kiev', 'Europe/Kiev', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('41', '1de864fbd6dc21eca4b910163ec66df3', 'Europe/Uzhgorod', 'Europe/Uzhgorod', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('42', '1fe864fbd6dc11eca4b900163ec66df3', 'Europe/Zaporozhye', 'Europe/Zaporozhye', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('43', '1de864fbd6dc21eca4b910163ec66df4', 'Europe/Belfast', 'Europe/Belfast', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('44', '1fe864fbd6dc11eca4b900163ec66df4', 'Europe/Bratislava', 'Europe/Bratislava', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('45', '1de864fbd6dc21eca4b910163ec66df5', 'Europe/Ljubljana', 'Europe/Ljubljana', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('46', '1fe864fbd6dc11eca4b900163ec66df5', 'Europe/Mariehamn', 'Europe/Mariehamn', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('47', '1de864fbd6dc21eca4b910163ec66df6', 'Europe/Nicosia', 'Europe/Nicosia', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('48', '1fe864fbd6dc11eca4b900163ec66df6', 'Europe/Podgorica', 'Europe/Podgorica', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('49', '1de864fbd6dc21eca4b910163ec66df7', 'Europe/Tiraspol', 'Europe/Tiraspol', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('50', '1fe864fbd6dc11eca4b900163ec66df7', 'Europe/Guernsey', 'Europe/Guernsey', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('51', '1de864fbd6dc21eca4b910163ec66df8', 'Europe/Isle_of_Man', 'Europe/Isle_of_Man', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('52', '1fe864fbd6dc11eca4b900163ec66df8', 'Europe/Jersey', 'Europe/Jersey', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('53', '1de864fbd6dc21eca4b910163ec66df9', 'Europe/San_Marino', 'Europe/San_Marino', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('54', '1fe864fbd6dc11eca4b900163ec66df9', 'Europe/Sarajevo', 'Europe/Sarajevo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('55', '1de864fbd6dc21eca4b910163ec66df10', 'Europe/Skopje', 'Europe/Skopje', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('56', '1fe864fbd6dc11eca4b900163ec66df10', 'Europe/Vaduz', 'Europe/Vaduz', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('57', '1de864fbd6dc21ecab910163ec66df11', 'Europe/Vatican', 'Europe/Vatican', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('58', '1fe864fbd6dc11eca4b90016ec66df11', 'Europe/Zagreb', 'Europe/Zagreb', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('59', '1de864fbd6dc21eca4b910163ec66df12', 'Asia/Dubai', 'Asia/Dubai', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('60', '1fe864fbd6dc11eca4b900163ec66df12', 'Asia/Kabul', 'Asia/Kabul', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('61', '1de864fbd6dc21ca4b910163ec66df13', 'Asia/Yerevan', 'Asia/Yerevan', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('62', '1fe864fbd6dc11eca4b900163ec66df13', 'Asia/Baku', 'Asia/Baku', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('63', '1de864fbd6dc21eca4b910163ec66df14', 'Asia/Dhaka', 'Asia/Dhaka', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('64', '1fe864fbd6dc11eca4b900163ec66df14', 'Asia/Brunei', 'Asia/Brunei', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('65', '1de864fbd6dc21eca4b910163ec66df15', 'Asia/Thimphu', 'Asia/Thimphu', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('66', '1fe864fbd6dc11eca4b900163ec66df15', 'Asia/Shanghai', 'Asia/Shanghai', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('67', '1de864fbd6dc21eca4b910163ec66df16', 'Asia/Urumqi', 'Asia/Urumqi', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('68', '1fe864fbd6dc11eca4b900163ec66df16', 'Asia/Nicosia', 'Asia/Nicosia', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('69', '1de864fbd6dc21eca4b910163ec66df17', 'Asia/Tbilisi', 'Asia/Tbilisi', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('70', '1fe864fbd6dc11eca4b900163ec66df17', 'Asia/Hong_Kong', 'Asia/Hong_Kong', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('71', '1de864fbd6dc21eca4b910163ec66df18', 'Asia/Jakarta', 'Asia/Jakarta', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('72', '1fe864fbd6dc11eca4b900163ec66df18', 'Asia/Pontianak', 'Asia/Pontianak', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('73', '1de864fbd6dc21eca4b910163ec66df19', 'Asia/Makassar', 'Asia/Makassar', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('74', '1fe864fbd6dc11eca4b900163ec66df19', 'Asia/Jayapura', 'Asia/Jayapura', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('75', '1fe864fbd6dc11eca4b900163ec66df2', 'Asia/Jerusalem', 'Asia/Jerusalem', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('76', '1de864fbd6dc21eca4b910161ec66df3', 'Asia/Kolkata', 'Asia/Kolkata', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('78', '1de864fbd6dc21eca4b910163ec66df4', 'Asia/Baghdad', 'Asia/Baghdad', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('79', '1fe864fbd6dc11eca4b900163ec66df4', 'Asia/Tehran', 'Asia/Tehran', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('80', '1de864fbd6dc21eca4b910163ec66df5', 'Asia/Amman', 'Asia/Amman', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('81', '1fe864fbd6dc11eca4b900163ec66df5', 'Asia/Tokyo', 'Asia/Tokyo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('82', '1de864fbd6dc21eca4b910163ec66df6', 'Asia/Bishkek', 'Asia/Bishkek', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('83', '1fe864fbd6dc11eca4b900163ec66df6', 'Asia/Pyongyang', 'Asia/Pyongyang', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('84', '1de864fbd6dc21eca4b910163ec66df7', 'Asia/Seoul', 'Asia/Seoul', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('85', '1fe864fbd6dc11eca4b900163ec66df7', 'Asia/Almaty', 'Asia/Almaty', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('86', '1de864fbd6dc21eca4b910163ec66df8', 'Asia/Qyzylorda', 'Asia/Qyzylorda', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('87', '1fe864fbd6dc11eca4b900163ec66df8', 'Asia/Aqtobe', 'Asia/Aqtobe', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('88', '1de864fbd6dc21eca4b910163ec66df9', 'Asia/Aqtau', 'Asia/Aqtau', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('89', '1fe864fbd6dc11eca4b900163ec66df9', 'Asia/Oral', 'Asia/Oral', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('90', '1de864fbd6dc21eca4b910163ec66df10', 'Asia/Beirut', 'Asia/Beirut', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('91', '1fe864fbd6dc11eca4b900163ec66df10', 'Asia/Colombo', 'Asia/Colombo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('92', '1de864fbd6dc21eca4b910163ec66df11', 'Asia/Rangoon', 'Asia/Rangoon', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('93', '1fe864fbd6dc11eca4b900163ec66df11', 'Asia/Ulaanbaatar', 'Asia/Ulaanbaatar', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('94', '1de864fbd6dc21ecab910163ec66df12', 'Asia/Hovd', 'Asia/Hovd', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('95', '1fe864fbd6dc11eca4b90016ec66df12', 'Asia/Choibalsan', 'Asia/Choibalsan', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('96', '1de864fbd6dc21eca4b910163ec66df13', 'Asia/Macau', 'Asia/Macau', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('97', '1fe864fbd6dc11eca4b900163ec66df13', 'Asia/Kuala_Lumpur', 'Asia/Kuala_Lumpur', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('98', '1de864fbd6dc21ca4b910163ec66df14', 'Asia/Kuching', 'Asia/Kuching', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('99', '1fe864fbd6dc11eca4b900163ec66df14', 'Asia/Kathmandu', 'Asia/Kathmandu', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('100', '1de864fbd6dc21eca4b910163ec66df15', 'Asia/Manila', 'Asia/Manila', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('101', '1fe864fbd6dc11eca4b900163ec66df15', 'Asia/Karachi', 'Asia/Karachi', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('102', '1de864fbd6dc21eca4b910163ec66df16', 'Asia/Gaza', 'Asia/Gaza', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('103', '1fe864fbd6dc11eca4b900163ec66df16', 'Asia/Hebron', 'Asia/Hebron', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('104', '1de864fbd6dc21eca4b910163ec66df17', 'Asia/Qatar', 'Asia/Qatar', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('105', '1fe864fbd6dc11eca4b900163ec66df17', 'Asia/Yekaterinburg', 'Asia/Yekaterinburg', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('106', '1de864fbd6dc21eca4b910163ec66df18', 'Asia/Omsk', 'Asia/Omsk', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('107', '1fe864fbd6dc11eca4b900163ec66df18', 'Asia/Novosibirsk', 'Asia/Novosibirsk', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('108', '1de864fbd6dc21eca4b910163ec66df19', 'Asia/Novokuznetsk', 'Asia/Novokuznetsk', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('109', '1fe864fbd6dc11eca4b900163ec66df19', 'Asia/Krasnoyarsk', 'Asia/Krasnoyarsk', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('110', '1de864fbd6dc21eca4b910163ec66df20', 'Asia/Irkutsk', 'Asia/Irkutsk', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('111', '1fe864fbd6dc11eca4b900163ec66df20', 'Asia/Chita', 'Asia/Chita', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('112', '1fe864fbd6dc11eca4b900163ec66df3', 'Asia/Yakutsk', 'Asia/Yakutsk', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('113', '1de864fbd6dc21eca4b910161ec66df4', 'Asia/Khandyga', 'Asia/Khandyga', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('114', '1fe864fbd6dc11eca4b900163ec66df4', 'Asia/Vladivostok', 'Asia/Vladivostok', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('115', '1de864fbd6dc21eca4b910163ec66df5', 'Asia/Sakhalin', 'Asia/Sakhalin', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('116', '1fe864fbd6dc11eca4b900163ec66df5', 'Asia/Ust-Nera', 'Asia/Ust-Nera', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('117', '1de864fbd6dc21eca4b910163ec66df6', 'Asia/Magadan', 'Asia/Magadan', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('118', '1fe864fbd6dc11eca4b900163ec66df6', 'Asia/Srednekolymsk', 'Asia/Srednekolymsk', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('119', '1de864fbd6dc21eca4b910163ec66df7', 'Asia/Kamchatka', 'Asia/Kamchatka', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('120', '1fe864fbd6dc11eca4b900163ec66df7', 'Asia/Anadyr', 'Asia/Anadyr', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('121', '1de864fbd6dc21eca4b910163ec66df8', 'Asia/Riyadh', 'Asia/Riyadh', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('122', '1fe864fbd6dc11eca4b900163ec66df8', 'Asia/Singapore', 'Asia/Singapore', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('123', '1de864fbd6dc21eca4b910163ec66df9', 'Asia/Damascus', 'Asia/Damascus', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('124', '1fe864fbd6dc11eca4b900163ec66df9', 'Asia/Bangkok', 'Asia/Bangkok', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('125', '1de864fbd6dc21eca4b910163ec66df10', 'Asia/Dushanbe', 'Asia/Dushanbe', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('126', '1fe864fbd6dc11eca4b900163ec66df10', 'Asia/Dili', 'Asia/Dili', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('127', '1de864fbd6dc21eca4b910163ec66df11', 'Asia/Ashgabat', 'Asia/Ashgabat', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('128', '1fe864fbd6dc11eca4b900163ec66df11', 'Asia/Taipei', 'Asia/Taipei', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('129', '1de864fbd6dc21eca4b910163ec66df12', 'Asia/Samarkand', 'Asia/Samarkand', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('130', '1fe864fbd6dc11eca4b900163ec66df12', 'Asia/Tashkent', 'Asia/Tashkent', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('131', '1de864fbd6dc21ecab910163ec66df13', 'Asia/Ho_Chi_Minh', 'Asia/Ho_Chi_Minh', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('132', '1fe864fbd6dc11eca4b90016ec66df13', 'Asia/Aden', 'Asia/Aden', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('133', '1de864fbd6dc21eca4b910163ec66df14', 'Asia/Ashkhabad', 'Asia/Ashkhabad', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('134', '1fe864fbd6dc11eca4b900163ec66df14', 'Asia/Bahrain', 'Asia/Bahrain', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('135', '1de864fbd6dc21ca4b910163ec66df15', 'Asia/Calcutta', 'Asia/Calcutta', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('136', '1fe864fbd6dc11eca4b900163ec66df15', 'Asia/Chongqing', 'Asia/Chongqing', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('137', '1de864fbd6dc21eca4b910163ec66df16', 'Asia/Chungking', 'Asia/Chungking', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('138', '1fe864fbd6dc11eca4b900163ec66df16', 'Asia/Dacca', 'Asia/Dacca', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('139', '1de864fbd6dc21eca4b910163ec66df17', 'Asia/Istanbul', 'Asia/Istanbul', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('140', '1fe864fbd6dc11eca4b900163ec66df17', 'Asia/Kashgar', 'Asia/Kashgar', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('141', '1de864fbd6dc21eca4b910163ec66df18', 'Asia/Macao', 'Asia/Macao', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('142', '1fe864fbd6dc11eca4b900163ec66df18', 'Asia/Vientiane', 'Asia/Vientiane', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('143', '1de864fbd6dc21eca4b910163ec66df19', 'Asia/Kuwait', 'Asia/Kuwait', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('144', '1fe864fbd6dc11eca4b900163ec66df19', 'Asia/Harbin', 'Asia/Harbin', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('145', '1de864fbd6dc21eca4b910163ec66df20', 'Asia/Muscat', 'Asia/Muscat', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('146', '1fe864fbd6dc11eca4b900163ec66df20', 'Asia/Phnom_Penh', 'Asia/Phnom_Penh', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('147', '1de864fbd6dc21eca4b910163ec66df21', 'Asia/Saigon', 'Asia/Saigon', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('148', '1fe864fbd6dc11eca4b900163ec66df21', 'Asia/Tel_Aviv', 'Asia/Tel_Aviv', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('149', '1fe864fbd6dc11eca4b900163ec66df4', 'Asia/Thimbu', 'Asia/Thimbu', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('150', '1de864fbd6dc21eca4b910161ec66df5', 'Asia/Ujung_Pandang', 'Asia/Ujung_Pandang', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('151', '1fe864fbd6dc11eca4b900163ec66df5', 'Asia/Ulan_Bator', 'Asia/Ulan_Bator', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('152', '1de864fbd6dc21eca4b910163ec66df6', 'Antarctica/Rothera', 'Antarctica/Rothera', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('153', '1fe864fbd6dc11eca4b900163ec66df6', 'Antarctica/Palmer', 'Antarctica/Palmer', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('154', '1de864fbd6dc21eca4b910163ec66df7', 'Antarctica/Mawson', 'Antarctica/Mawson', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('155', '1fe864fbd6dc11eca4b900163ec66df7', 'Antarctica/Davis', 'Antarctica/Davis', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('156', '1de864fbd6dc21eca4b910163ec66df8', 'Antarctica/Casey', 'Antarctica/Casey', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('157', '1fe864fbd6dc11eca4b900163ec66df8', 'Antarctica/Vostok', 'Antarctica/Vostok', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('158', '1de864fbd6dc21eca4b910163ec66df9', 'Antarctica/DumontDUrville', 'Antarctica/DumontDUrville', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('159', '1fe864fbd6dc11eca4b900163ec66df9', 'Antarctica/Syowa', 'Antarctica/Syowa', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('160', '1de864fbd6dc21eca4b910163ec66df10', 'Antarctica/Troll', 'Antarctica/Troll', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('161', '1fe864fbd6dc11eca4b900163ec66df10', 'Antarctica/Macquarie', 'Antarctica/Macquarie', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('162', '1de864fbd6dc21eca4b910163ec66df11', 'Antarctica/McMurdo', 'Antarctica/McMurdo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('163', '1fe864fbd6dc11eca4b900163ec66df11', 'Antarctica/South_Pole', 'Antarctica/South_Pole', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('164', '1de864fbd6dc21eca4b910163ec66df12', 'America/Argentina/Buenos_Aires', 'America/Argentina/Buenos_Aires', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('165', '1fe864fbd6dc11eca4b900163ec66df12', 'America/Argentina/Cordoba', 'America/Argentina/Cordoba', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('166', '1de864fbd6dc21eca4b910163ec66df13', 'America/Argentina/Salta', 'America/Argentina/Salta', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('167', '1fe864fbd6dc11eca4b900163ec66df13', 'America/Argentina/Jujuy', 'America/Argentina/Jujuy', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('168', '1de864fbd6dc21ecab910163ec66df14', 'America/Argentina/Tucuman', 'America/Argentina/Tucuman', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('169', '1fe864fbd6dc11eca4b90016ec66df14', 'America/Argentina/Catamarca', 'America/Argentina/Catamarca', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('170', '1de864fbd6dc21eca4b910163ec66df15', 'America/Argentina/La_Rioja', 'America/Argentina/La_Rioja', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('171', '1fe864fbd6dc11eca4b900163ec66df15', 'America/Argentina/San_Juan', 'America/Argentina/San_Juan', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('172', '1de864fbd6dc21ca4b910163ec66df16', 'America/Argentina/Mendoza', 'America/Argentina/Mendoza', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('173', '1fe864fbd6dc11eca4b900163ec66df16', 'America/Argentina/San_Luis', 'America/Argentina/San_Luis', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('174', '1de864fbd6dc21eca4b910163ec66df17', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Rio_Gallegos', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('175', '1fe864fbd6dc11eca4b900163ec66df17', 'America/Argentina/Ushuaia', 'America/Argentina/Ushuaia', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('176', '1de864fbd6dc21eca4b910163ec66df18', 'America/Barbados', 'America/Barbados', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('177', '1fe864fbd6dc11eca4b900163ec66df18', 'America/La_Paz', 'America/La_Paz', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('178', '1de864fbd6dc21eca4b910163ec66df19', 'America/Noronha', 'America/Noronha', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('179', '1fe864fbd6dc11eca4b900163ec66df19', 'America/Belem', 'America/Belem', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('180', '1de864fbd6dc21eca4b910163ec66df20', 'America/Fortaleza', 'America/Fortaleza', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('181', '1fe864fbd6dc11eca4b900163ec66df20', 'America/Recife', 'America/Recife', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('182', '1de864fbd6dc21eca4b910163ec66df21', 'America/Araguaina', 'America/Araguaina', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('183', '1fe864fbd6dc11eca4b900163ec66df21', 'America/Maceio', 'America/Maceio', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('184', '1de864fbd6dc21eca4b910163ec66df22', 'America/Bahia', 'America/Bahia', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('185', '1fe864fbd6dc11eca4b900163ec66df22', 'America/Sao_Paulo', 'America/Sao_Paulo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('186', '1fe864fbd6dc11eca4b900163ec66df5', 'America/Campo_Grande', 'America/Campo_Grande', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('187', '1de864fbd6dc21eca4b910161ec66df6', 'America/Cuiaba', 'America/Cuiaba', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('188', '1fe864fbd6dc11eca4b900163ec66df6', 'America/Santarem', 'America/Santarem', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('189', '1de864fbd6dc21eca4b910163ec66df7', 'America/Porto_Velho', 'America/Porto_Velho', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('190', '1fe864fbd6dc11eca4b900163ec66df7', 'America/Boa_Vista', 'America/Boa_Vista', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('191', '1de864fbd6dc21eca4b910163ec66df8', 'America/Manaus', 'America/Manaus', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('192', '1fe864fbd6dc11eca4b900163ec66df8', 'America/Eirunepe', 'America/Eirunepe', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('193', '1de864fbd6dc21eca4b910163ec66df9', 'America/Rio_Branco', 'America/Rio_Branco', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('194', '1fe864fbd6dc11eca4b900163ec66df9', 'America/Nassau', 'America/Nassau', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('195', '1de864fbd6dc21eca4b910163ec66df10', 'America/Belize', 'America/Belize', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('196', '1fe864fbd6dc11eca4b900163ec66df10', 'America/St_Johns', 'America/St_Johns', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('197', '1de864fbd6dc21eca4b910163ec66df11', 'America/Halifax', 'America/Halifax', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('198', '1fe864fbd6dc11eca4b900163ec66df11', 'America/Glace_Bay', 'America/Glace_Bay', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('199', '1de864fbd6dc21eca4b910163ec66df12', 'America/Moncton', 'America/Moncton', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('200', '1fe864fbd6dc11eca4b900163ec66df12', 'America/Goose_Bay', 'America/Goose_Bay', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('201', '1de864fbd6dc21eca4b910163ec66df13', 'America/Blanc-Sablon', 'America/Blanc-Sablon', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('202', '1fe864fbd6dc11eca4b900163ec66df13', 'America/Toronto', 'America/Toronto', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('203', '1de864fbd6dc21eca4b910163ec66df14', 'America/Nipigon', 'America/Nipigon', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('204', '1fe864fbd6dc11eca4b900163ec66df14', 'America/Thunder_Bay', 'America/Thunder_Bay', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('205', '1de864fbd6dc21ecab910163ec66df15', 'America/Iqaluit', 'America/Iqaluit', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('206', '1fe864fbd6dc11eca4b90016ec66df15', 'America/Pangnirtung', 'America/Pangnirtung', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('207', '1de864fbd6dc21eca4b910163ec66df16', 'America/Resolute', 'America/Resolute', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('208', '1fe864fbd6dc11eca4b900163ec66df16', 'America/Atikokan', 'America/Atikokan', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('209', '1de864fbd6dc21ca4b910163ec66df17', 'America/Rankin_Inlet', 'America/Rankin_Inlet', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('210', '1fe864fbd6dc11eca4b900163ec66df17', 'America/Winnipeg', 'America/Winnipeg', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('211', '1de864fbd6dc21eca4b910163ec66df18', 'America/Rainy_River', 'America/Rainy_River', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('212', '1fe864fbd6dc11eca4b900163ec66df18', 'America/Regina', 'America/Regina', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('213', '1de864fbd6dc21eca4b910163ec66df19', 'America/Swift_Current', 'America/Swift_Current', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('214', '1fe864fbd6dc11eca4b900163ec66df19', 'America/Edmonton', 'America/Edmonton', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('215', '1de864fbd6dc21eca4b910163ec66df20', 'America/Cambridge_Bay', 'America/Cambridge_Bay', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('216', '1fe864fbd6dc11eca4b900163ec66df20', 'America/Yellowknife', 'America/Yellowknife', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('217', '1de864fbd6dc21eca4b910163ec66df21', 'America/Inuvik', 'America/Inuvik', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('218', '1fe864fbd6dc11eca4b900163ec66df21', 'America/Creston', 'America/Creston', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('219', '1de864fbd6dc21eca4b910163ec66df22', 'America/Dawson_Creek', 'America/Dawson_Creek', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('220', '1fe864fbd6dc11eca4b900163ec66df22', 'America/Vancouver', 'America/Vancouver', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('221', '1de864fbd6dc21eca4b910163ec66df23', 'America/Whitehorse', 'America/Whitehorse', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('222', '1fe864fbd6dc11eca4b900163ec66df23', 'America/Dawson', 'America/Dawson', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('223', '1fe864fbd6dc11eca4b900163ec66df6', 'America/Santiago', 'America/Santiago', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('224', '1de864fbd6dc21eca4b910161ec66df7', 'America/Bogota', 'America/Bogota', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('225', '1fe864fbd6dc11eca4b900163ec66df7', 'America/Costa_Rica', 'America/Costa_Rica', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('226', '1de864fbd6dc21eca4b910163ec66df8', 'America/Havana', 'America/Havana', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('227', '1fe864fbd6dc11eca4b900163ec66df8', 'America/Curacao', 'America/Curacao', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('228', '1de864fbd6dc21eca4b910163ec66df9', 'America/Santo_Domingo', 'America/Santo_Domingo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('229', '1fe864fbd6dc11eca4b900163ec66df9', 'America/Guayaquil', 'America/Guayaquil', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('230', '1de864fbd6dc21eca4b910163ec66df10', 'America/Cayenne', 'America/Cayenne', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('231', '1fe864fbd6dc11eca4b900163ec66df10', 'America/Godthab', 'America/Godthab', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('232', '1de864fbd6dc21eca4b910163ec66df11', 'America/Danmarkshavn', 'America/Danmarkshavn', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('233', '1fe864fbd6dc11eca4b900163ec66df11', 'America/Scoresbysund', 'America/Scoresbysund', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('234', '1de864fbd6dc21eca4b910163ec66df12', 'America/Thule', 'America/Thule', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('235', '1fe864fbd6dc11eca4b900163ec66df12', 'America/Guatemala', 'America/Guatemala', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('236', '1de864fbd6dc21eca4b910163ec66df13', 'America/Guyana', 'America/Guyana', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('237', '1fe864fbd6dc11eca4b900163ec66df13', 'America/Tegucigalpa', 'America/Tegucigalpa', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('238', '1de864fbd6dc21eca4b910163ec66df14', 'America/Port-au-Prince', 'America/Port-au-Prince', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('239', '1fe864fbd6dc11eca4b900163ec66df14', 'America/Jamaica', 'America/Jamaica', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('240', '1de864fbd6dc21eca4b910163ec66df15', 'America/Martinique', 'America/Martinique', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('241', '1fe864fbd6dc11eca4b900163ec66df15', 'America/Mexico_City', 'America/Mexico_City', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('242', '1de864fbd6dc21ecab910163ec66df16', 'America/Cancun', 'America/Cancun', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('243', '1fe864fbd6dc11eca4b90016ec66df16', 'America/Merida', 'America/Merida', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('244', '1de864fbd6dc21eca4b910163ec66df17', 'America/Monterrey', 'America/Monterrey', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('245', '1fe864fbd6dc11eca4b900163ec66df17', 'America/Matamoros', 'America/Matamoros', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('246', '1de864fbd6dc21ca4b910163ec66df18', 'America/Mazatlan', 'America/Mazatlan', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('247', '1fe864fbd6dc11eca4b900163ec66df18', 'America/Chihuahua', 'America/Chihuahua', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('248', '1de864fbd6dc21eca4b910163ec66df19', 'America/Ojinaga', 'America/Ojinaga', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('249', '1fe864fbd6dc11eca4b900163ec66df19', 'America/Hermosillo', 'America/Hermosillo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('250', '1de864fbd6dc21eca4b910163ec66df20', 'America/Tijuana', 'America/Tijuana', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('251', '1fe864fbd6dc11eca4b900163ec66df20', 'America/Santa_Isabel', 'America/Santa_Isabel', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('252', '1de864fbd6dc21eca4b910163ec66df21', 'America/Bahia_Banderas', 'America/Bahia_Banderas', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('253', '1fe864fbd6dc11eca4b900163ec66df21', 'America/Managua', 'America/Managua', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('254', '1de864fbd6dc21eca4b910163ec66df22', 'America/Panama', 'America/Panama', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('255', '1fe864fbd6dc11eca4b900163ec66df22', 'America/Lima', 'America/Lima', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('256', '1de864fbd6dc21eca4b910163ec66df23', 'America/Miquelon', 'America/Miquelon', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('257', '1fe864fbd6dc11eca4b900163ec66df23', 'America/Puerto_Rico', 'America/Puerto_Rico', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('258', '1de864fbd6dc21eca4b910163ec66df24', 'America/Asuncion', 'America/Asuncion', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('259', '1fe864fbd6dc11eca4b900163ec66df24', 'America/Paramaribo', 'America/Paramaribo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('260', '1fe864fbd6dc11eca4b900163ec66df7', 'America/El_Salvador', 'America/El_Salvador', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('261', '1de864fbd6dc21eca4b910161ec66df8', 'America/Grand_Turk', 'America/Grand_Turk', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('262', '1fe864fbd6dc11eca4b900163ec66df8', 'America/Port_of_Spain', 'America/Port_of_Spain', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('263', '1de864fbd6dc21eca4b910163ec66df9', 'America/New_York', 'America/New_York', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('264', '1fe864fbd6dc11eca4b900163ec66df9', 'America/Detroit', 'America/Detroit', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('265', '1de864fbd6dc21eca4b910163ec66df10', 'America/Kentucky/Louisville', 'America/Kentucky/Louisville', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('266', '1fe864fbd6dc11eca4b900163ec66df10', 'America/Kentucky/Monticello', 'America/Kentucky/Monticello', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('267', '1de864fbd6dc21eca4b910163ec66df11', 'America/Indiana/Indianapolis', 'America/Indiana/Indianapolis', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('268', '1fe864fbd6dc11eca4b900163ec66df11', 'America/Indiana/Vincennes', 'America/Indiana/Vincennes', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('269', '1de864fbd6dc21eca4b910163ec66df12', 'America/Indiana/Winamac', 'America/Indiana/Winamac', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('270', '1fe864fbd6dc11eca4b900163ec66df12', 'America/Indiana/Marengo', 'America/Indiana/Marengo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('271', '1de864fbd6dc21eca4b910163ec66df13', 'America/Indiana/Petersburg', 'America/Indiana/Petersburg', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('272', '1fe864fbd6dc11eca4b900163ec66df13', 'America/Indiana/Vevay', 'America/Indiana/Vevay', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('273', '1de864fbd6dc21eca4b910163ec66df14', 'America/Chicago', 'America/Chicago', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('274', '1fe864fbd6dc11eca4b900163ec66df14', 'America/Indiana/Tell_City', 'America/Indiana/Tell_City', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('275', '1de864fbd6dc21eca4b910163ec66df15', 'America/Indiana/Knox', 'America/Indiana/Knox', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('276', '1fe864fbd6dc11eca4b900163ec66df15', 'America/Menominee', 'America/Menominee', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('277', '1de864fbd6dc21eca4b910163ec66df16', 'America/North_Dakota/Center', 'America/North_Dakota/Center', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('278', '1fe864fbd6dc11eca4b900163ec66df16', 'America/North_Dakota/New_Salem', 'America/North_Dakota/New_Salem', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('279', '1de864fbd6dc21ecab910163ec66df17', 'America/North_Dakota/Beulah', 'America/North_Dakota/Beulah', + 'linux', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('280', '1fe864fbd6dc11eca4b90016ec66df17', 'America/Denver', 'America/Denver', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('281', '1de864fbd6dc21eca4b910163ec66df18', 'America/Boise', 'America/Boise', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('282', '1fe864fbd6dc11eca4b900163ec66df18', 'America/Phoenix', 'America/Phoenix', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('283', '1de864fbd6dc21ca4b910163ec66df19', 'America/Los_Angeles', 'America/Los_Angeles', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('284', '1fe864fbd6dc11eca4b900163ec66df19', 'America/Metlakatla', 'America/Metlakatla', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('285', '1de864fbd6dc21eca4b910163ec66df20', 'America/Anchorage', 'America/Anchorage', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('286', '1fe864fbd6dc11eca4b900163ec66df20', 'America/Juneau', 'America/Juneau', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('287', '1de864fbd6dc21eca4b910163ec66df21', 'America/Sitka', 'America/Sitka', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('288', '1fe864fbd6dc11eca4b900163ec66df21', 'America/Yakutat', 'America/Yakutat', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('289', '1de864fbd6dc21eca4b910163ec66df22', 'America/Nome', 'America/Nome', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('290', '1fe864fbd6dc11eca4b900163ec66df22', 'America/Adak', 'America/Adak', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('291', '1de864fbd6dc21eca4b910163ec66df23', 'America/Montevideo', 'America/Montevideo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('292', '1fe864fbd6dc11eca4b900163ec66df23', 'America/Caracas', 'America/Caracas', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('293', '1de864fbd6dc21eca4b910163ec66df24', 'America/Anguilla', 'America/Anguilla', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('294', '1fe864fbd6dc11eca4b900163ec66df24', 'America/Antigua', 'America/Antigua', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('295', '1de864fbd6dc21eca4b910163ec66df25', 'America/Aruba', 'America/Aruba', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('296', '1fe864fbd6dc11eca4b900163ec66df25', 'America/Atka', 'America/Atka', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('297', '1fe864fbd6dc11eca4b900163ec66df8', 'America/Buenos_Aires', 'America/Buenos_Aires', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('298', '1de864fbd6dc21eca4b910161ec66df9', 'America/Catamarca', 'America/Catamarca', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('299', '1fe864fbd6dc11eca4b900163ec66df9', 'America/Cayman', 'America/Cayman', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('300', '1de864fbd6dc21eca4b910163ec66df10', 'America/Coral_Harbour', 'America/Coral_Harbour', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('301', '1fe864fbd6dc11eca4b900163ec66df10', 'America/Cordoba', 'America/Cordoba', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('302', '1de864fbd6dc21eca4b910163ec66df11', 'America/Dominica', 'America/Dominica', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('303', '1fe864fbd6dc11eca4b900163ec66df11', 'America/Ensenada', 'America/Ensenada', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('304', '1de864fbd6dc21eca4b910163ec66df12', 'America/Fort_Wayne', 'America/Fort_Wayne', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('305', '1fe864fbd6dc11eca4b900163ec66df12', 'America/Grenada', 'America/Grenada', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('306', '1de864fbd6dc21eca4b910163ec66df13', 'America/Guadeloupe', 'America/Guadeloupe', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('307', '1fe864fbd6dc11eca4b900163ec66df13', 'America/Indianapolis', 'America/Indianapolis', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('308', '1de864fbd6dc21eca4b910163ec66df14', 'America/Jujuy', 'America/Jujuy', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('309', '1fe864fbd6dc11eca4b900163ec66df14', 'America/Knox_IN', 'America/Knox_IN', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('310', '1de864fbd6dc21eca4b910163ec66df15', 'America/Louisville', 'America/Louisville', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('311', '1fe864fbd6dc11eca4b900163ec66df15', 'America/Mendoza', 'America/Mendoza', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('312', '1de864fbd6dc21eca4b910163ec66df16', 'America/Montreal', 'America/Montreal', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('313', '1fe864fbd6dc11eca4b900163ec66df16', 'America/Montserrat', 'America/Montserrat', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('314', '1de864fbd6dc21eca4b910163ec66df17', 'America/Porto_Acre', 'America/Porto_Acre', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('315', '1fe864fbd6dc11eca4b900163ec66df17', 'America/Rosario', 'America/Rosario', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('316', '1de864fbd6dc21ecab910163ec66df18', 'America/Shiprock', 'America/Shiprock', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('317', '1fe864fbd6dc11eca4b90016ec66df18', 'America/St_Barthelemy', 'America/St_Barthelemy', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('318', '1de864fbd6dc21eca4b910163ec66df19', 'America/St_Kitts', 'America/St_Kitts', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('319', '1fe864fbd6dc11eca4b900163ec66df19', 'America/St_Lucia', 'America/St_Lucia', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('320', '1de864fbd6dc21ca4b910163ec66df20', 'America/St_Vincent', 'America/St_Vincent', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('321', '1fe864fbd6dc11eca4b900163ec66df20', 'America/Tortola', 'America/Tortola', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('322', '1de864fbd6dc21eca4b910163ec66df21', 'America/Marigot', 'America/Marigot', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('323', '1fe864fbd6dc11eca4b900163ec66df21', 'America/St_Thomas', 'America/St_Thomas', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('324', '1de864fbd6dc21eca4b910163ec66df22', 'America/Virgin', 'America/Virgin', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('325', '1fe864fbd6dc11eca4b900163ec66df22', 'Pacific/Pago_Pago', 'Pacific/Pago_Pago', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('326', '1de864fbd6dc21eca4b910163ec66df23', 'Pacific/Rarotonga', 'Pacific/Rarotonga', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('327', '1fe864fbd6dc11eca4b900163ec66df23', 'Pacific/Easter', 'Pacific/Easter', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('328', '1de864fbd6dc21eca4b910163ec66df24', 'Pacific/Galapagos', 'Pacific/Galapagos', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('329', '1fe864fbd6dc11eca4b900163ec66df24', 'Pacific/Fiji', 'Pacific/Fiji', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('330', '1de864fbd6dc21eca4b910163ec66df25', 'Pacific/Chuuk', 'Pacific/Chuuk', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('331', '1fe864fbd6dc11eca4b900163ec66df25', 'Pacific/Pohnpei', 'Pacific/Pohnpei', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('332', '1de864fbd6dc21eca4b910163ec66df26', 'Pacific/Kosrae', 'Pacific/Kosrae', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('333', '1fe864fbd6dc11eca4b900163ec66df26', 'Pacific/Guam', 'Pacific/Guam', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('334', '1fe864fbd6dc11eca4b900163ec66df9', 'Pacific/Tarawa', 'Pacific/Tarawa', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('335', '1de864fbd6dc21eca4b910161ec66df10', 'Pacific/Enderbury', 'Pacific/Enderbury', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('336', '1fe864fbd6dc11eca4b900163ec66df10', 'Pacific/Kiritimati', 'Pacific/Kiritimati', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('337', '1de864fbd6dc21eca4b910163ec66df11', 'Pacific/Majuro', 'Pacific/Majuro', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('338', '1fe864fbd6dc11eca4b900163ec66df11', 'Pacific/Kwajalein', 'Pacific/Kwajalein', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('339', '1de864fbd6dc21eca4b910163ec66df12', 'Pacific/Noumea', 'Pacific/Noumea', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('340', '1fe864fbd6dc11eca4b900163ec66df12', 'Pacific/Norfolk', 'Pacific/Norfolk', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('341', '1de864fbd6dc21eca4b910163ec66df13', 'Pacific/Nauru', 'Pacific/Nauru', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('342', '1fe864fbd6dc11eca4b900163ec66df13', 'Pacific/Niue', 'Pacific/Niue', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('343', '1de864fbd6dc21eca4b910163ec66df14', 'Pacific/Auckland', 'Pacific/Auckland', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('344', '1fe864fbd6dc11eca4b900163ec66df14', 'Pacific/Chatham', 'Pacific/Chatham', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('345', '1de864fbd6dc21eca4b910163ec66df15', 'Pacific/Tahiti', 'Pacific/Tahiti', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('346', '1fe864fbd6dc11eca4b900163ec66df15', 'Pacific/Marquesas', 'Pacific/Marquesas', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('347', '1de864fbd6dc21eca4b910163ec66df16', 'Pacific/Gambier', 'Pacific/Gambier', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('348', '1fe864fbd6dc11eca4b900163ec66df16', 'Pacific/Port_Moresby', 'Pacific/Port_Moresby', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('349', '1de864fbd6dc21eca4b910163ec66df17', 'Pacific/Bougainville', 'Pacific/Bougainville', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('350', '1fe864fbd6dc11eca4b900163ec66df17', 'Pacific/Pitcairn', 'Pacific/Pitcairn', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('351', '1de864fbd6dc21eca4b910163ec66df18', 'Pacific/Palau', 'Pacific/Palau', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('352', '1fe864fbd6dc11eca4b900163ec66df18', 'Pacific/Guadalcanal', 'Pacific/Guadalcanal', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('353', '1de864fbd6dc21ecab910163ec66df19', 'Pacific/Fakaofo', 'Pacific/Fakaofo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('354', '1fe864fbd6dc11eca4b90016ec66df19', 'Pacific/Tongatapu', 'Pacific/Tongatapu', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('355', '1de864fbd6dc21eca4b910163ec66df20', 'Pacific/Funafuti', 'Pacific/Funafuti', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('356', '1fe864fbd6dc11eca4b900163ec66df20', 'Pacific/Wake', 'Pacific/Wake', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('357', '1de864fbd6dc21ca4b910163ec66df21', 'Pacific/Honolulu', 'Pacific/Honolulu', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('358', '1fe864fbd6dc11eca4b900163ec66df21', 'Pacific/Efate', 'Pacific/Efate', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('359', '1de864fbd6dc21eca4b910163ec66df22', 'Pacific/Wallis', 'Pacific/Wallis', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('360', '1fe864fbd6dc11eca4b900163ec66df22', 'Pacific/Apia', 'Pacific/Apia', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('361', '1de864fbd6dc21eca4b910163ec66df23', 'Pacific/Johnston', 'Pacific/Johnston', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('362', '1fe864fbd6dc11eca4b900163ec66df23', 'Pacific/Midway', 'Pacific/Midway', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('363', '1de864fbd6dc21eca4b910163ec66df24', 'Pacific/Saipan', 'Pacific/Saipan', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('364', '1fe864fbd6dc11eca4b900163ec66df24', 'Pacific/Samoa', 'Pacific/Samoa', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('365', '1de864fbd6dc21eca4b910163ec66df25', 'Pacific/Truk', 'Pacific/Truk', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('366', '1fe864fbd6dc11eca4b900163ec66df25', 'Australia/Lord_Howe', 'Australia/Lord_Howe', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('367', '1de864fbd6dc21eca4b910163ec66df26', 'Australia/Hobart', 'Australia/Hobart', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('368', '1fe864fbd6dc11eca4b900163ec66df26', 'Australia/Currie', 'Australia/Currie', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('369', '1de864fbd6dc21eca4b910163ec66df27', 'Australia/Melbourne', 'Australia/Melbourne', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('370', '1fe864fbd6dc11eca4b900163ec66df27', 'Australia/Sydney', 'Australia/Sydney', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('371', '1fe864fbd6dc11eca4b900163ec66df10', 'Australia/Broken_Hill', 'Australia/Broken_Hill', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('372', '1de864fbd6dc21eca4b910161ec66df11', 'Australia/Brisbane', 'Australia/Brisbane', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('373', '1fe864fbd6dc11eca4b900163ec66df11', 'Australia/Lindeman', 'Australia/Lindeman', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('374', '1de864fbd6dc21eca4b910163ec66df12', 'Australia/Adelaide', 'Australia/Adelaide', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('375', '1fe864fbd6dc11eca4b900163ec66df12', 'Australia/Darwin', 'Australia/Darwin', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('376', '1de864fbd6dc21eca4b910163ec66df13', 'Australia/Perth', 'Australia/Perth', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('377', '1fe864fbd6dc11eca4b900163ec66df13', 'Australia/Eucla', 'Australia/Eucla', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('378', '1de864fbd6dc21eca4b910163ec66df14', 'Australia/ACT', 'Australia/ACT', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('379', '1fe864fbd6dc11eca4b900163ec66df14', 'Australia/Canberra', 'Australia/Canberra', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('380', '1de864fbd6dc21eca4b910163ec66df15', 'Australia/LHI', 'Australia/LHI', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('381', '1fe864fbd6dc11eca4b900163ec66df15', 'Australia/North', 'Australia/North', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('382', '1de864fbd6dc21eca4b910163ec66df16', 'Australia/NSW', 'Australia/NSW', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('383', '1fe864fbd6dc11eca4b900163ec66df16', 'Australia/Queensland', 'Australia/Queensland', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('384', '1de864fbd6dc21eca4b910163ec66df17', 'Australia/South', 'Australia/South', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('385', '1fe864fbd6dc11eca4b900163ec66df17', 'Australia/Tasmania', 'Australia/Tasmania', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('386', '1de864fbd6dc21eca4b910163ec66df18', 'Australia/Victoria', 'Australia/Victoria', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('387', '1fe864fbd6dc11eca4b900163ec66df18', 'Australia/West', 'Australia/West', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('388', '1de864fbd6dc21eca4b910163ec66df19', 'Atlantic/Bermuda', 'Atlantic/Bermuda', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('389', '1fe864fbd6dc11eca4b900163ec66df19', 'Atlantic/Cape_Verde', 'Atlantic/Cape_Verde', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('390', '1de864fbd6dc21ecab910163ec66df20', 'Atlantic/Canary', 'Atlantic/Canary', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('391', '1fe864fbd6dc11eca4b90016ec66df20', 'Atlantic/Stanley', 'Atlantic/Stanley', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('392', '1de864fbd6dc21eca4b910163ec66df21', 'Atlantic/Faroe', 'Atlantic/Faroe', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('393', '1fe864fbd6dc11eca4b900163ec66df21', 'Atlantic/South_Georgia', 'Atlantic/South_Georgia', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('394', '1de864fbd6dc21ca4b910163ec66df22', 'Atlantic/Reykjavik', 'Atlantic/Reykjavik', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('395', '1fe864fbd6dc11eca4b900163ec66df22', 'Atlantic/Madeira', 'Atlantic/Madeira', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('396', '1de864fbd6dc21eca4b910163ec66df23', 'Atlantic/Azores', 'Atlantic/Azores', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('397', '1fe864fbd6dc11eca4b900163ec66df23', 'Atlantic/St_Helena', 'Atlantic/St_Helena', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('398', '1de864fbd6dc21eca4b910163ec66df24', 'Indian/Cocos', 'Indian/Cocos', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('399', '1fe864fbd6dc11eca4b900163ec66df24', 'Indian/Christmas', 'Indian/Christmas', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('400', '1de864fbd6dc21eca4b910163ec66df25', 'Indian/Chagos', 'Indian/Chagos', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('401', '1fe864fbd6dc11eca4b900163ec66df25', 'Indian/Mauritius', 'Indian/Mauritius', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('402', '1de864fbd6dc21eca4b910163ec66df26', 'Indian/Maldives', 'Indian/Maldives', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('403', '1fe864fbd6dc11eca4b900163ec66df26', 'Indian/Reunion', 'Indian/Reunion', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('404', '1de864fbd6dc21eca4b910163ec66df27', 'Indian/Mahe', 'Indian/Mahe', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('405', '1fe864fbd6dc11eca4b900163ec66df27', 'Indian/Kerguelen', 'Indian/Kerguelen', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('406', '1de864fbd6dc21eca4b910163ec66df28', 'Indian/Antananarivo', 'Indian/Antananarivo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('407', '1fe864fbd6dc11eca4b900163ec66df28', 'Africa/Abidjan', 'Africa/Abidjan', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('408', '1fe864fbd6dc11eca4b900163ec66df11', 'Africa/Algiers', 'Africa/Algiers', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('409', '1de864fbd6dc21eca4b910161ec66df12', 'Africa/Cairo', 'Africa/Cairo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('410', '1fe864fbd6dc11eca4b900163ec66df12', 'Africa/El_Aaiun', 'Africa/El_Aaiun', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('411', '1de864fbd6dc21eca4b910163ec66df13', 'Africa/Ceuta', 'Africa/Ceuta', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('412', '1fe864fbd6dc11eca4b900163ec66df13', 'Africa/Accra', 'Africa/Accra', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('413', '1de864fbd6dc21eca4b910163ec66df14', 'Africa/Bissau', 'Africa/Bissau', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('414', '1fe864fbd6dc11eca4b900163ec66df14', 'Africa/Nairobi', 'Africa/Nairobi', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('415', '1de864fbd6dc21eca4b910163ec66df15', 'Africa/Monrovia', 'Africa/Monrovia', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('416', '1fe864fbd6dc11eca4b900163ec66df15', 'Africa/Tripoli', 'Africa/Tripoli', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('417', '1de864fbd6dc21eca4b910163ec66df16', 'Africa/Casablanca', 'Africa/Casablanca', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('418', '1fe864fbd6dc11eca4b900163ec66df16', 'Africa/Maputo', 'Africa/Maputo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('419', '1de864fbd6dc21eca4b910163ec66df17', 'Africa/Windhoek', 'Africa/Windhoek', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('420', '1fe864fbd6dc11eca4b900163ec66df17', 'Africa/Lagos', 'Africa/Lagos', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('421', '1de864fbd6dc21eca4b910163ec66df18', 'Africa/Khartoum', 'Africa/Khartoum', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('422', '1fe864fbd6dc11eca4b900163ec66df18', 'Africa/Ndjamena', 'Africa/Ndjamena', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('423', '1de864fbd6dc21eca4b910163ec66df19', 'Africa/Tunis', 'Africa/Tunis', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('424', '1fe864fbd6dc11eca4b900163ec66df19', 'Africa/Johannesburg', 'Africa/Johannesburg', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('425', '1de864fbd6dc21eca4b910163ec66df20', 'Africa/Freetown', 'Africa/Freetown', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('426', '1fe864fbd6dc11eca4b900163ec66df20', 'Africa/Gaborone', 'Africa/Gaborone', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('427', '1de864fbd6dc21ecab910163ec66df21', 'Africa/Addis_Ababa', 'Africa/Addis_Ababa', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('428', '1fe864fbd6dc11eca4b90016ec66df21', 'Africa/Asmara', 'Africa/Asmara', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('429', '1de864fbd6dc21eca4b910163ec66df22', 'Africa/Asmera', 'Africa/Asmera', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('430', '1fe864fbd6dc11eca4b900163ec66df22', 'Africa/Bamako', 'Africa/Bamako', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('431', '1de864fbd6dc21ca4b910163ec66df23', 'Africa/Bangui', 'Africa/Bangui', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('432', '1fe864fbd6dc11eca4b900163ec66df23', 'Africa/Banjul', 'Africa/Banjul', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('433', '1de864fbd6dc21eca4b910163ec66df24', 'Africa/Blantyre', 'Africa/Blantyre', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('434', '1fe864fbd6dc11eca4b900163ec66df24', 'Africa/Brazzaville', 'Africa/Brazzaville', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('435', '1de864fbd6dc21eca4b910163ec66df25', 'Africa/Bujumbura', 'Africa/Bujumbura', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('436', '1fe864fbd6dc11eca4b900163ec66df25', 'Africa/Conakry', 'Africa/Conakry', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('437', '1de864fbd6dc21eca4b910163ec66df26', 'Africa/Dakar', 'Africa/Dakar', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('438', '1fe864fbd6dc11eca4b900163ec66df26', 'Africa/Dar_es_Salaam', 'Africa/Dar_es_Salaam', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('439', '1de864fbd6dc21eca4b910163ec66df27', 'Africa/Djibouti', 'Africa/Djibouti', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('440', '1fe864fbd6dc11eca4b900163ec66df27', 'Africa/Douala', 'Africa/Douala', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('441', '1de864fbd6dc21eca4b910163ec66df28', 'Africa/Harare', 'Africa/Harare', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('442', '1fe864fbd6dc11eca4b900163ec66df28', 'Africa/Kampala', 'Africa/Kampala', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('443', '1de864fbd6dc21eca4b910163ec66df29', 'Africa/Kigali', 'Africa/Kigali', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('444', '1fe864fbd6dc11eca4b900163ec66df29', 'Africa/Kinshasa', 'Africa/Kinshasa', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('445', '1fe864fbd6dc11eca4b900163ec66df12', 'Africa/Libreville', 'Africa/Libreville', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('446', '1de864fbd6dc21eca4b910161ec66df13', 'Africa/Lome', 'Africa/Lome', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('447', '1fe864fbd6dc11eca4b900163ec66df13', 'Africa/Luanda', 'Africa/Luanda', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('448', '1de864fbd6dc21eca4b910163ec66df14', 'Africa/Lubumbashi', 'Africa/Lubumbashi', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('449', '1fe864fbd6dc11eca4b900163ec66df14', 'Africa/Lusaka', 'Africa/Lusaka', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('450', '1de864fbd6dc21eca4b910163ec66df15', 'Africa/Malabo', 'Africa/Malabo', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('451', '1fe864fbd6dc11eca4b900163ec66df15', 'Africa/Maseru', 'Africa/Maseru', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('452', '1de864fbd6dc21eca4b910163ec66df16', 'Africa/Mbabane', 'Africa/Mbabane', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('453', '1fe864fbd6dc11eca4b900163ec66df16', 'Africa/Mogadishu', 'Africa/Mogadishu', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('454', '1de864fbd6dc21eca4b910163ec66df17', 'Africa/Niamey', 'Africa/Niamey', 'linux', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('455', '1fe864fbd6dc11eca4b900163ec66df17', 'Africa/Nouakchott', 'Africa/Nouakchott', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('456', '1de864fbd6dc21eca4b910163ec66df18', 'Africa/Ouagadougou', 'Africa/Ouagadougou', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('457', '1fe864fbd6dc11eca4b900163ec66df18', 'Africa/Porto-Novo', 'Africa/Porto-Novo', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('458', '1de864fbd6dc21eca4b910163ec66df19', 'Africa/Sao_Tome', 'Africa/Sao_Tome', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('459', '1fe864fbd6dc11eca4b900163ec66df19', 'Africa/Timbuktu', 'Africa/Timbuktu', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('460', '1de864fbd6dc21eca4b910163ec66df20', 'Arctic/Longyearbyen', 'Arctic/Longyearbyen', 'linux', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('461', '1fe864fbd6dc11eca4b900163ec66df20', 'Dateline Standard Time', 'Dateline Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('462', '1de864fbd6dc21eca4b910163ec66df21', 'UTC-11', 'UTC-11', 'windows', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('463', '1fe864fbd6dc11eca4b900163ec66df21', 'Hawaiian Standard Time', 'Hawaiian Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('464', '1de864fbd6dc21ecab910163ec66df22', 'Alaskan Standard Time', 'Alaskan Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('465', '1fe864fbd6dc11eca4b90016ec66df22', 'Pacific Standard Time (Mexico)', 'Pacific Standard Time (Mexico)', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('466', '1de864fbd6dc21eca4b910163ec66df23', 'Pacific Standard Time', 'Pacific Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('467', '1fe864fbd6dc11eca4b900163ec66df23', 'US Mountain Standard Time', 'US Mountain Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('468', '1de864fbd6dc21ca4b910163ec66df24', 'Mountain Standard Time (Mexico)', 'Mountain Standard Time (Mexico)', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('469', '1fe864fbd6dc11eca4b900163ec66df24', 'Mountain Standard Time', 'Mountain Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('470', '1de864fbd6dc21eca4b910163ec66df25', 'Central America Standard Time', 'Central America Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('471', '1fe864fbd6dc11eca4b900163ec66df25', 'Central Standard Time', 'Central Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('472', '1de864fbd6dc21eca4b910163ec66df26', 'Central Standard Time (Mexico)', 'Central Standard Time (Mexico)', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('473', '1fe864fbd6dc11eca4b900163ec66df26', 'Canada Central Standard Time', 'Canada Central Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('474', '1de864fbd6dc21eca4b910163ec66df27', 'Eastern Standard Time', 'Eastern Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('475', '1fe864fbd6dc11eca4b900163ec66df27', 'US Eastern Standard Time', 'US Eastern Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('476', '1de864fbd6dc21eca4b910163ec66df28', 'SA Pacific Standard Time', 'SA Pacific Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('477', '1fe864fbd6dc11eca4b900163ec66df28', 'Venezuela Standard Time', 'Venezuela Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('478', '1de864fbd6dc21eca4b910163ec66df29', 'SA Western Standard Time', 'SA Western Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('479', '1fe864fbd6dc11eca4b900163ec66df29', 'Paraguay Standard Time', 'Paraguay Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('480', '1de864fbd6dc21eca4b910163ec66df30', 'Pacific SA Standard Time', 'Pacific SA Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('481', '1fe864fbd6dc11eca4b900163ec66df30', 'Atlantic Standard Time', 'Atlantic Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('482', '1fe864fbd6dc11eca4b900163ec66df13', 'Central Brazilian Standard Time', + 'Central Brazilian Standard Time', 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('483', '1de864fbd6dc21eca4b910161ec66df14', 'Newfoundland Standard Time', 'Newfoundland Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('484', '1fe864fbd6dc11eca4b900163ec66df14', 'SA Eastern Standard Time', 'SA Eastern Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('485', '1de864fbd6dc21eca4b910163ec66df15', 'E. South America Standard Time', 'E. South America Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('486', '1fe864fbd6dc11eca4b900163ec66df15', 'Argentina Standard Time', 'Argentina Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('487', '1de864fbd6dc21eca4b910163ec66df16', 'Greenland Standard Time', 'Greenland Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('488', '1fe864fbd6dc11eca4b900163ec66df16', 'Bahia Standard Time', 'Bahia Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('489', '1de864fbd6dc21eca4b910163ec66df17', 'Montevideo Standard Time', 'Montevideo Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('490', '1fe864fbd6dc11eca4b900163ec66df17', 'Mid-Atlantic Standard Time', 'Mid-Atlantic Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('491', '1de864fbd6dc21eca4b910163ec66df18', 'UTC-02', 'UTC-02', 'windows', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('492', '1fe864fbd6dc11eca4b900163ec66df18', 'Azores Standard Time', 'Azores Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('493', '1de864fbd6dc21eca4b910163ec66df19', 'Cape Verde Standard Time', 'Cape Verde Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('494', '1fe864fbd6dc11eca4b900163ec66df19', 'UTC', 'UTC', 'windows', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('495', '1de864fbd6dc21eca4b910163ec66df20', 'Morocco Standard Time', 'Morocco Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('496', '1fe864fbd6dc11eca4b900163ec66df20', 'Greenwich Standard Time', 'Greenwich Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('497', '1de864fbd6dc21eca4b910163ec66df21', 'GMT Standard Time', 'GMT Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('498', '1fe864fbd6dc11eca4b900163ec66df21', 'W. Central Africa Standard Time', + 'W. Central Africa Standard Time', 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('499', '1de864fbd6dc21eca4b910163ec66df22', 'Romance Standard Time', 'Romance Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('500', '1fe864fbd6dc11eca4b900163ec66df22', 'Namibia Standard Time', 'Namibia Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('501', '1de864fbd6dc21ecab910163ec66df23', 'Central European Standard Time', 'Central European Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('502', '1fe864fbd6dc11eca4b90016ec66df23', 'Central Europe Standard Time', 'Central Europe Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('503', '1de864fbd6dc21eca4b910163ec66df24', 'W. Europe Standard Time', 'W. Europe Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('504', '1fe864fbd6dc11eca4b900163ec66df24', 'E. Europe Standard Time', 'E. Europe Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('505', '1de864fbd6dc21ca4b910163ec66df25', 'Turkey Standard Time', 'Turkey Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('506', '1fe864fbd6dc11eca4b900163ec66df25', 'South Africa Standard Time', 'South Africa Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('507', '1de864fbd6dc21eca4b910163ec66df26', 'Syria Standard Time', 'Syria Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('508', '1fe864fbd6dc11eca4b900163ec66df26', 'Egypt Standard Time', 'Egypt Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('509', '1de864fbd6dc21eca4b910163ec66df27', 'Israel Standard Time', 'Israel Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('510', '1fe864fbd6dc11eca4b900163ec66df27', 'Middle East Standard Time', 'Middle East Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('511', '1de864fbd6dc21eca4b910163ec66df28', 'FLE Standard Time', 'FLE Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('512', '1fe864fbd6dc11eca4b900163ec66df28', 'GTB Standard Time', 'GTB Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('513', '1de864fbd6dc21eca4b910163ec66df29', 'E. Africa Standard Time', 'E. Africa Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('514', '1fe864fbd6dc11eca4b900163ec66df29', 'Kaliningrad Standard Time', 'Kaliningrad Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('515', '1de864fbd6dc21eca4b910163ec66df30', 'Jordan Standard Time', 'Jordan Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('516', '1fe864fbd6dc11eca4b900163ec66df30', 'Arabic Standard Time', 'Arabic Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('517', '1de864fbd6dc21eca4b910163ec66df31', 'Arab Standard Time', 'Arab Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('518', '1fe864fbd6dc11eca4b900163ec66df31', 'Iran Standard Time', 'Iran Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('519', '1fe864fbd6dc11eca4b900163ec66df14', 'Caucasus Standard Time', 'Caucasus Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('520', '1de864fbd6dc21eca4b910161ec66df15', 'Azerbaijan Standard Time', 'Azerbaijan Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('521', '1fe864fbd6dc11eca4b900163ec66df15', 'Georgian Standard Time', 'Georgian Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('522', '1de864fbd6dc21eca4b910163ec66df16', 'Russian Standard Time', 'Russian Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('523', '1fe864fbd6dc11eca4b900163ec66df16', 'Mauritius Standard Time', 'Mauritius Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('524', '1de864fbd6dc21eca4b910163ec66df17', 'Arabian Standard Time', 'Arabian Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('525', '1fe864fbd6dc11eca4b900163ec66df17', 'Afghanistan Standard Time', 'Afghanistan Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('526', '1de864fbd6dc21eca4b910163ec66df18', 'Pakistan Standard Time', 'Pakistan Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('527', '1fe864fbd6dc11eca4b900163ec66df18', 'West Asia Standard Time', 'West Asia Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('528', '1de864fbd6dc21eca4b910163ec66df19', 'Sri Lanka Standard Time', 'Sri Lanka Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('529', '1fe864fbd6dc11eca4b900163ec66df19', 'India Standard Time', 'India Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('530', '1de864fbd6dc21eca4b910163ec66df20', 'Nepal Standard Time', 'Nepal Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('531', '1fe864fbd6dc11eca4b900163ec66df20', 'Ekaterinburg Standard Time', 'Ekaterinburg Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('532', '1de864fbd6dc21eca4b910163ec66df21', 'Bangladesh Standard Time', 'Bangladesh Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('533', '1fe864fbd6dc11eca4b900163ec66df21', 'Central Asia Standard Time', 'Central Asia Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('534', '1de864fbd6dc21eca4b910163ec66df22', 'Myanmar Standard Time', 'Myanmar Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('535', '1fe864fbd6dc11eca4b900163ec66df22', 'N. Central Asia Standard Time', 'N. Central Asia Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('536', '1de864fbd6dc21eca4b910163ec66df23', 'SE Asia Standard Time', 'SE Asia Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('537', '1fe864fbd6dc11eca4b900163ec66df23', 'Ulaanbaatar Standard Time', 'Ulaanbaatar Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('538', '1de864fbd6dc21ecab910163ec66df24', 'North Asia Standard Time', 'North Asia Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('539', '1fe864fbd6dc11eca4b90016ec66df24', 'China Standard Time', 'China Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('540', '1de864fbd6dc21eca4b910163ec66df25', 'Taipei Standard Time', 'Taipei Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('541', '1fe864fbd6dc11eca4b900163ec66df25', 'Singapore Standard Time', 'Singapore Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('542', '1de864fbd6dc21ca4b910163ec66df26', 'W. Australia Standard Time', 'W. Australia Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('543', '1fe864fbd6dc11eca4b900163ec66df26', 'North Asia East Standard Time', 'North Asia East Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('544', '1de864fbd6dc21eca4b910163ec66df27', 'Tokyo Standard Time', 'Tokyo Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('545', '1fe864fbd6dc11eca4b900163ec66df27', 'Korea Standard Time', 'Korea Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('546', '1de864fbd6dc21eca4b910163ec66df28', 'AUS Central Standard Time', 'AUS Central Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('547', '1fe864fbd6dc11eca4b900163ec66df28', 'Cen. Australia Standard Time', 'Cen. Australia Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('548', '1de864fbd6dc21eca4b910163ec66df29', 'West Pacific Standard Time', 'West Pacific Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('549', '1fe864fbd6dc11eca4b900163ec66df29', 'AUS Eastern Standard Time', 'AUS Eastern Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('550', '1de864fbd6dc21eca4b910163ec66df30', 'E. Australia Standard Time', 'E. Australia Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('551', '1fe864fbd6dc11eca4b900163ec66df30', 'Yakutsk Standard Time', 'Yakutsk Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('552', '1de864fbd6dc21eca4b910163ec66df31', 'Tasmania Standard Time', 'Tasmania Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('553', '1fe864fbd6dc11eca4b900163ec66df31', 'Central Pacific Standard Time', 'Central Pacific Standard Time', + 'windows', '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('554', '1de864fbd6dc21eca4b910163ec66df32', 'Vladivostok Standard Time', 'Vladivostok Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('555', '1fe864fbd6dc11eca4b900163ec66df32', 'UTC+12', 'UTC+12', 'windows', '2022-05-19 11:18:00', + '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('556', '1fe864fbd6dc11eca4b900163ec66df15', 'New Zealand Standard Time', 'New Zealand Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('557', '1de864fbd6dc21eca4b910161ec66df16', 'Kamchatka Standard Time', 'Kamchatka Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('558', '1fe864fbd6dc11eca4b900163ec66df16', 'Fiji Standard Time', 'Fiji Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('559', '1de864fbd6dc21eca4b910163ec66df17', 'Magadan Standard Time', 'Magadan Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('560', '1fe864fbd6dc11eca4b900163ec66df17', 'Tonga Standard Time', 'Tonga Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); +INSERT INTO `starlet_control_timezone` +VALUES ('561', '1de864fbd6dc21eca4b910163ec66df18', 'Samoa Standard Time', 'Samoa Standard Time', 'windows', + '2022-05-19 11:18:00', '2022-05-19 11:18:00'); diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/mapper/SysUserMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/mapper/SysUserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c8c970bf11bc9d34945f010030cab325c8330822 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-application/src/main/resources/mapper/SysUserMapper.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + UPDATE cosmos_iboot_sys_user + SET login_fail_count = login_fail_count + 1 + WHERE + account = #{account} + + + + + + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/pom.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..27101d1138901fe828e95dbf4f57ac43c8ada847 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/pom.xml @@ -0,0 +1,43 @@ + + + + cosmos-biz-iboot-base + com.inspur.cosmos.biz.iboot.base + ${revision} + + 4.0.0 + cosmos-biz-iboot-base-core + Cosmos Biz Iboot Base Core + + + + org.slf4j + slf4j-api + 2.0.7 + + + org.dom4j + dom4j + 2.1.3 + compile + + + com.inspur.cosmos.biz.iboot.base + cosmos-biz-iboot-base-api + + + javax.persistence + javax.persistence-api + + + com.inspur.cdc.combo + cdc-combo-mybatis + + + jakarta.servlet + jakarta.servlet-api + + + \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/DeviceServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/DeviceServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cc76cf01c7e20effecbee20676b80638bff70c58 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/DeviceServiceImpl.java @@ -0,0 +1,1242 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import cn.hutool.core.lang.UUID; +import cn.hutool.core.net.Ipv4Util; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.ser.FilterProvider; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import com.inspur.cdc.combo.mybatis.page.Pages; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.cdc.commons.lang.util.CommonCheck; +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.cdc.commons.lang.web.PageRequest; +import com.inspur.ispim.cosmos.commons.exception.PimException; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TemplateTypeEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.*; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootUserCfgBeans; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.UserCfgBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRepositoryImageEntity; +import com.inspur.ispim.cosmos.iboot.base.api.service.DeviceService; +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootTemplateService; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.DeviceMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootRepositoryImageMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.SpreadsheetVersion; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.xssf.usermodel.*; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.scheduling.concurrent.CustomizableThreadFactory; +import tk.mybatis.mapper.util.StringUtil; + +import java.awt.Color; +import java.io.*; +import java.util.List; +import java.util.*; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static cn.hutool.core.bean.BeanUtil.beanToMap; +import static com.inspur.cdc.commons.lang.consts.CdcConsts.VERIFY_IPV4_PATTERN; +import static com.inspur.cdc.commons.lang.consts.CdcConsts.VERIFY_IPV6_PATTERN; +import static com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant.ibootBasePath; +import static com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant.webserviceBasePath; + +/** + * 给设备使用的内部实现 + */ +@Slf4j +public class DeviceServiceImpl implements DeviceService { + + protected static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + private static final String IBOOT_USERNAME = "inmanage"; + private static final String IBOOT_PW = "manage1!"; + // PXE重启 + private static final String PXE_RESET = "pxereset"; + private static final String COMMAND_SERVICE_STATUS = "systemctl status tftp nginx dhcpd smb xinetd|grep \"●\\|Active:\""; + private static final String COMMAND_IP_ADDR = "ip a|grep \"state UP\" -A2 --no-group-separator|grep \"inet \"|awk '{print $2}'"; + private static final String COMMAND_DHCP_IP = "cat " + webserviceBasePath + "dhcpip"; + private static final String COMMAND_DHCP_RANGE = "cat /etc/dhcp/dhcpd.conf|grep \"^subnet\" -A1"; + private static final String COMMAND_NGINX_IP = "cat " + webserviceBasePath + "webserverip"; + protected final DeviceMapper deviceMapper; + private final IBootTemplateService iBootTemplateService; + private final IBootRepositoryImageMapper iBootRepositoryImageMapper; + + public DeviceServiceImpl(DeviceMapper deviceMapper, IBootTemplateService iBootTemplateService, IBootRepositoryImageMapper iBootRepositoryImageMapper) { + this.deviceMapper = deviceMapper; + this.iBootTemplateService = iBootTemplateService; + this.iBootRepositoryImageMapper = iBootRepositoryImageMapper; + } + + @Override + public List getAll() { + return deviceMapper.getAll(); + } + + @Override + public Page deviceList(DeviceQueryBean queryBean) { + this.handleDeviceQueryBean(queryBean); + return Pages.of(queryBean).page(deviceMapper.queryListWithPage(queryBean)); + } + + @Override + public DeviceDropdownBean deviceDropdown() { + DeviceDropdownBean deviceDropdownBean = new DeviceDropdownBean(); + deviceDropdownBean.setModelList(deviceMapper.queryModelList(null)); + deviceDropdownBean.setVendorList(deviceMapper.queryVendorList()); + return deviceDropdownBean; + } + + @Override + public List deviceModelList(String vendor) { + return deviceMapper.queryModelList(vendor); + } + + @Override + public ResultBean deviceDelete(DeviceQueryBean queryBean) { + this.handleDeviceQueryBean(queryBean); + List deviceEntities = deviceMapper.queryListWithPage(queryBean); + if (Objects.nonNull(deviceEntities) && deviceEntities.stream().anyMatch(e -> e.getStatus() == DeviceStatusEnum.Busy)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.busy"), null); + } + deviceMapper.batchDeleteNotBusyDevice(queryBean); + return new ResultBean(true, null, null); + } + + @Override + public ResultBean devicePowerManage(DeviceQueryBean queryBean, String mode) { + if (!StringUtils.equalsAny(mode, "on", "off", "reset", PXE_RESET)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + this.handleDeviceQueryBean(queryBean); + List deviceEntities = deviceMapper.queryListWithPage(queryBean); + if (deviceEntities.isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.busy"), null); + } + ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, + new SynchronousQueue<>(), + new CustomizableThreadFactory("iboot-device-power-manage"), + new ThreadPoolExecutor.AbortPolicy()); + executor.submit(() -> deviceEntities.forEach(e -> powerControl(e, mode))); + return new ResultBean(true, null, null); + } + + private void powerControl(DeviceEntity deviceEntity, String powerStatus) { + if (StringUtils.isBlank(powerStatus) || Objects.isNull(deviceEntity) || deviceEntity.getStatus() == DeviceStatusEnum.Busy) { + return; + } + if (powerStatus.equals("on")) { + if (IpmiStatusEnum.AVAILABLE == deviceEntity.getIpmiStatus() && DeviceStatusEnum.Offline == deviceEntity.getStatus()) { + powerControlOutofband(deviceEntity, powerStatus); + } else { + log.error("[{}]IPMI状态为[{}],设备状态为[{}],不可开机", CommonCheck.convertValidLog(deviceEntity.getId()), deviceEntity.getIpmiStatus(), deviceEntity.getStatus()); + } + } else if (DeviceStatusEnum.Online == deviceEntity.getStatus() && StringUtils.isNotBlank(deviceEntity.getDhcpIp())) { + String content = null; + if (powerStatus.equals("off")) { + content = "{\"type\":\"Shutdown\"}"; + } else if (powerStatus.equals("reset")) { + content = "{\"type\":\"Reboot\"}"; + } else if (PXE_RESET.equals(powerStatus)) { + content = "{\"type\":\"PXErestart\"}"; + } + if (StringUtils.isNotBlank(content)) { + try (HttpResponse response = HttpRequest.post("http://" + deviceEntity.getDhcpIp() + ":16061/powerSupply").body(content).execute()) { + log.info("[{}]执行带内电源管理[{}]", CommonCheck.convertValidLog(deviceEntity.getDhcpIp()), CommonCheck.convertValidLog(powerStatus)); + } catch (Exception e) { + log.info("[{}]执行带内电源管理[{}]", CommonCheck.convertValidLog(deviceEntity.getDhcpIp()), CommonCheck.convertValidLog(powerStatus)); + } + } + } else { + powerControlOutofband(deviceEntity, powerStatus); + } + } + + private void reset(String ip, String username, String password) { + try { + CommonUtil.powerControl(ip, username, password, "off"); + Thread.sleep(30000L); + CommonUtil.powerControl(ip, username, password, "on"); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + } + + private void powerControlOutofband(DeviceEntity deviceEntity, String powerStatus) { + if (StringUtils.isBlank(powerStatus) || Objects.isNull(deviceEntity) || StringUtils.isBlank(deviceEntity.getManageIp()) || IpmiStatusEnum.AVAILABLE != deviceEntity.getIpmiStatus()) { + log.error("[{}]执行带外电源管理失败", CommonCheck.convertValidLog(deviceEntity.getId())); + return; + } + try { + String userName = IBOOT_USERNAME; + String password = IBOOT_PW; + if (!StringUtils.isAnyBlank(deviceEntity.getManageUser(), deviceEntity.getManagePassword())) { + userName = deviceEntity.getManageUser(); + password = deviceEntity.getManagePassword(); + } + + if (PXE_RESET.equals(powerStatus)) { + if (CommonUtil.setSysBoot(deviceEntity.getManageIp(), userName, password, "pxe")) { + reset(deviceEntity.getManageIp(), userName, password); + } else { + log.error("[{}]设置pxe重启失败", CommonCheck.convertValidLog(deviceEntity.getSn())); + } + } else { + CommonUtil.powerControl(deviceEntity.getManageIp(), userName, password, powerStatus); + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + @Override + public ResultBean deviceRefresh(DeviceQueryBean queryBean) { + queryBean.setStatus(DeviceStatusEnum.Online); + this.handleDeviceQueryBean(queryBean); + List deviceEntities = deviceMapper.queryListWithPage(queryBean); + if (deviceEntities.isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.busy"), null); + } + return iBootTemplateService.startIBootTask(null, TemplateTypeEnum.DEVICE_REFRESH.name(), deviceEntities, Languages.getString("device_refresh")) ? + new ResultBean(true, null, null) : new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } + + @Override + public ResultBean deviceHeartbeat(String sn, String ip) { + if (StringUtils.isBlank(sn) || StringUtils.isBlank(ip)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + deviceMapper.updateHeartBeatBySn(sn, ip); + return new ResultBean(true, null, null); + } + + @Override + public ResultBean deviceReport(DeviceDetailBean detailBean) { + if (Objects.isNull(detailBean) || Objects.isNull(detailBean.getSystem()) || StringUtils.isBlank(detailBean.getSystem().getSerialNumber())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.import.fail.serial"), null); + } + DeviceSystemInfoBean systemInfoBean = detailBean.getSystem(); + DeviceEntity entity = new DeviceEntity(); + entity.setSn(systemInfoBean.getSerialNumber()); + entity.setDhcpIp(systemInfoBean.getDhcpIP()); + if (StringUtils.equalsIgnoreCase(systemInfoBean.getArchitecture(), ArchitectureEnum.x86_64.name())) { + entity.setArchitecture(ArchitectureEnum.x86_64); // 暂时只支持这一种 + } + if (StringUtils.isNotBlank(systemInfoBean.getManageIP())) { + entity.setManageIp(systemInfoBean.getManageIP()); + } + if (StringUtils.isNotBlank(systemInfoBean.getManageChannel())) { + if (StringUtils.equalsIgnoreCase(systemInfoBean.getManageChannel(), ManageChannelEnum.DEDICATED.name())) { + entity.setManageChannel(ManageChannelEnum.DEDICATED); + } else if (StringUtils.equalsIgnoreCase(systemInfoBean.getManageChannel(), ManageChannelEnum.SHARELINK.name())) { + entity.setManageChannel(ManageChannelEnum.SHARELINK); + } + } + if (StringUtils.isNotBlank(systemInfoBean.getBootOption())) { + if (StringUtils.equalsIgnoreCase(systemInfoBean.getBootOption(), BootOptionEnum.UEFI.name())) { + entity.setBootOption(BootOptionEnum.UEFI); + } else if (StringUtils.equalsIgnoreCase(systemInfoBean.getBootOption(), BootOptionEnum.LEGACY.name())) { + entity.setBootOption(BootOptionEnum.LEGACY); + } + } + entity.setNetworkDevice(systemInfoBean.getNetwork()); + entity.setModel(systemInfoBean.getModel()); + entity.setVendor(systemInfoBean.getVendor()); + try { + if (Objects.nonNull(detailBean.getStorage())) { + entity.setStorageInfo(OBJECT_MAPPER.writeValueAsString(detailBean.getStorage())); + + if (Objects.nonNull(detailBean.getStorage().getControllers()) && !detailBean.getStorage().getControllers().isEmpty()) { + ObjectMapper simpleMapper = JsonMapper.builder().configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true).build(); + FilterProvider simpleFilterProvider = new SimpleFilterProvider() + .addFilter("deviceControllerBeanFilter", SimpleBeanPropertyFilter.filterOutAllExcept("controllerId", "productName", "volumes", "drives", "type")) + .addFilter("deviceVolumeBeanFilter", SimpleBeanPropertyFilter.filterOutAllExcept("vid", "capacity", "name", "raidType", "slot", "drives", "driveGroup", "accessPolicy", "backPlane", "boot", "cachePolicy", "ioPolicy", "readPolicy", "strip", "writePolicy")) + .addFilter("deviceDriveBeanFilter", SimpleBeanPropertyFilter.filterOutAllExcept("controllerId", "enclosureId", "mediaType", "rawSize", "slotNumber", "status", "driveGroup")); + simpleMapper.addMixIn(DeviceControllerBean.class, DeviceControllerBeanFilter.class); + simpleMapper.addMixIn(DeviceVolumeBean.class, DeviceVolumeBeanFilter.class); + simpleMapper.addMixIn(DeviceDriveBean.class, DeviceDriveBeanFilter.class); + simpleMapper.setFilterProvider(simpleFilterProvider); + entity.setSingleStorageInfo(simpleMapper.writeValueAsString(detailBean.getStorage().getControllers())); + entity.setSingleStorageMd(CommonUtil.strToMd5(entity.getSingleStorageInfo())); + } + } + entity.setSystemInfo(OBJECT_MAPPER.writeValueAsString(systemInfoBean)); + } catch (JsonProcessingException e) { + log.error(e.getMessage()); + } + deviceMapper.updateBySn(entity); + return new ResultBean(true, null, null); + } + + @Override + public ResultBean addDevice(DeviceEntity deviceEntity) { + if (Objects.isNull(deviceEntity) || StringUtils.isBlank(deviceEntity.getSn())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.import.fail.serial"), null); + } + List list = deviceMapper.queryListBySn(Collections.singletonList(deviceEntity.getSn())); + if (Objects.nonNull(list) && !list.isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.is.exists"), null); + } + deviceEntity.setStatus(DeviceStatusEnum.Offline); + deviceEntity.setIpmiStatus(IpmiStatusEnum.UNAVAILABLE); + if (StringUtils.isAllBlank(deviceEntity.getManageIp(), deviceEntity.getManageUser(), deviceEntity.getManagePassword())) { + deviceEntity.setManageIp(null); + deviceEntity.setManageUser(null); + deviceEntity.setManagePassword(null); + deviceEntity.setIpmiFail(IpmiFailEnum.CONFIGURATION); + } else if (StringUtils.isBlank(deviceEntity.getManageUser()) != StringUtils.isBlank(deviceEntity.getManagePassword())) { + if (StringUtils.isBlank(deviceEntity.getManageUser())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null", Languages.getString("cosmos.iboot.device.parameter.username")), null); + } + if (StringUtils.isBlank(deviceEntity.getManagePassword())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null", Languages.getString("cosmos.iboot.device.parameter.password")), null); + } + } else if (StringUtils.isBlank(deviceEntity.getManageUser()) != StringUtils.isBlank(deviceEntity.getManageIp())) { + deviceEntity.setIpmiFail(IpmiFailEnum.CONFIGURATION); + } else { + deviceEntity.setIpmiFail(IpmiFailEnum.CONNECTION); + } + deviceEntity.setId(UUID.fastUUID().toString(true)); + deviceEntity.setHeartbeatTime(new Date()); + deviceMapper.batchInsert(Collections.singletonList(deviceEntity)); + if (deviceEntity.getManageAccount() == ManageAccountEnum.ON) { + UserCfgBean userCfgBean = new UserCfgBean(); + userCfgBean.setUsername(IBOOT_USERNAME); + userCfgBean.setUserPw(IBOOT_PW); + userCfgBean.setPrivilege("Admin"); + userCfgBean.setId("-1"); + userCfgBean.setSn(deviceEntity.getSn()); + IBootUserCfgBeans iBootUserCfgBeans = new IBootUserCfgBeans(); + iBootUserCfgBeans.setUserCfgBeans(Collections.singletonList(userCfgBean)); + try { + iBootTemplateService.startIBootTask(OBJECT_MAPPER.writeValueAsString(iBootUserCfgBeans), TemplateTypeEnum.USER_CONF.name(), Collections.singletonList(deviceEntity), Languages.getString("template_add_bmc_user", IBOOT_USERNAME)); + } catch (JsonProcessingException e) { + log.error("设备[{}]创建[iboot]用户失败, {}", deviceEntity.getSn(), e.getMessage()); + } + } + return new ResultBean(true, null, null); + } + + @Override + public ResultBean updateDevice(DeviceEntity deviceEntity) { + if (Objects.isNull(deviceEntity) || StringUtils.isBlank(deviceEntity.getId()) || StringUtils.isBlank(deviceEntity.getSn()) || deviceEntity.getManageAccount() == null) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + // 管理账户和密码需同时设置,如果用户只设置了管理账户或密码中的一个时,判断参数不合法原因 + if (StringUtils.isBlank(deviceEntity.getManageUser()) != StringUtils.isBlank(deviceEntity.getManagePassword())) { + if (StringUtils.isBlank(deviceEntity.getManageUser())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null", Languages.getString("cosmos.iboot.device.parameter.username")), null); + } + if (StringUtils.isBlank(deviceEntity.getManagePassword())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null", Languages.getString("cosmos.iboot.device.parameter.password")), null); + } + } + // 用户名密码中不能包含空格 + if (StringUtils.containsWhitespace(deviceEntity.getManagePassword()) || StringUtils.containsWhitespace(deviceEntity.getManageUser())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.whitespace"), null); + } + DeviceEntity originEntity = deviceMapper.queryEntityById(deviceEntity.getId()); + if (Objects.isNull(originEntity)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + deviceEntity.setIpmiStatus(IpmiStatusEnum.UNAVAILABLE); + if (StringUtils.isBlank(deviceEntity.getManageIp())) { + deviceEntity.setManageIp(null); + deviceEntity.setManageUser(StringUtils.stripToNull(deviceEntity.getManageUser())); + deviceEntity.setManagePassword(StringUtils.stripToNull(deviceEntity.getManagePassword())); + deviceEntity.setIpmiFail(IpmiFailEnum.CONFIGURATION); + } else { + if (StringUtils.isBlank(deviceEntity.getManageUser())) { + deviceEntity.setIpmiFail(IpmiFailEnum.CONFIGURATION); + } else { + deviceEntity.setIpmiFail(IpmiFailEnum.CREDENTIALS); + } + } + + // 更新内置的BMC管理用户信息 + if (deviceEntity.getManageAccount() != originEntity.getManageAccount()) { + UserCfgBean userCfgBean = new UserCfgBean(); + userCfgBean.setSn(deviceEntity.getSn()); + userCfgBean.setUsername(IBOOT_USERNAME); + userCfgBean.setId("-1"); + if (deviceEntity.getManageAccount() == ManageAccountEnum.OFF) { + userCfgBean.setDelete(true); + } else { + userCfgBean.setUserPw(IBOOT_PW); + userCfgBean.setPrivilege("Admin"); + } + IBootUserCfgBeans iBootUserCfgBeans = new IBootUserCfgBeans(); + iBootUserCfgBeans.setUserCfgBeans(Collections.singletonList(userCfgBean)); + try { + iBootTemplateService.startIBootTask(OBJECT_MAPPER.writeValueAsString(iBootUserCfgBeans), TemplateTypeEnum.USER_CONF.name(), Collections.singletonList(deviceEntity), Languages.getString("template_modify_bmc_user", userCfgBean.getUsername())); + } catch (JsonProcessingException e) { + log.error("设备[{}]编辑用户[iboot]失败, {}", deviceEntity.getSn(), e.getMessage()); + } + } + + deviceMapper.updateById(deviceEntity); + return new ResultBean(true, null, null); + } + + @Override + public ResultBean getDeviceDetail(String id) { + if (StringUtils.isBlank(id)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + DeviceEntity deviceEntity = deviceMapper.queryEntityById(id); + if (Objects.isNull(deviceEntity)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + return new ResultBean(true, null, deviceEntity); + } + + /** + * todo 是否有单独刷新的功能 + * + * @param id + * @return + */ + @Override + public ResultBean getDeviceSystemDetail(String id) { + if (StringUtils.isBlank(id)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + DeviceEntity deviceEntity = deviceMapper.queryEntityById(id); + if (Objects.isNull(deviceEntity)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + return new ResultBean(true, null, deviceEntity.getSystemInfo()); + } + + @Override + public ResultBean getDeviceStorageDetail(String id) { + if (StringUtils.isBlank(id)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + DeviceEntity deviceEntity = deviceMapper.queryEntityById(id); + if (Objects.isNull(deviceEntity)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + if (Objects.isNull(deviceEntity.getStorageInfo())) { + return new ResultBean(true, Languages.getString("cosmos.iboot.device.storage.report.error"), null); + } + TreeNode root = new TreeNode(); + root.setId("Root"); + root.setName("Root"); + root.setTypeName("root"); + // 转成前端需要的格式 + try { + DeviceStorageBean storageBean = OBJECT_MAPPER.readValue(deviceEntity.getStorageInfo(), DeviceStorageBean.class); + if (Objects.isNull(storageBean)) { + return new ResultBean(true, null, null); + } + List drives = this.parseDriveTreeNode(storageBean.getDrives()); + List controllers = this.parseControllerTreeNode(storageBean.getControllers()); + if (drives.isEmpty() && controllers.isEmpty()) { + return new ResultBean(true, null, null); + } + controllers.addAll(drives); + root.setChildList(controllers); + } catch (JsonProcessingException e) { + log.error(e.getMessage()); + return new ResultBean(false, Languages.getString("cosmos.iboot.device.storage.parse.error"), null); + } + return new ResultBean(true, null, root); + } + + private List parseDriveTreeNode(List driveBeans) { + List list = new LinkedList<>(); + int[] i = {0}; + if (Objects.nonNull(driveBeans) && !driveBeans.isEmpty()) { + list = driveBeans.stream().map(e -> { + if (StringUtils.isBlank(e.getSerialNumber())) { + log.error("磁盘序列号为空"); + e.setSerialNumber(Languages.getString("cosmos.iboot.device.storage.serial.unknown", i[0]++)); + } + TreeNode node = new TreeNode(); + node.setTypeName("drive"); + node.setId(e.getSerialNumber()); + if (StringUtils.isBlank(e.getDeviceName())) { + node.setName(e.getSerialNumber()); + } else { + node.setName(e.getDeviceName()); + } + // 处理物理盘状态 + DeviceDriveStatusEnum statusEnum = DeviceDriveStatusEnum.matchStatus(e.getStatus()); + e.setStatus(statusEnum.getStatus()); + e.setStatusTip(statusEnum.getDescription()); + node.setNodeStatus(statusEnum.name()); + + Map m = beanToMap(e, new HashMap<>(), false, + k -> StringUtils.isBlank(k) ? null : StringUtils.capitalize(k)); + node.setContent(parseStorageContent(m)); + return node; + }).collect(Collectors.toList()); + } + return list; + } + + private List parseVolumeTreeNode(List volumeBeans) { + List list = new LinkedList<>(); + int[] i = {0}; + if (Objects.nonNull(volumeBeans) && !volumeBeans.isEmpty()) { + list = volumeBeans.stream().map(e -> { + if (StringUtils.isBlank(e.getName())) { + log.error("逻辑磁盘名为空"); + e.setName(Languages.getString("cosmos.iboot.device.storage.volume.unknown", i[0]++)); + } + TreeNode node = new TreeNode(); + node.setTypeName("volume"); + node.setId(e.getName()); + node.setName(e.getName()); + node.setChildList(this.parseDriveTreeNode(e.getDrives())); + Map m = beanToMap(e, new HashMap<>(), false, + k -> StringUtils.isBlank(k) || "drives".equalsIgnoreCase(k) ? null : StringUtils.capitalize(k)); + node.setContent(parseStorageContent(m)); + return node; + }).collect(Collectors.toList()); + } + return list; + } + + private List parseControllerTreeNode(List controllerBeans) { + List list = new LinkedList<>(); + int[] i = {0}; + if (Objects.nonNull(controllerBeans) && !controllerBeans.isEmpty()) { + list = controllerBeans.stream().map(e -> { + if (StringUtils.isBlank(e.getSerialNumber())) { + log.error("磁盘控制器序列号为空"); + e.setSerialNumber(Languages.getString("cosmos.iboot.device.storage.controller.unknown", i[0]++)); + } + TreeNode node = new TreeNode(); + node.setTypeName("controller"); + node.setId(e.getSerialNumber()); + if (StringUtils.isBlank(e.getProductName())) { + node.setName(e.getSerialNumber()); + } else { + node.setName(e.getProductName()); + } + List volumes = this.parseVolumeTreeNode(e.getVolumes()); + List drives = this.parseDriveTreeNode(e.getDrives()); + volumes.addAll(drives); + node.setChildList(volumes); + Map m = beanToMap(e, new HashMap<>(), false, + k -> StringUtils.isBlank(k) || "drives".equalsIgnoreCase(k) || "volumes".equalsIgnoreCase(k) ? null : StringUtils.capitalize(k)); + node.setContent(parseStorageContent(m)); + return node; + }).collect(Collectors.toList()); + } + return list; + } + + private String parseStorageContent(Map content) { + try { + List entryList = content.entrySet().stream().map(entry -> { + DeviceStorageEntryBean bean = new DeviceStorageEntryBean(); + bean.setDesc(entry.getKey()); + bean.setValue(entry.getValue()); + return bean; + }).collect(Collectors.toList()); + return OBJECT_MAPPER.writeValueAsString(entryList); + } catch (JsonProcessingException ex) { + log.error(ex.getMessage()); + return null; + } + } + + @Override + public byte[] deviceTemplateDownload() { + XSSFWorkbook workbook = new XSSFWorkbook(); + XSSFSheet sheet = workbook.createSheet("sheet1"); + sheet.setDefaultColumnWidth(20); + XSSFCellStyle cellStyle = workbook.createCellStyle(); + cellStyle.setAlignment(HorizontalAlignment.CENTER); + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + cellStyle.setFillForegroundColor(new XSSFColor(Color.GRAY)); + cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); + XSSFRow row = sheet.createRow(0); + + XSSFCell cell1 = row.createCell(0); + cell1.setCellStyle(cellStyle); + cell1.setCellValue("SN"); + + XSSFCell cell2 = row.createCell(1); + cell2.setCellStyle(cellStyle); + cell2.setCellValue("BMC IP"); + + XSSFCell cell3 = row.createCell(2); + cell3.setCellStyle(cellStyle); + cell3.setCellValue(Languages.getString("cosmos.iboot.device.parameter.username")); + + XSSFCell cell4 = row.createCell(3); + cell4.setCellStyle(cellStyle); + cell4.setCellValue(Languages.getString("cosmos.iboot.device.parameter.password")); + + XSSFCell cell5 = row.createCell(4); + cell5.setCellStyle(cellStyle); + cell5.setCellValue(Languages.getString("cosmos.iboot.device.parameter.account")); + + DataValidationHelper helper = sheet.getDataValidationHelper(); + DataValidationConstraint explicitListConstraint = helper.createExplicitListConstraint(new String[]{"Yes", "No"}); + DataValidation validation = helper.createValidation(explicitListConstraint, new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getMaxRows(), 4, 4)); + sheet.addValidationData(validation); + try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { + workbook.write(outputStream); + return outputStream.toByteArray(); + } catch (IOException e) { + log.error(e.getMessage()); + return null; + } + } + + @Override + public ResultBean deviceTemplateUpload(byte[] content) { + try (XSSFWorkbook workbook = new XSSFWorkbook(new ByteArrayInputStream(content))) { + XSSFSheet sheet = workbook.getSheetAt(0); + if (Objects.isNull(sheet)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.template.file.error"), null); + } + int length = sheet.getLastRowNum(); + List deviceEntities = new LinkedList<>(); + for (int i = 1; i <= length; i++) { + XSSFRow row = sheet.getRow(i); + String sn = this.getXSSFCellValue(row.getCell(0)); + if (StringUtils.isBlank(sn)) { + continue; + } + DeviceEntity entity = new DeviceEntity(); + entity.setSn(sn); + entity.setStatus(DeviceStatusEnum.Offline); + entity.setIpmiStatus(IpmiStatusEnum.UNAVAILABLE); + entity.setIpmiFail(IpmiFailEnum.CONFIGURATION); + + String account = this.getXSSFCellValue(row.getCell(4)); + ManageAccountEnum manageAccountEnum = ManageAccountEnum.OFF; + if (StringUtils.equalsIgnoreCase(account, "Yes")) { + manageAccountEnum = ManageAccountEnum.ON; + } + entity.setManageAccount(manageAccountEnum); + + String ip = this.getXSSFCellValue(row.getCell(1)); + String username = this.getXSSFCellValue(row.getCell(2)); + String password = this.getXSSFCellValue(row.getCell(3)); + if (StringUtils.isAnyBlank(ip, username, password) || !(ip.matches(VERIFY_IPV4_PATTERN) || ip.matches(VERIFY_IPV6_PATTERN))) { + deviceEntities.add(entity); + continue; + } + entity.setManageIp(ip); + entity.setHeartbeatTime(new Date()); + entity.setManageUser(username); + entity.setManagePassword(password); + entity.setIpmiFail(IpmiFailEnum.CONNECTION); + deviceEntities.add(entity); + } + List origin = deviceMapper.queryListBySn(deviceEntities.stream().map(DeviceEntity::getSn).collect(Collectors.toList())); + Set deviceSnSet = origin.stream().map(DeviceEntity::getSn).collect(Collectors.toSet()); + deviceEntities = deviceEntities.stream().filter(e -> !deviceSnSet.contains(e.getSn())).peek(e -> e.setId(UUID.fastUUID().toString(true))).collect(Collectors.toList()); + if (!deviceEntities.isEmpty()) { + deviceMapper.batchInsert(deviceEntities); + // 批量新增用户 + List newUserList = deviceEntities.stream().filter(e -> e.getManageAccount() == ManageAccountEnum.ON).toList(); + if (!newUserList.isEmpty()) { + IBootUserCfgBeans iBootUserCfgBeans = new IBootUserCfgBeans(); + iBootUserCfgBeans.setUserCfgBeans(newUserList.stream().map(e -> { + UserCfgBean userCfgBean = new UserCfgBean(); + userCfgBean.setUsername(IBOOT_USERNAME); + userCfgBean.setUserPw(IBOOT_PW); + userCfgBean.setId("-1"); + userCfgBean.setPrivilege("Admin"); + userCfgBean.setSn(e.getSn()); + return userCfgBean; + }).toList()); + try { + iBootTemplateService.startIBootTask(OBJECT_MAPPER.writeValueAsString(iBootUserCfgBeans), TemplateTypeEnum.USER_CONF.name(), newUserList, Languages.getString("template_modify_bmc_user", IBOOT_USERNAME)); + } catch (JsonProcessingException e) { + log.error("批量新增用户失败, {}", e.getMessage()); + } + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + return new ResultBean(true, null, null); + } + + private String getXSSFCellValue(XSSFCell cell) { + if (Objects.isNull(cell)) { + return null; + } + switch (cell.getCellTypeEnum()) { + case STRING -> { + return cell.getStringCellValue(); + } + case NUMERIC -> { + return cell.getRawValue(); + } + } + return null; + } + + @Override + public ResultBean updateDeviceBySn(DeviceEntity deviceEntity) { + if (Objects.isNull(deviceEntity) || StringUtils.isBlank(deviceEntity.getSn())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.import.fail.serial"), null); + } + deviceMapper.updateBySn(deviceEntity); + return new ResultBean(true, null, null); + } + + @Override + @Scheduled(fixedDelay = 10 * 1000L) + public void deviceStatusRefreshTimer() { + deviceMapper.updateStatus(); + } + + @Override + @Scheduled(fixedDelay = 60 * 1000L) + public void deviceIpmiStatusRefreshTimer() { + List list = deviceMapper.getAll(); + // 测试IPMI连通性 + list.stream().filter(entity -> StringUtils.isNotBlank(entity.getManageIp())).forEach(entity -> { + ProcessBuilder builder; + if (OperationSystemUtil.isWindows()) { + builder = new ProcessBuilder("cmd.exe", "/c", "ping", "-n", "2", entity.getManageIp()); + } else { + builder = new ProcessBuilder("/bin/sh", "-c", "ping -c 2 " + entity.getManageIp()); + } + builder.redirectErrorStream(true); + try { + Process process = builder.start(); + int exitValue = process.waitFor(); + if (exitValue == 0) { + if (!StringUtils.isAnyBlank(entity.getManageUser(), entity.getManagePassword())) { + String ps = CommonUtil.getPowerStatus(entity.getManageIp(), entity.getManageUser(), entity.getManagePassword()); + if (StringUtils.isNotEmpty(ps)) { + entity.setIpmiStatus(IpmiStatusEnum.AVAILABLE); + entity.setIpmiFail(IpmiFailEnum.NORMAL); + deviceMapper.updateIpmiStatusById(entity); + return; + } + } + if (entity.getManageAccount() == ManageAccountEnum.ON) { + String ps = CommonUtil.getPowerStatus(entity.getManageIp(), IBOOT_USERNAME, IBOOT_PW); + if (StringUtils.isNotEmpty(ps)) { + entity.setIpmiStatus(IpmiStatusEnum.AVAILABLE); + entity.setIpmiFail(IpmiFailEnum.NORMAL_IBOOT); + deviceMapper.updateIpmiStatusById(entity); + return; + } + } + entity.setIpmiFail(IpmiFailEnum.CREDENTIALS); + } else { + entity.setIpmiFail(IpmiFailEnum.CONNECTION); + } + } catch (IOException | InterruptedException ex) { + log.error("[{}]IPMI状态刷新异常:{}", CommonCheck.convertValidLog(entity.getSn()), CommonCheck.convertValidLog(ex.getMessage())); + entity.setIpmiFail(IpmiFailEnum.CONFIGURATION); + } catch (Exception ex) { + log.error("[{}]IPMI状态刷新异常:{}", CommonCheck.convertValidLog(entity.getSn()), CommonCheck.convertValidLog(ex.getMessage())); + entity.setIpmiFail(IpmiFailEnum.CREDENTIALS); + } + entity.setIpmiStatus(IpmiStatusEnum.UNAVAILABLE); + deviceMapper.updateIpmiStatusById(entity); + }); + } + + protected void handleDeviceQueryBean(DeviceQueryBean queryBean) { + PageRequest.checkPage(queryBean); + if (!beanToMap(new DeviceEntity(), false, false).containsKey(queryBean.getField())) { + throw new PimException("cosmos.iboot.page.sort.field.not.exist"); + } + queryBean.setField(StringUtil.camelhumpToUnderline(queryBean.getField())); + } + + @Override + public ResultBean getServiceState() { + if (!OperationSystemUtil.isWindows()) { + Map result = new HashMap<>(Map.of("tftp", "inactive", "nginx", "inactive", "dhcpd", "inactive", "smb", "inactive", "xinetd", "inactive")); + Map> out = executeCommand(COMMAND_SERVICE_STATUS); + if (Objects.nonNull(out.get(0)) && !out.get(0).isEmpty()) { + Iterator iterator = out.get(0).iterator(); + while (iterator.hasNext()) { + String line = iterator.next().trim(); + if (line.contains("service")) { + String[] info = line.split("\\s+"); + if (info.length < 2) { + continue; + } + String name = info[1].replace(".service", ""); + if (!result.containsKey(name) || line.contains("could not be found")) { + continue; + } + if (iterator.hasNext()) { + line = iterator.next().trim(); + String[] item = line.split("\\s+"); + if (item.length > 2 && item[1].contains("active")) { + result.put(name, item[1]); + } + } + } + } + } + return new ResultBean(true, null, result); + } else { + Map result = new HashMap<>(); + //获取windows的安装路径 + String dhcpStatusResult = (String) executeWindows(IBootPathConstant.ibootWindowsBatPath + "StatusDUALServer.bat").getData(); +// String nfsStatusResult= executeWindows(IBootPathConstant.ibootWindowsBatPath+"StatusNFSServer.bat"); + String nginxStatusResult = (String) executeWindows(IBootPathConstant.ibootWindowsBatPath + "StatusNginxServer.bat").getData(); + String tftpStatusResult = (String) executeWindows(IBootPathConstant.ibootWindowsBatPath + "StatusTFTPServer.bat").getData(); + if (dhcpStatusResult.contains("RUNNING")) { + result.put("dhcpd", "active"); + } else { + result.put("dhcpd", "inactive"); + } + if (nginxStatusResult.contains("RUNNING")) { + result.put("nginx", "active"); + } else { + result.put("nginx", "inactive"); + } + if (tftpStatusResult.contains("RUNNING")) { + result.put("xinetd", "active"); + result.put("tftp", "active"); + } else { + result.put("xinetd", "inactive"); + result.put("tftp", "inactive"); + } + result.put("smb", "active"); + return new ResultBean(true, null, result); + } + } + + public synchronized ResultBean executeWindows(String path) { + ResultBean resultBean = new ResultBean(true, "", ""); + try { + ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/c", path); + // 设置工作目录 + pb.directory(new File("C:\\")); + // 启动进程并等待程序执行完成 + Process process = pb.start(); + process.waitFor(); + // 获取进程的输入流并转换为BufferedReader对象 + InputStream inputStream = process.getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + // 读取输出并打印 + String output = ""; + String line; + while ((line = reader.readLine()) != null) { + System.out.println(line); + output += line; + } + resultBean.setData(output); + return resultBean; + } catch (IOException | InterruptedException e) { + log.error(e.getMessage()); + resultBean.setFlag(false); + return resultBean; + } + } + + @Override + public ResultBean changeServiceState(String name, String mode) { + if (!StringUtils.equalsAnyIgnoreCase(mode, "start", "stop", "restart") + || !StringUtils.equalsAnyIgnoreCase(name, "tftp", "nginx", "dhcpd", "smb", "xinetd", "all")) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + if (!OperationSystemUtil.isWindows()) { + String[] command = new String[1]; + if ("all".equals(name)) { + command[0] = String.join(" ", "systemctl", mode, "tftp", "nginx", "dhcpd", "smb", "xinetd"); + } else { + command[0] = String.join(" ", "systemctl", mode, name); + } + ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, + new SynchronousQueue<>(), + new CustomizableThreadFactory("iboot-device-service-manage"), + new ThreadPoolExecutor.AbortPolicy()); + executor.submit(() -> { + Map> out = executeCommand(command[0]); + if (out.containsKey(0)) { + log.info("[{}]执行[{}]命令成功", name, mode); + } else { + log.error("[{}]执行[{}]命令失败", name, mode); + } + }); + return new ResultBean(true, Languages.getString("cosmos.iboot.device.acceptance.result.success"), null); + } else { + if (!mode.equalsIgnoreCase("stop")) { + //获取windows的安装路径 + ResultBean dhcpResult = executeWindows(IBootPathConstant.ibootWindowsBatPath + "StartDUALServer.bat"); +// String nfsStatusResult= executeWindows(IBootPathConstant.ibootWindowsBatPath+"StatusNFSServer.bat"); + ResultBean nginxResult = executeWindows(IBootPathConstant.ibootWindowsBatPath + "StartNginxServer.bat"); + ResultBean tftpResult = executeWindows(IBootPathConstant.ibootWindowsBatPath + "StartTFTPServer.bat"); + if (dhcpResult.isFlag() && nginxResult.isFlag() && tftpResult.isFlag()) { + return new ResultBean(true, Languages.getString("cosmos.iboot.device.acceptance.result.success"), null); + } else { + return new ResultBean(false, null, null); + } + } else { + //获取windows的安装路径 + ResultBean dhcpResult = executeWindows(IBootPathConstant.ibootWindowsBatPath + "StopDUALServer.bat"); +// String nfsStatusResult= executeWindows(IBootPathConstant.ibootWindowsBatPath+"StatusNFSServer.bat"); + ResultBean nginxResult = executeWindows(IBootPathConstant.ibootWindowsBatPath + "StopNginxServer.bat"); + ResultBean tftpResult = executeWindows(IBootPathConstant.ibootWindowsBatPath + "StopTFTPServer.bat"); + if (dhcpResult.isFlag() && nginxResult.isFlag() && tftpResult.isFlag()) { + return new ResultBean(true, Languages.getString("cosmos.iboot.device.acceptance.result.success"), null); + } else { + return new ResultBean(false, null, null); + } + } + } + } + + @Override + public ResultBean getManageNetwork() { + if (OperationSystemUtil.isLinux()) { + return getManageNetworkForLinux(); + } + if (OperationSystemUtil.isWindows()) { + return getManageNetworkForWindows(); + } + return new ResultBean(false, Languages.getString("cosmos.iboot.network.os.error"), null); + + } + + private ResultBean getManageNetworkForWindows() { + Map> out1 = this.executeWinCommand(IBootPathConstant.ibootWindowsBatPath + "GetLocalIP.bat"); + Map> out2 = this.executeWinCommand(IBootPathConstant.ibootWindowsBatPath + "GetDHCPIP.bat"); + Map> out3 = this.executeWinCommand(IBootPathConstant.ibootWindowsBatPath + "GetDHCPRange.bat"); + + // 获取网络设备列表 + if (!out1.containsKey(0)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.network.address.error"), null); + } + List ip = out1.get(0); + if (Objects.isNull(ip) || ip.isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.network.address.invalid"), null); + } + ip = ip.stream().filter(StringUtils::isNotBlank).distinct().map(e -> { + String[] s = e.trim().split(" "); + if (s.length != 2) { + return null; + } else { + return s[0] + "/" + Ipv4Util.getMaskBitByMask(s[1]); + } + }).filter(Objects::nonNull).toList(); + ServerManageNetworkBean manageNetworkBean = new ServerManageNetworkBean(); + manageNetworkBean.setIp(ip); + + // 获取DHCP IP与DHCP范围 + if (out2.containsKey(0) && Objects.nonNull(out2.get(0)) && !out2.get(0).isEmpty() && out2.get(0).get(0).matches(VERIFY_IPV4_PATTERN)) { + String[] dhcp = {out2.get(0).get(0)}; + ip.stream().filter(e -> e.contains(dhcp[0])).findAny().ifPresent(manageNetworkBean::setDhcpIp); + if (StringUtils.isNotBlank(manageNetworkBean.getDhcpIp()) && out3.containsKey(0) && Objects.nonNull(out3.get(0)) && !out3.get(0).isEmpty()) { + String[] range = out3.get(0).get(0).trim().split("-"); + if (range.length == 2) { + manageNetworkBean.setDhcpRangeBegin(range[0]); + manageNetworkBean.setDhcpRangeEnd(range[1]); + } + } + } + + // 获取Nginx IP + try (BufferedReader reader = new BufferedReader(new FileReader(IBootPathConstant.webServerIpFile))) { + String nginx = reader.readLine(); + if (StringUtils.isNotBlank(nginx) && nginx.matches(VERIFY_IPV4_PATTERN)) { + manageNetworkBean.setNginxIp(nginx); + } + } catch (IOException e) { + log.error("读取NGINX配置文件失败:{}", e.getMessage()); + } + return new ResultBean(true, null, manageNetworkBean); + } + + private ResultBean getManageNetworkForLinux() { + Map> out1 = this.executeCommand(COMMAND_IP_ADDR); + Map> out2 = this.executeCommand(COMMAND_DHCP_IP); + Map> out3 = this.executeCommand(COMMAND_DHCP_RANGE); + Map> out4 = this.executeCommand(COMMAND_NGINX_IP); + if (!out1.containsKey(0)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.network.address.error"), null); + } + List ip = out1.get(0); + if (Objects.isNull(ip) || ip.isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.network.address.invalid"), null); + } + ip = ip.stream().distinct().toList(); + ServerManageNetworkBean manageNetworkBean = new ServerManageNetworkBean(); + manageNetworkBean.setIp(ip); + + if (out2.containsKey(0) && Objects.nonNull(out2.get(0)) && !out2.get(0).isEmpty() && out2.get(0).get(0).matches(VERIFY_IPV4_PATTERN)) { // v7.2只适配IPv4 + String[] dhcp = {out2.get(0).get(0)}; + ip.stream().filter(e -> e.contains(dhcp[0])).findAny().ifPresent(manageNetworkBean::setDhcpIp); + if (StringUtils.isNotBlank(manageNetworkBean.getDhcpIp()) && out3.containsKey(0) && Objects.nonNull(out3.get(0)) && !out3.get(0).isEmpty()) { + List dhcpConf = out3.get(0); + int index = -1; + for (String line : dhcpConf) { + index++; + if (!line.startsWith("subnet")) + continue; + String[] s = line.split("\\s+"); + if (s.length < 4 || !s[1].matches(VERIFY_IPV4_PATTERN) || !s[3].matches(VERIFY_IPV4_PATTERN)) + continue; + if (StringUtils.equals(s[1], Ipv4Util.getBeginIpStr(dhcp[0], Ipv4Util.getMaskBitByMask(s[3])))) + break; + } + index++; + if (index > 0 && index < dhcpConf.size()) { + String range = dhcpConf.get(index); + if (range.contains("range")) { + String[] s = range.replace("range", "").replace(";", "").trim().split("\\s+"); + if (s.length == 2 && s[0].matches(VERIFY_IPV4_PATTERN) && s[1].matches(VERIFY_IPV4_PATTERN)) { + manageNetworkBean.setDhcpRangeBegin(s[0]); + manageNetworkBean.setDhcpRangeEnd(s[1]); + } + } + } + } + } + if (out4.containsKey(0) && Objects.nonNull(out4.get(0)) && !out4.get(0).isEmpty() && out4.get(0).get(0).matches(VERIFY_IPV4_PATTERN)) { + manageNetworkBean.setNginxIp(out4.get(0).get(0)); + } + return new ResultBean(true, null, manageNetworkBean); + } + + @Override + public ResultBean getManageNetworkRange(String ip) { + if (StringUtils.isBlank(ip)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + String[] s = ip.trim().split("/"); + try { + if (s.length != 2 || !s[0].matches(VERIFY_IPV4_PATTERN) || Integer.parseInt(s[1]) < 0 || Integer.parseInt(s[1]) > 32) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + } catch (Exception e) { + log.error("解析IP错误,{}", e.getMessage()); + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + int mask = Integer.parseInt(s[1]); + Map range; + if (mask > 24) { + range = Map.of("begin", Ipv4Util.getBeginIpStr(s[0], mask), "end", Ipv4Util.getEndIpStr(s[0], mask)); + } else { + range = Map.of("begin", Ipv4Util.longToIpv4(Ipv4Util.getBeginIpLong(s[0], mask) + 10), "end", Ipv4Util.longToIpv4(Ipv4Util.getEndIpLong(s[0], mask) - 10)); + } + return new ResultBean(true, null, range); + } + + @Override + public ResultBean setManageNetwork(ServerManageNetworkBean serverManageNetworkBean) { + if (!OperationSystemUtil.isLinux() && !OperationSystemUtil.isWindows()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.network.os.error"), null); + } + + if (Objects.isNull(serverManageNetworkBean) || StringUtils.isAnyBlank(serverManageNetworkBean.getDhcpIp(), serverManageNetworkBean.getDhcpRangeBegin(), serverManageNetworkBean.getDhcpRangeEnd(), serverManageNetworkBean.getNginxIp())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + String[] dhcpInfo = serverManageNetworkBean.getDhcpIp().trim().split("/"); + if (dhcpInfo.length != 2 || !dhcpInfo[0].matches(VERIFY_IPV4_PATTERN) || !StringUtils.isNumeric(dhcpInfo[1]) || Integer.parseInt(dhcpInfo[1]) < 0 || Integer.parseInt(dhcpInfo[1]) > 32) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + String dhcpIp = dhcpInfo[0]; + int dhcpMask = Integer.parseInt(dhcpInfo[1]); + String dhcpRangeBegin = serverManageNetworkBean.getDhcpRangeBegin().trim(); + String dhcpRangeEnd = serverManageNetworkBean.getDhcpRangeEnd().trim(); + String nginxIp = serverManageNetworkBean.getNginxIp().trim(); + if (!dhcpRangeBegin.matches(VERIFY_IPV4_PATTERN) || !dhcpRangeEnd.matches(VERIFY_IPV4_PATTERN) || !nginxIp.matches(VERIFY_IPV4_PATTERN)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + String beginIp = Ipv4Util.getBeginIpStr(dhcpIp, dhcpMask); + if (!StringUtils.equals(beginIp, Ipv4Util.getBeginIpStr(dhcpRangeBegin, dhcpMask)) || !StringUtils.equals(beginIp, Ipv4Util.getBeginIpStr(dhcpRangeEnd, dhcpMask))) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.network.range.error"), null); + } + if (Ipv4Util.ipv4ToLong(dhcpRangeBegin) >= Ipv4Util.ipv4ToLong(dhcpRangeEnd)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.network.valid.error"), null); + } + Map> out; + if (OperationSystemUtil.isLinux()) { +// String command = String.join(" ", COMMAND_MANAGE_IP, dhcpIp, nginxIp, beginIp, Ipv4Util.getMaskByMaskBit(dhcpMask), dhcpRangeBegin, dhcpRangeEnd); + String command = String.join(" ", "imcli config iboot", dhcpIp, nginxIp, beginIp, Ipv4Util.getMaskByMaskBit(dhcpMask), dhcpRangeBegin, dhcpRangeEnd); + out = executeCommand(command); + } else { + File nginx = new File(IBootPathConstant.webServerIpFile); + if (nginx.exists()) { + nginx.delete(); + } + try (FileWriter writer = new FileWriter(nginx)) { + writer.write(nginxIp); + } catch (IOException e) { + log.error("写入Nginx IP失败,{}", e.getMessage()); + } + String command = String.join(" ", IBootPathConstant.ibootWindowsBatPath + "ChangeLocalIPAndDHCPRange.bat", dhcpIp, dhcpRangeBegin + "-" + dhcpRangeEnd); + out = executeWinCommand(command); + } + return Objects.nonNull(out) && out.containsKey(0) ? new ResultBean(true, Languages.getString("cosmos.iboot.device.network.manage.success"), null) : new ResultBean(false, Languages.getString("cosmos.iboot.device.network.manage.failed"), null); + } + + private Map> executeCommand(String command) { + ProcessBuilder builder = new ProcessBuilder("/bin/sh", "-c", command); + builder.redirectErrorStream(true); + Map> out = null; + try { + Process process = builder.start(); + int exitValue = process.waitFor(); + LinkedList result = new LinkedList<>(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { + String line = null; + while ((line = reader.readLine()) != null) { + result.add(line); + } + log.info(result.toString()); + } + out = Map.of(exitValue, result); + } catch (IOException | InterruptedException e) { + log.error(e.getMessage()); + out = Map.of(-1, Collections.singletonList(e.getMessage())); + } + return out; + } + + private Map> executeWinCommand(String command) { + ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", command); + builder.directory(new File("C:\\")); + Map> out = null; + try { + Process process = builder.start(); + int exitValue = process.waitFor(); + LinkedList result = new LinkedList<>(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { + String line = null; + while ((line = reader.readLine()) != null) { + result.add(line); + } + log.info(result.toString()); + } + out = Map.of(exitValue, result); + } catch (IOException | InterruptedException e) { + log.error(e.getMessage()); + out = Map.of(-1, Collections.singletonList(e.getMessage())); + } + return out; + } + + /** + * @param queryBean + * @param mode pxe: yes(探测后不关机), no(探测后关机) + * @return + */ + @Override + public ResultBean deviceDetection(DeviceQueryBean queryBean, String mode) { + this.handleDeviceQueryBean(queryBean); + List deviceEntities = deviceMapper.queryListWithPage(queryBean); + if (deviceEntities.isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + if (!deviceEntities.stream().filter(e -> e.getStatus() == DeviceStatusEnum.Busy).toList().isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.device.busy.error"), null); + } + try { + return iBootTemplateService.startIBootTask(OBJECT_MAPPER.writeValueAsString(Collections.singletonMap("pxe", mode)), TemplateTypeEnum.OS_EXPLORE.name(), deviceEntities, Languages.getString("os_explorer")) ? + new ResultBean(true, null, null) : new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } catch (JsonProcessingException e) { + log.error("任务启动失败:{}", e.getMessage()); + return new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } + } + + @Override + public ResultBean deviceDiskBackup(DeviceDiskCloneBean diskCloneBean) { + if (Objects.isNull(diskCloneBean) || StringUtils.isBlank(diskCloneBean.getDeviceId()) || StringUtils.isBlank(diskCloneBean.getImageName()) || Objects.isNull(diskCloneBean.getDisk()) || diskCloneBean.getDisk().isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + DeviceEntity deviceEntity = deviceMapper.queryEntityById(diskCloneBean.getDeviceId()); + if (Objects.isNull(deviceEntity)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + diskCloneBean.setDisk(diskCloneBean.getDisk().stream().map(e -> StringUtils.substringAfterLast(e, "/")).filter(StringUtils::isNotBlank).toList()); + diskCloneBean.setMethod(DiskCloneMethodEnum.BACKUP); + try { + return iBootTemplateService.startIBootTask(OBJECT_MAPPER.writeValueAsString(diskCloneBean), TemplateTypeEnum.DISK_CLONE.name(), Collections.singletonList(deviceEntity), TemplateTypeEnum.DISK_CLONE.getTemplateName()) ? + new ResultBean(true, null, null) : new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } catch (JsonProcessingException e) { + log.error("任务启动失败:{}", e.getMessage()); + return new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } + } + + @Override + public ResultBean deviceDiskRestore(DeviceQueryBean queryBean, String imageId) { + if (StringUtils.isBlank(imageId)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + this.handleDeviceQueryBean(queryBean); + List deviceEntities = deviceMapper.queryListWithPage(queryBean); + if (Objects.isNull(deviceEntities) || deviceEntities.isEmpty()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + IBootRepositoryImageEntity imageEntity = iBootRepositoryImageMapper.getByID(imageId); + if (Objects.isNull(imageEntity) || StringUtils.isBlank(imageEntity.getName())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.resource.not.exist"), null); + } + String[] s = imageEntity.getName().split("-"); + if (s.length != 2) { + log.error("镜像文件名称错误"); + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + List diskList = Arrays.stream(s[1].split("_")).toList(); + if (diskList.isEmpty()) { + log.error("镜像文件名不包含有效的磁盘信息"); + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.error"), null); + } + DeviceDiskCloneBean deviceDiskCloneBean = new DeviceDiskCloneBean(); + deviceDiskCloneBean.setImageName(imageEntity.getName()); + deviceDiskCloneBean.setMethod(DiskCloneMethodEnum.RESTORE); + deviceDiskCloneBean.setDisk(diskList); + try { + return iBootTemplateService.startIBootTask(OBJECT_MAPPER.writeValueAsString(deviceDiskCloneBean), TemplateTypeEnum.DISK_RESTORE.name(), deviceEntities, TemplateTypeEnum.DISK_RESTORE.getTemplateName()) ? + new ResultBean(true, null, null) : new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } catch (JsonProcessingException e) { + log.error("任务启动失败:{}", e.getMessage()); + return new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } + } + + @Override + public ResultBean deviceLogicDisk(String id) { + if (StringUtils.isBlank(id)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.parameter.null.error"), null); + } + DeviceEntity deviceEntity = deviceMapper.queryEntityById(id); + if (Objects.isNull(deviceEntity) || StringUtils.isBlank(deviceEntity.getSystemInfo())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.device.storage.report.error"), null); + } + try { + DeviceSystemInfoBean infoBean = OBJECT_MAPPER.readValue(deviceEntity.getSystemInfo(), DeviceSystemInfoBean.class); + List logicDisk = infoBean.getLogicDisk().stream().map(e -> StringUtils.substringAfterLast(e.getName(), "/")).filter(StringUtils::isNotBlank).toList(); + HashMap map = new HashMap<>(); + map.put("disk", logicDisk); + map.put("deviceId", id); + map.put("sn", deviceEntity.getSn()); + return new ResultBean(true, null, map); + } catch (JsonProcessingException e) { + log.error("解析设备存储信息失败,{}", e.getMessage()); + return new ResultBean(false, Languages.getString("cosmos.iboot.device.storage.parse.error"), null); + } + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootRepositoryImageServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootRepositoryImageServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..74dac95c16d3fe677a24b1b928eb020830e8b003 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootRepositoryImageServiceImpl.java @@ -0,0 +1,554 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.lang.UUID; +import cn.hutool.core.util.NumberUtil; +import com.inspur.cdc.combo.mybatis.page.MPageHelper; +import com.inspur.cdc.combo.mybatis.page.bean.PageResult; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.cdc.commons.lang.util.CommonCheck; +import com.inspur.cdc.commons.lang.util.UUIDUtil; +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.ispim.cosmos.commons.exception.PimException; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.*; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRepositoryImageEntity; +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootRepositoryImageService; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.ExecCommand; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootMaintenanceCache; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootRepositoryImageMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import tk.mybatis.mapper.util.StringUtil; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; +import java.util.stream.Collectors; + +import static com.inspur.cdc.commons.i18n.Languages.getString; +import static com.inspur.cdc.commons.lang.web.PageRequest.checkPage; + + +@Slf4j +public class IBootRepositoryImageServiceImpl implements IBootRepositoryImageService { + private final IBootRepositoryImageMapper iBootRepositoryImageMapper; + + public IBootRepositoryImageServiceImpl(IBootRepositoryImageMapper iBootRepositoryImageMapper) { + this.iBootRepositoryImageMapper = iBootRepositoryImageMapper; + } + + @Override + public PageResult getByConditionPage(ImageQueryBean query) { + checkPage(query); + String field = query.getField(); + if (!BeanUtil.beanToMap(new IBootRepositoryImageEntity(), false, false).containsKey(query.getField())) { + throw new PimException(Languages.getString("cosmos.iboot.page.sort.field.not.exist")); + } + field = StringUtil.camelhumpToUnderline(field); + if (field.equalsIgnoreCase("custom_image")) { + field = "is_custom_image"; + } + MPageHelper helper = MPageHelper.startPage(query.getPage(), query.getPageSize(), field, + query.getDir()); + PageResult result = helper + .run(iBootRepositoryImageMapper.getByConditions(query)); + return result; + } + + @Override + public List getByCondition(ImageQueryBean query) { + if (!BeanUtil.beanToMap(new IBootRepositoryImageEntity(), false, false).containsKey(query.getField())) { + throw new PimException(Languages.getString("cosmos.iboot.page.sort.field.not.exist")); + } + query.setField(StringUtil.camelhumpToUnderline(query.getField())); + return iBootRepositoryImageMapper.getByConditions(query); + } + + @Override + public List getYumImageList() { + return iBootRepositoryImageMapper.getYumImageList(); + } + + @Override + public IBootRepositoryImageEntity getByFileName(String fileName) { + return iBootRepositoryImageMapper.getByFileName(fileName); + } + + @Override + public boolean checkfileExist(String fileName) { + String finalFileFoldar = IBootPathConstant.OsPath; + File foldar = new File(finalFileFoldar); + if (!foldar.exists()) { + return false; + } + String finalFilePath = finalFileFoldar + File.separator + fileName; + File file = new File(finalFilePath); + if (!file.exists()) { + return false; + } else { + return true; + } + } + + @Override + public boolean uploadFragmentedFile(Chunk chunk, byte[] filebytes) { + BufferedOutputStream bufferedOutputStream = null; + try { + String filePath = generatePath(chunk.getIdentifier()); + String fileName = filePath + File.separator + chunk.getFilename() + chunk.getChunkNumber(); + File file = new File(fileName); + if (!file.exists()) { + if (!file.createNewFile()) { + return false; + } + /* byte[] bytes = filebytes; + Path path = Paths.get(fileName); + Files.write(path, bytes);*/ + + bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file)); + bufferedOutputStream.write(filebytes); + + + } else { + //非断点续传,将之前的分片文件覆盖掉 + if (!chunk.isRenewalFlag()) { + if (file.delete()) { + byte[] bytes = filebytes; + Path path = Paths.get(fileName); + + Files.write(path, bytes); +// FileUtil.writeFromStream( filebytes,fileName); + } + } + } + } catch (Exception e) { + log.error(e.getMessage()); + return false; + } finally { + if (bufferedOutputStream != null) { + try { + bufferedOutputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + return true; + } + + /** + * @param identifier + * @return + * @Title: generatePath + * @Description:创建文件临时目录. + */ + private String generatePath(String identifier) { + String fragmentedFileFolder = IBootPathConstant.OstmpPath + File.separator + identifier; + File filefolder = new File(fragmentedFileFolder); + if (!filefolder.exists()) { + if (!filefolder.mkdirs()) { + return null; + } + } + return fragmentedFileFolder; + } + + @Override + public ResultBean mergeFragmentedFile(ChunkFileModel chunkFileModel, String userName) { + ResultBean resultBean = new ResultBean(true, "", null); + String finalFileFoldar = IBootPathConstant.OsPath; + File foldar = new File(finalFileFoldar); + if (!foldar.exists()) { + if (!foldar.mkdirs()) { + resultBean.setFlag(false); + return resultBean; + } + } + String fileName = UUIDUtil.getUuid(); + String finalFilePath = finalFileFoldar + File.separator + fileName + ".iso"; + File file = new File(finalFilePath); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + resultBean.setFlag(false); + return resultBean; + } + } + //分片文件文件夹 + String tmpFolder = generatePath(chunkFileModel.getIdentifier()); + new Thread( + new Runnable() { + @Override + public void run() { + IBootMaintenanceCache.IMAGEUPLOADFLAG.put(fileName, "0"); + BufferedOutputStream outputStream = null; + BufferedInputStream inputStream = null; + try { + int bufSize = 1024; + byte[] buffer = new byte[bufSize]; + outputStream = new BufferedOutputStream(new FileOutputStream(file)); + for (int i = 1; i <= chunkFileModel.getTotalChunks(); i++) { + String filePath = tmpFolder + File.separator + chunkFileModel.getFileName() + i; + File tempFile = new File(filePath); + byte[] bytes = FileUtils.readFileToByteArray(tempFile); + outputStream.write(bytes); + outputStream.flush(); + tempFile.delete(); + Thread.sleep(100); + } + String id = UUID.fastUUID().toString(true); + saveImage(chunkFileModel, finalFilePath, fileName, userName, id); + //判断前台是否传了md5值,如果md5值不为空,则需要进行md5校验 + if (StringUtils.isNotEmpty(chunkFileModel.getMd5())) { + IBootRepositoryImageEntity controlRepositoryImageEntity = getByFileName(fileName); + String filemd5 = CommonUtil.md5(new File(FileUtil.normalize(controlRepositoryImageEntity.getFullPath()))); + if (!filemd5.equalsIgnoreCase(chunkFileModel.getMd5())) {//如果不一致,则删除文件和删除数据库 + List ids = new ArrayList(); + ids.add(controlRepositoryImageEntity.getId()); + deleteOsRepositoryFileById(ids); + IBootMaintenanceCache.IMAGEUPLOADFLAG.put(fileName, "3");//返给前端3,代表md5值不匹配 + } + } +// //将镜像解压至nginx的发布目录 +// String nginxPath=IBootPathConstant.NginxPushPath+chunkFileModel.getFileName()+"/"; +// File nginxFile=new File(nginxPath); +// if (!nginxFile.exists()) { +// nginxFile.mkdirs(); +// } +// //本次操作的文件路径 +// String mountPath=IBootPathConstant.OsPath + File.separator + id; +// FileUtil.mkdir(mountPath); +// Commands.exec4Linux("mount "+finalFilePath+" "+ mountPath); +// //复制mount后的文件到真正存储的位置 +// Commands.exec4Linux("cp -r "+ mountPath+ File.separator +"* " +// +nginxPath); +// Commands.exec4Linux("umount "+ mountPath); +// FileUtil.del(mountPath); + String flag = IBootMaintenanceCache.IMAGEUPLOADFLAG.get(fileName); + if ("0".equals(flag)) {//如果此时合并成功标识还为0,则说明合并完成且未出现异常,则将其置成成功 + IBootMaintenanceCache.IMAGEUPLOADFLAG.put(fileName, "1"); + } + } catch (Exception e) { + IBootMaintenanceCache.IMAGEUPLOADFLAG.put(fileName, "2"); + resultBean.setFlag(false); + log.error(e.getMessage()); + } finally { + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + resultBean.setFlag(false); + } + } + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + resultBean.setFlag(false); + } + } + } + } + } + ).start(); + resultBean.setData(fileName); + return resultBean; + } + + public void saveImage(ChunkFileModel chunkFileModel, String fileFullPath, String fileName, String userName, String id) { + IBootRepositoryImageEntity fileEntity = new IBootRepositoryImageEntity(); + fileEntity.setName(fileName); + fileEntity.setOriginalName(chunkFileModel.getFileName()); + fileEntity.setFullPath(fileFullPath); + fileEntity.setId(id); + // 默认文件可用 + fileEntity.setHasKs(chunkFileModel.isHasKS()); + fileEntity.setCustomImage(chunkFileModel.getCustomImage()); + fileEntity.setArchitecture(chunkFileModel.getArchitecture()); + if (chunkFileModel.getImageType() != null) { + fileEntity.setImageType(chunkFileModel.getImageType().name()); + } + fileEntity.setVersion(chunkFileModel.getVersion()); + fileEntity.setCreateTime(new Date()); + fileEntity.setCreateUser(userName); + fileEntity.setInsource(chunkFileModel.isInsource()); + iBootRepositoryImageMapper.insert(fileEntity); + } + + @Override + public ResultBean deleteFragmentedFile(String pathId, String fileName) { + ResultBean resultBean = new ResultBean(true, "", null); + //分片文件文件夹. + String tmpFolder = generatePath(pathId); + File file = new File(tmpFolder); + if (file.exists()) { + String[] tempList = file.list(); + if (null != tempList) { + for (int i = 0; i < tempList.length; i++) { + File tmp = new File(tmpFolder + File.separator + tempList[i]); + if (!tmp.delete()) { + resultBean.setFlag(false); + return resultBean; + } + } + } + } + // 点击取消,删除os_install文件夹下的fileName + String fileOsPath = IBootPathConstant.OsPath + File.separator + fileName; + File fileOs = new File(fileOsPath); + if (fileOs.exists()) { + fileOs.delete(); + } + // 点击取消,删除数据库中的fileName列 + ImageQueryBean queryBean = new ImageQueryBean(); + queryBean.setName(fileName); + queryBean.setField("id"); + List fileList = iBootRepositoryImageMapper.getByConditions(queryBean); + if (CollUtil.isNotEmpty(fileList)) { + for (IBootRepositoryImageEntity fileEntity : fileList) { + iBootRepositoryImageMapper.deleteByPrimaryKey(fileEntity.getId()); + } + } + return resultBean; + } + + /** + * @param ids + * @return + * @Description: 单个或批量删除列表数据. + */ + @Override + public ApiResult deleteOsRepositoryFileById(List ids) { + if (CommonCheck.isNullOrEmpty(ids)) { + return ApiResult.fail(getString("OS_LIST_PARAMETER_IS_NULL")); + } + String useImageName = ""; + for (String id : ids) { + IBootRepositoryImageEntity imageEntity = iBootRepositoryImageMapper.getByID(id); + try { + if (null != imageEntity) { + if (!imageEntity.isTempuse()) {//没有被模板使用 + //对镜像进行umount操作 + ExecCommand exec = new ExecCommand(); + String mountPath; + if (imageEntity.getImageType().equalsIgnoreCase("Windows")) { // windows挂载点不同 + mountPath = IBootPathConstant.MountImageFileSamba + File.separator + imageEntity.getId(); + } else { + mountPath = IBootPathConstant.MountImageFile + File.separator + imageEntity.getId(); + } + if (StringUtils.isNotEmpty(mountPath)) { + if (OperationSystemUtil.isWindows()) { + File file = new File(mountPath); + if (file.exists() && file.isDirectory()) { + file.delete(); + } + } else { + String mountCmd = "umount " + mountPath; + exec.runLocal(mountCmd); + } + } + String filePath = imageEntity.getFullPath(); + boolean fileDeleted = true; + if (StringUtils.isNotEmpty(filePath)) { + fileDeleted = FileUtil.del(filePath); + } + if (fileDeleted) { + iBootRepositoryImageMapper.deleteById(id); + } else { + ApiResult.fail(getString("OS_DELETE_FILE_FAILED")); + } + } else { + useImageName = useImageName + "," + imageEntity.getOriginalName(); + } + } else { + ApiResult.fail(getString("REPO_LIST_DB_NOT_EXIT_FIELD")); + } + } catch (Exception e) { + log.error(e.getMessage()); + ApiResult.fail(getString("OS_DELETE_FILE_FAILED")); + } + } + if (StringUtils.isNotEmpty(useImageName)) { + useImageName = useImageName.substring(1); + return ApiResult.success(useImageName + " " + Languages.getString("cosmos.image.exist.error")); + } + return ApiResult.success(); + } + + public String getMerginFlag(String fileId) { + String flag = IBootMaintenanceCache.IMAGEUPLOADFLAG.get(fileId); + if (!"0".equals(flag)) { + IBootMaintenanceCache.IMAGEUPLOADFLAG.remove(fileId); + } + return flag; + } + + /** + * @return + * @Description:获取文件上传所在路径的可用空间大小. + */ + @Override + public double getUsableSpace() { + String nfsPath = IBootPathConstant.nfsPath; + File file = new File(nfsPath); + if (!file.exists()) { + return -1L; + } + if (OperationSystemUtil.isWindows()) { + long freeSpace = file.getFreeSpace(); + return NumberUtil.div(freeSpace, 2 << 30); + } else { + String cmd = "df -h " + nfsPath + " | awk '{print $4}' | head -n 2 | tail -n 1"; + ExecCommand exec = new ExecCommand(); + try { + String result = exec.runLocal(cmd); + if (result.contains("T")) { + result = result.split("T")[0].replace("\n", ""); + return Double.valueOf(result) * 1024; + } else if (result.contains("G")) { + result = result.split("G")[0].replace("\n", ""); +// result = result.substring(0, result.length() - 2); + return Double.valueOf(result); + } else { + return -1L; + } + } catch (Exception var4) { + return -1L; + } + } + } + + @Override + public List getAllSupportImages() { + List l = iBootRepositoryImageMapper.selectSupportedImageAll(); + if (CollUtil.isNotEmpty(l)) { + List list = new ArrayList<>(); + Map> rs = new HashMap<>(); + for (IBootOtherSupportedImageBean single : l) { + // Ubuntu、UOS暂不显示 + if (org.apache.commons.lang.StringUtils.isNotEmpty(single.getImageType()) && ("Ubuntu".equals(single.getImageType()) || "UOS".equals(single.getImageType()))) { + continue; + } + if (!rs.containsKey(single.getImageType())) { + List releases = new ArrayList<>(); + releases.add(single); + rs.put(single.getImageType(), releases); + } else { + rs.get(single.getImageType()).add(single); + } + } + + for (String release : rs.keySet()) { + IBootSupportedImageBean single = new IBootSupportedImageBean(); + single.setLabel(release); + single.setValue(release); + List ch = new ArrayList<>(); + List oriList = rs.get(release); + for (IBootOtherSupportedImageBean entity : oriList) { + KeyValueBean kv = new KeyValueBean(); + kv.setLabel(entity.getVersion()); + kv.setValue(entity.getVersion()); + ch.add(kv); + } + single.setChildren(ch); + list.add(single); + } + return list; + } + return null; + } + + @Override + public List getImageTypeList() { + List controlOtherSupportedImageEntities = iBootRepositoryImageMapper.selectSupportedImageAll(); + List imageTypeList = controlOtherSupportedImageEntities.stream().map(i -> { + String imageType = i.getImageType(); + return imageType; + }).distinct().collect(Collectors.toList()); + //不显示Ubuntu + imageTypeList.remove("Ubuntu"); + return imageTypeList; + } + + @Override + public SpaceCheckResult checkNFSAvaliableSpace(String size, String type) { + SpaceCheckResult spaceCheckResult = new SpaceCheckResult(); + spaceCheckResult.setResult(SpaceCheckEnum.INSUFFICIENT); + String nfsPath = IBootPathConstant.nfsPath; + File file = new File(nfsPath); + if (!file.exists()) { + return spaceCheckResult; + } + try { + double capacity; + if (OperationSystemUtil.isWindows()) { + long freeSpace = file.getFreeSpace(); + capacity = NumberUtil.div(freeSpace, 2 << 20); + } else { + String cmd = "df -h " + nfsPath + " | awk '{print $4}' | head -n 2 | tail -n 1"; + ExecCommand exec = new ExecCommand(); + String result = exec.runLocal(cmd); + capacity = convertCapacity(result); + } + switch (type) { + case "1": // 仅添加镜像 + if (capacity >= Double.valueOf(size) * 2.2) { + spaceCheckResult.setResult(SpaceCheckEnum.AVALIVABLE); + } else { + spaceCheckResult.setOverSpace(String.format("%.2f", (Double.valueOf(size) * 2.2 - capacity)) + "M"); + } + break; + case "2": // 添加镜像并加入源 + if (capacity >= Double.valueOf(size) * 3.2) { + spaceCheckResult.setResult(SpaceCheckEnum.AVALIVABLE); + } else if (capacity >= Double.valueOf(size) * 2.2) { + spaceCheckResult.setResult(SpaceCheckEnum.WARNING); + spaceCheckResult.setOverSpace(String.format("%.2f", (Double.valueOf(size) * 3.2 - capacity)) + "M"); + } else { + spaceCheckResult.setOverSpace(String.format("%.2f", (Double.valueOf(size) * 3.2 - capacity)) + "M"); + } + break; + case "3": // 仅加入源 + if (capacity >= Double.valueOf(size) * 1.2) { + spaceCheckResult.setResult(SpaceCheckEnum.AVALIVABLE); + } else { + spaceCheckResult.setOverSpace(String.format("%.2f", (Double.valueOf(size) * 1.2 - capacity)) + "M"); + } + break; + default: + break; + } + return spaceCheckResult; + } catch (Exception e) { + return spaceCheckResult; + } + } + + private double convertCapacity(String result) { + if (result.contains("T")) { + result = result.split("T")[0].replace("\n", ""); + return Double.valueOf(result) * 1024 * 1024; + } else if (result.contains("G")) { + result = result.split("G")[0].replace("\n", ""); + return Double.valueOf(result) * 1024; + } else if (result.contains("M")) { + result = result.split("M")[0].replace("\n", ""); + return Double.valueOf(result); + } else if (result.contains("P")) { + result = result.split("P")[0].replace("\n", ""); + return Double.valueOf(result) * 1024 * 1024 * 1024; + } else { + return 0L; + } + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTaskMessageHandler.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTaskMessageHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..1c7aa68e614b02e892632d14586d177e9818e88d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTaskMessageHandler.java @@ -0,0 +1,637 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.lang.UUID; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.google.common.collect.Queues; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.util.CdcThreadFactory; +import com.inspur.cdc.commons.lang.util.CommonCheck; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TemplateTypeEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDiskCloneBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DiskCloneMethodEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ManageAccountEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootUserCfgBeans; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.UserCfgBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.*; +import com.inspur.ispim.cosmos.iboot.base.api.service.TemplateCreateService; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootMacFileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate.TaskTemplateFactory; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.*; +import jakarta.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.io.File; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * @author :zhangchen + * @date :Created in 2023/8/08 9:51 + * @description 消息处理类 + */ +//@Component +@Slf4j +public class IBootTaskMessageHandler { + + /** + * 任务状态队列 + */ + private final BlockingQueue ibootNodeChangeQueue = Queues.newArrayBlockingQueue(200000); + private final IBootTaskMapper iBootTaskMapper; + private final IBootTaskHostMapper iBootTaskHostMapper; + private final IBootTaskHostLogMapper iBootTaskHostLogMapper; + private final IBootTaskHistoryMapper iBootTaskHistoryMapper; + private final IBootTaskHostHistoryMapper iBootTaskHostHistoryMapper; + private final TaskTemplateFactory taskTemplateFactory; + private final DeviceMapper deviceMapper; + private final IBootTemplateMapper templateMapper; + private final IBootRepositoryImageMapper iBootRepositoryImageMapper; + private final BlockingQueue jobLogQueue = Queues.newArrayBlockingQueue(200000); + long initTime = 0L; + long lastTime = 0L; + @Value("${isMainNode}") + private int isMainNode = 1; + public IBootTaskMessageHandler(IBootTaskMapper iBootTaskMapper, IBootTaskHostMapper iBootTaskHostMapper, IBootTaskHostLogMapper iBootTaskHostLogMapper + , IBootTaskHistoryMapper iBootTaskHistoryMapper, IBootTaskHostHistoryMapper iBootTaskHostHistoryMapper, TaskTemplateFactory taskTemplateFactory, DeviceMapper deviceMapper, IBootTemplateMapper templateMapper, IBootRepositoryImageMapper iBootRepositoryImageMapper) { + this.iBootTaskMapper = iBootTaskMapper; + this.iBootTaskHostMapper = iBootTaskHostMapper; + this.iBootTaskHostLogMapper = iBootTaskHostLogMapper; + this.iBootTaskHistoryMapper = iBootTaskHistoryMapper; + this.iBootTaskHostHistoryMapper = iBootTaskHostHistoryMapper; + this.taskTemplateFactory = taskTemplateFactory; + this.deviceMapper = deviceMapper; + this.templateMapper = templateMapper; + this.iBootRepositoryImageMapper = iBootRepositoryImageMapper; + } + + @PostConstruct + public void init() { + //20秒,轮询,如果task的全部host完成,将task置完成,并进历史 + Runnable ibootTaskRunner = () -> { + initTime = System.currentTimeMillis(); + lastTime = System.currentTimeMillis(); + while (true) { + try { + if (isMainNode == 1) { + checkTaskIsFinish(); + } + Thread.sleep(20 * 1000L); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + }; + //10秒,查询等待的任务,将并发维持在100 + Runnable ibootWaitingToRunningRunner = () -> { + initTime = System.currentTimeMillis(); + lastTime = System.currentTimeMillis(); + while (true) { + try { + pollWaitingTask(); + Thread.sleep(10 * 1000L); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + }; + //修改任务状态的队列, + Runnable ibootStatusChangeRunner = () -> { + initTime = System.currentTimeMillis(); + lastTime = System.currentTimeMillis(); + while (true) { + try { + handleTaskHostStatus(); + Thread.sleep(10L); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + }; + //插入日志的队列 + Runnable ibootTaskLogInsertRunner = () -> { + initTime = System.currentTimeMillis(); + lastTime = System.currentTimeMillis(); + while (true) { + try { + ibootTaskLogInsert(); + Thread.sleep(10L); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + }; + Runnable checkJobNeedStopRunner = () -> { + while (true) { + try { + if (isMainNode == 1) { + stopLongTimeTask(); + } + Thread.sleep(1000 * 60 * 5L); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + }; + ExecutorService pool = Executors.newFixedThreadPool(5, new CdcThreadFactory("iboot.task.status.persistence")); + pool.submit(ibootWaitingToRunningRunner); + pool.submit(ibootStatusChangeRunner); + pool.submit(ibootTaskLogInsertRunner); + pool.submit(ibootTaskRunner); + pool.submit(checkJobNeedStopRunner); + } + + private void stopLongTimeTask() { + try { + List allRuninghost = iBootTaskHostMapper.selectAllHost(); + if (CollUtil.isNotEmpty(allRuninghost)) { + for (IBootTaskHostEntity hostEntity : allRuninghost) { + //判断时间是否超过2个小时 + Date ureateTime = hostEntity.getUpdateTime(); + Date nowDate = new Date(); + if (nowDate.getTime() - ureateTime.getTime() > 1000 * 60 * 60 * 2) {//超过两个小时 + String msg = hostEntity.getSn() + " " + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + " " + Languages.getString("cosmos.iboot.longtime"); + //将该任务置成失败,并插入一条记录 + hostEntity.setJobHostStatus(TaskHostStatusEnum.FAILED); + hostEntity.setMsg(msg); + hostEntity.setProcess(100); + hostEntity.setEndTime(new Date()); + hostEntity.setUpdateTime(new Date()); + iBootTaskHostMapper.updateByPrimaryKeySelective(hostEntity); + IBootTaskHostLogEntity logEntity = new IBootTaskHostLogEntity(); + logEntity.setResourceId(hostEntity.getResourceId()); +// logEntity.setJobHostId(hostEntity.getId()); + logEntity.setTaskId(hostEntity.getTaskId()); + logEntity.setJobHostId(hostEntity.getId()); + logEntity.setId(UUID.fastUUID().toString(true)); + logEntity.setContent(msg); + logEntity.setCreateTime(new Date()); + logEntity.setUpdateTime(new Date()); + iBootTaskHostLogMapper.insert(logEntity); + //修改资源的状态 + DeviceEntity deviceEntity = new DeviceEntity(); + deviceEntity.setSn(hostEntity.getSn()); + deviceEntity.setStatus(DeviceStatusEnum.Online); + deviceMapper.updateBySn(deviceEntity); + } + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + private void checkTaskIsFinish() { + try { + List allTasks = iBootTaskMapper.selectAll(); + if (CollUtil.isNotEmpty(allTasks)) { + for (IBootTaskEntity taskEntity : allTasks) { + //查询全部的host表数据 + int getListCountByTaskId = iBootTaskHostMapper.getListCountByTaskId(taskEntity.getId()); + List iBootTaskHostEntities = new ArrayList<>(); + if (getListCountByTaskId > 5000) { + int count = getListCountByTaskId / 5000; + for (int i = 0; i <= count; i++) { + List iBootTaskHostEntities1 = iBootTaskHostMapper.getListByTaskId(taskEntity.getId(), i, 5000); + iBootTaskHostEntities.addAll(iBootTaskHostEntities1); + } + } else { + iBootTaskHostEntities = iBootTaskHostMapper.getListByTaskId(taskEntity.getId(), 0, 5000); + } + //取出host表中最小开始时间作为任务的开始时间 + if (taskEntity.getStartTime() == null) { + Date startTime = iBootTaskHostEntities.stream().filter(e -> e.getStartTime() != null).map(IBootTaskHostEntity::getStartTime).min(Date::compareTo).orElse(null); + taskEntity.setStartTime(startTime); + } + //判断任务类型,如果是系统安装,任务结束后,需要删除mac.ini文件 + iBootTaskHostEntities.forEach(iBootTaskHostEntity -> { + if (StringUtils.isNotEmpty(iBootTaskHostEntity.getMac()) && iBootTaskHostEntity.getTemplateType().equalsIgnoreCase("OS_INSTALL")) { + if (iBootTaskHostEntity.getJobHostStatus().equals(TaskHostStatusEnum.SUCCESS) || iBootTaskHostEntity.getJobHostStatus().equals(TaskHostStatusEnum.FAILED)) { + IBootMacFileUtil.stringRemoveFromFile(":" + iBootTaskHostEntity.getMac(), IBootPathConstant.MacIniFile); + } + } + if (iBootTaskHostEntity.getTemplateType().equalsIgnoreCase("USER_CONF") && iBootTaskHostEntity.getJobHostStatus().equals(TaskHostStatusEnum.FAILED) && StrUtil.isNotBlank(iBootTaskHostEntity.getTemplateId())) { + IBootTemplateEntity templateEntity = templateMapper.getByID(iBootTaskHostEntity.getTemplateId()); + if (Objects.nonNull(templateEntity) && StrUtil.isNotBlank(templateEntity.getContent())) { + IBootUserCfgBeans userCfgBeans = JSONUtil.toBean(templateEntity.getContent(), IBootUserCfgBeans.class, true); + if (Objects.nonNull(userCfgBeans) && Objects.nonNull(userCfgBeans.getUserCfgBeans()) && !userCfgBeans.getUserCfgBeans().isEmpty() && "-1".equals(userCfgBeans.getUserCfgBeans().get(0).getId())) { + Optional userCfgBean = userCfgBeans.getUserCfgBeans().stream().filter(e -> StrUtil.equalsIgnoreCase(e.getSn(), iBootTaskHostEntity.getSn())).findFirst(); + if (userCfgBean.isPresent()) { + DeviceEntity deviceEntity = new DeviceEntity(); + deviceEntity.setSn(userCfgBean.get().getSn()); + if (userCfgBean.get().isDelete()) { + deviceEntity.setManageAccount(ManageAccountEnum.ON); + } else { + deviceEntity.setManageAccount(ManageAccountEnum.OFF); + } + deviceMapper.updateBySn(deviceEntity); + } + } + } + } + if (iBootTaskHostEntity.getTemplateType().equalsIgnoreCase("DISK_CLONE") && iBootTaskHostEntity.getJobHostStatus().equals(TaskHostStatusEnum.SUCCESS) && StringUtils.isNotEmpty(iBootTaskHostEntity.getParam())) { + DeviceDiskCloneBean diskBackupBean = JSONUtil.toBean(iBootTaskHostEntity.getParam(), DeviceDiskCloneBean.class); + if (diskBackupBean.getMethod() == null) { + log.error("执行磁盘备份镜像处理操作失败,参数为空"); + return; + } + // 非备份操作不需要处理镜像 + if (DiskCloneMethodEnum.BACKUP != diskBackupBean.getMethod()) { + return; + } + // 生成的镜像入库 + IBootRepositoryImageEntity iBootRepositoryImageEntity = new IBootRepositoryImageEntity(); + iBootRepositoryImageEntity.setName(diskBackupBean.getImageName()); + iBootRepositoryImageEntity.setOriginalName(diskBackupBean.getImageName()); + iBootRepositoryImageEntity.setFullPath(IBootPathConstant.ImageFile + File.separator + diskBackupBean.getImageName()); + iBootRepositoryImageEntity.setId(UUID.fastUUID().toString(true)); + iBootRepositoryImageEntity.setCreateTime(new Date()); + iBootRepositoryImageEntity.setImageType("Disk"); + iBootRepositoryImageMapper.insert(iBootRepositoryImageEntity); + } + }); + if (iBootTaskHostEntities.stream().allMatch(jobhost -> jobhost.getJobHostStatus().equals(TaskHostStatusEnum.SUCCESS))) { + if (null == taskEntity.getEndTime()) { + taskEntity.setEndTime(new Date()); + } + taskEntity.setTaskStatus(TaskHostStatusEnum.HISTORY); + taskEntity.setUpdateTime(new Date()); + } else if (iBootTaskHostEntities.stream().allMatch(jobhost -> jobhost.getJobHostStatus().equals(TaskHostStatusEnum.FAILED))) { + if (null == taskEntity.getEndTime()) { + taskEntity.setEndTime(new Date()); + } + taskEntity.setTaskStatus(TaskHostStatusEnum.HISTORY); + taskEntity.setUpdateTime(new Date()); + } else if (iBootTaskHostEntities.stream().allMatch(jobhost -> (!jobhost.getJobHostStatus().equals(TaskHostStatusEnum.WAITING) && !jobhost.getJobHostStatus().equals(TaskHostStatusEnum.RUNNING)))) { + if (null == taskEntity.getEndTime()) { + taskEntity.setEndTime(new Date()); + } + taskEntity.setTaskStatus(TaskHostStatusEnum.HISTORY); + taskEntity.setUpdateTime(new Date()); + } else if (iBootTaskHostEntities.stream().allMatch(jobhost -> jobhost.getJobHostStatus().equals(TaskHostStatusEnum.WAITING))) { + taskEntity.setTaskStatus(TaskHostStatusEnum.WAITING); + } else { + taskEntity.setTaskStatus(TaskHostStatusEnum.RUNNING); + if (null == taskEntity.getStartTime()) { + taskEntity.setStartTime(new Date()); + } + taskEntity.setUpdateTime(new Date()); + } + if (taskEntity.getTaskStatus().equals(TaskHostStatusEnum.HISTORY)) { + if (taskEntity.getTemplateType().equalsIgnoreCase("OS_INSTALL")) { // uos安装完成后删除目录 + File imageDir = new File(IBootPathConstant.MountImageFile + File.separator + taskEntity.getId()); + if (imageDir.exists()) { + FileUtil.del(imageDir); + } + } + } + iBootTaskMapper.updateByPrimaryKeySelective(taskEntity); + if (BeanUtil.isNotEmpty(taskEntity.getEndTime())) { + task2History(taskEntity); + } + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void task2History(IBootTaskEntity iBootTaskEntity) { + //先处理task表 入历史 并删除 + if (BeanUtil.isNotEmpty(iBootTaskEntity)) { + IBootTaskHistoryEntity historyTask = BeanUtil.copyProperties(iBootTaskEntity, IBootTaskHistoryEntity.class, "pk"); + historyTask.setTaskId(iBootTaskEntity.getId()); + historyTask.setExcuteUser(iBootTaskEntity.getCreateUser()); + historyTask.setId(UUID.fastUUID().toString(true)); + //处理任务状态 + IBootTaskJobBean iBootTaskJobBean = iBootTaskHostMapper.getIBootTaskJobByTaskId(iBootTaskEntity.getId()); + if (iBootTaskJobBean.getFailNum() != 0 && iBootTaskJobBean.getSuccessNum() != 0) {//成功失败个数都不为0,则为部分成功 + historyTask.setTaskStatus(TaskHostStatusEnum.PART_SUCCESS); + } else if (iBootTaskJobBean.getFailNum() == 0 && iBootTaskJobBean.getSuccessNum() != 0) {//失败个数为0.成功不为0,则为成功 + historyTask.setTaskStatus(TaskHostStatusEnum.SUCCESS); + } else { + historyTask.setTaskStatus(TaskHostStatusEnum.FAILED); + } + iBootTaskHistoryMapper.insert(historyTask); + iBootTaskMapper.deleteByPrimaryKey(iBootTaskEntity); + } + //分片500进历史 + List hostHistoryEntities1 = new ArrayList<>(); + int getHost2HistoryCount = iBootTaskHostHistoryMapper.getHost2HistoryCount(iBootTaskEntity.getId()); + if (getHost2HistoryCount > 5000) { + hostHistoryEntities1 = iBootTaskHostHistoryMapper.jobHost2History(iBootTaskEntity.getId(), 0, 5000); + } else { + hostHistoryEntities1 = iBootTaskHostHistoryMapper.jobHost2History(iBootTaskEntity.getId(), 0, 5000); + } + //先把前5000处理完成 + hostHistoryEntities1.forEach(hostHistoryEntitie -> { + try { + iBootTaskHostHistoryMapper.insertUseGeneratedKeysSelective(hostHistoryEntitie); + Thread.sleep(10); + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + }); + int count = getHost2HistoryCount / 5000; + if (count > 1) { + for (int i = 1; i <= count; i++) { + List hostHistoryEntities = iBootTaskHostHistoryMapper.jobHost2History(iBootTaskEntity.getId(), i, 5000); + //其他多余数据按5000依次入库 + hostHistoryEntities.forEach(hostHistoryEntitie -> { + try { + iBootTaskHostHistoryMapper.insertUseGeneratedKeysSelective(hostHistoryEntitie); + Thread.sleep(10); + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + }); + } + } + iBootTaskHostMapper.deleteByTaskId(iBootTaskEntity.getId()); + } + + /** + * 从任务表中取出waiting状态的任务,保证最多并发为100个,则方法需要定义成同步锁方法 + */ + public synchronized void pollWaitingTask() { + try { + //查询,当前运行的任务个数 + int running = iBootTaskHostMapper.getRunningCount(); + int limitcount = 100 - running; + if (limitcount > 0) {//存在空闲数量 + //查询waiting的任务 + List iBootTaskHostEntities = iBootTaskHostMapper.getWaitingTaskHostList(limitcount); + if (CollUtil.isNotEmpty(iBootTaskHostEntities)) { + iBootTaskHostEntities.forEach(iBootTaskHostEntity -> { + try { + //将任务状态置成running + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.RUNNING); + iBootTaskHostEntity.setUpdateTime(new Date()); + iBootTaskHostEntity.setStartTime(new Date()); + iBootTaskHostMapper.updateByPrimaryKeySelective(iBootTaskHostEntity); + List sns = new ArrayList<>(); + sns.add(iBootTaskHostEntity.getSn()); + List deviceEntities = deviceMapper.queryListBySn(sns); + if (deviceEntities == null || deviceEntities.isEmpty() || (StringUtils.isBlank(deviceEntities.get(0).getDhcpIp()) && !StringUtils.equalsIgnoreCase(iBootTaskHostEntity.getTemplateType(), TemplateTypeEnum.OS_EXPLORE.name()))) {//设备不正常 + exceptionMsg(iBootTaskHostEntity, Languages.getString("iboot.execute.dhcpip.no.exist")); + } else { + //将设备置成忙碌 + DeviceEntity deviceEntity = new DeviceEntity(); + deviceEntity.setSn(iBootTaskHostEntity.getSn()); + deviceEntity.setStatus(DeviceStatusEnum.Busy); + deviceMapper.updateBySn(deviceEntity); + //上报任务开始执行日志 + IBootTaskHostLogEntity iBootTaskHostLogEntity = new IBootTaskHostLogEntity(); + iBootTaskHostLogEntity.setJobHostId(iBootTaskHostEntity.getId()); + iBootTaskHostLogEntity.setContent(Languages.getString("cosmos.iboot.task.taskstart")); + iBootTaskHostLogEntity.setCreateTime(new Date()); + iBootTaskHostLogEntity.setUpdateTime(new Date()); + acceptTaskHostLogBean(iBootTaskHostLogEntity); + //创建任务所需要的文件夹 + new Thread(() -> createTarAndTrigger(iBootTaskHostEntity)).start(); + } + } catch (Exception e) {//出现异常,将任务置成失败 + exceptionMsg(iBootTaskHostEntity, e.getMessage()); + } + }); + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + private void createTarAndTrigger(IBootTaskHostEntity iBootTaskHostEntity) { + try { + String taskForldPath = IBootPathConstant.TaskTmpPath; + File taskForld = new File(taskForldPath); + if (!taskForld.exists()) { + taskForld.mkdirs(); + } + String thisTaskTmpPath = taskForldPath + iBootTaskHostEntity.getId() + "/"; + File thisTaskForld = new File(FileUtil.normalize(thisTaskTmpPath)); + thisTaskForld.mkdir(); + TemplateCreateService templateCreateService = taskTemplateFactory.getCreateTemplateImpl(iBootTaskHostEntity.getTemplateType()); + ResultBean resultBean1 = templateCreateService.createTemplateShFile(thisTaskTmpPath, iBootTaskHostEntity.getId(), iBootTaskHostEntity.getParam()); + if (!resultBean1.isFlag()) { + exceptionMsg(iBootTaskHostEntity, resultBean1.getMessage()); + } else { + ResultBean resultBean2 = templateCreateService.putTools(thisTaskTmpPath); + if (!resultBean2.isFlag()) { + exceptionMsg(iBootTaskHostEntity, resultBean2.getMessage()); + } else { + ResultBean resultBean = templateCreateService.execute(thisTaskTmpPath, iBootTaskHostEntity); + if (!resultBean.isFlag()) { + exceptionMsg(iBootTaskHostEntity, resultBean.getMessage()); + } else { + if (StringUtils.equalsIgnoreCase(iBootTaskHostEntity.getTemplateType(), TemplateTypeEnum.OS_EXPLORE.name())) { + IBootTaskHostLogEntity logEntity = new IBootTaskHostLogEntity(); + logEntity.setJobHostId(iBootTaskHostEntity.getId()); + logEntity.setContent(resultBean.getMessage()); + logEntity.setCreateTime(new Date()); + logEntity.setUpdateTime(new Date()); + acceptTaskHostLogBean(logEntity); + IBootTaskHostEntity entity = new IBootTaskHostEntity(); + entity.setId(iBootTaskHostEntity.getId()); + entity.setJobHostStatus(TaskHostStatusEnum.SUCCESS); + entity.setMsg(resultBean.getMessage()); + acceptStatusChangeBean(entity); + } + } + } + } + } catch (Exception e) { + exceptionMsg(iBootTaskHostEntity, e.getMessage()); + } finally {//线程结束后删除文件夹 + FileUtil.del(IBootPathConstant.TaskTmpPath + iBootTaskHostEntity.getId() + "/"); + } + } + + public void exceptionMsg(IBootTaskHostEntity iBootTaskHostEntity, String msg) { + IBootTaskHostEntity iBootTaskHostEntity1 = new IBootTaskHostEntity(); + iBootTaskHostEntity1.setId(iBootTaskHostEntity.getId()); + iBootTaskHostEntity1.setPk(iBootTaskHostEntity.getPk()); + iBootTaskHostEntity1.setJobHostStatus(TaskHostStatusEnum.FAILED); + iBootTaskHostEntity1.setMsg(Languages.getString("iboot.execute.fail") + " : " + msg); + iBootTaskHostEntity1.setUpdateTime(new Date()); + iBootTaskHostEntity1.setStartTime(new Date()); + acceptStatusChangeBean(iBootTaskHostEntity1); + IBootTaskHostLogEntity iBootTaskHostLogEntity = new IBootTaskHostLogEntity(); + iBootTaskHostLogEntity.setJobHostId(iBootTaskHostEntity.getId()); + iBootTaskHostLogEntity.setContent(Languages.getString("iboot.execute.fail") + " : " + msg); + iBootTaskHostLogEntity.setCreateTime(new Date()); + iBootTaskHostLogEntity.setUpdateTime(new Date()); + acceptTaskHostLogBean(iBootTaskHostLogEntity); + } + + /** + * 批量插入日志 + */ + private void ibootTaskLogInsert() { + try { + List jobList = new ArrayList<>(); + jobLogQueue.drainTo(jobList, 100); + if (CollUtil.isNotEmpty(jobList)) { + //增加上报日志时,需要修改host表的update_time + jobList.forEach(iBootTaskHostLogEntity -> { + //设备上报时,不能给出taskid和resourceid,需要根据taskhostid取出,并统一给日志赋uuid + IBootTaskHostEntity iBootTaskHostEntitytemplate = iBootTaskHostMapper.getJobHostStatusById(iBootTaskHostLogEntity.getJobHostId()); + iBootTaskHostLogEntity.setResourceId(iBootTaskHostEntitytemplate.getResourceId()); + iBootTaskHostLogEntity.setTaskId(iBootTaskHostEntitytemplate.getTaskId()); + iBootTaskHostLogEntity.setId(UUID.fastUUID().toString(true)); + Date date = new Date(); + Instant instant = date.toInstant(); + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + String fotmatDate = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + //对raid上报日志统一中英文处理 + String raidContent = ""; + if (StringUtils.isNotEmpty(iBootTaskHostLogEntity.getContent())) { + if (iBootTaskHostLogEntity.getContent().contains("#")) { + String[] contentStr = iBootTaskHostLogEntity.getContent().split("#"); + if (contentStr.length > 0) { + if (contentStr[0].equalsIgnoreCase("logicallog")) {//逻辑盘上传日志 + if (contentStr.length == 4) { + raidContent = contentStr[1] + " " + contentStr[2] + " " + Languages.getString(contentStr[3]); + } + } else if (contentStr[0].equalsIgnoreCase("disklog")) {//硬盘日志 + if (contentStr.length == 5) { + raidContent = contentStr[1] + " " + contentStr[2] + " " + Languages.getString("diskstatus") + " " + contentStr[3] + " " + Languages.getString(contentStr[4]); + } + } else if (contentStr[0].equalsIgnoreCase("jbodlog")) {//jbod日志 + if (contentStr.length == 3) { + raidContent = contentStr[1] + " " + Languages.getString(contentStr[2]); + } + } else if (contentStr[0].equalsIgnoreCase("raidchecklog")) {//整体日志 + if (contentStr.length == 2) { + raidContent = Languages.getString(contentStr[1]); + } + } + } + } + } + if (StringUtils.isNotEmpty(raidContent)) { + iBootTaskHostLogEntity.setContent(iBootTaskHostEntitytemplate.getSn() + " " + fotmatDate + " " + raidContent); + } else { + //将日志中英文 + String contentNew = Languages.getString(iBootTaskHostLogEntity.getContent().trim()); + iBootTaskHostLogEntity.setContent(iBootTaskHostEntitytemplate.getSn() + " " + fotmatDate + " " + contentNew); + } + iBootTaskHostLogEntity.setUpdateTime(new Date()); + iBootTaskHostLogEntity.setCreateTime(new Date()); + IBootTaskHostEntity taskJobHostEntity = new IBootTaskHostEntity(); + taskJobHostEntity.setUpdateTime(new Date()); + taskJobHostEntity.setId(iBootTaskHostEntitytemplate.getId()); + taskJobHostEntity.setPk(iBootTaskHostEntitytemplate.getPk()); + iBootTaskHostMapper.updateByPrimaryKeySelective(taskJobHostEntity); + }); + iBootTaskHostLogMapper.insertList(jobList); + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + /** + * 取出需要修改状态的任务队列,修改任务状态 + */ + private void handleTaskHostStatus() { + try { + List pendingStatusList = new ArrayList<>(); + ibootNodeChangeQueue.drainTo(pendingStatusList, 100); + if (CollUtil.isNotEmpty(pendingStatusList)) { + for (IBootTaskHostEntity bean : pendingStatusList) { + updateJobHostStatus(bean); + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + + } + + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void updateJobHostStatus(IBootTaskHostEntity bean) { + try { + if (StrUtil.isNotEmpty(bean.getId())) {//任务id和host表id不可为null + //张晨增加,处理并发时,有的子任务已被修改成结束,但是由于并发,前面的日志处理的慢,又将结束的任务置成了running + IBootTaskHostEntity iBootTaskHostEntity = iBootTaskHostMapper.getJobHostStatusById(bean.getId()); + log.error("control task " + CommonCheck.convertValidLog(bean.getResourceId())); + if (iBootTaskHostEntity != null && iBootTaskHostEntity.getJobHostStatus() != null && + (iBootTaskHostEntity.getJobHostStatus().equals(TaskHostStatusEnum.FAILED) || iBootTaskHostEntity.getJobHostStatus().equals(TaskHostStatusEnum.SUCCESS))) { + return; + } + IBootTaskHostEntity taskJobHostEntity = new IBootTaskHostEntity(); + taskJobHostEntity.setId(bean.getId()); + taskJobHostEntity.setPk(iBootTaskHostEntity.getPk()); + taskJobHostEntity.setJobHostStatus(bean.getJobHostStatus()); + taskJobHostEntity.setMsg(bean.getMsg()); + if (taskJobHostEntity.getProcess() != bean.getProcess() && bean.getProcess() != 0) { + taskJobHostEntity.setProcess(bean.getProcess()); + } + //处理将等待的设备置成失败情况 + if (iBootTaskHostEntity != null && iBootTaskHostEntity.getStartTime() == null) { + taskJobHostEntity.setStartTime(new Date()); + } + //如果修改任务为FAILED和SUCCESS,则增加结束时间 + if (bean.getJobHostStatus() != null && (bean.getJobHostStatus().equals(TaskHostStatusEnum.FAILED) || bean.getJobHostStatus().equals(TaskHostStatusEnum.SUCCESS))) { + taskJobHostEntity.setEndTime(new Date()); + } + taskJobHostEntity.setUpdateTime(new Date()); + iBootTaskHostMapper.updateByPrimaryKeySelective(taskJobHostEntity); + //判断任务是否完成,已完成,释放设备 + if (bean.getJobHostStatus().equals(TaskHostStatusEnum.SUCCESS) || bean.getJobHostStatus().equals(TaskHostStatusEnum.FAILED)) { + DeviceEntity deviceEntity = new DeviceEntity(); + deviceEntity.setSn(iBootTaskHostEntity.getSn()); + deviceEntity.setStatus(DeviceStatusEnum.Online); + deviceMapper.updateBySn(deviceEntity); + } + } else { + log.error("iboot change status fail param is" + JSONUtil.toJsonStr(bean)); + } + } catch (Exception e) { + log.error("iboot change task status exception " + e.getMessage()); + } + } + + /** + * 接受修改任务状态的数据 + * + * @param iBootTaskHostEntity + */ + public void acceptStatusChangeBean(IBootTaskHostEntity iBootTaskHostEntity) { + ibootNodeChangeQueue.offer(iBootTaskHostEntity); + } + + /** + * 接受日志上报数据 + * + * @param iBootTaskHostEntity + */ + public void acceptTaskHostLogBean(IBootTaskHostLogEntity iBootTaskHostEntity) { + jobLogQueue.offer(iBootTaskHostEntity); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTaskScheduler.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTaskScheduler.java new file mode 100644 index 0000000000000000000000000000000000000000..46208c43238aa472dae465ee03e0b6fa8dff52d1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTaskScheduler.java @@ -0,0 +1,19 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; + +@Configuration +@EnableScheduling +public class IBootTaskScheduler { + @Bean + public ThreadPoolTaskScheduler ibootTaskScheduler() { + ThreadPoolTaskScheduler Scheduler = new ThreadPoolTaskScheduler(); + Scheduler.setPoolSize(10); + Scheduler.setWaitForTasksToCompleteOnShutdown(true); + Scheduler.setAwaitTerminationSeconds(60); + return Scheduler; + } +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTemplateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTemplateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d53b824976b0402e300c4a25f35c6d9c1aa5c5dc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/IBootTemplateServiceImpl.java @@ -0,0 +1,2286 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.lang.UUID; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.google.common.collect.Maps; +import com.inspur.cdc.combo.mybatis.page.Pages; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.cdc.commons.lang.util.CommonCheck; +import com.inspur.cdc.commons.lang.util.UUIDUtil; +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.cdc.commons.lang.web.PageRequest; +import com.inspur.ispim.cosmos.commons.exception.PimException; +import com.inspur.ispim.cosmos.commons.utils.ISOUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.*; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceSystemInfoBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageEnvironmentBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageGroupBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageXmlBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageXmlBeans; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.*; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.*; +import com.inspur.ispim.cosmos.iboot.base.api.entity.*; +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootOsInstallService; +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootTemplateService; +import com.inspur.ispim.cosmos.iboot.base.api.service.TaskService; +import com.inspur.ispim.cosmos.iboot.base.api.util.*; +import com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall.IBootOsInstallFactory; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.dom4j.tree.DefaultAttribute; +import org.springframework.transaction.annotation.Transactional; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import tk.mybatis.mapper.util.StringUtil; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/7 + */ +@Slf4j +public class IBootTemplateServiceImpl implements IBootTemplateService { + + private static Map uosMap = Maps.newHashMap(); + + static { + uosMap.put("Basic-Server-Environment", "常规服务器环境"); + uosMap.put("Cloud-and-Virtualzalition", "云和虚拟化"); + uosMap.put("Big-Data", "大数据"); + uosMap.put("Server-Environment-with-GUI", "图形化服务器环境"); + uosMap.put("Custom-Installation", "自定义安装"); + } + + private final TaskService taskService; + private final IBootInabndFileMapper iBootInabndFileMapper; + private final IBootTemplateMapper iBootTemplateMapper; + private final DeviceMapper deviceMapper; + private final IBootTimezoneMapper iBootTimezoneMapper; + private final IBootRepositoryImageMapper iBootRepositoryImageMapper; + private final IBootImageXmlMapper iBootImageXmlMapper; + private final IBootOsInstallFactory iBootOsInstallFactory; + private final IBootRaidConfigXmlMapper iBootRaidConfigXmlMapper; + private final IBootStressDataMapper iBootStressDataMapper; + private final IBootStressTessServerMapper iBootStressTessServerMapper; + + public IBootTemplateServiceImpl(TaskService taskService, IBootTemplateMapper iBootTemplateMapper, + IBootInabndFileMapper iBootInabndFileMapper, DeviceMapper deviceMapper, + IBootTimezoneMapper iBootTimezoneMapper, IBootRepositoryImageMapper iBootRepositoryImageMapper, + IBootImageXmlMapper iBootImageXmlMapper, IBootOsInstallFactory iBootOsInstallFactory, + IBootRaidConfigXmlMapper iBootRaidConfigXmlMapper, IBootStressDataMapper iBootStressDataMapper, + IBootStressTessServerMapper iBootStressTessServerMapper) { + this.taskService = taskService; + this.iBootTemplateMapper = iBootTemplateMapper; + this.iBootInabndFileMapper = iBootInabndFileMapper; + this.deviceMapper = deviceMapper; + this.iBootTimezoneMapper = iBootTimezoneMapper; + this.iBootRepositoryImageMapper = iBootRepositoryImageMapper; + this.iBootImageXmlMapper = iBootImageXmlMapper; + this.iBootOsInstallFactory = iBootOsInstallFactory; + this.iBootRaidConfigXmlMapper = iBootRaidConfigXmlMapper; + this.iBootStressDataMapper = iBootStressDataMapper; + this.iBootStressTessServerMapper = iBootStressTessServerMapper; + } + + private static String readJsonFile(String fileName) { + String jsonStr = ""; + FileReader fileReader = null; + Reader reader = null; + try { + File jsonFile = new File(FilenameUtils.normalize(fileName)); + fileReader = new FileReader(jsonFile); + reader = new InputStreamReader(new FileInputStream(jsonFile), StandardCharsets.UTF_8); + int ch = 0; + StringBuffer sb = new StringBuffer(); + while ((ch = reader.read()) != -1) { + sb.append((char) ch); + } + fileReader.close(); + reader.close(); + jsonStr = sb.toString(); + return jsonStr; + } catch (IOException e) { + log.error(e.getMessage()); + return null; + } finally { + // 关闭流 + if (fileReader != null) { + try { + fileReader.close(); + } catch (IOException e) { + fileReader = null; + log.error("close stream error", e); + } + } + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + reader = null; + log.error("close stream error", e); + } + } + } + } + + @Override + public Page queryTemplateByCondition(IBootTemplateQueryBean queryBean) { + PageRequest.checkPage(queryBean); + if (!BeanUtil.beanToMap(new IBootTemplateEntity(), false, false).containsKey(queryBean.getField())) { + throw new PimException(Languages.getString("cosmos.iboot.page.sort.field.not.exist")); + } + Pages pages = Pages.of(queryBean.getPage(), queryBean.getPageSize(), queryBean.getField(), queryBean.getDir()); + List entities = iBootTemplateMapper.getByConditions(queryBean).stream().peek(this::filterSafe).collect(Collectors.toList()); + //如果是raid配置,需要填充敏感信息 + entities.forEach(entitie -> { + if (entitie.getTemplateType().equals(TemplateTypeEnum.RAID_SET_CONF)) { + IBootRaidConfigBigTemplateBean iBootInstallParamBean = JSONUtil.toBean(entitie.getContent(), IBootRaidConfigBigTemplateBean.class); + List deleteVolume = iBootInstallParamBean.getDeleteVolume(); + if (CollUtil.isNotEmpty(deleteVolume)) { + String contentTol = ""; + for (LogicalDiskForDelete logicalDiskForDelete : deleteVolume) { + String content = ""; + if (logicalDiskForDelete.getOperation().equalsIgnoreCase("delVolume")) {//删除逻辑盘 + content = content + logicalDiskForDelete.getCardName() + " " + Languages.getString("cosmos.iboot.deleteVolume") + ":" + logicalDiskForDelete.getName(); + } else if (logicalDiskForDelete.getOperation().equalsIgnoreCase("delJobd")) { + content = content + logicalDiskForDelete.getCardName() + " " + Languages.getString("cosmos.iboot.deleteJbod"); + } else if (logicalDiskForDelete.getOperation().equalsIgnoreCase("ghotToUG")) { + content = content + logicalDiskForDelete.getCardName() + " " + logicalDiskForDelete.getName() + " " + Languages.getString("cosmos.iboot.deleteGlobal"); + } + if (StringUtils.isNotEmpty(content)) { + content.replaceAll("-null", ""); + content.replaceAll("null", ""); + contentTol = contentTol + content + " \r"; + } + } + if (StringUtils.isNotEmpty(contentTol)) { + entitie.setMgOper(contentTol); + } + } + } + }); + return pages.page(entities); + } + + @Override + public IBootTemplateEntity addTemplateWithEntity(IBootTemplateEntity iBootTemplateEntity) { + iBootTemplateEntity.setCreateTime(new Date()); + iBootTemplateEntity.setUpdateTime(new Date()); + iBootTemplateEntity.setShow(true); + iBootTemplateEntity.setId(UUID.fastUUID().toString(true)); + Object templateBean = iBootTemplateEntity.getTemplateBean(); + // 将模板参数转换为json存储 + iBootTemplateEntity.setContent(JSONUtil.toJsonStr(templateBean)); + // 处理模板数据 + boolean result = handleTemplateEntity(iBootTemplateEntity); + if (!result) { // 模板数据异常 + return null; + } + iBootTemplateMapper.insertUseGeneratedKeys(iBootTemplateEntity); + return iBootTemplateEntity; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean deleteTemplateByIds(List templateIds) { + List results = templateIds.stream().map(id -> { + IBootTemplateEntity templateEntity = iBootTemplateMapper.getByID(id); + templateEntity.setShow(false); + return iBootTemplateMapper.updateByPrimaryKeySelective(templateEntity); + }).toList(); + return results.stream().allMatch(result -> result > 0); + } + + @Override + public boolean updateTemplate(IBootTemplateEntity iBootTemplateEntity) { + iBootTemplateEntity.setUpdateTime(new Date()); + Object templateBean = iBootTemplateEntity.getTemplateBean(); + // 将模板参数转换为json存储 + iBootTemplateEntity.setContent(JSONUtil.toJsonStr(templateBean)); + boolean result = handleTemplateEntity(iBootTemplateEntity); + if (!result) { + return false; + } + return iBootTemplateMapper.updateByPrimaryKeySelective(iBootTemplateEntity) > 0; + } + + @Override + public List select(IBootTemplateEntity iBootTemplateEntity) { + return iBootTemplateMapper.select(iBootTemplateEntity); + } + + @Override + public IBootTemplateEntity queryTemplateDetail(Long templatePk) { + IBootTemplateEntity iBootTemplateEntity = iBootTemplateMapper.selectByPrimaryKey(templatePk); + this.filterSafe(iBootTemplateEntity); + return iBootTemplateEntity; + } + + @Override + public IBootTemplateEntity queryTemplateDetailById(String templateId) { + IBootTemplateEntity iBootTemplateEntity = iBootTemplateMapper.getByID(templateId); + this.filterSafe(iBootTemplateEntity); + return iBootTemplateEntity; + } + + @Override + public ResultBean duplicateTemplate(IBootTemplateEntity iBootTemplateEntity) { + if (Objects.isNull(iBootTemplateEntity) || Objects.isNull(iBootTemplateEntity.getPk()) || StringUtils.isBlank(iBootTemplateEntity.getName())) { + return new ResultBean(false, Languages.getString("iboot.template.param.error"), null); + } + IBootTemplateEntity templateEntity = iBootTemplateMapper.selectByPrimaryKey(iBootTemplateEntity.getPk()); + if (Objects.isNull(templateEntity)) { + return new ResultBean(false, Languages.getString("iboot.template.pk.noexsit"), null); + } + List templateEntities = iBootTemplateMapper.getByName(iBootTemplateEntity.getName()); + if (Objects.nonNull(templateEntities) && !templateEntities.isEmpty()) { + return new ResultBean(false, Languages.getString("iboot.template.duplicate"), null); + } + templateEntity.setPk(null); + templateEntity.setId(UUID.fastUUID().toString(true)); + templateEntity.setShow(true); + templateEntity.setName(iBootTemplateEntity.getName()); + templateEntity.setCreateUser(iBootTemplateEntity.getCreateUser()); + templateEntity.setCreateTime(new Date()); + templateEntity.setUpdateTime(new Date()); + iBootTemplateMapper.insertUseGeneratedKeys(templateEntity); + return new ResultBean(true, null, null); + } + + @Override + public ResultBean checkGraphicRaid(IBootTemplateEntity controlTemplateEntity) { + StringJoiner reason = new StringJoiner(""); + if (controlTemplateEntity == null || controlTemplateEntity.getTemplateBean() == null) { + reason.add(Languages.getString("RAID_BEAN_NULL")); + return new ResultBean(false, reason.toString(), null); + } + IBootRaidConfigBigTemplateBean templateBean = GsonUtil.fromJson(JSONUtil.toJsonStr(controlTemplateEntity.getTemplateBean()), IBootRaidConfigBigTemplateBean.class); + //检查参数的合法性 + return checkRaidConfigTemplate(templateBean); + } + + private ResultBean checkRaidConfigTemplate(IBootRaidConfigBigTemplateBean iBootRaidConfigBigTemplateBean) { + IBootRaidConfigTemplateBean raidConfigTemplate = iBootRaidConfigBigTemplateBean.getTemplateBean(); + ResultBean result = new ResultBean(true, "", null); + result.setFlag(true); + raidConfigTemplate.getRaidLogicalDisk().forEach((key, value) -> { + //判断 + String message = checkRaidConfig(key, value); + if (org.apache.commons.lang3.StringUtils.isNotEmpty(message)) { + result.setFlag(false); + result.setMessage(message); + } + }); + return result; + } + + private String checkRaidConfig(String key, List value) { + String message = ""; + // 获取RAID配置样本,加入后续校验 + String raidType = key.split(":")[1].toUpperCase(); + String raidModel = key.split(":")[2]; + IBootRaidConfigXmlEntity controlRaidConfigXmlEntity = iBootRaidConfigXmlMapper.getByModelAndType(raidModel.toUpperCase(), raidType); + RaidConfigXmlBean raidConfigXmlBean = GsonUtil.fromJson(controlRaidConfigXmlEntity.getContent(), RaidConfigXmlBean.class); + if (ObjectUtil.isNull(raidConfigXmlBean.getLogical().getRange())) { // 不支持RAID + message = Languages.getString("starlet.iboot.raid.config.xml.error"); + return message; + } + int pdCount = 0; + for (LogicalDisk logicalDisk : value) { + String cid = key.split(":")[0]; + cid = cid.substring(cid.indexOf("c") + 1); + if (logicalDisk.getType().equalsIgnoreCase("logical") || logicalDisk.getType().equalsIgnoreCase("jbod") || logicalDisk.getType().equalsIgnoreCase("hot")) { + if (logicalDisk.getType().equalsIgnoreCase("hot")) { + if (BeanUtil.isEmpty(raidConfigXmlBean.getGlobal())) { // 不支持全局热备 + message = Languages.getString("starlet.iboot.raid.config.xml.error"); + } else if (raidConfigXmlBean.getGlobal().getRange() instanceof Integer) { + if (logicalDisk.getPhysicalDiskList().size() > (int) raidConfigXmlBean.getGlobal().getRange()) { // 全局热备数限制 + message = Languages.getString("starlet.iboot.raid.config.xml.error"); + } + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + } + RaidLevelEnum raidLevel = logicalDisk.getRaidLevel(); + if (raidLevel != null) { + List raidLevels = raidConfigXmlBean.getRaidLevel().getValue(); + if (BeanUtil.isNotEmpty(raidConfigXmlBean.getJbod())) { + raidLevels.add("JBOD"); + } + if (!raidLevels.contains(raidLevel.name())) { // 不支持的RAID等级 + message = Languages.getString("cosmos.control.raidconfig.raid.checknosupport"); + } + switch (raidLevel) { + case JBOD: { + break; + } + case RAID0: { + //Raid0 没有局部热备 + if (CollUtil.isNotEmpty(logicalDisk.getPartHotDisk())) { + message = Languages.getString("cosmos.control.raidconfig.raid", "Raid0 "); + } + // Raid0 关联硬盘数量校验 + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID0().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID0().getUpper()) { + message = Languages.getString("cosmos.control.raidconfig.raid.checkcount", "Raid0 ", raidConfigXmlBean.getRAID0().getLower()); + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + case RAID1: { + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID1().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID1().getUpper() || logicalDisk.getPhysicalDiskList().size() % 2 == 1) { + message = Languages.getString("cosmos.control.raidconfig.raid.checknumeven", "Raid1 ", raidConfigXmlBean.getRAID1().getLower()); + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + case RAID5: { + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID5().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID5().getUpper()) { + message = Languages.getString("cosmos.control.raidconfig.raid.checkcount", "Raid5 ", raidConfigXmlBean.getRAID5().getLower()); + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + case RAID6: { + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID6().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID6().getUpper()) { + message = Languages.getString("cosmos.control.raidconfig.raid.checkcount", "Raid6 ", raidConfigXmlBean.getRAID6().getLower()); + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + case RAID10: { + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID10().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID10().getUpper() || logicalDisk.getPhysicalDiskList().size() % 2 == 1) { + message = Languages.getString("cosmos.control.raidconfig.raid.checknumeven", "Raid10 ", raidConfigXmlBean.getRAID10().getLower());//"Raid10 关联硬盘数量至少4块并且必须为偶数"; + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + case RAID1E: { + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID1E().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID1E().getUpper() || logicalDisk.getPhysicalDiskList().size() % 2 == 0) { + message = Languages.getString("cosmos.control.raidconfig.raid.checknumnoeven", "Raid1E ", raidConfigXmlBean.getRAID1E().getLower()); + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + case RAID50: { + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID50().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID50().getUpper()) { + message = Languages.getString("cosmos.control.raidconfig.raid.checkcount", "Raid50 ", raidConfigXmlBean.getRAID50().getLower()); + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + case RAID60: { + if (ObjectUtil.isNull(logicalDisk.getPhysicalDiskList()) || logicalDisk.getPhysicalDiskList().size() < raidConfigXmlBean.getRAID60().getLower() + || logicalDisk.getPhysicalDiskList().size() > raidConfigXmlBean.getRAID60().getUpper()) { + message = Languages.getString("cosmos.control.raidconfig.raid.checkcount", "Raid60 ", raidConfigXmlBean.getRAID60().getLower()); + } + pdCount += logicalDisk.getPhysicalDiskList().size(); + break; + } + default: { + message = Languages.getString("cosmos.control.raidconfig.raid.checknosupport"); + } + } + } + List partHostDisks = logicalDisk.getPartHotDisk(); + if (CollUtil.isNotEmpty(partHostDisks)) { + if (BeanUtil.isEmpty(raidConfigXmlBean.getDedicated())) { // 不支持局部热备 + message = Languages.getString("starlet.iboot.raid.config.xml.error"); + } else { + for (PhysicalDisk physicalDisk : partHostDisks) { + //对使用的物理磁盘进行排序 + Collections.sort(logicalDisk.getPhysicalDiskList(), (o1, o2) -> (int) (unifySizeUnit(o1.getSize(), o1.getSizeUnit()) - unifySizeUnit(o2.getSize(), o2.getSizeUnit()))); + if (unifySizeUnit(physicalDisk.getSize(), physicalDisk.getSizeUnit()) < unifySizeUnit(logicalDisk.getPhysicalDiskList().get(0).getSize(), logicalDisk.getPhysicalDiskList().get(0).getSizeUnit())) { + message = Languages.getString("cosmos.control.raidconfig.raid.checkdisksize"); // 局部热备盘容量必须大于等于逻辑盘最小硬盘容量; + } + } + } + } + if (org.apache.commons.lang.StringUtils.isNotEmpty(message)) { + break; + } + } + } + if ((raidModel.contains("3008IR") || raidModel.contains("2308")) && pdCount > 14) { // SAS的卡对盘数有限制 + message = Languages.getString("starlet.iboot.raid.config.xml.error"); + } + return message; + } + + /** + * 统一磁盘 容量单位 + * + * @param size + * @param sizeUnit + * @return + */ + private double unifySizeUnit(String size, String sizeUnit) { + double sizeNum = Double.parseDouble(size); + switch (sizeUnit.toUpperCase()) { + case "KB": { + sizeNum = sizeNum / Math.pow(2, 20); + break; + } + case "MB": { + sizeNum = sizeNum / Math.pow(2, 10); + break; + } + case "GB": { + break; + } + case "TB": { + sizeNum = sizeNum * Math.pow(2, 10); + break; + } + } + + return sizeNum; + } + + @Override + public ResultBean addInbandFile(byte[] file, String fileName) { + ResultBean resultBean = new ResultBean(true, "", null); + if (CommonCheck.isNullOrEmpty(fileName)) { + resultBean.setFlag(false); + resultBean.setMessage("REPO_BUNDLE_FILE_NAME_ILLEGAL"); + return resultBean; + } + String fileNameUUid = UUIDUtil.getUuid(); + FileUtil.mkdir(IBootPathConstant.InbandFile + File.separator + fileNameUUid); + String filePath = IBootPathConstant.InbandFile + File.separator + fileNameUUid + File.separator + fileName; + try { + FileUtil.writeBytes(file, filePath); + IBootInbandFileEntity iBootInbandFileEntity = new IBootInbandFileEntity(); + String id = UUIDUtil.getUuid(); + iBootInbandFileEntity.setId(id); + iBootInbandFileEntity.setName(fileName); + iBootInbandFileEntity.setOriginalName(fileName); + iBootInbandFileEntity.setFullPath(filePath); + String md5sum = CommonUtil.md5(file); + iBootInbandFileEntity.setMd5(md5sum); + iBootInbandFileEntity.setCreateTime(new Date()); + iBootInbandFileEntity.setUpdateTime(new Date()); + iBootInabndFileMapper.insertUseGeneratedKeys(iBootInbandFileEntity); + resultBean.setData(iBootInabndFileMapper.getOneById(id)); + } catch (Exception ie) { + resultBean.setFlag(false); + FileUtil.del(new File(filePath)); + resultBean.setMessage("CONTROL_UPLOAD_FILE_FAIL"); + } + return resultBean; + } + + @Override + public ResultBean deleteInbandFile(String fileId) { + ResultBean resultBean = new ResultBean(true, "", null); + if (CommonCheck.isNullOrEmpty(fileId)) { + resultBean.setFlag(false); + } else { + IBootInbandFileEntity iBootInbandFile = iBootInabndFileMapper.getOneById(fileId); + if (BeanUtil.isNotEmpty(iBootInbandFile)) { + iBootInabndFileMapper.deleteById(fileId); + File inbandFile = new File(FileUtil.normalize(iBootInbandFile.getFullPath())); + try { + inbandFile.deleteOnExit(); + } catch (Exception e) { + log.error(e.getMessage()); + } + } + } + return resultBean; + } + + @Override + public boolean startIBootTemplate(Long templatePk, IBootStartTaskBean iBootStartTaskBean) { + try { + IBootTemplateEntity iBootTemplateEntity = iBootTemplateMapper.selectByPrimaryKey(templatePk); + List deviceEntities = new ArrayList<>(); + DeviceQueryBean deviceQueryBean = iBootStartTaskBean.getDeviceQueryBean(); + handleDeviceQueryBean(deviceQueryBean); + if (ObjectUtil.isNotNull(deviceQueryBean) && deviceQueryBean.getSelectAll()) { + // 处理全选 + deviceEntities = deviceMapper.queryListWithPage(deviceQueryBean); + } else { + if (CollectionUtil.isNotEmpty(iBootStartTaskBean.getResourceIdList())) { + List resources = new ArrayList<>(iBootStartTaskBean.getResourceIdList()); + deviceQueryBean.setContainsIds(resources); + deviceEntities = deviceMapper.queryListWithPage(deviceQueryBean); + } + } + if (CollectionUtil.isEmpty(deviceEntities)) { + return false; + } + // 生成taskEntity + IBootTaskEntity iBootTaskEntity = new IBootTaskEntity(); + String taskId = UUID.fastUUID().toString(true); + iBootTaskEntity.setId(taskId); + iBootTaskEntity.setName(iBootTemplateEntity.getTemplateType().getTemplateName() + "_" + iBootTemplateEntity.getName()); + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.WAITING); + iBootTaskEntity.setCreateTime(new Date()); + iBootTaskEntity.setTemplateId(iBootTemplateEntity.getId()); + iBootTaskEntity.setTemplateName(iBootTemplateEntity.getName()); + iBootTaskEntity.setTemplateType(iBootTemplateEntity.getTemplateType().name()); + iBootTaskEntity.setCreateUser(iBootStartTaskBean.getExcuteUser()); + // 生成taskHostEntity,最多一次插入500个设备 + List deviceEntities1; + List iBootTaskHostEntities = new ArrayList<>(); + if (deviceEntities.size() > 500) { + deviceEntities1 = deviceEntities.subList(0, 500); + } else { + deviceEntities1 = deviceEntities; + } + deviceEntities1.forEach(deviceEntity -> { + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + iBootTaskHostEntity.setId(UUID.fastUUID().toString(true)); + iBootTaskHostEntity.setCreateTime(new Date()); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.WAITING); + iBootTaskHostEntity.setParam(iBootTemplateEntity.getContent()); + iBootTaskHostEntity.setResourceId(deviceEntity.getId()); + iBootTaskHostEntity.setResourceIp(deviceEntity.getDhcpIp()); + iBootTaskHostEntity.setSn(deviceEntity.getSn()); + iBootTaskHostEntity.setTaskId(taskId); + iBootTaskHostEntity.setTemplateId(iBootTemplateEntity.getId()); + iBootTaskHostEntity.setTemplateType(iBootTemplateEntity.getTemplateType().name()); + iBootTaskHostEntities.add(iBootTaskHostEntity); + }); + // 入库并触发任务 + taskService.insertTask(iBootTaskEntity); + taskService.insertTaskHostList(iBootTaskHostEntities); + taskService.triggerTask(); + // 异步处理剩下的设备 + if (deviceEntities.size() > 500) { + List deviceEntities2 = deviceEntities.subList(500, deviceEntities.size()); + new Thread(() -> addTaskHost(deviceEntities2, iBootTemplateEntity, taskId)).start(); + } + } catch (Exception e) { + log.error("start template error:", e); + return false; + } + return true; + } + + /** + * 异步处理任务 + */ + public void addTaskHost(List deviceEntities, IBootTemplateEntity iBootTemplateEntity, String taskId) { + int count = deviceEntities.size() / 500; + List iBootTaskHostEntitiesFail = new ArrayList<>(); + for (int i = 0; i <= count; i++) { + List iBootTaskHostEntities = new ArrayList<>(); + // 休眠0.1s + try { + List deviceEntities1; + Thread.sleep(100L); + if (count > i) { + deviceEntities1 = deviceEntities.subList(500 * i, 500 * (i + 1)); + } else { + deviceEntities1 = deviceEntities.subList(500 * i, deviceEntities.size()); + } + deviceEntities1.forEach(deviceEntity -> { + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + iBootTaskHostEntity.setId(UUID.fastUUID().toString(true)); + iBootTaskHostEntity.setCreateTime(new Date()); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.WAITING); + iBootTaskHostEntity.setParam(iBootTemplateEntity.getContent()); + iBootTaskHostEntity.setResourceId(deviceEntity.getId()); + iBootTaskHostEntity.setResourceIp(deviceEntity.getDhcpIp()); + iBootTaskHostEntity.setSn(deviceEntity.getSn()); + iBootTaskHostEntity.setTaskId(taskId); + iBootTaskHostEntity.setTemplateId(iBootTemplateEntity.getId()); + iBootTaskHostEntity.setTemplateType(iBootTemplateEntity.getTemplateType().name()); + iBootTaskHostEntities.add(iBootTaskHostEntity); + }); + // 入库 + taskService.insertTaskHostList(iBootTaskHostEntities); + } catch (Exception e) { + log.error(e.getMessage()); + iBootTaskHostEntitiesFail.addAll(iBootTaskHostEntities); + } + } + // 失败的设备,重新再入库,再失败就不做处理了 + if (!iBootTaskHostEntitiesFail.isEmpty()) { + if (iBootTaskHostEntitiesFail.size() > 200) { + int countFail = iBootTaskHostEntitiesFail.size() / 200; + for (int j = 0; j <= countFail; j++) { + List iBootTaskHostEntities1; + try { + Thread.sleep(100L); + if (countFail > j) { + iBootTaskHostEntities1 = iBootTaskHostEntitiesFail.subList(200 * j, 200 * (j + 1)); + } else { + iBootTaskHostEntities1 = iBootTaskHostEntitiesFail.subList(200 * j, iBootTaskHostEntitiesFail.size()); + } + taskService.insertTaskHostList(iBootTaskHostEntities1); + } catch (Exception e) { + log.error(e.getMessage()); + } + } + } else { + taskService.insertTaskHostList(iBootTaskHostEntitiesFail); + } + } + } + + @Override + public boolean startIBootTask(String param, String templateType, List deviceEntities, String customTaskName) { + try { + // 生成虚拟模板入库 + IBootTemplateEntity iBootTemplateEntity = new IBootTemplateEntity(); + String templateId = UUID.fastUUID().toString(true); + iBootTemplateEntity.setId(templateId); + iBootTemplateEntity.setName(templateType + "_" + templateId); + iBootTemplateEntity.setTemplateType(TemplateTypeEnum.valueOf(templateType)); + iBootTemplateEntity.setContent(param); + iBootTemplateEntity.setCreateTime(new Date()); + iBootTemplateEntity.setUpdateTime(new Date()); + iBootTemplateEntity.setShow(false); + iBootTemplateEntity.setCreateUser("iboot"); + handleTemplateEntity(iBootTemplateEntity); + iBootTemplateMapper.insertUseGeneratedKeys(iBootTemplateEntity); + // 生成taskEntity + IBootTaskEntity iBootTaskEntity = new IBootTaskEntity(); + String taskId = UUID.fastUUID().toString(true); + iBootTaskEntity.setId(taskId); + if (null == customTaskName) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + if (Objects.nonNull(deviceEntities) && deviceEntities.size() == 1) { + customTaskName = iBootTemplateEntity.getTemplateType().getTemplateName() + "_" + deviceEntities.get(0).getSn() + "_" + dateFormat.format(new Date()); + } else { + customTaskName = iBootTemplateEntity.getTemplateType().getTemplateName() + "_" + dateFormat.format(new Date()); + } + } + iBootTaskEntity.setName(customTaskName); + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.WAITING); + iBootTaskEntity.setCreateTime(new Date()); + iBootTaskEntity.setTemplateType(templateType); + iBootTaskEntity.setTemplateId(templateId); + iBootTaskEntity.setTemplateName(customTaskName); + iBootTaskEntity.setCreateUser("iboot"); + // 生成taskHostEntity,最多一次插入500个设备 + List deviceEntities1; + List iBootTaskHostEntities = new ArrayList<>(); + if (deviceEntities.size() > 500) { + deviceEntities1 = deviceEntities.subList(0, 500); + } else { + deviceEntities1 = deviceEntities; + } + deviceEntities1.forEach(deviceEntity -> { + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + iBootTaskHostEntity.setId(UUID.fastUUID().toString(true)); + iBootTaskHostEntity.setCreateTime(new Date()); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.WAITING); + iBootTaskHostEntity.setParam(iBootTemplateEntity.getContent()); + iBootTaskHostEntity.setResourceId(deviceEntity.getId()); + iBootTaskHostEntity.setResourceIp(deviceEntity.getDhcpIp()); + iBootTaskHostEntity.setSn(deviceEntity.getSn()); + iBootTaskHostEntity.setTaskId(taskId); + iBootTaskHostEntity.setTemplateId(iBootTemplateEntity.getId()); + iBootTaskHostEntity.setTemplateType(iBootTemplateEntity.getTemplateType().name()); + iBootTaskHostEntities.add(iBootTaskHostEntity); + }); + // 入库并触发任务 + taskService.insertTask(iBootTaskEntity); + taskService.insertTaskHostList(iBootTaskHostEntities); + taskService.triggerTask(); + // 异步处理剩下的设备 + if (deviceEntities.size() > 500) { + List deviceEntities2 = deviceEntities.subList(500, deviceEntities.size()); + new Thread(() -> addTaskHost(deviceEntities2, iBootTemplateEntity, taskId)).start(); + } + } catch (Exception e) { + log.error("应用模板异常:", e); + return false; + } + return true; + } + + @Override + public boolean osInstalled(IBootInstallParamBean iBootInstallParamBean, String executeUser) { + InputStream inputStream = null; + try { + // 处理设备 + List deviceEntities = new ArrayList<>(); + DeviceQueryBean deviceQueryBean = iBootInstallParamBean.getDeviceQueryBean(); + handleDeviceQueryBean(deviceQueryBean); + if (ObjectUtil.isNotNull(deviceQueryBean)) { + deviceEntities = deviceMapper.queryListWithPage(deviceQueryBean); + } + if (CollectionUtil.isEmpty(deviceEntities)) { + return false; + } + // 安装参数 + IBootTemplateEntity iBootTemplateEntity = iBootTemplateMapper.getByID(iBootInstallParamBean.getTemplateId()); + IBootOsInstallBean iBootOsInstallBean = JSONUtil.toBean(iBootTemplateEntity.getContent(), IBootOsInstallBean.class); + IBootRepositoryImageEntity fileEntity = iBootRepositoryImageMapper.getByID(iBootOsInstallBean.getImageFileId()); + String taskId = UUID.fastUUID().toString(true); + // 镜像挂载 + ExecCommand exec = new ExecCommand(); + String mountPath; + if (iBootOsInstallBean.getImageType().equalsIgnoreCase("Windows")) { // windows挂载点不同 + mountPath = IBootPathConstant.MountImageFileSamba + File.separator + iBootOsInstallBean.getImageFileId(); + } else { + mountPath = IBootPathConstant.MountImageFile + File.separator + iBootOsInstallBean.getImageFileId(); + } + File filePath = new File(FileUtil.normalize(mountPath)); + if (!filePath.exists()) { + filePath.mkdir(); + } + if (ArrayUtil.isEmpty(filePath.list())) { + if (OperationSystemUtil.isWindows()) { + ISOUtil.unarchiveISO(fileEntity.getFullPath(), mountPath); + } else { + String mountCmd = "mount " + fileEntity.getFullPath() + " " + mountPath; + exec.runLocal(mountCmd); + } + } + // todo uos需要把镜像内容都拷贝出来 + iBootInstallParamBean.setIBootOsInstallBean(iBootOsInstallBean); + IBootOsInstallService iBootOsInstallService = iBootOsInstallFactory.getOsInstallImpl(iBootOsInstallBean.getImageType(), iBootOsInstallBean.getVersion()); + if (StringUtils.isNotEmpty(iBootInstallParamBean.getFileId())) { + // 网络配置 + IBootInbandFileEntity iBootInbandFileEntity = iBootInabndFileMapper.getOneById(iBootInstallParamBean.getFileId()); + String ext = IBootFileUtil.getExtensionName(iBootInbandFileEntity.getOriginalName()); + if (!ext.equals("xls")) { + return false; + } + inputStream = new FileInputStream(FileUtil.normalize(iBootInbandFileEntity.getFullPath())); + iBootInstallParamBean.setNetworkBean(iBootOsInstallService.configNetwork(inputStream, iBootInstallParamBean, taskId)); + } + // 生成taskEntity + IBootTaskEntity iBootTaskEntity = new IBootTaskEntity(); + iBootTaskEntity.setId(taskId); + iBootTaskEntity.setName(Languages.getString("template_install_OS", iBootTemplateEntity.getName())); + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.WAITING); + iBootTaskEntity.setCreateTime(new Date()); + iBootTaskEntity.setTemplateId(iBootTemplateEntity.getId()); + iBootTaskEntity.setTemplateName(iBootTemplateEntity.getName()); + iBootTaskEntity.setTemplateType(iBootTemplateEntity.getTemplateType().name()); + iBootTaskEntity.setCreateUser(executeUser); + // 生成taskHostEntity,最多一次插入500个设备 + List deviceEntities1; + List iBootTaskHostEntities = new ArrayList<>(); + if (deviceEntities.size() > 500) { + deviceEntities1 = deviceEntities.subList(0, 500); + } else { + deviceEntities1 = deviceEntities; + } + deviceEntities1.forEach(deviceEntity -> { + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + String taskHostId = UUID.fastUUID().toString(true); + iBootTaskHostEntity.setId(taskHostId); + iBootTaskHostEntity.setCreateTime(new Date()); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.WAITING); + iBootTaskHostEntity.setParam(JSONUtil.toJsonStr(iBootInstallParamBean)); + iBootTaskHostEntity.setResourceId(deviceEntity.getId()); + iBootTaskHostEntity.setResourceIp(deviceEntity.getDhcpIp()); + iBootTaskHostEntity.setSn(deviceEntity.getSn()); + iBootTaskHostEntity.setTaskId(taskId); + iBootTaskHostEntity.setTemplateId(iBootTemplateEntity.getId()); + iBootTaskHostEntity.setTemplateType(iBootTemplateEntity.getTemplateType().name()); + DeviceSystemInfoBean deviceSystemInfoBean = JSONUtil.toBean(deviceEntity.getSystemInfo(), DeviceSystemInfoBean.class); + iBootTaskHostEntity.setMac(deviceSystemInfoBean.getMac()); + iBootTaskHostEntities.add(iBootTaskHostEntity); + }); + // todo 由于UOS无法放到单个设备里创建,单独处理 + // 入库并触发任务 + taskService.insertTask(iBootTaskEntity); + taskService.insertTaskHostList(iBootTaskHostEntities); + taskService.triggerTask(); + // 异步处理剩下的设备 + if (deviceEntities.size() > 500) { + List deviceEntities2 = deviceEntities.subList(500, deviceEntities.size()); + new Thread(() -> addOsTaskHost(deviceEntities2, iBootTemplateEntity, iBootInstallParamBean, taskId)).start(); + } + } catch (Exception e) { + log.error("start os install error:", e); + return false; + } finally { + if (null != inputStream) { + try { + inputStream.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + // 删除文件 + IBootInbandFileEntity iBootInbandFileEntity = iBootInabndFileMapper.getOneById(iBootInstallParamBean.getFileId()); + try { + File file = new File(FileUtil.normalize(iBootInbandFileEntity.getFullPath())); + if (file.exists()) { + file.delete(); + } + iBootInabndFileMapper.deleteByPrimaryKey(iBootInbandFileEntity.getPk()); + } catch (Exception e) { + log.error(e.getMessage()); + return true; + } + return true; + } + + /** + * 异步处理任务 + */ + public void addOsTaskHost(List deviceEntities, IBootTemplateEntity iBootTemplateEntity, IBootInstallParamBean iBootInstallParamBean, String taskId) { + int count = deviceEntities.size() / 500; + List iBootTaskHostEntitiesFail = new ArrayList<>(); + for (int i = 0; i <= count; i++) { + List iBootTaskHostEntities = new ArrayList<>(); + // 休眠0.1s + try { + List deviceEntities1; + Thread.sleep(100L); + if (count > i) { + deviceEntities1 = deviceEntities.subList(500 * i, 500 * (i + 1)); + } else { + deviceEntities1 = deviceEntities.subList(500 * i, deviceEntities.size()); + } + deviceEntities1.forEach(deviceEntity -> { + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + String taskHostId = UUID.fastUUID().toString(true); + iBootTaskHostEntity.setId(taskHostId); + iBootTaskHostEntity.setCreateTime(new Date()); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.WAITING); + iBootTaskHostEntity.setParam(JSONUtil.toJsonStr(iBootInstallParamBean)); + iBootTaskHostEntity.setResourceId(deviceEntity.getId()); + iBootTaskHostEntity.setResourceIp(deviceEntity.getDhcpIp()); + iBootTaskHostEntity.setSn(deviceEntity.getSn()); + iBootTaskHostEntity.setTaskId(taskId); + iBootTaskHostEntity.setTemplateId(iBootTemplateEntity.getId()); + iBootTaskHostEntity.setTemplateType(iBootTemplateEntity.getTemplateType().name()); + DeviceSystemInfoBean deviceSystemInfoBean = JSONUtil.toBean(deviceEntity.getSystemInfo(), DeviceSystemInfoBean.class); + iBootTaskHostEntity.setMac(deviceSystemInfoBean.getMac()); + iBootTaskHostEntities.add(iBootTaskHostEntity); + }); + // 入库 + taskService.insertTaskHostList(iBootTaskHostEntities); + } catch (Exception e) { + log.error(e.getMessage()); + iBootTaskHostEntitiesFail.addAll(iBootTaskHostEntities); + } + } + // 失败的设备,重新再入库,再失败就不做处理了 + if (!iBootTaskHostEntitiesFail.isEmpty()) { + if (iBootTaskHostEntitiesFail.size() > 200) { + int countFail = iBootTaskHostEntitiesFail.size() / 200; + for (int j = 0; j <= countFail; j++) { + List iBootTaskHostEntities1; + try { + Thread.sleep(100L); + if (countFail > j) { + iBootTaskHostEntities1 = iBootTaskHostEntitiesFail.subList(200 * j, 200 * (j + 1)); + } else { + iBootTaskHostEntities1 = iBootTaskHostEntitiesFail.subList(200 * j, iBootTaskHostEntitiesFail.size()); + } + taskService.insertTaskHostList(iBootTaskHostEntities1); + } catch (Exception e) { + log.error(e.getMessage()); + } + } + } else { + taskService.insertTaskHostList(iBootTaskHostEntitiesFail); + } + } + } + + @Override + public boolean networkConfig(DeviceQueryBean deviceQueryBean, String fileId, String executeUser) { + // 处理设备 + List deviceEntities = new ArrayList<>(); + handleDeviceQueryBean(deviceQueryBean); + if (ObjectUtil.isNotNull(deviceQueryBean)) { + deviceEntities = deviceMapper.queryListWithPage(deviceQueryBean); + } + if (CollectionUtil.isEmpty(deviceEntities)) { + return false; + } + // 构造网络配置参数 + boolean flag; + try { + Map networkCfgMap = new HashMap<>(); + IBootInbandFileEntity iBootInbandFileEntity = iBootInabndFileMapper.getOneById(fileId); + String ext = IBootFileUtil.getExtensionName(iBootInbandFileEntity.getOriginalName()); + InputStream inputStream = null; + try { + if (ext.equals("xls")) { + inputStream = new FileInputStream(FileUtil.normalize(iBootInbandFileEntity.getFullPath())); + IBootExcelReaderUtil excelReaderUtil = new IBootExcelReaderUtil(); + List iBootBMCNetBeans = excelReaderUtil.readExcelBMCImport(inputStream, MagicNumber.M1, MagicNumber.M2); + deviceEntities.forEach(deviceEntity -> { + for (IBootBMCNetPreviewBean.IBootBMCNetBean iBootBMCNetBean : iBootBMCNetBeans) { + if (iBootBMCNetBean.getSn().equalsIgnoreCase(deviceEntity.getSn())) { + IBootNetworkCfgBeans.NetworkCfgBean networkCfgBean = new IBootNetworkCfgBeans.NetworkCfgBean(); + networkCfgBean.setIp(iBootBMCNetBean.getIp()); + networkCfgBean.setNetmask(iBootBMCNetBean.getNetmask()); + networkCfgBean.setGateway(iBootBMCNetBean.getGateway()); + networkCfgBean.setChannel(iBootBMCNetBean.getChannel()); + networkCfgMap.put(iBootBMCNetBean.getSn(), networkCfgBean); + break; + } + } + }); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + if (null != inputStream) { + inputStream.close(); + } + } + // 无有效配置数据 + if (MapUtil.isEmpty(networkCfgMap)) { + return false; + } + IBootNetworkCfgBeans iBootNetworkCfgBeans = new IBootNetworkCfgBeans(); + iBootNetworkCfgBeans.setNetworkCfgBeans(networkCfgMap); + // 启动任务 + flag = startIBootTask(JSONUtil.toJsonStr(iBootNetworkCfgBeans), TemplateTypeEnum.NETWORK_CONF.name(), deviceEntities, Languages.getString("template_config_BMC_IP")); + } catch (Exception e) { + log.error(e.getMessage()); + return false; + } + // 删除网络配置文件和数据 + IBootInbandFileEntity iBootInbandFileEntity = iBootInabndFileMapper.getOneById(fileId); + try { + File file = new File(FileUtil.normalize(iBootInbandFileEntity.getFullPath())); + if (file.exists()) { + file.delete(); + } + iBootInabndFileMapper.deleteByPrimaryKey(iBootInbandFileEntity.getPk()); + } catch (Exception e) { + log.error(e.getMessage()); + return flag; + } + return flag; + } + + @Override + public List> getTimezoneBySysType(String systemType) { + List iBootTimezoneEntities = iBootTimezoneMapper.getBySysType(systemType); + List> resultList = new ArrayList<>(); + iBootTimezoneEntities.forEach(iBootTimezoneEntity -> { + Map map = new HashMap<>(); + map.put("key", iBootTimezoneEntity.getTimezoneKey()); + map.put("value", iBootTimezoneEntity.getTimezoneValue()); + resultList.add(map); + }); + return resultList; + } + + @Override + public ResultBean getDefaultKs(String id) { + IBootRepositoryImageEntity iBootRepositoryImageEntity = iBootRepositoryImageMapper.getByID(id); + return iBootOsInstallFactory.getOsInstallImpl(iBootRepositoryImageEntity.getImageType(), iBootRepositoryImageEntity.getVersion()).getDefaultKs(); + } + + @Override + public ImageXmlBean getXmlAnalyse(String imageId) { + IBootRepositoryImageEntity imageEntity = iBootRepositoryImageMapper.getByID(imageId); + String environment = iBootImageXmlMapper.queryByImageId(imageId); + ImageXmlBean xmlBean = new ImageXmlBean(); + try { + if (StringUtils.isEmpty(environment)) { + if (imageEntity.getVersion().contains("8U") || imageEntity.getVersion().contains("9U")) { // Centos/ReaHat8.0以上 + xmlBean = analysisXmlFromIso(imageEntity); + } else { + ImageXmlBeans xmlEBeans = getBaseE(imageEntity); + for (String element : xmlEBeans.getListE()) { + ImageEnvironmentBean environmentBean = new ImageEnvironmentBean(); + environmentBean.setEnName(element); + environmentBean.setCnName(xmlEBeans.getMapE().get(element)); + String element_id = xmlEBeans.getMapI().get(element); + environmentBean.setId(element_id); + xmlBean.getEnvMap().put(element_id, environmentBean); + } + } + // 入库 + IBootImageXmlEntity xmlEntity = new IBootImageXmlEntity(); + String xmlId = UUID.fastUUID().toString(true); + xmlEntity.setId(xmlId); + xmlEntity.setImageId(imageId); + xmlEntity.setEnviroment(JSONUtil.toJsonStr(xmlBean)); + iBootImageXmlMapper.insertUseGeneratedKeys(xmlEntity); + } else { + xmlBean = JSONUtil.toBean(environment, ImageXmlBean.class); + } + } catch (Exception e) { + log.error(e.getMessage()); + return xmlBean; + } + return xmlBean; + } + + @Override + public RaidAnalyResult raidAnalyseResult(IBootRaidConfigTemplateBean iBootRaidConfigTemplateBean, String md5) { + RaidAnalyResult raidAnalyResult = new RaidAnalyResult(); + List operationList = new ArrayList<>(); + List dictinctoperationList = new ArrayList<>(); + List showList = new ArrayList<>(); + try { + //根据md5值,查询出原始的数据 + DeviceEntity deviceEntity = deviceMapper.querySingRaidByMd5(md5); + String singleStorageInfo = deviceEntity.getSingleStorageInfo(); + if (StringUtils.isNotEmpty(singleStorageInfo)) { + List raidSingeBeans = JSONUtil.toList(JSONUtil.parseArray(singleStorageInfo), RaidSingeBean.class); + Map> raidLogicalDisk = iBootRaidConfigTemplateBean.getRaidLogicalDisk(); + raidLogicalDisk.forEach((key, value) -> {//遍历每个raid卡,获取页面传递的配置信息 + //获取raid卡的原始数据 + RaidSingeBean raidSingeBean = new RaidSingeBean(); + for (RaidSingeBean raidSingeBeantmp : raidSingeBeans) { + if (("/c" + raidSingeBeantmp.getControllerId() + ":" + raidSingeBeantmp.getType() + ":" + raidSingeBeantmp.getProductName()).equalsIgnoreCase(key)) { + raidSingeBean = raidSingeBeantmp; + } + } + for (LogicalDisk logicalDisk : value) { + //1,处理逻辑盘的操作 + if (logicalDisk.getType().equalsIgnoreCase(LogicalTypeEnum.logical.getValue())) { + //1.1原有的逻辑盘,只需要看有没有新增的局部热备即可 + if (StringUtils.isNotEmpty(logicalDisk.getVid())) { + List partHotDisk = logicalDisk.getPartHotDisk(); + if (CollUtil.isNotEmpty(partHotDisk)) { + //取出原有逻辑盘使用的局部热备 + List volumes = raidSingeBean.getVolumes(); + RaidVolumeBean raidVolumeBean = new RaidVolumeBean(); + for (RaidVolumeBean raidVolumeBeantmp : volumes) { + if (raidVolumeBeantmp.getVid().equalsIgnoreCase(logicalDisk.getVid())) { + raidVolumeBean = raidVolumeBeantmp; + } + } + List oldPartHotDisk = new ArrayList<>();//原有逻辑盘的局部热备盘列表 + for (RaidDriveBean raidDriveBeantmp : raidVolumeBean.getDrives()) { + if (raidDriveBeantmp.getStatus().equalsIgnoreCase("HOT_SPARE")) {//局部热备 + oldPartHotDisk.add(raidDriveBeantmp); + } + } + for (PhysicalDisk physicalDisk : partHotDisk) { + //局部热备盘是否在原有局部热备中 + boolean parthotFlag = false; + for (RaidDriveBean raidDriveBeantmp : oldPartHotDisk) { + if ((physicalDisk.getEid() + ":" + physicalDisk.getSlot()).equalsIgnoreCase(raidDriveBeantmp.getEnclosureId() + ":" + raidDriveBeantmp.getSlotNumber())) { + parthotFlag = true; + break; + } + } + if (!parthotFlag) { + //判断使用的硬盘状态是否是被占用,占用的话,需要处理将使用的逻辑盘等删除 + List check1 = checkDiskOperation(raidSingeBean, physicalDisk, key); + operationList.addAll(check1); + //不在逻辑盘中,新增一个记录,记录需要将做一个局部热备 + LogicalDiskForDelete logicalDiskForDelete = new LogicalDiskForDelete(); + logicalDiskForDelete.setCid(physicalDisk.getCid()); + logicalDiskForDelete.setEid(physicalDisk.getEid()); + logicalDiskForDelete.setOperation("dhotToOldLogic"); + logicalDiskForDelete.setDg(raidVolumeBean.getDriveGroup()); + logicalDiskForDelete.setSid(physicalDisk.getSlot()); + operationList.add(logicalDiskForDelete); + } + } + } + } else {//新做的逻辑盘 + List useDisks = logicalDisk.getPhysicalDiskList(); + if (ObjectUtil.isNotEmpty(logicalDisk.getPartHotDisk())) { + useDisks.addAll(logicalDisk.getPartHotDisk()); + } + for (PhysicalDisk physicalDisk : useDisks) { + operationList.addAll(checkDiskOperation(raidSingeBean, physicalDisk, key)); + } + } + } else if (logicalDisk.getType().equalsIgnoreCase("hot")) {//全局热备 + List globalHotDiskList = logicalDisk.getPhysicalDiskList(); + for (PhysicalDisk globalhotDisk : globalHotDiskList) { + //判断逻辑盘是否为原全局热备盘,如果是原全局热备,则不处理 + boolean ischeck = true; + if (StringUtils.isNotEmpty(globalhotDisk.getContent())) { + RaidDriveBean raidDriveBean = JSONUtil.toBean(globalhotDisk.getContent(), RaidDriveBean.class); + if (StringUtils.isNotEmpty(raidDriveBean.getGlobalHot())) { + ischeck = false; + } + } + if (ischeck) { + operationList.addAll(checkDiskOperation(raidSingeBean, globalhotDisk, key)); + } + } + } + } + }); + //2、处理空闲盘 + Map> raidFreeDisk = iBootRaidConfigTemplateBean.getRaidFreeDisk(); + raidFreeDisk.forEach((key, value) -> { + //获取raid卡的原始数据 + RaidSingeBean raidSingeBean = new RaidSingeBean(); + for (RaidSingeBean raidSingeBeantmp : raidSingeBeans) { + if (("/c" + raidSingeBeantmp.getControllerId() + ":" + raidSingeBeantmp.getType() + ":" + raidSingeBeantmp.getProductName()).equalsIgnoreCase(key)) { + raidSingeBean = raidSingeBeantmp; + } + } + for (PhysicalDisk freeDisk : value) { + operationList.addAll(checkDiskOperation(raidSingeBean, freeDisk, key)); + } + }); + //3,处理完成后,需要对操作进行归一化,因为这里面肯定会有重复操作,对重复数据处理 + dictinctoperationList = operationList.stream().distinct().collect(Collectors.toList()); + //4.将列表数据转化成页面展示的数据 + for (LogicalDiskForDelete logicalDiskForDelete : dictinctoperationList) { + String content = ""; + if (logicalDiskForDelete.getOperation().equalsIgnoreCase("delVolume")) {//删除逻辑盘 + content = content + logicalDiskForDelete.getCardName() + " " + Languages.getString("cosmos.iboot.deleteVolume") + ":" + logicalDiskForDelete.getName(); + } else if (logicalDiskForDelete.getOperation().equalsIgnoreCase("delJobd")) { + content = content + logicalDiskForDelete.getCardName() + " " + Languages.getString("cosmos.iboot.deleteJbod"); + } else if (logicalDiskForDelete.getOperation().equalsIgnoreCase("ghotToUG")) { + content = content + logicalDiskForDelete.getCardName() + " " + logicalDiskForDelete.getName() + " " + Languages.getString("cosmos.iboot.deleteGlobal"); + } + if (StringUtils.isNotEmpty(content)) { + showList.add(content); + } + } + } + raidAnalyResult.setOperationList(dictinctoperationList); + raidAnalyResult.setShowList(showList); + return raidAnalyResult; + } catch (Exception e) { + return raidAnalyResult; + } + } + + /** + * 统一转化方法,入参为raid的原始数据和逻辑盘所使用的硬盘(需要将该盘置成UG状态所需要的操作) + * + * @param raidSingeBean + * @param physicalDisk + * @return + */ + private List checkDiskOperation(RaidSingeBean raidSingeBean, PhysicalDisk physicalDisk, String cardName) { + List operationList = new ArrayList<>(); + //判断硬盘是否在逻辑盘中 + boolean diskFindInLogic = false; + List volumes1 = raidSingeBean.getVolumes(); + if (volumes1 != null) { + for (RaidVolumeBean raidVolumeBean1 : volumes1) { + for (RaidDriveBean raidDriveBean : raidVolumeBean1.getDrives()) { + if ((physicalDisk.getEid() + ":" + physicalDisk.getSlot()).equalsIgnoreCase(raidDriveBean.getEnclosureId() + ":" + raidDriveBean.getSlotNumber())) { + //判断是否有局部热备,删除逻辑盘时,需要删除局部设备 + for (RaidDriveBean raidDriveBean1 : raidVolumeBean1.getDrives()) { + if (raidDriveBean1.getStatus().equalsIgnoreCase("HOT_SPARE")) {//局部热备 + LogicalDiskForDelete logicalDiskForDelete1 = new LogicalDiskForDelete(); + logicalDiskForDelete1.setCid(physicalDisk.getCid()); + logicalDiskForDelete1.setEid(physicalDisk.getEid()); + logicalDiskForDelete1.setOperation("dhotToUG"); + logicalDiskForDelete1.setDg(raidVolumeBean1.getDriveGroup()); + logicalDiskForDelete1.setSid(physicalDisk.getSlot()); + operationList.add(logicalDiskForDelete1); + } + } + LogicalDiskForDelete logicalDiskForDelete = new LogicalDiskForDelete(); + logicalDiskForDelete.setCid(physicalDisk.getCid()); + logicalDiskForDelete.setOperation("delVolume"); + logicalDiskForDelete.setCardName(cardName); + logicalDiskForDelete.setName(raidVolumeBean1.getRaidType() + "-" + raidVolumeBean1.getCapacity() + "-VID" + raidVolumeBean1.getVid() + "-DG" + raidVolumeBean1.getDriveGroup()); + logicalDiskForDelete.setVid(raidVolumeBean1.getVid()); + operationList.add(logicalDiskForDelete); + diskFindInLogic = true; + break; + } + } + } + } + if (!diskFindInLogic) {//逻辑盘中未发现,继续在driver中发现 + if (ObjectUtil.isNotEmpty(raidSingeBean.getDrives())) { + for (RaidDriveBean raidDriveBean : raidSingeBean.getDrives()) { + if ((physicalDisk.getEid() + ":" + physicalDisk.getSlot()).equalsIgnoreCase(raidDriveBean.getEnclosureId() + ":" + raidDriveBean.getSlotNumber())) { + if (raidDriveBean.getStatus().equalsIgnoreCase("HOT_SPARE")) {//原先盘为全局热备,则全局热备转UG + LogicalDiskForDelete logicalDiskForDelete1 = new LogicalDiskForDelete(); + logicalDiskForDelete1.setCid(physicalDisk.getCid()); + logicalDiskForDelete1.setEid(physicalDisk.getEid()); + logicalDiskForDelete1.setOperation("ghotToUG"); + logicalDiskForDelete1.setCardName(cardName); + logicalDiskForDelete1.setName(physicalDisk.getEid() + "-" + physicalDisk.getSlot() + "-" + physicalDisk.getSize() + physicalDisk.getSizeUnit()); + logicalDiskForDelete1.setSid(physicalDisk.getSlot()); + operationList.add(logicalDiskForDelete1); + } else if (raidDriveBean.getStatus().equalsIgnoreCase("JBOD")) { + LogicalDiskForDelete logicalDiskForDelete1 = new LogicalDiskForDelete(); + logicalDiskForDelete1.setCid(physicalDisk.getCid()); + logicalDiskForDelete1.setOperation("delJobd"); + logicalDiskForDelete1.setCardName(cardName); + operationList.add(logicalDiskForDelete1); + } + } + } + } + } + return operationList; + } + + @Override + public Page getRaidConfigPage(DeviceQueryBean query) { + PageRequest.checkPage(query); + if (!BeanUtil.beanToMap(new DeviceEntity(), false, false).containsKey(query.getField())) { + throw new PimException(Languages.getString("cosmos.asset.page.sort.field.not.exist")); + } + Pages pages = Pages.of(query.getPage(), query.getPageSize(), query.getField(), query.getDir()); + Page page = pages.page(deviceMapper.querySingRaidInfo(query)); + List deviceEntities = page.getData(); + deviceEntities.forEach(deviceEntity -> { + if (StringUtils.isNotEmpty(deviceEntity.getSingleStorageInfo())) { + List raidSingeBeans = JSONUtil.toList(JSONUtil.parseArray(deviceEntity.getSingleStorageInfo()), RaidSingeBean.class); + String raidmodel = ""; + for (RaidSingeBean raidSingeBean : raidSingeBeans) { + raidmodel = "/c" + raidSingeBean.getControllerId() + ":" + raidSingeBean.getType() + ":" + raidSingeBean.getProductName() + ","; + } + if (StringUtils.isNotEmpty(raidmodel)) { + raidmodel = raidmodel.substring(0, raidmodel.length() - 1); + } + deviceEntity.setRaidmodel(raidmodel); + } + }); + return page; + } + + @Override + public RaidXmlBean getRaidXml(String md5) { + RaidXmlBean raidXmlBean = new RaidXmlBean(); + DeviceEntity deviceEntity = deviceMapper.querySingRaidByMd5(md5); + String singleStorageInfo = deviceEntity.getSingleStorageInfo(); + Map raidXmlMap = new HashMap<>(); + Map raidDetailMap = new HashMap<>(); + List raidCardList = new ArrayList<>(); + if (StringUtils.isNotEmpty(singleStorageInfo)) { + List raidSingeBeans = JSONUtil.toList(JSONUtil.parseArray(singleStorageInfo), RaidSingeBean.class); + if (CollUtil.isNotEmpty(raidSingeBeans)) { + for (RaidSingeBean raidSingeBean : raidSingeBeans) { + String raidType = raidSingeBean.getType().toUpperCase(); + String raidModel = raidSingeBean.getProductName(); + String raidCard = "/c" + raidSingeBean.getControllerId() + ":" + raidSingeBean.getType().toUpperCase() + ":" + raidSingeBean.getProductName(); + raidCardList.add(raidCard); + IBootRaidConfigXmlEntity controlRaidConfigXmlEntity = iBootRaidConfigXmlMapper.getByModelAndType(raidModel.toUpperCase(), raidType); + if (BeanUtil.isEmpty(controlRaidConfigXmlEntity)) { + controlRaidConfigXmlEntity = iBootRaidConfigXmlMapper.getByModelAndType(raidType, raidType); + } + if (BeanUtil.isNotEmpty(controlRaidConfigXmlEntity)) { + raidXmlMap.put(raidModel, controlRaidConfigXmlEntity.getContent().trim().replaceAll("[\r\n\t]", "")); + if (Languages.getLocale().getLanguage().equalsIgnoreCase("en")) { + raidDetailMap.put(raidModel, controlRaidConfigXmlEntity.getRemarkEn().trim().replaceAll("[\r\n\t]", "")); + } else { + raidDetailMap.put(raidModel, controlRaidConfigXmlEntity.getRemarkCn().trim().replaceAll("[\r\n\t]", "")); + } + } + } + } + // 默认补充LSI和PMC、9230通用 + IBootRaidConfigXmlEntity lsiControlRaidConfigXmlEntity = iBootRaidConfigXmlMapper.getByModelAndType("LSI", "LSI"); + if (BeanUtil.isNotEmpty(lsiControlRaidConfigXmlEntity)) { + raidXmlMap.put("LSI", lsiControlRaidConfigXmlEntity.getContent().trim().replaceAll("[\r\n\t]", "")); + if (Languages.getLocale().getLanguage().equalsIgnoreCase("en")) { + raidDetailMap.put("LSI", lsiControlRaidConfigXmlEntity.getRemarkEn().trim().replaceAll("[\r\n\t]", "")); + } else { + raidDetailMap.put("LSI", lsiControlRaidConfigXmlEntity.getRemarkCn().trim().replaceAll("[\r\n\t]", "")); + } + } + IBootRaidConfigXmlEntity pmcControlRaidConfigXmlEntity = iBootRaidConfigXmlMapper.getByModelAndType("PMC", "PMC"); + if (BeanUtil.isNotEmpty(pmcControlRaidConfigXmlEntity)) { + raidXmlMap.put("PMC", pmcControlRaidConfigXmlEntity.getContent().trim().replaceAll("[\r\n\t]", "")); + if (Languages.getLocale().getLanguage().equalsIgnoreCase("en")) { + raidDetailMap.put("PMC", pmcControlRaidConfigXmlEntity.getRemarkEn().trim().replaceAll("[\r\n\t]", "")); + } else { + raidDetailMap.put("PMC", pmcControlRaidConfigXmlEntity.getRemarkCn().trim().replaceAll("[\r\n\t]", "")); + } + } + IBootRaidConfigXmlEntity nttzControlRaidConfigXmlEntity = iBootRaidConfigXmlMapper.getByModelAndType("9230", "9230"); + if (BeanUtil.isNotEmpty(nttzControlRaidConfigXmlEntity)) { + raidXmlMap.put("9230", nttzControlRaidConfigXmlEntity.getContent().trim().replaceAll("[\r\n\t]", "")); + if (Languages.getLocale().getLanguage().equalsIgnoreCase("en")) { + raidDetailMap.put("9230", nttzControlRaidConfigXmlEntity.getRemarkEn().trim().replaceAll("[\r\n\t]", "")); + } else { + raidDetailMap.put("9230", nttzControlRaidConfigXmlEntity.getRemarkCn().trim().replaceAll("[\r\n\t]", "")); + } + } + } + raidXmlBean.setRaidXml(raidXmlMap); + raidXmlBean.setRaidDetail(raidDetailMap); + raidXmlBean.setRaidCardList(raidCardList); + return raidXmlBean; + } + + @Override + public List getRaidTree(String md5) { + + DeviceEntity deviceEntity = deviceMapper.querySingRaidByMd5(md5); + String singleStorageInfo = deviceEntity.getSingleStorageInfo(); + List raidTreeList = new ArrayList(); + if (StringUtils.isNotEmpty(singleStorageInfo)) { + List raidSingeBeans = JSONUtil.toList(JSONUtil.parseArray(singleStorageInfo), RaidSingeBean.class); + for (RaidSingeBean raidSingeBean : raidSingeBeans) {//第一层处理raid + RaidTreeBean raidTreeBean = new RaidTreeBean(); + String firstParantKey = "c" + raidSingeBean.getControllerId(); + raidTreeBean.setKey(firstParantKey); + raidTreeBean.setTitle("/c" + raidSingeBean.getControllerId() + ":" + raidSingeBean.getType().toUpperCase() + ":" + raidSingeBean.getProductName()); + raidTreeBean.setType("card"); + raidTreeBean.setParent(""); + raidTreeBean.setStatus(""); + raidTreeBean.setContent(""); + //处理第二层的逻辑盘 + List raidChildren = new ArrayList(); + List volumes = raidSingeBean.getVolumes(); + if (CollUtil.isNotEmpty(volumes)) { + for (RaidVolumeBean raidVolumeBean : volumes) { + RaidTreeBean volumeTree = new RaidTreeBean(); + String twoParantKey = firstParantKey + "v" + raidVolumeBean.getVid(); + volumeTree.setKey(twoParantKey); + volumeTree.setParent(firstParantKey); + volumeTree.setType("logical"); + volumeTree.setStatus(""); + volumeTree.setTitle(raidVolumeBean.getRaidType() + "-" + raidVolumeBean.getCapacity() + "-VID" + raidVolumeBean.getVid() + "-DG" + raidVolumeBean.getDriveGroup()); + volumeTree.setContent(JSONUtil.toJsonStr(raidVolumeBean)); + List volumeDiskTreeList = new ArrayList(); + if (CollUtil.isNotEmpty(raidVolumeBean.getDrives())) { + for (RaidDriveBean raidDriveBean : raidVolumeBean.getDrives()) { + RaidTreeBean diskTree = new RaidTreeBean(); + diskTree.setType("disk"); + diskTree.setParent(twoParantKey); + String threeParantKey = twoParantKey + "d" + raidDriveBean.getSlotNumber(); + diskTree.setKey(threeParantKey); + diskTree.setStatus(raidDriveBean.getStatus()); + diskTree.setTitle(raidDriveBean.getEnclosureId() + "-" + raidDriveBean.getSlotNumber() + "-" + raidDriveBean.getRawSize()); + diskTree.setContent(JSONUtil.toJsonStr(raidDriveBean)); + volumeDiskTreeList.add(diskTree); + } + } + volumeTree.setChildren(volumeDiskTreeList); + raidChildren.add(volumeTree); + } + } + //处理第二次的JBOD + List drives = raidSingeBean.getDrives(); + List jobdList = new ArrayList<>(); + if (CollUtil.isNotEmpty(drives)) { + for (RaidDriveBean raidDriveBean : drives) { + if (raidDriveBean.getStatus().equals("JBOD")) { + jobdList.add(raidDriveBean); + } + } + } + if (CollUtil.isNotEmpty(jobdList)) { + RaidTreeBean jobdTree = new RaidTreeBean(); + jobdTree.setType("jbod"); + jobdTree.setTitle("JBOD"); + String twoParantKey = firstParantKey + "j0"; + jobdTree.setKey(twoParantKey); + jobdTree.setParent(firstParantKey); + List jbodChidredTreeList = new ArrayList(); + for (RaidDriveBean raidDriveBean : jobdList) { + RaidTreeBean diskTree = new RaidTreeBean(); + diskTree.setType("disk"); + diskTree.setParent(twoParantKey); + String threeParantKey = twoParantKey + "d" + raidDriveBean.getSlotNumber(); + diskTree.setKey(threeParantKey); + diskTree.setStatus(raidDriveBean.getStatus()); + diskTree.setTitle(raidDriveBean.getEnclosureId() + "-" + raidDriveBean.getSlotNumber() + "-" + raidDriveBean.getRawSize()); + diskTree.setContent(JSONUtil.toJsonStr(raidDriveBean)); + jbodChidredTreeList.add(diskTree); + } + jobdTree.setChildren(jbodChidredTreeList); + raidChildren.add(jobdTree); + } + //处理单个盘 + if (CollUtil.isNotEmpty(drives)) { + for (RaidDriveBean raidDriveBean : drives) { + if (!raidDriveBean.getStatus().equals("JBOD")) { + String twoParantKey = firstParantKey + "d" + raidDriveBean.getSlotNumber(); + RaidTreeBean diskTree = new RaidTreeBean(); + diskTree.setType("disk"); + diskTree.setParent(firstParantKey); + diskTree.setKey(twoParantKey); + if (raidDriveBean.getStatus().equals("HOT_SPARE")) { + diskTree.setStatus("SPARE"); + raidDriveBean.setGlobalHot("1"); + } else { + diskTree.setStatus(raidDriveBean.getStatus()); + } + diskTree.setTitle(raidDriveBean.getEnclosureId() + "-" + raidDriveBean.getSlotNumber() + "-" + raidDriveBean.getRawSize()); + diskTree.setContent(JSONUtil.toJsonStr(raidDriveBean)); + raidChildren.add(diskTree); + } + } + } + raidTreeBean.setChildren(raidChildren); + raidTreeList.add(raidTreeBean); + } + } + return raidTreeList; + } + + @Override + public ResultBean getBondScript(IBootBondShellBean bondShellBean) throws IOException { + ResultBean resultBean = new ResultBean(true, null, null); + if (CollUtil.isEmpty(bondShellBean.getEths()) || bondShellBean.getEths().size() < 2) { // 至少两个网口名 + resultBean.setFlag(false); + resultBean.setMessage(Languages.getString("iboot.osinstall.bond.error")); + } else { + Set eths = new HashSet<>(bondShellBean.getEths()); + if (eths.size() != bondShellBean.getEths().size()) { // 存在重复网口名 + resultBean.setFlag(false); + resultBean.setMessage(Languages.getString("iboot.osinstall.bond.duplicate")); + } else { // 拼接脚本内容 + List delShells = new ArrayList<>(); + List addShells = new ArrayList<>(); + bondShellBean.getEths().forEach(s -> { + delShells.add("nmcli con del eth0".replace("eth0", s)); + addShells.add("nmcli con add type bond-slave ifname eth0 master $name".replace("eth0", s)); + }); + String scriptContent = IBootFileUtil.readFileStr(new File(IBootPathConstant.IBootBondFile + "pim_bond0.sh".replace("bond0", bondShellBean.getBond()))); + scriptContent = scriptContent.replace("# nmcli con del eth0", String.join("\r\n", delShells)) + .replace("# nmcli con add type bond-slave ifname eth0 master $name", String.join("\r\n", addShells)); + resultBean.setData(scriptContent); + } + } + return resultBean; + } + + @Override + public IBootPreviewBean osInstallPreviewResult(IBootInstallParamBean iBootInstallParamBean) throws Exception { + if (CommonCheck.isNull(iBootInstallParamBean)) { + throw new RuntimeException("iBootInstallParamBean is null!"); + } + IBootPreviewBean iBootPreviewBean = new IBootPreviewBean(); + // 模板数据 + IBootTemplateEntity iBootTemplateEntity = iBootTemplateMapper.getByID(iBootInstallParamBean.getTemplateId()); + IBootOsInstallBean iBootOsInstallBean = JSONUtil.toBean(iBootTemplateEntity.getContent(), IBootOsInstallBean.class); + iBootPreviewBean.setIBootOsInstallBean(iBootOsInstallBean); + // 设备数据 + Page deviceEntityPage = new Page<>(); + DeviceQueryBean deviceQueryBean = iBootInstallParamBean.getDeviceQueryBean(); + handleDeviceQueryBean(deviceQueryBean); + if (ObjectUtil.isNotNull(deviceQueryBean)) { + deviceEntityPage = Pages.of(deviceQueryBean).page(deviceMapper.queryListWithPage(deviceQueryBean)); + ; + } + if (CollUtil.isEmpty(deviceEntityPage.getData())) { + return iBootPreviewBean; + } + Page iBootNetPreviewBeanPage = new Page<>(); + iBootNetPreviewBeanPage.setTotal(deviceEntityPage.getTotal()); + List iBootNetPreviewBeans = new ArrayList<>(); + deviceEntityPage.getData().forEach(deviceEntity -> { + IBootNetPreviewBean iBootNetPreviewBean = new IBootNetPreviewBean(); + iBootNetPreviewBean.setDhcpIp(deviceEntity.getDhcpIp()); + iBootNetPreviewBean.setSn(deviceEntity.getSn()); + iBootNetPreviewBean.setStatus(deviceEntity.getStatus()); + iBootNetPreviewBeans.add(iBootNetPreviewBean); + }); + // 网络配置数据 + if (StringUtils.isNotEmpty(iBootInstallParamBean.getFileId())) { + IBootInbandFileEntity iBootInbandFileEntity = iBootInabndFileMapper.getOneById(iBootInstallParamBean.getFileId()); + String ext = IBootFileUtil.getExtensionName(iBootInbandFileEntity.getOriginalName()); + if (ext.equals("xls")) { + InputStream inputStream = new FileInputStream(FileUtil.normalize(iBootInbandFileEntity.getFullPath())); + IBootExcelReaderUtil excelReaderUtil = new IBootExcelReaderUtil(); + if (iBootInstallParamBean.getIsBond()) { + List bondSet = excelReaderUtil.readExcelBondImport(inputStream, MagicNumber.M1, MagicNumber.M2); + if (CollUtil.isNotEmpty(bondSet)) { + iBootNetPreviewBeans.forEach(iBootNetPreviewBean -> { + for (IBootBondSetBean iBootBondSetBean : bondSet) { + if (iBootNetPreviewBean.getSn().equalsIgnoreCase(iBootBondSetBean.getSn())) { + iBootNetPreviewBean.setHostname(iBootBondSetBean.getHostname()); + iBootNetPreviewBean.setBondName(iBootBondSetBean.getBondName()); + iBootNetPreviewBean.setIp(iBootBondSetBean.getBondIp()); + iBootNetPreviewBean.setGateway(iBootBondSetBean.getGateway()); + break; + } + } + }); + } + } else { + List ipSet = excelReaderUtil.readExcelAssetImport(inputStream, MagicNumber.M1, MagicNumber.M2); + if (CollUtil.isNotEmpty(ipSet)) { + iBootNetPreviewBeans.forEach(iBootNetPreviewBean -> { + for (IBootIPSetBean iBootIPSetBean : ipSet) { + if (iBootNetPreviewBean.getSn().equalsIgnoreCase(iBootIPSetBean.getSn())) { + iBootNetPreviewBean.setHostname(iBootIPSetBean.getHostname()); + int i = 1; + String ipConfig; + for (IBootOsIp osIp : new ArrayList<>(iBootIPSetBean.getOsIpList())) { + ipConfig = String.join(",", new String[]{osIp.getNetInterface(), osIp.getIp(), osIp.getGateway(), osIp.getNetmask()}); + switch (i) { + case 1 -> iBootNetPreviewBean.setIpconfig1(ipConfig); + case 2 -> iBootNetPreviewBean.setIpconfig2(ipConfig); + case 3 -> iBootNetPreviewBean.setIpconfig3(ipConfig); + case 4 -> iBootNetPreviewBean.setIpconfig4(ipConfig); + } + i++; + } + break; + } + } + }); + } + } + } + } + iBootNetPreviewBeanPage.setData(iBootNetPreviewBeans); + iBootPreviewBean.setIBootNetPreviewBeanPage(iBootNetPreviewBeanPage); + return iBootPreviewBean; + } + + @Override + public IBootBMCNetPreviewBean netConfigPreviewResult(DeviceQueryBean deviceQueryBean, String fileId) throws Exception { + IBootBMCNetPreviewBean iBootBMCNetPreviewBean = new IBootBMCNetPreviewBean(); + // 设备数据 + Page deviceEntityPage = new Page<>(); + handleDeviceQueryBean(deviceQueryBean); + if (ObjectUtil.isNotNull(deviceQueryBean)) { + deviceEntityPage = Pages.of(deviceQueryBean).page(deviceMapper.queryListWithPage(deviceQueryBean)); + } + if (CollUtil.isEmpty(deviceEntityPage.getData())) { + return iBootBMCNetPreviewBean; + } + Page iBootBMCNetBeanPage = new Page<>(); + iBootBMCNetBeanPage.setTotal(deviceEntityPage.getTotal()); + List iBootBMCNetBeans = new ArrayList<>(); + deviceEntityPage.getData().forEach(deviceEntity -> { + IBootBMCNetPreviewBean.IBootBMCNetBean iBootBMCNetBean = new IBootBMCNetPreviewBean.IBootBMCNetBean(); + iBootBMCNetBean.setDhcpIp(deviceEntity.getDhcpIp()); + iBootBMCNetBean.setSn(deviceEntity.getSn()); + iBootBMCNetBean.setStatus(deviceEntity.getStatus()); + iBootBMCNetBeans.add(iBootBMCNetBean); + }); + IBootInbandFileEntity iBootInbandFileEntity = iBootInabndFileMapper.getOneById(fileId); + String ext = IBootFileUtil.getExtensionName(iBootInbandFileEntity.getOriginalName()); + InputStream inputStream = null; + try { + if (ext.equals("xls")) { + inputStream = new FileInputStream(FileUtil.normalize(iBootInbandFileEntity.getFullPath())); + IBootExcelReaderUtil excelReaderUtil = new IBootExcelReaderUtil(); + List iBootBMCNetBeans1 = excelReaderUtil.readExcelBMCImport(inputStream, MagicNumber.M1, MagicNumber.M2); + iBootBMCNetBeans.forEach(iBootBMCNetBean -> { + for (IBootBMCNetPreviewBean.IBootBMCNetBean iBootBMCNetBean1 : iBootBMCNetBeans1) { + if (iBootBMCNetBean1.getSn().equalsIgnoreCase(iBootBMCNetBean.getSn())) { + iBootBMCNetBean.setIp(iBootBMCNetBean1.getIp()); + iBootBMCNetBean.setNetmask(iBootBMCNetBean1.getNetmask()); + iBootBMCNetBean.setGateway(iBootBMCNetBean1.getGateway()); + iBootBMCNetBean.setChannel(iBootBMCNetBean1.getChannel()); + break; + } + } + }); + } + iBootBMCNetBeanPage.setData(iBootBMCNetBeans); + iBootBMCNetPreviewBean.setIBootNetPreviewBeanPage(iBootBMCNetBeanPage); + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + if (null != inputStream) { + inputStream.close(); + } + } + return iBootBMCNetPreviewBean; + } + + @Override + public byte[] downloadNetConfigExcel(DeviceQueryBean deviceQueryBean, int type) { + List deviceEntities = new ArrayList<>(); + handleDeviceQueryBean(deviceQueryBean); + if (ObjectUtil.isNotNull(deviceQueryBean)) { + deviceEntities = deviceMapper.queryListWithPage(deviceQueryBean); + } + if (CollectionUtil.isEmpty(deviceEntities)) { + return null; + } + String excelId = UUID.fastUUID().toString(true); + File destFile = new File(IBootPathConstant.ibootBasePath + excelId + ".xls"); + try { + IBootExcelUtil iBootExcelUtil = new IBootExcelUtil(); + if (type == 1) { // BMC网络配置 + if (!iBootExcelUtil.createBMCExcel(IBootPathConstant.ibootBasePath + excelId + ".xls", deviceEntities)) { + return null; + } + } else if (type == 2) { // IP设置 + if (!iBootExcelUtil.createOSExcel(IBootPathConstant.ibootBasePath + excelId + ".xls", deviceEntities)) { + return null; + } + } else if (type == 3) { // Bond设置 + if (!iBootExcelUtil.createBondExcel(IBootPathConstant.ibootBasePath + excelId + ".xls", deviceEntities)) { + return null; + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + byte[] file = new byte[0]; + try { + file = IBootFileUtil.readFile(destFile); + } catch (IOException e) { + log.error(e.getMessage(), e); + } finally { + destFile.delete(); + } + return file; + } + + @Override + public Page getStressHistory(IBootTaskQueryBean iBootTaskQueryBean) { + Page stressHistoryBeanPage = new Page<>(); + Page taskHistoryEntityPage = new Page<>(); + if (ObjectUtil.isNotNull(iBootTaskQueryBean)) { + taskHistoryEntityPage = taskService.getTaskHistoryList(iBootTaskQueryBean); + } + if (CollUtil.isEmpty(taskHistoryEntityPage.getData())) { + return stressHistoryBeanPage; + } + // 补全数据 + stressHistoryBeanPage.setTotal(taskHistoryEntityPage.getTotal()); + List iBootStressHistoryBeans = new ArrayList<>(); + taskHistoryEntityPage.getData().forEach(iBootTaskHistoryEntity -> { + IBootStressHistoryBean iBootStressHistoryBean = new IBootStressHistoryBean(); + iBootStressHistoryBean.setTaskId(iBootTaskHistoryEntity.getTaskId()); + iBootStressHistoryBean.setTaskName(iBootTaskHistoryEntity.getName()); + iBootStressHistoryBean.setStatus(iBootTaskHistoryEntity.getTaskStatus()); + iBootStressHistoryBean.setStartTime(iBootTaskHistoryEntity.getStartTime()); + iBootStressHistoryBean.setEndTime(iBootTaskHistoryEntity.getEndTime()); + iBootStressHistoryBean.setCostTime(DateUtil.between(iBootStressHistoryBean.getStartTime(), iBootStressHistoryBean.getEndTime(), DateUnit.MS)); + iBootStressHistoryBean.setNum(taskService.getTaskHostHistoryList(iBootTaskHistoryEntity.getTaskId()).size()); + IBootTemplateEntity iBootTemplateEntity = queryTemplateDetailById(iBootTaskHistoryEntity.getTemplateId()); + if (BeanUtil.isNotEmpty(iBootTemplateEntity)) { + IBootStressTestBean iBootStressTestBean = JSONUtil.toBean(iBootTemplateEntity.getContent(), IBootStressTestBean.class); + if (iBootStressTestBean.getMemoryMinutes() > 0) { + iBootStressHistoryBean.setCpuTest(true); + } + if (iBootStressTestBean.getMemoryMinutes() > 0) { + iBootStressHistoryBean.setMemTest(true); + } + } + iBootStressHistoryBeans.add(iBootStressHistoryBean); + }); + stressHistoryBeanPage.setData(iBootStressHistoryBeans); + return stressHistoryBeanPage; + } + + @Override + public Page queryPageStressTestServerData(IBootTaskQueryBean iBootTaskQueryBean) { + PageRequest.checkPage(iBootTaskQueryBean); + if (!BeanUtil.beanToMap(new IBootStressTestServerEntity(), false, false).containsKey(iBootTaskQueryBean.getField())) { + throw new PimException(Languages.getString("cosmos.asset.page.sort.field.not.exist")); + } + // 模板内容 + IBootTaskHistoryEntity iBootTaskHistoryEntity = taskService.getTaskHistory(iBootTaskQueryBean.getTaskId()); + IBootTemplateEntity iBootTemplateEntity = queryTemplateDetailById(iBootTaskHistoryEntity.getTemplateId()); + Pages pages = Pages.of(iBootTaskQueryBean.getPage(), iBootTaskQueryBean.getPageSize(), iBootTaskQueryBean.getField(), iBootTaskQueryBean.getDir()); + List iBootStressTestServerEntities = iBootStressTessServerMapper.getListByTaskId(iBootTaskQueryBean); + iBootStressTestServerEntities.forEach(iBootStressTestServerEntity -> { + iBootStressTestServerEntity.setTemplateContent(iBootTemplateEntity.getContent()); + if (iBootStressTestServerEntity.getStatus().equals("EXCEPTION")) { + iBootStressTestServerEntity.setResult(Languages.getString("iboot.stress.data.exc")); + } else { + iBootStressTestServerEntity.setResult(Languages.getString("iboot.stress.data.suc")); + } + }); + if (CollUtil.isEmpty(iBootStressTestServerEntities)) { + iBootStressTestServerEntities = new ArrayList<>(); + } + return pages.page(iBootStressTestServerEntities); + } + + @Override + public IBootStressExportBean export(IBootTaskQueryBean query) { + IBootStressExportBean stressExportBean = new IBootStressExportBean(); + // 基本信息 + IBootStressTestReportBean reportBean = getStressTestReportData(query.getTaskId()); + query.setStatus(null); + query.setField("update_time"); + // 模板内容 + IBootTaskHistoryEntity iBootTaskHistoryEntity = taskService.getTaskHistory(query.getTaskId()); + IBootTemplateEntity iBootTemplateEntity = queryTemplateDetailById(iBootTaskHistoryEntity.getTemplateId()); + IBootStressTestBean iBootStressTestBean = JSONUtil.toBean(iBootTemplateEntity.getContent(), IBootStressTestBean.class); + List sheetDatas = iBootStressTessServerMapper.getListByTaskId(query); + sheetDatas.forEach(iBootStressTestServerEntity -> { + if (iBootStressTestServerEntity.getStatus().equals("EXCEPTION")) { + iBootStressTestServerEntity.setResult(Languages.getString("iboot.stress.data.exc")); + } else { + iBootStressTestServerEntity.setResult(Languages.getString("iboot.stress.data.suc")); + } + }); + List sheet2Datas = new ArrayList<>(); + List> firstTableDatas = new ArrayList<>(); + if (CollectionUtil.isEmpty(sheetDatas)) { + log.error("sheet1 data is null"); + } + List leftData = new ArrayList<>(); + List types = new ArrayList<>(); + if (iBootStressTestBean.isCpuTest()) { + types.add("CPU"); + } + if (iBootStressTestBean.isMemoryTest()) { + types.add("Memory"); + } + leftData.add(String.join(",", types)); + leftData.add(String.valueOf(iBootStressTestBean.getInterval())); + leftData.add(String.valueOf(reportBean.getAllServerNum())); + leftData.add(String.valueOf(reportBean.getNormalSeverNum())); + leftData.add(String.valueOf(reportBean.getExceptionNum())); + leftData.add(String.valueOf(reportBean.getNoDataNum())); + for (IBootStressTestServerEntity data1 : sheetDatas) { + List data = new ArrayList<>(); + data.add(data1.getIp()); + data.add(data1.getSn()); + data.add(data1.getStatus()); + data.add(data1.getResult()); + sheet2Datas.addAll(iBootStressDataMapper.getStressData(data1.getJobHostId())); + firstTableDatas.add(data); + } + List> secondTableDatas = new ArrayList<>(); + if (CollectionUtil.isEmpty(sheet2Datas)) { + log.error("sheet2 data is null"); + } + for (IBootStressDataEntity dateEntity : sheet2Datas) { + List data = new ArrayList<>(); + data.add(dateEntity.getIp()); + data.add(dateEntity.getSn()); + data.add(dateEntity.getTotalPower()); + data.add(dateEntity.getInletTemperature()); + data.add(dateEntity.getOutletTemperature()); + data.add(dateEntity.getCpuRateUser()); + data.add(dateEntity.getCpuRateIdle()); + data.add(dateEntity.getCpuRateSystem()); + data.add(dateEntity.getCpuPower()); + data.add(dateEntity.getCpuTemperature()); + data.add(dateEntity.getMemoryRate()); + data.add(dateEntity.getMemoryPower()); + data.add(dateEntity.getEccCPU0()); + data.add(dateEntity.getEccCPU1()); + data.add(dateEntity.getEccReason()); + data.add(formatDateTime(dateEntity.getCreateTime())); + secondTableDatas.add(data); + } + File sampleReportFile = null; + if (Languages.getLocale().equals(Locale.SIMPLIFIED_CHINESE)) { + sampleReportFile = new File(IBootPathConstant.STRSS_TEMPLATE_ZH); + } else { + sampleReportFile = new File(IBootPathConstant.STRSS_TEMPLATE_EN); + } + InputStream fileOutputStream = null; + try { + fileOutputStream = new FileInputStream(sampleReportFile); + byte[] bytes = IBootExcelUtil.generateStressTest(fileOutputStream, leftData, firstTableDatas, secondTableDatas); + stressExportBean.setBy(bytes); + stressExportBean.setFileName("collect_" + query.getTaskId() + ".xlsx"); + } catch (Exception e) { + log.error(e.getMessage()); + } finally { + // 安全漏洞修复:Unreleased Resource: Streams + IoUtil.close(fileOutputStream); + } + return stressExportBean; + } + + private String formatDateTime(Date date) { + SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + return format.format(date); + } + + @Override + public IBootStressTestReportBean getStressTestReportData(String taskId) { + IBootStressTestReportBean iBootStressTestReportBean = new IBootStressTestReportBean(); + List taskHostHistoryEntities = taskService.getTaskHostHistoryList(taskId); + if (CollUtil.isEmpty(taskHostHistoryEntities)) { + log.error("stressServerData is null or empty"); + return iBootStressTestReportBean; + } + //设备数量 + iBootStressTestReportBean.setAllServerNum(taskHostHistoryEntities.size()); + int normalCount = 0; + int eccCount = 0; + int noneCount = 0; + for (IBootTaskHostHistoryEntity iBootTaskHostHistoryEntity : taskHostHistoryEntities) { + IBootStressTestServerEntity iBootStressTestServerEntity = iBootStressTessServerMapper.getById(iBootTaskHostHistoryEntity.getJobHostId()); + if (BeanUtil.isEmpty(iBootStressTestServerEntity)) { + noneCount += 1; + } else if (iBootStressTestServerEntity.getStatus().equals("NORMAL")) { + normalCount += 1; + } else { + eccCount += 1; + } + } + iBootStressTestReportBean.setNoDataNum(noneCount); + iBootStressTestReportBean.setExceptionNum(eccCount); + iBootStressTestReportBean.setNormalSeverNum(normalCount); + return iBootStressTestReportBean; + } + + @Override + public void addStressData(IBootStressDataEntity iBootStressDataEntity) { + IBootStressTestServerEntity iBootStressTestServerEntity = iBootStressTessServerMapper.getById(iBootStressDataEntity.getJobHostId()); + // 添加压力测试机器任务数据 + if (BeanUtil.isEmpty(iBootStressTestServerEntity)) { + IBootStressTestServerEntity iBootStressTestServerEntity1 = new IBootStressTestServerEntity(); + iBootStressTestServerEntity1.setId(UUID.fastUUID().toString(true)); + iBootStressTestServerEntity1.setSn(iBootStressDataEntity.getSn()); + iBootStressTestServerEntity1.setNum(1); + iBootStressTestServerEntity1.setJobHostId(iBootStressDataEntity.getJobHostId()); + iBootStressTestServerEntity1.setIp(iBootStressDataEntity.getIp()); + iBootStressTestServerEntity1.setUpdateTime(new Date()); + // 补全taskId + IBootTaskHostEntity iBootTaskHostEntity = taskService.getTaskHost(iBootStressDataEntity.getJobHostId()); + if (BeanUtil.isNotEmpty(iBootTaskHostEntity)) { + iBootStressTestServerEntity1.setTaskId(iBootTaskHostEntity.getTaskId()); + } + if (StringUtils.isNotEmpty(iBootStressDataEntity.getEccReason())) { + iBootStressTestServerEntity1.setStatus("EXCEPTION"); + } else { + iBootStressTestServerEntity1.setStatus("NORMAL"); + } + iBootStressTessServerMapper.insertUseGeneratedKeys(iBootStressTestServerEntity1); + } else { + iBootStressTestServerEntity.setNum(iBootStressTestServerEntity.getNum() + 1); + iBootStressTestServerEntity.setUpdateTime(new Date()); + if (StringUtils.isNotEmpty(iBootStressDataEntity.getEccReason())) { + iBootStressTestServerEntity.setStatus("EXCEPTION"); + } + iBootStressTessServerMapper.updateByPrimaryKey(iBootStressTestServerEntity); + } + iBootStressDataMapper.insertUseGeneratedKeys(iBootStressDataEntity); + } + + private void filterSafe(IBootTemplateEntity iBootTemplateEntity) { + if (StrUtil.isBlank(iBootTemplateEntity.getContent())) { + return; + } + } + + private Boolean handleTemplateEntity(IBootTemplateEntity iBootTemplateEntity) { + if (StrUtil.isBlank(iBootTemplateEntity.getContent())) { + return true; + } + if (iBootTemplateEntity.getTemplateType().equals(TemplateTypeEnum.OS_INSTALL)) { // 系统安装 + IBootOsInstallBean iBootOsInstallBean = JSONUtil.toBean(iBootTemplateEntity.getContent(), IBootOsInstallBean.class); + if (!iBootOsInstallBean.getImageType().equalsIgnoreCase("Windows")) { + if (iBootOsInstallBean.getKsType() == 1) { + iBootOsInstallBean.setDiskPartition(iBootOsInstallFactory.getOsInstallImpl(iBootOsInstallBean.getImageType(), iBootOsInstallBean.getVersion()).diskPartition(iBootOsInstallBean)); + } + } + iBootTemplateEntity.setTemplateBean(iBootOsInstallBean); + iBootTemplateEntity.setContent(JSONUtil.toJsonStr(iBootOsInstallBean)); + } else if (iBootTemplateEntity.getTemplateType().equals(TemplateTypeEnum.STRESS_TEST)) { // 压力测试 + IBootStressTestBean iBootStressTestBean = JSONUtil.toBean(iBootTemplateEntity.getContent(), IBootStressTestBean.class); + if (!iBootStressTestBean.isCpuTest() && !iBootStressTestBean.isMemoryTest()) { + return false; + } + } + return true; + } + + private ImageXmlBeans getBaseE(IBootRepositoryImageEntity imageEntity) { + ImageXmlBeans xmlEBeans = new ImageXmlBeans(); + try { + ExecCommand exec = new ExecCommand(); + // 镜像挂载 + String mountPath = IBootPathConstant.MountImageFile + File.separator + imageEntity.getId(); + File filePath = new File(FileUtil.normalize(mountPath)); + if (!filePath.exists()) { + filePath.mkdir(); + } + if (ArrayUtil.isEmpty(filePath.list())) { + if (OperationSystemUtil.isWindows()) { + ISOUtil.unarchiveISO(imageEntity.getFullPath(), mountPath); + } else { + String mountCmd = "mount " + imageEntity.getFullPath() + " " + mountPath; + exec.runLocal(mountCmd); + } + } + if (imageEntity.getImageType().equalsIgnoreCase("uos")) { + String path = null; + if (OperationSystemUtil.isWindows()) { + List files = CommonUtil.findFilesForWindows(mountPath, "packages_default.json", true); + if (!files.isEmpty()) { + path = files.get(0); + } + } else { + String cmd_find = "find " + mountPath + " -name packages_default.json"; + path = exec.runLocal(cmd_find); + } + if (StringUtils.isNotBlank(path)) { + Map map = (Map) JSONUtil.toBean(readJsonFile(path.replace("\n", "")), Map.class); + for (String key : map.keySet()) { + // 临时做法 强制转换 + String valueCN = queryUosValue(key); + xmlEBeans.getMapE().put(key, valueCN); + xmlEBeans.getMapZ().put(valueCN, key); + xmlEBeans.getMapI().put(key, key); + xmlEBeans.getListE().add(key); + xmlEBeans.getListZ().add(valueCN); + xmlEBeans.getListI().add(key); + } + } + } else { + List listPath = new ArrayList<>(); + if (OperationSystemUtil.isWindows()) { + listPath = CommonUtil.findFilesForWindows(mountPath, "repodata", true); + } else { + String cmd_find = "find " + mountPath + " -name repodata"; + String paths = exec.runLocal(cmd_find); + listPath = Arrays.stream(paths.split("\n")).toList(); + } + for (String path : listPath) { + ImageXmlBeans xmlEBeans_f = analysisXml(path); + xmlEBeans.getListE().addAll(xmlEBeans_f.getListE()); + xmlEBeans.getListZ().addAll(xmlEBeans_f.getListZ()); + xmlEBeans.getListI().addAll(xmlEBeans_f.getListI()); + xmlEBeans.getMapE().putAll(xmlEBeans_f.getMapE()); + xmlEBeans.getMapZ().putAll(xmlEBeans_f.getMapZ()); + xmlEBeans.getMapI().putAll(xmlEBeans_f.getMapI()); + } + List list_z = new ArrayList<>(new TreeSet<>(xmlEBeans.getListZ())); + List list_e = new ArrayList<>(new TreeSet<>(xmlEBeans.getListE())); + List list_i = new ArrayList<>(new TreeSet<>(xmlEBeans.getListI())); + xmlEBeans.setListZ(list_z); + xmlEBeans.setListE(list_e); + xmlEBeans.setListI(list_i); + } + } catch (IOException e) { + log.error(e.getMessage()); + return xmlEBeans; + } + // iboot镜像挂载到目录下后暂不卸载,待后续安装使用 + return xmlEBeans; + } + + private ImageXmlBean analysisXmlFromIso(IBootRepositoryImageEntity imageEntity) throws Exception { + ImageXmlBean xmlBean = new ImageXmlBean(); + ExecCommand exec = new ExecCommand(); + // 镜像挂载 + String mountPath = IBootPathConstant.MountImageFile + File.separator + imageEntity.getId(); + File filePath = new File(FileUtil.normalize(mountPath)); + if (!filePath.exists()) { + filePath.mkdir(); + } + if (ArrayUtil.isEmpty(filePath.list())) { + if (OperationSystemUtil.isWindows()) { + ISOUtil.unarchiveISO(imageEntity.getFullPath(), mountPath); + } else { + String mountCmd = "mount " + imageEntity.getFullPath() + " " + mountPath; + exec.runLocal(mountCmd); + } + } + Map groupMap = Maps.newHashMap(); + Map envMap = Maps.newHashMap(); + Set defaultGroupList = new HashSet<>(); + List listPath = new ArrayList<>(); + if (OperationSystemUtil.isWindows()) { + listPath = CommonUtil.findFilesForWindows(mountPath, "repodata", true); + } else { + String cmd_find = "find " + mountPath + " -name repodata"; + String paths = exec.runLocal(cmd_find); + if (StringUtils.isNotBlank(paths)) { + listPath = Arrays.stream(paths.split("\n")).toList(); + } + } + for (String path : listPath) { + FileFilter filter = new FileFilter(".xml"); + File file = new File(FilenameUtils.normalize(path)); + String[] names = file.list(filter); + if (CommonCheck.nonNullOrEmpty(names)) { + for (String name : names) { + if (!name.contains("repomd")) { + SAXReader reader = new SAXReader(); + reader.setEntityResolver(new IgnoreDTD()); + String xmlPath = path + File.separator + name; + Document document = reader.read(new File(FilenameUtils.normalize(xmlPath))); + Element rootElement = document.getRootElement(); + //环境选择 选择环境 + List listE = rootElement.elements("environment"); + List group = rootElement.elements("group"); + for (Element element : group) { + ImageGroupBean groupBean = new ImageGroupBean(); + String groupId = element.element("id").getText(); + groupBean.setGroupId(groupId); + List nameList = element.elements("name"); + Optional optionalElement = nameList.stream().filter(el -> "zh_CN".equalsIgnoreCase(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String cnName = optionalElement.get().getText(); + groupBean.setCnName(cnName); + } + optionalElement = nameList.stream().filter(el -> StrUtil.isEmpty(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String enName = optionalElement.get().getText(); + groupBean.setEnName(enName); + } + List desList = element.elements("description"); + optionalElement = desList.stream().filter(el -> "zh_CN".equalsIgnoreCase(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String cnDes = optionalElement.get().getText(); + groupBean.setCnDes(cnDes); + } + optionalElement = desList.stream().filter(el -> StrUtil.isEmpty(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String enDes = optionalElement.get().getText(); + groupBean.setEnDes(enDes); + } + groupMap.put(groupId, groupBean); + if (isDefaultGroup(groupId)) { + defaultGroupList.add(groupBean); + } + } + for (Element element : listE) { + ImageEnvironmentBean enviromentBean = new ImageEnvironmentBean(); + String envId = element.element("id").getText(); + enviromentBean.setId(envId); + List nameList = element.elements("name"); + Optional optionalElement = nameList.stream().filter(el -> "zh_CN".equalsIgnoreCase(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String cnName = optionalElement.get().getText(); + enviromentBean.setCnName(cnName); + } + optionalElement = nameList.stream().filter(el -> StrUtil.isEmpty(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String enName = optionalElement.get().getText(); + enviromentBean.setEnName(enName); + } + List desList = element.elements("description"); + optionalElement = desList.stream().filter(el -> "zh_CN".equalsIgnoreCase(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String cnDes = optionalElement.get().getText(); + enviromentBean.setCnDes(cnDes); + } + optionalElement = desList.stream().filter(el -> StrUtil.isEmpty(el.attributeValue("lang"))).findFirst(); + if (optionalElement.isPresent()) { + String enDes = optionalElement.get().getText(); + enviromentBean.setEnDes(enDes); + } + Element optionlist = element.element("optionlist"); + Element grouplist = element.element("grouplist"); + List groupIdList = grouplist.elements("groupid").stream().map(Element::getText).collect(Collectors.toList()); + Set groups = new HashSet<>(defaultGroupList); + enviromentBean.setGroupIdList(groupIdList); + optionlist.elements("groupid").stream().map(Element::getText).forEach(id -> { + if (null != groupMap.get(id)) { + groups.add(groupMap.get(id)); + } + }); + enviromentBean.setOptionGroupSet(groups); + envMap.put(envId, enviromentBean); + + } + } + } + } + } + xmlBean.setEnvMap(envMap); + xmlBean.setGroupMap(groupMap); + return xmlBean; + } + + private boolean isDefaultGroup(String groupId) { + return groupId.equalsIgnoreCase("legacy-unix") + || groupId.equalsIgnoreCase("container-management") + || groupId.equalsIgnoreCase("development") + || groupId.equalsIgnoreCase("dotnet-core") + || groupId.equalsIgnoreCase("graphical-admin-tools") + || groupId.equalsIgnoreCase("headless-management") + || groupId.equalsIgnoreCase("network-server") + || groupId.equalsIgnoreCase("rpm-development-tools") + || groupId.equalsIgnoreCase("scientific") + || groupId.equalsIgnoreCase("security-tools") + || groupId.equalsIgnoreCase("smart-card") + || groupId.equalsIgnoreCase("system-tools"); + } + + private String queryUosValue(String key) { + return uosMap.get(key) != null ? uosMap.get(key) : key; + } + + /** + * 查询目录下 包含{.xml}后缀的文件 + * + * @param dir + * @return + */ + private ImageXmlBeans analysisXml(String dir) { + ImageXmlBeans xmlEBeans = new ImageXmlBeans(); + String fileName = ""; + File file = new File(FilenameUtils.normalize(dir)); + String[] names; + FilenameFilter filter = new FileFilter(".xml"); + names = file.list(filter); + if (CommonCheck.nonNullOrEmpty(names)) { + for (String name : names) { + if (!name.contains("repomd")) { + fileName = name; + } + } + SAXReader reader = new SAXReader(); + reader.setEntityResolver(new IgnoreDTD()); + try { + String xmlPath = dir + File.separator + fileName; + Document document = reader.read(new File(FilenameUtils.normalize(xmlPath))); + Element rootElement = document.getRootElement(); + List listE = rootElement.elements("environment"); + for (Element element : listE) { + List nameEs = element.elements("name"); + for (Element el : nameEs) { + if (!el.attributes().isEmpty()) { + DefaultAttribute defaultAttribute = (DefaultAttribute) el.attributes().get(0); + String att = defaultAttribute.getValue(); + if (att.equals("zh_CN")) { + xmlEBeans.getListZ().add(el.getText().toString()); + xmlEBeans.getMapZ().put(el.getText(), element.elementText("name")); + xmlEBeans.getMapE().put(element.elementText("name"), el.getText()); + } + } + } + xmlEBeans.getListI().add(element.elementText("id")); + xmlEBeans.getMapI().put(element.elementText("name"), element.elementText("id")); + xmlEBeans.getListE().add(element.elementText("name")); + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + return xmlEBeans; + } + + private void handleDeviceQueryBean(DeviceQueryBean queryBean) { + PageRequest.checkPage(queryBean); + if (!BeanUtil.beanToMap(new DeviceEntity(), false, false).containsKey(queryBean.getField())) { + throw new PimException("cosmos.asset.page.sort.field.not.exist"); + } + queryBean.setField(StringUtil.camelhumpToUnderline(queryBean.getField())); + } + + private void configUosNet(IBootInstallParamBean iBootInstallParamBean, String snJobHostIds) { + String setIpFilePath = IBootPathConstant.MountImageFile + File.separator + iBootInstallParamBean.getIBootOsInstallBean().getImageFileId() + IBootPathConstant.InRootFile + "02_setup_ip.job"; + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(setIpFilePath); + StringBuffer ipStr = new StringBuffer(); + if (StringUtils.isNotEmpty(iBootInstallParamBean.getNetworkBean())) { + List iBootIPSetBeans = JSONUtil.toList(iBootInstallParamBean.getNetworkBean(), IBootIPSetBean.class); + for (IBootIPSetBean iBootIPSetBean : iBootIPSetBeans) { + ipStr.append(iBootIPSetBean.getSn()).append(" ").append(iBootIPSetBean.getHostname()).append(" "); + iBootIPSetBean.getOsIpList().forEach(osIp -> ipStr.append(osIp.getIp()).append(" ").append(osIp.getNetmask()).append(" ").append(osIp.getGateway()).append(" ").append(osIp.getNetInterface()).append(" ")); + ipStr.append("\n"); + } + } + String iBootIp = CommonUtil.getDHCPIp(); + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("ipCfg", ipStr.toString())); + replaceBeanList.add(new ReplaceBean("snJobHostIds", snJobHostIds)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + ReplaceUtil.autoReplaceNew(IBootPathConstant.UosTemplateFile + File.separator + "02_setup_ip.job", setIpFilePath, replaceBeanList); + } + + private boolean createUosKs(IBootInstallParamBean iBootInstallParamBean) { + try { + String ksFilePath = IBootPathConstant.MountImageFile + File.separator + iBootInstallParamBean.getIBootOsInstallBean().getImageFileId() + "/oem/settings.ini"; + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(ksFilePath); + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + if (iBootOsInstallBean.getKsType() != 2) { + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("zh_CN", iBootOsInstallBean.getLanguage())); + replaceBeanList.add(new ReplaceBean("diskPartition", iBootOsInstallBean.getDiskPartition())); + replaceBeanList.add(new ReplaceBean("Asia/Shanghai", iBootOsInstallBean.getTimeZone())); + if (StringUtils.isNotEmpty(iBootOsInstallBean.getBaseE())) { + replaceBeanList.add(new ReplaceBean("#baseE#", iBootOsInstallBean.getBaseE())); + } else { + replaceBeanList.add(new ReplaceBean("#baseE#", "Basic-Server-Environment")); + } + ReplaceUtil.autoReplaceNew(IBootPathConstant.UosTemplateFile + File.separator + "settings.ini", ksFilePath, replaceBeanList); + } else { + IBootFileUtil.writeFile(ksFilePath, iBootOsInstallBean.getKsContent().getBytes()); + if (OperationSystemUtil.isWindows()) { + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("\r", "")); + ReplaceUtil.autoReplace(ksFilePath, replaceBeanList); + } else { + String cmd = "sed -i 's/\\r//g' " + ksFilePath; + ExecCommand execCommand = new ExecCommand(); + execCommand.runLocal(cmd); + } + } + } catch (Exception e) { + log.error(e.getMessage()); + return false; + } + return true; + } + + private void configUosUrl(IBootInstallParamBean iBootInstallParamBean, String snJobHostIds) { + // 创建后置目录 + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + File afterDir = new File(IBootPathConstant.MountImageFile + File.separator + iBootOsInstallBean.getImageFileId() + IBootPathConstant.AfterRootFile); + if (!afterDir.exists()) { + FileUtil.createTempFile(afterDir); + } + String addpassPath = IBootPathConstant.MountImageFile + File.separator + iBootInstallParamBean.getIBootOsInstallBean().getImageFileId() + IBootPathConstant.InRootFile + "98_addpass.job"; + String finisPath = IBootPathConstant.MountImageFile + File.separator + iBootInstallParamBean.getIBootOsInstallBean().getImageFileId() + IBootPathConstant.AfterRootFile + "99_finis.job"; + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(addpassPath); + IBootFileUtil.deleteFile(finisPath); + String iBootIp = CommonUtil.getDHCPIp(); + if (StringUtils.isEmpty(iBootOsInstallBean.getRootPw())) { + iBootOsInstallBean.setRootPw("Inspur1!"); + } + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("osPwTmp", iBootOsInstallBean.getRootPw())); + replaceBeanList.add(new ReplaceBean("snJobHostIds", snJobHostIds)); + ReplaceUtil.autoReplaceNew(IBootPathConstant.UosTemplateFile + File.separator + "98_addpass.job", addpassPath, replaceBeanList); + ReplaceUtil.autoReplaceNew(IBootPathConstant.UosTemplateFile + File.separator + "99_finis.job", finisPath, replaceBeanList); + } + + private class FileFilter implements FilenameFilter { + private String fileFilter; + + private FileFilter(String filter) { + this.fileFilter = filter; + } + + @Override + public boolean accept(File dir, String name) { + if (name.lastIndexOf('.') > 0) { + int lastIndex = name.lastIndexOf('.'); + String str = name.substring(lastIndex); + return str.equals(this.fileFilter); + } + return false; + } + } + + /** + * 忽略校验 + */ + private class IgnoreDTD implements EntityResolver { + @Override + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { + return new InputSource(new ByteArrayInputStream("".getBytes())); + } + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/InnerServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/InnerServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..165f6c2f93d794c084d91f159bc7005c50741961 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/InnerServiceImpl.java @@ -0,0 +1,69 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDetailBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressDataEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostLogEntity; +import com.inspur.ispim.cosmos.iboot.base.api.service.DeviceService; +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootTemplateService; +import com.inspur.ispim.cosmos.iboot.base.api.service.InnerService; +import com.inspur.ispim.cosmos.iboot.base.api.service.TaskService; +import lombok.extern.slf4j.Slf4j; + +/** + * 给设备使用的内部实现 + */ +@Slf4j +//@Service +//@SofaService(bindings = @SofaServiceBinding(bindingType = "bolt"), uniqueId = "InnerServiceImpl") +public class InnerServiceImpl implements InnerService { + + private final DeviceService deviceService; + private final TaskService taskService; + + private final IBootTemplateService iBootTemplateService; + + public InnerServiceImpl(DeviceService deviceService, TaskService taskService, IBootTemplateService iBootTemplateService) { + this.deviceService = deviceService; + this.taskService = taskService; + this.iBootTemplateService = iBootTemplateService; + } + + @Override + public ApiResult getAll() { + return ApiResult.success(deviceService.getAll()); + } + + @Override + public void acceptStatusChangeBean(IBootTaskHostEntity iBootTaskHostEntity) { + taskService.acceptStatusChangeBean(iBootTaskHostEntity); + } + + @Override + public void acceptTaskHostLogBean(IBootTaskHostLogEntity iBootTaskHostLogEntity) { + taskService.acceptTaskHostLogBean(iBootTaskHostLogEntity); + } + + @Override + public ResultBean deviceHeartbeat(String sn, String ip) { + return deviceService.deviceHeartbeat(sn, ip); + } + + @Override + public ResultBean deviceReport(DeviceDetailBean detailBean) { + return deviceService.deviceReport(detailBean); + } + + @Override + public IBootTaskHostEntity getTaskHost(String jobHostId) { + return taskService.getTaskHost(jobHostId); + } + + @Override + public void addStressData(IBootStressDataEntity iBootStressDataEntity) { + iBootTemplateService.addStressData(iBootStressDataEntity); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/OuterServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/OuterServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0404b2d4e2c96d8a77dca982edf4668bae6475c8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/OuterServiceImpl.java @@ -0,0 +1,475 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.inspur.cdc.combo.mybatis.page.bean.PageResult; +import com.inspur.cdc.commons.lang.web.ApiResult; +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.ispim.cosmos.iboot.base.api.bean.IBootTemplateQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDiskCloneBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.ServerManageNetworkBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.*; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.DeviceShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TemplateShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TotalBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.IBootRaidConfigTemplateBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidAnalyResult; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidTreeBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.RaidXmlBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.*; +import com.inspur.ispim.cosmos.iboot.base.api.entity.*; +import com.inspur.ispim.cosmos.iboot.base.api.service.*; +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * 给设备使用的内部实现 + */ +@Slf4j +public class OuterServiceImpl implements OuterService { + + protected final DeviceService deviceService; + private final TaskService taskService; + private final IBootRepositoryImageService iBootRepositoryImageService; + private final IBootTemplateService iBootTemplateService; + + public OuterServiceImpl(DeviceService deviceService, IBootTemplateService iBootTemplateService, TaskService taskService, IBootRepositoryImageService iBootRepositoryImageService) { + this.deviceService = deviceService; + this.taskService = taskService; + this.iBootRepositoryImageService = iBootRepositoryImageService; + this.iBootTemplateService = iBootTemplateService; + } + + @Override + public ApiResult getAllDevices() { + return ApiResult.success(deviceService.getAll()); + } + + @Override + public ResultBean deviceList(DeviceQueryBean queryBean) { + return new ResultBean(true, null, deviceService.deviceList(queryBean)); + } + + @Override + public ResultBean deviceDropdown() { + return new ResultBean(true, null, deviceService.deviceDropdown()); + } + + @Override + public ResultBean deviceModelList(String vendor) { + return new ResultBean(true, null, deviceService.deviceModelList(vendor)); + } + + @Override + public ResultBean deviceDelete(DeviceQueryBean queryBean) { + return deviceService.deviceDelete(queryBean); + } + + @Override + public ResultBean deviceRefresh(DeviceQueryBean queryBean) { + return deviceService.deviceRefresh(queryBean); + } + + @Override + public ResultBean devicePowerManage(DeviceQueryBean queryBean, String mode) { + return deviceService.devicePowerManage(queryBean, mode); + } + + @Override + public ResultBean addDevice(DeviceEntity deviceEntity) { + return deviceService.addDevice(deviceEntity); + } + + @Override + public ResultBean updateDevice(DeviceEntity deviceEntity) { + return deviceService.updateDevice(deviceEntity); + } + + @Override + public ResultBean getDeviceDetail(String id) { + return deviceService.getDeviceDetail(id); + } + + @Override + public ResultBean getDeviceSystemDetail(String id) { + return deviceService.getDeviceSystemDetail(id); + } + + @Override + public ResultBean getDeviceStorageDetail(String id) { + return deviceService.getDeviceStorageDetail(id); + } + + @Override + public byte[] deviceTemplateDownload() { + return deviceService.deviceTemplateDownload(); + } + + @Override + public ResultBean deviceTemplateUpload(byte[] content) { + return deviceService.deviceTemplateUpload(content); + } + + @Override + public ResultBean getServiceState() { + return deviceService.getServiceState(); + } + + @Override + public ResultBean changeServiceState(String name, String mode) { + return deviceService.changeServiceState(name, mode); + } + + @Override + public ResultBean getManageNetwork() { + return deviceService.getManageNetwork(); + } + + @Override + public ResultBean getManageNetworkRange(String ip) { + return deviceService.getManageNetworkRange(ip); + } + + @Override + public ResultBean setManageNetwork(ServerManageNetworkBean serverManageNetworkBean) { + return deviceService.setManageNetwork(serverManageNetworkBean); + } + + @Override + public ResultBean deviceDetection(DeviceQueryBean queryBean, String mode) { + return deviceService.deviceDetection(queryBean, mode); + } + + @Override + public ResultBean deviceLogicDisk(String id) { + return deviceService.deviceLogicDisk(id); + } + + @Override + public ResultBean deviceDiskBackup(DeviceDiskCloneBean diskCloneBean) { + return deviceService.deviceDiskBackup(diskCloneBean); + } + + @Override + public ResultBean deviceDiskRestore(DeviceQueryBean queryBean, String imageId) { + return deviceService.deviceDiskRestore(queryBean, imageId); + } + + @Override + public ApiResult getTaskHosts(String taskID) { + return ApiResult.success(ObjectUtil.isNull(taskService)); + } + + @Override + public PageResult getIBootRepositoryImagePageByCondition(ImageQueryBean imageQueryBean) { + return iBootRepositoryImageService.getByConditionPage(imageQueryBean); + } + + @Override + public List getByCondition(ImageQueryBean queryBean) { + return iBootRepositoryImageService.getByCondition(queryBean); + } + + @Override + public SpaceCheckResult checkNFSAvaliableSpace(String size, String type) { + return iBootRepositoryImageService.checkNFSAvaliableSpace(size, type); + } + + @Override + public IBootRepositoryImageEntity getByFileName(String fileName) { + return iBootRepositoryImageService.getByFileName(fileName); + } + + @Override + public boolean uploadFragmentedFile(Chunk chunk, byte[] filebytes) { + return iBootRepositoryImageService.uploadFragmentedFile(chunk, filebytes); + } + + @Override + public ResultBean mergeFragmentedFile(ChunkFileModel chunkFileModel, String userName) { + return iBootRepositoryImageService.mergeFragmentedFile(chunkFileModel, userName); + } + + @Override + public ResultBean deleteFragmentedFile(String pathId, String fileName) { + return iBootRepositoryImageService.deleteFragmentedFile(pathId, fileName); + } + + @Override + public ApiResult deleteOsRepositoryFileById(List ids) { + return iBootRepositoryImageService.deleteOsRepositoryFileById(ids); + } + + @Override + public String getMerginFlag(String fileId) { + return iBootRepositoryImageService.getMerginFlag(fileId); + } + + @Override + public double getUsableSpace() { + return iBootRepositoryImageService.getUsableSpace(); + } + + @Override + public List getAllSupportImages() { + return iBootRepositoryImageService.getAllSupportImages(); + } + + @Override + public List getImageTypeList() { + return iBootRepositoryImageService.getImageTypeList(); + } + + @Override + public Page getTaskList(IBootTaskQueryBean iBootTaskQueryBean) { + return taskService.getTaskList(iBootTaskQueryBean); + } + + @Override + public Page getTaskHostList(IBootTaskQueryBean iBootTaskQueryBean) { + return taskService.getTaskHostList(iBootTaskQueryBean); + } + + @Override + public List getTaskHostLogList(IBootTaskQueryBean iBootTaskQueryBean) { + return taskService.getTaskHostLogList(iBootTaskQueryBean); + } + + @Override + public Page getTaskHistoryList(IBootTaskQueryBean iBootTaskQueryBean) { + return taskService.getTaskHistoryList(iBootTaskQueryBean); + } + + @Override + public Page getTaskHostHistoryList(IBootTaskQueryBean iBootTaskQueryBean) { + return taskService.getTaskHostHistoryList(iBootTaskQueryBean); + } + + @Override + public void insertTask(IBootTaskEntity iBootTaskEntity) { + taskService.insertTask(iBootTaskEntity); + } + + @Override + public void insertTaskHost(IBootTaskHostEntity iBootTaskHostEntity) { + taskService.insertTaskHost(iBootTaskHostEntity); + } + + @Override + public void insertTaskHostList(List iBootTaskHostEntityList) { + taskService.insertTaskHostList(iBootTaskHostEntityList); + } + + @Override + public void stopTaskByTaskHostId(String taskHostId) { + taskService.stopTaskByTaskHostId(taskHostId); + } + + @Override + public void stopTaskByTaskId(String taskId) { + taskService.stopTaskByTaskId(taskId); + } + + @Override + public void deleteTaskByTaskId(String taskId) { + taskService.deleteTaskByTaskId(taskId); + } + + @Override + public void deleteTaskByTaskIds(List taskIds) { + taskService.deleteTaskByTaskIds(taskIds); + } + + @Override + public ResultBean retryTaskByTaskHostId(String taskHostId) { + return taskService.retryTaskByTaskHostId(taskHostId); + } + + @Override + public ResultBean retryTaskByTaskId(String taskId) { + return taskService.retryTaskByTaskId(taskId); + } + + @Override + public TotalBean getTotal() { + return taskService.getTotal(); + } + + @Override + public DeviceShowBean getDeviceShow() { + return taskService.getDeviceShow(); + } + + @Override + public List getTemplateShow() { + return taskService.getTemplateShow(); + } + + @Override + public List getTaskHistoryListTopten() { + return taskService.getTaskHistoryListTopten(); + } + + @Override + public List getImageShow() { + return taskService.getImageShow(); + } + + /**************************模板关联相关接口 开始***********************/ + @Override + public ResultBean checkGraphicRaid(IBootTemplateEntity controlTemplateEntity) { + return iBootTemplateService.checkGraphicRaid(controlTemplateEntity); + } + + @Override + public Page queryTemplateByCondition(IBootTemplateQueryBean queryBean) { + return iBootTemplateService.queryTemplateByCondition(queryBean); + } + + @Override + public IBootTemplateEntity addTemplateWithEntity(IBootTemplateEntity iBootTemplateEntity) { + return iBootTemplateService.addTemplateWithEntity(iBootTemplateEntity); + } + + @Override + public boolean deleteTemplateByIds(List templateIds) { + return iBootTemplateService.deleteTemplateByIds(templateIds); + } + + @Override + public boolean updateTemplate(IBootTemplateEntity iBootTemplateEntity) { + return iBootTemplateService.updateTemplate(iBootTemplateEntity); + } + + @Override + public List select(IBootTemplateEntity iBootTemplateEntity) { + return iBootTemplateService.select(iBootTemplateEntity); + } + + @Override + public IBootTemplateEntity queryTemplateDetail(Long templatePk) { + return iBootTemplateService.queryTemplateDetail(templatePk); + } + + @Override + public IBootTemplateEntity queryTemplateDetailById(String templateId) { + return iBootTemplateService.queryTemplateDetailById(templateId); + } + + @Override + public ResultBean duplicateTemplate(IBootTemplateEntity iBootTemplateEntity) { + return iBootTemplateService.duplicateTemplate(iBootTemplateEntity); + } + + @Override + public ResultBean addInbandFile(byte[] file, String fileName) { + return iBootTemplateService.addInbandFile(file, fileName); + } + + @Override + public ResultBean deleteInbandFile(String fileId) { + return iBootTemplateService.deleteInbandFile(fileId); + } + + @Override + public boolean startIBootTemplate(Long templatePk, IBootStartTaskBean iBootStartTaskBean) { + return iBootTemplateService.startIBootTemplate(templatePk, iBootStartTaskBean); + } + + @Override + public boolean osInstalled(IBootInstallParamBean iBootInstallParamBean, String executeUser) { + return iBootTemplateService.osInstalled(iBootInstallParamBean, executeUser); + } + + @Override + public boolean networkConfig(DeviceQueryBean deviceQueryBean, String fileId, String executeUser) { + return iBootTemplateService.networkConfig(deviceQueryBean, fileId, executeUser); + } + + @Override + public List searchTemplateIsInTask(String templateId) { + return taskService.searchTemplateIsInTask(templateId); + } + + @Override + public List> getTimezoneBySysType(String systemType) { + return iBootTemplateService.getTimezoneBySysType(systemType); + } + + @Override + public ResultBean getDefaultKs(String id) { + return iBootTemplateService.getDefaultKs(id); + } + + @Override + public ImageXmlBean getXmlAnalyse(String imageId) { + return iBootTemplateService.getXmlAnalyse(imageId); + } + + @Override + public Page getRaidConfigPage(DeviceQueryBean query) { + return iBootTemplateService.getRaidConfigPage(query); + } + + @Override + public RaidXmlBean getRaidXml(String md5) { + return iBootTemplateService.getRaidXml(md5); + } + + @Override + public RaidAnalyResult raidAnalyseResult(IBootRaidConfigTemplateBean iBootRaidConfigTemplateBean, String md5) { + return iBootTemplateService.raidAnalyseResult(iBootRaidConfigTemplateBean, md5); + } + + @Override + public List getRaidTree(String md5) { + return iBootTemplateService.getRaidTree(md5); + } + + @Override + public ResultBean getBondScript(IBootBondShellBean bondShellBean) throws IOException { + return iBootTemplateService.getBondScript(bondShellBean); + } + + @Override + public IBootPreviewBean osInstallPreviewResult(IBootInstallParamBean iBootInstallParamBean) throws Exception { + return iBootTemplateService.osInstallPreviewResult(iBootInstallParamBean); + } + + @Override + public IBootBMCNetPreviewBean netConfigPreviewResult(DeviceQueryBean deviceQueryBean, String fileId) throws Exception { + return iBootTemplateService.netConfigPreviewResult(deviceQueryBean, fileId); + } + + @Override + public byte[] downloadNetConfigExcel(DeviceQueryBean deviceQueryBean, int type) { + return iBootTemplateService.downloadNetConfigExcel(deviceQueryBean, type); + } + + @Override + public Page getStressHistory(IBootTaskQueryBean iBootTaskQueryBean) { + return iBootTemplateService.getStressHistory(iBootTaskQueryBean); + } + + @Override + public Page queryPageStressTestServerData(IBootTaskQueryBean iBootTaskQueryBean) { + return iBootTemplateService.queryPageStressTestServerData(iBootTaskQueryBean); + } + + @Override + public IBootStressTestReportBean getStressTestReportData(String taskId) { + return iBootTemplateService.getStressTestReportData(taskId); + } + + @Override + public IBootStressExportBean export(IBootTaskQueryBean query) { + return iBootTemplateService.export(query); + } + + /**************************模板关联相关接口 结束***********************/ +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/TaskServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/TaskServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..24b8df68374e0f49e2cc3d85e7ef484eb33e7b79 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/TaskServiceImpl.java @@ -0,0 +1,401 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.UUID; +import com.inspur.cdc.combo.mybatis.page.Pages; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.web.Page; +import com.inspur.cdc.commons.lang.web.PageRequest; +import com.inspur.ispim.cosmos.commons.exception.PimException; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskHostStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.DeviceShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TemplateShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TotalBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.*; +import com.inspur.ispim.cosmos.iboot.base.api.service.TaskService; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 给设备使用的内部实现 + */ +@Slf4j +//@Service +//@SofaService(interfaceType = TaskService.class, bindings = @SofaServiceBinding(bindingType = "bolt")) +public class TaskServiceImpl implements TaskService { + + private final IBootTaskMapper iBootTaskMapper; + private final IBootTaskHostMapper iBootTaskHostMapper; + private final IBootTaskHostLogMapper iBootTaskHostLogMapper; + private final IBootTaskHistoryMapper iBootTaskHistoryMapper; + private final IBootTaskHostHistoryMapper iBootTaskHostHistoryMapper; + private final IBootTaskMessageHandler iBootTaskMessageHandler; + private final DeviceMapper deviceMapper; + + public TaskServiceImpl(IBootTaskMapper iBootTaskMapper, IBootTaskHostMapper iBootTaskHostMapper, IBootTaskHostLogMapper iBootTaskHostLogMapper + , IBootTaskHistoryMapper iBootTaskHistoryMapper, IBootTaskHostHistoryMapper iBootTaskHostHistoryMapper, IBootTaskMessageHandler iBootTaskMessageHandler, DeviceMapper deviceMapper) { + this.iBootTaskMapper = iBootTaskMapper; + this.iBootTaskHostMapper = iBootTaskHostMapper; + this.iBootTaskHostLogMapper = iBootTaskHostLogMapper; + this.iBootTaskHistoryMapper = iBootTaskHistoryMapper; + this.iBootTaskHostHistoryMapper = iBootTaskHostHistoryMapper; + this.iBootTaskMessageHandler = iBootTaskMessageHandler; + this.deviceMapper = deviceMapper; + } + + @Override + public Page getTaskList(IBootTaskQueryBean query) { + PageRequest.checkPage(query); + if (!BeanUtil.beanToMap(new IBootTaskEntity(), false, false).containsKey(query.getField())) { + throw new PimException(Languages.getString("cosmos.iboot.page.sort.field.not.exist")); + } + Pages pages = Pages.of(query.getPage(), query.getPageSize(), query.getField(), query.getDir()); + Page page = pages.page(iBootTaskMapper.getByConditions(query)); + //处理成功、失败、运行中、等待个数 + List iBootTaskEntities = page.getData(); + iBootTaskEntities.forEach(iBootTaskEntity -> { + IBootTaskJobBean iBootTaskJobBean = iBootTaskHostMapper.getIBootTaskJobByTaskId(iBootTaskEntity.getId()); + if (iBootTaskJobBean != null) { + if (iBootTaskJobBean.getRunningNum() != 0) { + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.RUNNING); + } else if (iBootTaskJobBean.getSuccessNum() != 0 && iBootTaskJobBean.getFailNum() == 0) { + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.SUCCESS); + } else if (iBootTaskJobBean.getSuccessNum() == 0 && iBootTaskJobBean.getFailNum() != 0) { + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.FAILED); + } else if (iBootTaskJobBean.getSuccessNum() == 0 && iBootTaskJobBean.getFailNum() == 0) { + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.WAITING); + } else { + iBootTaskEntity.setTaskStatus(TaskHostStatusEnum.PART_SUCCESS); + } + } + iBootTaskEntity.setIBootTaskJobBean(iBootTaskJobBean); + }); + return page; + } + + @Override + public Page getTaskHostList(IBootTaskQueryBean query) { + PageRequest.checkPage(query); + if (!BeanUtil.beanToMap(new IBootTaskEntity(), false, false).containsKey(query.getField())) { + throw new PimException(Languages.getString("cosmos.iboot.page.sort.field.not.exist")); + } + Pages pages = Pages.of(query.getPage(), query.getPageSize(), query.getField(), query.getDir()); + Page page = pages.page(iBootTaskHostMapper.getListByQuery(query)); + return page; + } + + @Override + public Page getTaskHostHistoryList(IBootTaskQueryBean query) { +// PageRequest.checkPage(query); + if (!BeanUtil.beanToMap(new IBootTaskHostHistoryEntity(), false, false).containsKey(query.getField())) { + throw new PimException(Languages.getString("cosmos.iboot.page.sort.field.not.exist")); + } + Pages pages = Pages.of(query.getPage(), query.getPageSize(), query.getField(), query.getDir()); + Page page = pages.page(iBootTaskHostHistoryMapper.getListByTaskId(query)); + return page; + } + + @Override + public List getTaskHostHistoryList(String taskId) { + return iBootTaskHostHistoryMapper.getHostListByTaskId(taskId); + } + + @Override + public void insertTask(IBootTaskEntity iBootTaskEntity) { + iBootTaskMapper.insert(iBootTaskEntity); + } + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void insertTaskHost(IBootTaskHostEntity iBootTaskHostEntity) { + if (iBootTaskHostEntity != null && StringUtils.isNotEmpty(iBootTaskHostEntity.getSn())) { + DeviceEntity deviceEntity = new DeviceEntity(); + deviceEntity.setSn(iBootTaskHostEntity.getSn()); + deviceEntity.setStatus(DeviceStatusEnum.Busy); + deviceMapper.updateBySn(deviceEntity); + iBootTaskHostMapper.insert(iBootTaskHostEntity); + } + } + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void insertTaskHostList(List iBootTaskHostEntityList) { + if (CollUtil.isNotEmpty(iBootTaskHostEntityList)) { + iBootTaskHostMapper.insertList(iBootTaskHostEntityList); + } + } + + @Override + public void stopTaskByTaskHostId(String taskHostId) { + putStopMesByTaskHostId(taskHostId); + } + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public ResultBean retryTaskByTaskHostId(String taskHostId) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + //根据taskhostid查询历史数据 且查询设备为空闲状态 + IBootTaskHostHistoryEntity iBootTaskHostHistoryEntity = iBootTaskHostHistoryMapper.getListByTaskHostId(taskHostId); + if (iBootTaskHostHistoryEntity != null && StringUtils.isNotEmpty(iBootTaskHostHistoryEntity.getTaskId())) { + IBootTaskHistoryEntity iBootTaskHistoryEntity = iBootTaskHistoryMapper.getTaskHistoryByTaskId(iBootTaskHostHistoryEntity.getTaskId()); + if (iBootTaskHistoryEntity != null && StringUtils.isNotEmpty(iBootTaskHistoryEntity.getId())) { + IBootTaskEntity taskEntity = new IBootTaskEntity(); + taskEntity.setCreateUser(iBootTaskHistoryEntity.getExcuteUser()); + taskEntity.setTaskStatus(TaskHostStatusEnum.WAITING); + taskEntity.setUpdateTime(new Date()); + taskEntity.setCreateTime(new Date()); + taskEntity.setExecuteType("RUNTIME"); + taskEntity.setName(iBootTaskHistoryEntity.getName() + "_" + Languages.getString("cosmos.iboot.task.taskreTry")); + taskEntity.setTemplateId(iBootTaskHistoryEntity.getTemplateId()); + taskEntity.setTemplateName(iBootTaskHistoryEntity.getTemplateName()); + taskEntity.setTemplateType(iBootTaskHistoryEntity.getTemplateType()); + String taskId = UUID.fastUUID().toString(true); + taskEntity.setId(taskId); + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + iBootTaskHostEntity.setId(UUID.fastUUID().toString(true)); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.WAITING); + iBootTaskHostEntity.setCreateTime(new Date()); + iBootTaskHostEntity.setUpdateTime(new Date()); + iBootTaskHostEntity.setParam(iBootTaskHostHistoryEntity.getParam()); + iBootTaskHostEntity.setResourceId(iBootTaskHostHistoryEntity.getResourceId()); + iBootTaskHostEntity.setResourceIp(iBootTaskHostHistoryEntity.getResourceIp()); + iBootTaskHostEntity.setSn(iBootTaskHostHistoryEntity.getSn()); + iBootTaskHostEntity.setTemplateType(iBootTaskHistoryEntity.getTemplateType()); + iBootTaskHostEntity.setTaskId(taskId); + iBootTaskMapper.insert(taskEntity); + iBootTaskHostMapper.insert(iBootTaskHostEntity); + } else { + resultBean.setFlag(false); + resultBean.setData("Device no Online"); + } + } else { + resultBean.setFlag(false); + resultBean.setData("Device no Online"); + } + return resultBean; + } catch (Exception e) { + resultBean.setFlag(false); + resultBean.setData("Task Retry failed"); + log.error("Task Retry failed:" + e.getMessage()); + return resultBean; + } + } + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public ResultBean retryTaskByTaskId(String taskId) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + IBootTaskHistoryEntity iBootTaskHistoryEntity = iBootTaskHistoryMapper.getTaskHistoryByTaskId(taskId); + if (iBootTaskHistoryEntity != null && StringUtils.isNotEmpty(iBootTaskHistoryEntity.getId())) {//查出历史任务主表 + IBootTaskEntity taskEntity = new IBootTaskEntity();//组装任务主表数据 + taskEntity.setCreateUser(iBootTaskHistoryEntity.getExcuteUser()); + taskEntity.setTaskStatus(TaskHostStatusEnum.WAITING); + taskEntity.setUpdateTime(new Date()); + taskEntity.setCreateTime(new Date()); + taskEntity.setExecuteType("RUNTIME"); + taskEntity.setName(iBootTaskHistoryEntity.getName() + "_" + Languages.getString("cosmos.iboot.task.taskreTry")); + taskEntity.setTemplateId(iBootTaskHistoryEntity.getTemplateId()); + taskEntity.setTemplateName(iBootTaskHistoryEntity.getTemplateName()); + taskEntity.setTemplateType(iBootTaskHistoryEntity.getTemplateType()); + String taskIdnew = UUID.fastUUID().toString(true); + taskEntity.setId(taskIdnew); + //查出失败的设备,且查询设备为空闲状态 + List iBootTaskHostHistoryEntitys = iBootTaskHostHistoryMapper.getFailListByTaskId(taskId); + if (CollUtil.isNotEmpty(iBootTaskHostHistoryEntitys)) { + List iBootTaskHostEntities = new ArrayList<>(); + for (IBootTaskHostHistoryEntity iBootTaskHostHistoryEntity : iBootTaskHostHistoryEntitys) { + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + iBootTaskHostEntity.setId(UUID.fastUUID().toString(true)); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.WAITING); + iBootTaskHostEntity.setCreateTime(new Date()); + iBootTaskHostEntity.setUpdateTime(new Date()); + iBootTaskHostEntity.setParam(iBootTaskHostHistoryEntity.getParam()); + iBootTaskHostEntity.setResourceId(iBootTaskHostHistoryEntity.getResourceId()); + iBootTaskHostEntity.setResourceIp(iBootTaskHostHistoryEntity.getResourceIp()); + iBootTaskHostEntity.setSn(iBootTaskHostHistoryEntity.getSn()); + iBootTaskHostEntity.setTemplateType(iBootTaskHistoryEntity.getTemplateType()); + iBootTaskHostEntity.setTaskId(taskIdnew); + iBootTaskHostEntities.add(iBootTaskHostEntity); + } + iBootTaskMapper.insert(taskEntity); + iBootTaskHostMapper.insertList(iBootTaskHostEntities); + } else { + resultBean.setFlag(false); + resultBean.setData("Device no Online"); + } + } else { + resultBean.setFlag(false); + resultBean.setData("Device no Online"); + } + return resultBean; + } catch (Exception e) { + resultBean.setFlag(false); + resultBean.setData("Task Retry failed"); + log.error("Task Retry failed:" + e.getMessage()); + return resultBean; + } + } + + @Override + public void stopTaskByTaskId(String taskId) { + //查询任务正在运行中和等待中的数据 + List iBootTaskHostEntities = iBootTaskHostMapper.getRunningWaitingListByTaskId(taskId); + if (CollUtil.isNotEmpty(iBootTaskHostEntities)) { + iBootTaskHostEntities.forEach(iBootTaskHostEntity -> { + putStopMesByTaskHostId(iBootTaskHostEntity.getId()); + }); + } + } + + @Override + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void deleteTaskByTaskId(String taskId) { + //查询任务正在运行中和等待中的数据 + try { + if (StringUtils.isNotEmpty(taskId)) { + iBootTaskHistoryMapper.deleteByTaskId(taskId); + iBootTaskHostHistoryMapper.deleteByTaskId(taskId); + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + @Override + public void deleteTaskByTaskIds(List taskIds) { + //查询任务正在运行中和等待中的数据 + try { + if (CollUtil.isNotEmpty(taskIds)) { + for (String taskid : taskIds) { + deleteTaskByTaskId(taskid); + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + private void putStopMesByTaskHostId(String taskHostId) { + IBootTaskHostEntity iBootTaskHostEntitytemplate = iBootTaskHostMapper.getJobHostStatusById(taskHostId); + if (iBootTaskHostEntitytemplate != null && StringUtils.isNotEmpty(iBootTaskHostEntitytemplate.getId())) { + //修改状态为失败 + IBootTaskHostEntity iBootTaskHostEntity = new IBootTaskHostEntity(); + iBootTaskHostEntity.setId(taskHostId); + iBootTaskHostEntity.setJobHostStatus(TaskHostStatusEnum.FAILED); + iBootTaskHostEntity.setEndTime(new Date()); + iBootTaskMessageHandler.acceptStatusChangeBean(iBootTaskHostEntity); + //发送强制停止的日志 + IBootTaskHostLogEntity iBootTaskHostLogEntity = new IBootTaskHostLogEntity(); + iBootTaskHostLogEntity.setJobHostId(taskHostId); + iBootTaskHostLogEntity.setContent(Languages.getString("cosmos.iboot.task.taskstop")); + iBootTaskHostLogEntity.setCreateTime(new Date()); + iBootTaskHostLogEntity.setUpdateTime(new Date()); + iBootTaskMessageHandler.acceptTaskHostLogBean(iBootTaskHostLogEntity); + } + } + + @Override + public void triggerTask() { + iBootTaskMessageHandler.pollWaitingTask(); + } + + @Override + public void acceptStatusChangeBean(IBootTaskHostEntity iBootTaskHostEntity) { + iBootTaskMessageHandler.acceptStatusChangeBean(iBootTaskHostEntity); + } + + @Override + public void acceptTaskHostLogBean(IBootTaskHostLogEntity iBootTaskHostLogEntity) { + iBootTaskMessageHandler.acceptTaskHostLogBean(iBootTaskHostLogEntity); + } + + @Override + public List getTaskHostLogList(IBootTaskQueryBean query) { + List iBootTaskHostLogEntities = iBootTaskHostLogMapper.getByConditions(query.getJobHostId()); + if (CollectionUtil.isNotEmpty(iBootTaskHostLogEntities)) { + return iBootTaskHostLogEntities.stream().map(IBootTaskHostLogEntity::getContent).collect(Collectors.toList()); + } + return Arrays.asList(); + } + + @Override + public Page getTaskHistoryList(IBootTaskQueryBean query) { +// PageRequest.checkPage(query); + if (!BeanUtil.beanToMap(new IBootTaskEntity(), false, false).containsKey(query.getField())) { + throw new PimException(Languages.getString("cosmos.iboot.page.sort.field.not.exist")); + } + Pages pages = Pages.of(query.getPage(), query.getPageSize(), query.getField(), query.getDir()); + Page page = pages.page(iBootTaskHistoryMapper.getByConditions(query)); + List iBootTaskHistoryEntities = page.getData(); + iBootTaskHistoryEntities.forEach(iBootTaskHistoryEntity -> { + IBootTaskJobBean iBootTaskJobBean = iBootTaskHostHistoryMapper.getIBootTaskJobByTaskId(iBootTaskHistoryEntity.getTaskId()); + if (iBootTaskJobBean.getFailNum() != 0 && iBootTaskJobBean.getSuccessNum() != 0) {//成功失败个数都不为0,则为部分成功 + iBootTaskHistoryEntity.setTaskStatus(TaskHostStatusEnum.PART_SUCCESS); + } else if (iBootTaskJobBean.getFailNum() == 0 && iBootTaskJobBean.getSuccessNum() != 0) {//失败个数为0.成功不为0,则为成功 + iBootTaskHistoryEntity.setTaskStatus(TaskHostStatusEnum.SUCCESS); + } else { + iBootTaskHistoryEntity.setTaskStatus(TaskHostStatusEnum.FAILED); + } + iBootTaskHistoryEntity.setIBootTaskJobBean(iBootTaskJobBean); + }); + return page; + } + + @Override + public IBootTaskHistoryEntity getTaskHistory(String taskId) { + return iBootTaskHistoryMapper.getTaskHistoryByTaskId(taskId); + } + + @Override + public List searchTemplateIsInTask(String templateId) { + return iBootTaskMapper.getByTemplateId(templateId); + } + + @Override + public IBootTaskHostEntity getTaskHost(String jobHostId) { + return iBootTaskHostMapper.getJobHostStatusById(jobHostId); + } + + @Override + public TotalBean getTotal() { + return iBootTaskHistoryMapper.getTotal(); + } + + @Override + public DeviceShowBean getDeviceShow() { + return deviceMapper.getDeviceShow(); + } + + @Override + public List getTemplateShow() { + return iBootTaskHostHistoryMapper.getTemplateShow(); + } + + @Override + public List getImageShow() { + return iBootTaskHostHistoryMapper.getImageShow(); + } + + @Override + public List getTaskHistoryListTopten() { + return iBootTaskHistoryMapper.getTaskHistoryListTopten(); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootEsxiOsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootEsxiOsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5f15993f1e3d7c238fa3dffeb71c43f62384c1ed --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootEsxiOsInstallServiceImpl.java @@ -0,0 +1,280 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import cn.hutool.json.JSONUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootIPSetBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootInstallParamBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootOsInstallBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootOsIp; +import com.inspur.ispim.cosmos.iboot.base.api.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/21 + */ +@Slf4j +public class IBootEsxiOsInstallServiceImpl extends IBootOsInstallServiceImpl { + + @Override + public ResultBean getDefaultKs() { + String content = ""; + String preScript = ""; + String postScript = ""; + try { + content = IBootFileUtil.readFileStr(new File(IBootPathConstant.IBootEsxiExamplePathDefault)); + } catch (Exception e) { + log.error(e.getMessage()); + } + Map map = new HashMap<>(); + map.put("content", content); + map.put("preScript", preScript); + map.put("postScript", postScript); + return new ResultBean(true, "", map); + } + + @Override + public String autoPartition() { + return "clearpart --firstdisk=local --overwritevmfs\n" + "install --firstdisk=local --overwritevmfs"; + } + + @Override + public String createKsFileByUI(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + List replaceBeanList = new ArrayList<>(); + // 网络 + String netConfig = ""; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + String hostName = osNet[1]; + netConfig += "esxcli system hostname set --host " + hostName; + } + // ks内容 + if (StringUtils.isEmpty(iBootOsInstallBean.getRootPw())) { + iBootOsInstallBean.setRootPw("Inspur1!"); + } + replaceBeanList.add(new ReplaceBean("osPwTmp", iBootOsInstallBean.getRootPw())); + replaceBeanList.add(new ReplaceBean("diskPartition", iBootOsInstallBean.getDiskPartition())); + replaceBeanList.add(new ReplaceBean("@post1", netConfig)); + // curl,6.7和7.0以上不同 + String pre = ""; + String post = ""; + if (iBootOsInstallBean.getVersion().equalsIgnoreCase("ESXI6.7")) { + pre = ("import pycurl\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "data=json.dumps({\"content\":\"OSRUNNING\",\"jobHostId\":\"@jobHostId\"})\n" + + "c=pycurl.Curl()\n" + + "c.setopt(pycurl.URL,url)\n" + + "c.setopt(pycurl.CUSTOMREQUEST,\"POST\")\n" + + "c.setopt(pycurl.POSTFIELDS,data)\n" + + "c.setopt(c.HTTPHEADER,['Content-Type:application/json;charset=utf-8'])\n" + + "c.perform()\n" + + "c.close").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + post = ("import pycurl\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "data=json.dumps({\"content\":\"OSFINISH\",\"jobHostId\":\"@jobHostId\"})\n" + + "c=pycurl.Curl()\n" + + "c.setopt(pycurl.URL,url)\n" + + "c.setopt(pycurl.CUSTOMREQUEST,\"POST\")\n" + + "c.setopt(pycurl.POSTFIELDS,data)\n" + + "c.setopt(c.HTTPHEADER,['Content-Type:application/json;charset=utf-8'])\n" + + "c.perform()\n" + + "url='http://@ip:30100/v1/iboot/taskStatusChange'\n" + + "data=json.dumps({\"jobHostStatus\":\"SUCCESS\",\"id\":\"@jobHostId\"})\n" + + "c.setopt(pycurl.URL,url)\n" + + "c.setopt(pycurl.CUSTOMREQUEST,\"POST\")\n" + + "c.setopt(pycurl.POSTFIELDS,data)\n" + + "c.setopt(c.HTTPHEADER,['Content-Type:application/json;charset=utf-8'])\n" + + "c.perform()\n" + + "c.close").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + } else { + pre = ("import urllib.request as urllib2\n" + + "import urllib\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "_body={\"content\":\"OSRUNNING\",\"jobHostId\":\"@jobHostId\"}\n" + + "_json_data=json.dumps(_body).encode('utf8')\n" + + "header={\"Content-Type\" : \"application/json;charset=utf-8\"}\n" + + "request=urllib2.Request(url=url,data=_json_data,headers=header)\n" + + "urllib2.urlopen(request)").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + post = ("import urllib.request as urllib2\n" + + "import urllib\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "_body={\"content\":\"OSFINISH\",\"jobHostId\":\"@jobHostId\"}\n" + + "_json_data=json.dumps(_body).encode('utf8')\n" + + "header={\"Content-Type\" : \"application/json;charset=utf-8\"}\n" + + "request=urllib2.Request(url=url,data=_json_data,headers=header)\n" + + "urllib2.urlopen(request)\n" + + "url='http://@ip:30100/v1/iboot/taskStatusChange'\n" + + "_body={\"jobHostStatus\":\"SUCCESS\",\"id\":\"@jobHostId\"}\n" + + "_json_data=json.dumps(_body).encode('utf8')\n" + + "request=urllib2.Request(url=url,data=_json_data,headers=header)\n" + + "urllib2.urlopen(request)").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + } + replaceBeanList.add(new ReplaceBean("@pre", pre)); + replaceBeanList.add(new ReplaceBean("@post2", post)); + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg"); + ReplaceUtil.autoReplaceNew(queryKsFileName(), IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg", replaceBeanList); + return IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg"; + } + + @Override + public String createKsFile(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) throws IOException { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + // 网络 + String netConfig = ""; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + String hostName = osNet[1]; + netConfig += "esxcli system hostname set --host " + hostName; + } + // ks内容 + String ks = iBootOsInstallBean.getKsContent(); + // curl,6.7和7.0以上不同 + String pre = ""; + String post = ""; + if (iBootOsInstallBean.getVersion().equalsIgnoreCase("ESXI6.7")) { + pre = ("import pycurl\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "data=json.dumps({\"content\":\"OSRUNNING\",\"jobHostId\":\"@jobHostId\"})\n" + + "c=pycurl.Curl()\n" + + "c.setopt(pycurl.URL,url)\n" + + "c.setopt(pycurl.CUSTOMREQUEST,\"POST\")\n" + + "c.setopt(pycurl.POSTFIELDS,data)\n" + + "c.setopt(c.HTTPHEADER,['Content-Type:application/json;charset=utf-8'])\n" + + "c.perform()\n" + + "c.close").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + post = ("import pycurl\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "data=json.dumps({\"content\":\"OSFINISH\",\"jobHostId\":\"@jobHostId\"})\n" + + "c=pycurl.Curl()\n" + + "c.setopt(pycurl.URL,url)\n" + + "c.setopt(pycurl.CUSTOMREQUEST,\"POST\")\n" + + "c.setopt(pycurl.POSTFIELDS,data)\n" + + "c.setopt(c.HTTPHEADER,['Content-Type:application/json;charset=utf-8'])\n" + + "c.perform()\n" + + "url='http://@ip:30100/v1/iboot/taskStatusChange'\n" + + "data=json.dumps({\"jobHostStatus\":\"SUCCESS\",\"id\":\"@jobHostId\"})\n" + + "c.setopt(pycurl.URL,url)\n" + + "c.setopt(pycurl.CUSTOMREQUEST,\"POST\")\n" + + "c.setopt(pycurl.POSTFIELDS,data)\n" + + "c.setopt(c.HTTPHEADER,['Content-Type:application/json;charset=utf-8'])\n" + + "c.perform()\n" + + "c.close").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + } else { + pre = ("import urllib.request as urllib2\n" + + "import urllib\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "_body={\"content\":\"OSRUNNING\",\"jobHostId\":\"@jobHostId\"}\n" + + "_json_data=json.dumps(_body).encode('utf8')\n" + + "header={\"Content-Type\" : \"application/json;charset=utf-8\"}\n" + + "request=urllib2.Request(url=url,data=_json_data,headers=header)\n" + + "urllib2.urlopen(request)").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + post = ("import urllib.request as urllib2\n" + + "import urllib\n" + + "import json\n" + + "url='http://@ip:30100/v1/iboot/taskLogAccept'\n" + + "_body={\"content\":\"OSFINISH\",\"jobHostId\":\"@jobHostId\"}\n" + + "_json_data=json.dumps(_body).encode('utf8')\n" + + "header={\"Content-Type\" : \"application/json;charset=utf-8\"}\n" + + "request=urllib2.Request(url=url,data=_json_data,headers=header)\n" + + "urllib2.urlopen(request)\n" + + "url='http://@ip:30100/v1/iboot/taskStatusChange'\n" + + "_body={\"jobHostStatus\":\"SUCCESS\",\"id\":\"@jobHostId\"}\n" + + "_json_data=json.dumps(_body).encode('utf8')\n" + + "request=urllib2.Request(url=url,data=_json_data,headers=header)\n" + + "urllib2.urlopen(request)").replace("@ip", iBootIp).replace("@jobHostId", taskHostId).replace("30100", IBootPathConstant.getIBootPort()); + } + ks = ks + "\n\n" + "%pre --interpreter=python\n" + pre + "\n\n" + "%firstboot --interpreter=busybox\n" + netConfig + "\n\n" + "%firstboot --interpreter=python\n" + post + "\n"; + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg"); + IBootFileUtil.writeFile(IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg", ks.getBytes()); + if (OperationSystemUtil.isWindows()) { + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("\r", "")); + ReplaceUtil.autoReplace(IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg", replaceBeanList); + } else { + String cmd = "sed -i 's/\\r//g' " + IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg"; + ExecCommand execCommand = new ExecCommand(); + execCommand.runLocal(cmd); + } + return IBootPathConstant.EsxiTemplateFile + File.separator + mac.replace(":", "") + ".cfg"; + } + + @Override + public String[] osNetConfig(IBootInstallParamBean iBootInstallParamBean, String sn) { + String netConfig = "esxcli network firewall set -e false\n"; + String hostName = "manageos"; + if (StringUtils.isNotEmpty(iBootInstallParamBean.getNetworkBean())) { + List iBootIPSetBeans = JSONUtil.toList(iBootInstallParamBean.getNetworkBean(), IBootIPSetBean.class); + for (IBootIPSetBean iBootIPSetBean : iBootIPSetBeans) { + if (iBootIPSetBean.getSn().equalsIgnoreCase(sn)) { + hostName = iBootIPSetBean.getHostname(); + for (IBootOsIp iBootOsIp : iBootIPSetBean.getOsIpList()) { + netConfig += String.format("esxcli network ip interface ipv4 set -i %s -I %s -N %s -t static\nesxcli network ip route ipv4 add -g %s -n default\n", + iBootOsIp.getNetInterface(), iBootOsIp.getIp(), iBootOsIp.getNetmask(), iBootOsIp.getGateway()); + } + break; + } + } + } + return new String[]{netConfig, hostName}; + } + + @Override + public void copyFile(IBootOsInstallBean iBootOsInstallBean, String sn) { + // boot.cfg,用sn命名 + String webFileIp = CommonUtil.getWebServerIp(); + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("/", "")); + String prefix = "prefix=" + String.format("http://%s:32352/", webFileIp) + "osInstall/mount/" + iBootOsInstallBean.getImageFileId() + "/"; + replaceBeanList.add(new ReplaceBean("prefix=", prefix)); + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.EsxiTemplateFile + File.separator + sn + ".cfg"); + ReplaceUtil.autoReplaceNew(IBootPathConstant.MountImageFile + File.separator + iBootOsInstallBean.getImageFileId() + File.separator + "boot.cfg", IBootPathConstant.EsxiTemplateFile + File.separator + sn + ".cfg", replaceBeanList); + } + + @Override + public void insertMacIni(String imageFileId, String ksPath, String mac, String sn, String boodMode) { + String webFileIp = CommonUtil.getWebServerIp(); + String kernel; + if (boodMode.equalsIgnoreCase("UEFI")) { + kernel = IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "efi" + File.separator + "boot" + File.separator + "bootx64.efi"; + } else { + kernel = IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "mboot.c32"; + } + String macContent = String.format("\n:%s\nkernel %s -c %s ks=%s\nboot" + "\r\n", mac, + kernel.replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + (IBootPathConstant.EsxiTemplateFile + File.separator + sn + ".cfg").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + ksPath.replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/")); + IBootMacFileUtil.stringAddFile(macContent, IBootPathConstant.MacIniFile); + } + + @Override + public String queryKsFileName() { + return IBootPathConstant.EsxiTemplateFile + File.separator + "esxiks.cfg"; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootKylinOsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootKylinOsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8e0f34beba6ea46423c6549ac0438ea9c039ac3b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootKylinOsInstallServiceImpl.java @@ -0,0 +1,54 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import cn.hutool.core.util.StrUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootFileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import lombok.extern.slf4j.Slf4j; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/21 + */ +@Slf4j +public class IBootKylinOsInstallServiceImpl extends IBootOsInstallServiceImpl { + + @Override + public String queryKsFileName() { + return IBootPathConstant.KylinTemplateFile + File.separator + "kylinks.cfg"; + } + + @Override + public ResultBean getDefaultKs() { + String content = ""; + String preScript = ""; + String postScript = ""; + String str; + try { + //redhat centos kylin kos + str = IBootFileUtil.readFileStr(new File(IBootPathConstant.IBootKylinExamplePathDefault)); + // 分解获取content postscript prescript + if (StrUtil.isNotEmpty(str)) { + String[] strs = str.split("%end"); + if (strs.length >= 4) { + preScript = strs[0] + "%end\r\n"; + postScript = strs[2] + "%end\r\n"; + content = strs[1] + "%end\r\n" + strs[3] + "%end\r\n"; + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + Map map = new HashMap<>(); + map.put("content", content); + map.put("preScript", preScript); + map.put("postScript", postScript); + return new ResultBean(true, "", map); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootOsInstallFactory.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootOsInstallFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..9173267c501d4acf4b8827af6c25b034417bd799 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootOsInstallFactory.java @@ -0,0 +1,79 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootOsInstallService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/16 + */ +@Slf4j +@Component("iBootOsInstallFactory") +public class IBootOsInstallFactory { + + /** + * 标记系统类型 + */ + public static final String OS_TYPE_LINUX = "Linux"; + public static final String OS_TYPE_CENTOS = "CentOS"; + public static final String OS_TYPE_REDHAT = "RHEL"; + public static final String OS_TYPE_KOS = "KOS"; + public static final String OS_TYPE_NEOKYLIN = "NeoKylin"; + public static final String OS_TYPE_UBUNTU = "Ubuntu"; + public static final String OS_TYPE_WINDOWS = "Windows"; + public static final String OS_TYPE_ESXI = "ESXI"; + public static final String OS_TYPE_UOS = "UOS"; + public static final String OS_TYPE_SUSE = "SUSE"; + public static final String OS_TYPE_KYLIN = "Kylin"; + + /** + * 根据系统类型获取实现类 + * + * @param imageType + * @param version + * @return + */ + public IBootOsInstallService getOsInstallImpl(String imageType, String version) { + IBootOsInstallService iBootOsInstallService; + try { + switch (imageType) { + case OS_TYPE_KYLIN: + iBootOsInstallService = new IBootKylinOsInstallServiceImpl(); + break; + case OS_TYPE_ESXI: + iBootOsInstallService = new IBootEsxiOsInstallServiceImpl(); + break; + case OS_TYPE_SUSE: + if (version.contains("15")) { + iBootOsInstallService = new IBootSuse15OsInstallServiceImpl(); + } else { + iBootOsInstallService = new IBootSuseOsInstallServiceImpl(); + } + break; + case OS_TYPE_UOS: + iBootOsInstallService = new IBootUosOsInstallServiceImpl(); + break; + case OS_TYPE_WINDOWS: + iBootOsInstallService = new IBootWindowsOsInstallServiceImpl(); + break; + case OS_TYPE_REDHAT: + if (version.contains("9U")) { + iBootOsInstallService = new IBootRH9OsInstallServiceImpl(); + } else { + iBootOsInstallService = new IBootOsInstallServiceImpl(); + } + break; + default: + iBootOsInstallService = new IBootOsInstallServiceImpl(); + break; + } + } catch (Exception e) { + log.error("get osInstallServiceImpl error:" + e.getMessage()); + iBootOsInstallService = new IBootOsInstallServiceImpl(); + } + return iBootOsInstallService; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootOsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootOsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..85b62b4c94956232fd7d3c703de8e57fcb956598 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootOsInstallServiceImpl.java @@ -0,0 +1,421 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONArray; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.*; +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootOsInstallService; +import com.inspur.ispim.cosmos.iboot.base.api.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import tk.mybatis.mapper.util.StringUtil; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/16 + */ +@Slf4j +@Service +public class IBootOsInstallServiceImpl implements IBootOsInstallService { + + /** + * 分区的设备类型 + */ + static final String PART_DEVICE_TYPE_STANDARDPARTITION = "standardPartition"; + static final String PART_DEVICE_TYPE_LVM = "lvm"; + static final String PART_DEVICE_TYPE_LVM_SIMPLE = "lvmSimple"; + + /** + * 磁盘默认 + */ + static final String DEFAULT_DISK = "默认"; + static final String DEFAULT_DISK_EN = "Default"; + + @Override + public ResultBean getDefaultKs() { + String content = ""; + String preScript = ""; + String postScript = ""; + String str; + try { + //redhat centos kylin kos + str = IBootFileUtil.readFileStr(new File(IBootPathConstant.IBootKsExamplePathDefault)); + // 分解获取content postscript prescript + if (StrUtil.isNotEmpty(str)) { + String[] strs = str.split("%end"); + if (strs.length >= 4) { + preScript = strs[0] + "%end\r\n"; + postScript = strs[2] + "%end\r\n"; + content = strs[1] + "%end\r\n" + strs[3] + "%end\r\n"; + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + Map map = new HashMap<>(); + map.put("content", content); + map.put("preScript", preScript); + map.put("postScript", postScript); + return new ResultBean(true, "", map); + } + + @Override + public String configNetwork(InputStream inputStream, IBootInstallParamBean iBootInstallParamBean, String taskId) { + IBootExcelReaderUtil excelReaderUtil = new IBootExcelReaderUtil(); + if (iBootInstallParamBean.getIsBond()) { // 解析Bond配置 + List bondSet = excelReaderUtil.readExcelBondImport(inputStream, MagicNumber.M1, MagicNumber.M2); + if (CollUtil.isEmpty(bondSet)) { + return ""; + } + return JSONUtil.toJsonStr(bondSet); + } else { + List ipSet = excelReaderUtil.readExcelAssetImport(inputStream, MagicNumber.M1, MagicNumber.M2); + if (CollUtil.isEmpty(ipSet)) { + return ""; + } + return JSONUtil.toJsonStr(ipSet); + } + } + + @Override + public String diskPartition(IBootOsInstallBean iBootOsInstallBean) { + StringBuilder sb = new StringBuilder(); + if (iBootOsInstallBean.isCustomPart()) { + if (iBootOsInstallBean.getDiskPartitionType() == 1) { // 图形化分区 + sb.append("clearpart --all --initlabel").append("\n"); + List partList = JSONArray.parseArray(iBootOsInstallBean.getPreDiskPartition(), IBootPartBean.class); + if (CollUtil.isEmpty(partList)) { + sb.append("part swap --fstype=swap --size=16384").append("\n"); + sb.append("part /boot --fstype=ext4 --size=500").append("\n"); + sb.append("part /boot/efi --fstype=efi --size=256").append("\n"); + sb.append("part / --fstype=ext4 --size=1 --grow"); + } else { + List volumeGroupList = new ArrayList<>(); + //先判断 有没有swap /boot /boot/efi / + if (partList.stream().allMatch(partBean -> partBean.getDeviceType().equalsIgnoreCase(PART_DEVICE_TYPE_STANDARDPARTITION))) { + if (partList.stream().noneMatch(partBean -> partBean.getMountPoint().equalsIgnoreCase("swap"))) { + sb.append("part swap --fstype=swap --size=16384").append("\n"); + } + if (partList.stream().noneMatch(partBean -> partBean.getMountPoint().equalsIgnoreCase("/boot"))) { + sb.append("part /boot --fstype=ext4 --size=500").append("\n"); + } + if (partList.stream().noneMatch(partBean -> partBean.getMountPoint().equalsIgnoreCase("/boot/efi"))) { + sb.append("part /boot/efi --fstype=efi --size=256").append("\n"); + } + if (partList.stream().noneMatch(partBean -> partBean.getMountPoint().equalsIgnoreCase("/"))) { + sb.append("part / --fstype=ext4 --size=20480").append("\n"); + } + } + for (IBootPartBean part : partList) { + //逻辑卷组 + if (part.getDeviceType().equals(PART_DEVICE_TYPE_LVM)) { // 逻辑分区 + // suse lvm 分区处理 + IBootPartBean.VolumeGroup volumeGroup = part.getVolumeGroup(); + // 逻辑卷组获取 + boolean isHaveThisGroup = false; + for (IBootPartBean.VolumeGroup group : volumeGroupList) { + if (group.getName().equals(volumeGroup.getName())) { + isHaveThisGroup = true; + break; + } + } + if (!isHaveThisGroup && (volumeGroup != null)) { + // 添加自动分区的处理或手动分区未选择分区的处理 + if (volumeGroup.getName().equals("autopartlvm") && volumeGroup.getDisk().equals("auto")) { + sb.append("part pv.autopartlvm --size=1 --grow --ondisk=sda").append("\n"); + sb.append("volgroup autopartlvm pv.autopartlvm").append("\n"); + } else { + //为逻辑卷组创建分区,分区前必须加.否则分区不通过 + String partName = "pv." + volumeGroup.getName(); + // 逻辑分区修改,此处删除--fstype='lvmpv' + sb.append("part ").append(partName).append(" --size=").append(volumeGroup.getCapacity()); + if (1 == volumeGroup.getCapacity()) { + sb.append(" --grow"); + } + if (StringUtil.isNotEmpty(volumeGroup.getDisk()) && !volumeGroup.getDisk().equals(DEFAULT_DISK) + && !volumeGroup.getDisk().equals(DEFAULT_DISK_EN)) { + sb.append(" --ondisk=").append(volumeGroup.getDisk()); + } + sb.append("\n"); + //创建逻辑卷组 + sb.append("volgroup ").append(volumeGroup.getName()).append(" ").append(partName).append("\n"); + } + //将卷组信息存入List,防止重复创建 + volumeGroupList.add(volumeGroup); + //创建逻辑卷 + sb.append("logvol ").append(part.getMountPoint()).append(" --vgname=") + .append(volumeGroup.getName()).append(" --size=").append(part.getCapacity()) + .append(" --name=").append(part.getVolume()); + // 添加 --grow判断 + if (part.isGrow()) { + sb.append(" --grow"); + } + sb.append("\n"); + } + } else if (part.getDeviceType().equals(PART_DEVICE_TYPE_STANDARDPARTITION)) { // 标准分区 + sb.append("part ").append(part.getMountPoint()).append(" --fstype=").append(part.getFsType()) + .append(" --size=").append(part.getCapacity()); + if (StringUtil.isNotEmpty(part.getDisk()) + && !part.getDisk().equals(DEFAULT_DISK) + && !part.getDisk().equals(DEFAULT_DISK_EN)) { + sb.append(" --ondisk=").append(part.getDisk()); + } else if (StringUtil.isEmpty(part.getDisk())) { + sb.append(" --ondisk=").append("sda"); + } + if (part.isGrow()) { + sb.append(" --grow"); + } + sb.append("\n"); + } else if (part.getDeviceType().equals(PART_DEVICE_TYPE_LVM_SIMPLE)) { // 简易模式的默认ks文件采用lvm分区方式处理 + // 若为home则跳过 + if (part.getMountPoint().contains("home")) { + continue; + } + if (part.getMountPoint().contains("boot")) { + sb.append("part ").append(part.getMountPoint()); + sb.append(" --fstype=").append(part.getFsType()); + } else { + sb.append("logvol ").append(part.getMountPoint()); + sb.append(" --vgname=lvmos"); + } + sb.append(" --size=").append(part.getCapacity()); + if (StringUtil.isNotEmpty(part.getDisk()) + && !part.getDisk().equals(DEFAULT_DISK) + && !part.getDisk().equals(DEFAULT_DISK_EN)) { + sb.append(" --ondisk=").append(part.getDisk()); + } + if (part.isGrow()) { + sb.append(" --grow"); + } + if (part.getMountPoint().contains("swap")) { + sb.append(" --name=swap"); + } else if (part.getMountPoint().contains("home")) { + sb.append(" --name=home"); + } else if (part.getMountPoint().contains("boot")) { + } else { + sb.append(" --name=root"); + } + sb.append("\n"); + if (part.getMountPoint().contains("boot")) { + sb.append("part pv.simplelvm --size=1 --grow --ondisk=sda").append("\n").append("volgroup lvmos pv.simplelvm").append("\n"); + } + } + } + } + return sb.toString(); + } else { // 命令行分区 + return iBootOsInstallBean.getDiskPartition(); + } + } else { + return autoPartition(); + } + } + + @Override + public String autoPartition() { + String diskPartition = "clearpart --all --initlabel" + "\n"; + diskPartition = diskPartition + "autopart" + "\n"; + return diskPartition; + } + + @Override + public String createKsFileByUI(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + String webFileIp = CommonUtil.getWebServerIp(); + List replaceBeanList = new ArrayList<>(); + // 网络 + String netConfig = "network --hostname=manageos --onboot=yes --bootproto=dhcp"; + String hostName = "manageos"; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + hostName = osNet[1]; + } + // ks内容 + if (StringUtils.isEmpty(iBootOsInstallBean.getRootPw())) { + iBootOsInstallBean.setRootPw("123456Aa?"); + } + replaceBeanList.add(new ReplaceBean("osPwTmp", iBootOsInstallBean.getRootPw())); + replaceBeanList.add(new ReplaceBean("zh_CN", iBootOsInstallBean.getLanguage())); + replaceBeanList.add(new ReplaceBean("diskPartition", iBootOsInstallBean.getDiskPartition())); + replaceBeanList.add(new ReplaceBean("Asia/Shanghai", iBootOsInstallBean.getTimeZone())); + if (StringUtils.isNotEmpty(iBootOsInstallBean.getBaseE())) { + replaceBeanList.add(new ReplaceBean("baseE", iBootOsInstallBean.getBaseE())); + } else { + replaceBeanList.add(new ReplaceBean("@^baseE", "")); + } + if (StrUtil.isNotEmpty(iBootOsInstallBean.getSoftwareSelected())) { + // 处理选择项 + String[] strs = iBootOsInstallBean.getSoftwareSelected().split(","); + String soft = ""; + for (String str : strs) { + soft += "@" + str + "\n"; + } + replaceBeanList.add(new ReplaceBean("@core", soft.trim())); + } + if (isBond) { + replaceBeanList.add(new ReplaceBean("%include /tmp/net-include", String.format("network --hostname=%s --onboot=yes --bootproto=dhcp", hostName))); + replaceBeanList.add(new ReplaceBean("@bond", netConfig)); + } else { + replaceBeanList.add(new ReplaceBean("%include /tmp/net-include", netConfig)); + replaceBeanList.add(new ReplaceBean("@bond", "")); + } + String hostCmd = String.format("echo '%s' > /etc/hostname", hostName); + replaceBeanList.add(new ReplaceBean("@hostname", hostCmd)); + replaceBeanList.add(new ReplaceBean("@jobHostId", taskHostId)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + replaceBeanList.add(new ReplaceBean("@path", + (IBootPathConstant.MountImageFile + File.separator + iBootOsInstallBean.getImageFileId() + File.separator).replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"))); + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg"); + ReplaceUtil.autoReplaceNew(queryKsFileName(), IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg", replaceBeanList); + return IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg"; + } + + @Override + public String createKsFile(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) throws IOException { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + String webFileIp = CommonUtil.getWebServerIp(); + // 网络 + String netConfig = "network --hostname=manageos --onboot=yes --bootproto=dhcp"; + String hostName = "manageos"; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + hostName = osNet[1]; + } + // ks内容 + String ks = IBootFileUtil.readFileStr(new File(queryKsFileName())); + String[] strs = ks.split("%end"); + if (strs.length < 3) { + return ""; + } + // 前置 + if (StrUtil.isNotEmpty(iBootOsInstallBean.getPreScript())) { + String preScript = iBootOsInstallBean.getPreScript().replace("%pre", "#"); + preScript = preScript.replace("%end", ""); + strs[0] = strs[0] + "\n" + preScript; + } else { + strs[0] = strs[0] + "\n" + iBootOsInstallBean.getPreScript(); + } + String hostCmd = String.format("echo '%s' > /etc/hostname", hostName); + strs[0] = strs[0].replace("@hostname", hostCmd).replace("@jobHostId", taskHostId).replace("@ip", iBootIp).replace("30100", IBootPathConstant.getIBootPort()); + // 后置 + if (StrUtil.isNotEmpty(iBootOsInstallBean.getPostScript())) { + String postScript = iBootOsInstallBean.getPostScript().replace("%post", "#"); + postScript = postScript.replace("%end", ""); + strs[2] = strs[2] + "\n" + postScript; + } else { + strs[2] = strs[2] + "\n" + iBootOsInstallBean.getPostScript(); + } + if (isBond) { + strs[2] = strs[2].replace("@bond", netConfig); + } else { + strs[2] = strs[2].replace("@bond", ""); + } + strs[2] = strs[2].replace("@jobHostId", taskHostId).replace("@ip", iBootIp).replace("30100", IBootPathConstant.getIBootPort()); + // ks + if (StrUtil.isNotEmpty(iBootOsInstallBean.getKsContent())) { + String ksContent = iBootOsInstallBean.getKsContent(); + if (!isBond) { + strs[1] = ksContent.replace("%packages", netConfig + "\n" + "%packages"); + } else { + strs[1] = ksContent; + } + } + strs[1] = strs[1].replace("@path", + (IBootPathConstant.MountImageFile + File.separator + iBootOsInstallBean.getImageFileId() + File.separator).replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/")); + StringBuffer sb = new StringBuffer(); + for (String str : strs) { + if (!str.equalsIgnoreCase("\r\n")) { + sb.append(str).append("%end").append("\n"); + } + } + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg"); + IBootFileUtil.writeFile(IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg", sb.toString().getBytes()); + if (OperationSystemUtil.isWindows()) { + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("\r", "")); + ReplaceUtil.autoReplace(IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg", replaceBeanList); + } else { + String cmd = "sed -i 's/\\r//g' " + IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg"; + ExecCommand execCommand = new ExecCommand(); + execCommand.runLocal(cmd); + } + return IBootPathConstant.KsTemplateFile + File.separator + mac.replace(":", "") + ".cfg"; + } + + @Override + public String[] osNetConfig(IBootInstallParamBean iBootInstallParamBean, String sn) { + String netConfig = "network --hostname=manageos --onboot=yes --bootproto=dhcp"; + String hostName = "manageos"; + if (StringUtils.isNotEmpty(iBootInstallParamBean.getNetworkBean())) { + if (iBootInstallParamBean.getIsBond()) { + List iBootBondSetBeans = JSONUtil.toList(iBootInstallParamBean.getNetworkBean(), IBootBondSetBean.class); + for (IBootBondSetBean iBootBondSetBean : iBootBondSetBeans) { + if (iBootBondSetBean.getSn().equalsIgnoreCase(sn)) { + hostName = iBootBondSetBean.getHostname(); + netConfig = iBootInstallParamBean.getBondScript().replace("$name", iBootBondSetBean.getBondName()).replace("$ip4", iBootBondSetBean.getBondIp()).replace("$gw4", iBootBondSetBean.getGateway()); + break; + } + } + } else { + List iBootIPSetBeans = JSONUtil.toList(iBootInstallParamBean.getNetworkBean(), IBootIPSetBean.class); + for (IBootIPSetBean iBootIPSetBean : iBootIPSetBeans) { + if (iBootIPSetBean.getSn().equalsIgnoreCase(sn)) { + hostName = iBootIPSetBean.getHostname(); + netConfig = ""; + for (IBootOsIp iBootOsIp : iBootIPSetBean.getOsIpList()) { + netConfig += String.format("network --device=%s --onboot=yes --hostname=%s --bootproto=static --ip=%s --netmask=%s --gateway=%s\n", iBootOsIp.getNetInterface(), hostName, iBootOsIp.getIp(), iBootOsIp.getNetmask(), iBootOsIp.getGateway()); + } + break; + } + } + } + } + return new String[]{netConfig, hostName}; + } + + @Override + public void copyFile(IBootOsInstallBean iBootOsInstallBean, String sn) { + } + + @Override + public void insertMacIni(String imageFileId, String ksPath, String mac, String sn, String boodMode) { + String webFileIp = CommonUtil.getWebServerIp(); + String macContent = String.format("\n:%s\ninitrd %s\nkernel %s ksdevice=bootif lang=kssendmac text ks=%s initrd=initrd.img\nboot" + "\r\n", mac, + (IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "isolinux/initrd.img").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + (IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "isolinux/vmlinuz").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + ksPath.replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/")); + IBootMacFileUtil.stringAddFile(macContent, IBootPathConstant.MacIniFile); + } + + @Override + public String queryKsFileName() { + return IBootPathConstant.KsTemplateFile + File.separator + "ks.cfg"; + } + + @Override + public String startSh(String iBootIp, String taskHostId) { + return "#!/bin/bash\nipmitool chassis bootdev pxe\nsleep 10\nreboot\n"; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootRH9OsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootRH9OsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5b802fb506918b401258db4f7d0b9e1a91ce02e6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootRH9OsInstallServiceImpl.java @@ -0,0 +1,24 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +//import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; + +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootMacFileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; + +import java.io.File; + +public class IBootRH9OsInstallServiceImpl extends IBootOsInstallServiceImpl { + + @Override + public void insertMacIni(String imageFileId, String ksPath, String mac, String sn, String boodMode) { + String webFileIp = CommonUtil.getWebServerIp(); + String macContent = String.format("\n:%s\ninitrd %s\nkernel %s inst.repo=%s ksdevice=bootif lang=kssendmac text inst.ks=%s initrd=initrd.img\nboot" + "\r\n", mac, + (IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "isolinux/initrd.img").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + (IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "isolinux/vmlinuz").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + (IBootPathConstant.MountImageFile + File.separator + imageFileId).replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + ksPath.replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/")); + IBootMacFileUtil.stringAddFile(macContent, IBootPathConstant.MacIniFile); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootSuse15OsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootSuse15OsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d18db213f69754ee205f0234ef7746bcd03ae2e6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootSuse15OsInstallServiceImpl.java @@ -0,0 +1,121 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootInstallParamBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootOsInstallBean; +import com.inspur.ispim.cosmos.iboot.base.api.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.io.IOException; +import java.util.*; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/21 + */ +@Slf4j +public class IBootSuse15OsInstallServiceImpl extends IBootSuseOsInstallServiceImpl { + + @Override + public ResultBean getDefaultKs() { + String content = ""; + String str; + try { + str = IBootFileUtil.readFileStr(new File(IBootPathConstant.IBootSuse15ExamplePathDefault)); + if (StrUtil.isNotEmpty(str)) { + content = str.substring(0, str.indexOf(""; + } + } catch (Exception e) { + log.error(e.getMessage()); + } + Map map = new HashMap<>(); + map.put("content", content); + return new ResultBean(true, "", map); + } + + @Override + public String createKsFileByUI(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + String webFileIp = CommonUtil.getWebServerIp(); + List replaceBeanList = new ArrayList<>(); + // 网络 + String netConfig = ""; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + String hostName = osNet[1]; + netConfig = "hostname " + hostName + "\n" + netConfig + "\t\trcnetwork restart"; + } + // ks内容 + if (StringUtils.isEmpty(iBootOsInstallBean.getRootPw())) { + iBootOsInstallBean.setRootPw("Inspur1!"); + } + replaceBeanList.add(new ReplaceBean("", "" + iBootOsInstallBean.getRootPw() + "")); + replaceBeanList.add(new ReplaceBean("Asia/Shanghai", "" + iBootOsInstallBean.getTimeZone() + "")); + replaceBeanList.add(new ReplaceBean("en_US", "" + iBootOsInstallBean.getLanguage() + "")); + replaceBeanList.add(new ReplaceBean("", iBootOsInstallBean.getDiskPartition())); + replaceBeanList.add(new ReplaceBean("@post", netConfig)); + replaceBeanList.add(new ReplaceBean("@jobHostId", taskHostId)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + replaceBeanList.add(new ReplaceBean("@path", (IBootPathConstant.MountImageFile + File.separator + iBootOsInstallBean.getImageFileId() + "/").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"))); + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml"); + ReplaceUtil.autoReplaceNew(queryKsFileName(), IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml", replaceBeanList); + return IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml"; + } + + @Override + public String createKsFile(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) throws IOException { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + String webFileIp = CommonUtil.getWebServerIp(); + // 网络 + String netConfig = ""; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + String hostName = osNet[1]; + netConfig = "hostname " + hostName + "\n" + netConfig + "\t\trcnetwork restart"; + } + // ks内容 + String ks = IBootFileUtil.readFileStr(new File(queryKsFileName())); + String script = ks.substring(ks.indexOf(""), ks.lastIndexOf("")) + ""; + String ksContent = iBootOsInstallBean.getKsContent().replace("@path", (IBootPathConstant.MountImageFile + File.separator + iBootOsInstallBean.getImageFileId() + "/").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/")); + script = script.replace("@post", netConfig).replace("@jobHostId", taskHostId).replace("@ip", iBootIp); + ks = ksContent.substring(0, ksContent.lastIndexOf("")) + "\r\n" + script + "\r\n" + ""; + ks = ks.replace("30100", IBootPathConstant.getIBootPort()); + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml"); + IBootFileUtil.writeFile(IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml", ks.getBytes()); + if (OperationSystemUtil.isWindows()) { + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("\r", "")); + ReplaceUtil.autoReplace(IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml", replaceBeanList); + } else { + String cmd = "sed -i 's/\\r//g' " + IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml"; + ExecCommand execCommand = new ExecCommand(); + execCommand.runLocal(cmd); + } + return IBootPathConstant.Suse15TemplateFile + File.separator + mac.replace(":", "") + ".xml"; + } + + @Override + public String queryKsFileName() { + return IBootPathConstant.Suse15TemplateFile + File.separator + "autoinst.xml"; + } + + @Override + public String startSh(String iBootIp, String taskHostId) { + return String.format("#!/bin/bash\ncurl -k --location -g --request POST 'http://%s:%s/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{\"content\":\"'OSRUNNING'\",\"jobHostId\":\"'%s'\"}'\n ipmitool chassis bootdev pxe\nsleep 10\nreboot\n", iBootIp, IBootPathConstant.getIBootPort(), taskHostId); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootSuseOsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootSuseOsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3fb020e2cd1e4b54e8d65adb59e66df146053220 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootSuseOsInstallServiceImpl.java @@ -0,0 +1,428 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONArray; +import com.google.common.collect.Maps; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.*; +import com.inspur.ispim.cosmos.iboot.base.api.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/21 + */ +@Slf4j +public class IBootSuseOsInstallServiceImpl extends IBootOsInstallServiceImpl { + + @Override + public ResultBean getDefaultKs() { + String content = ""; + String str; + try { + str = IBootFileUtil.readFileStr(new File(IBootPathConstant.IBootSuseExamplePathDefault)); + //截取xml 获取 样例和前后置脚本 + if (StrUtil.isNotEmpty(str)) { + content = str.substring(0, str.indexOf("")) + "\r\n" + ""; + } + } catch (Exception e) { + log.error(e.getMessage()); + } + Map map = new HashMap<>(); + map.put("content", content); + map.put("preScript", ""); + map.put("postScript", ""); + return new ResultBean(true, "", map); + } + + @Override + public String diskPartition(IBootOsInstallBean iBootOsInstallBean) { + StringBuilder sb = new StringBuilder(); + if (iBootOsInstallBean.isCustomPart()) { + if (iBootOsInstallBean.getDiskPartitionType() == 1) { + List partList = JSONArray.parseArray(iBootOsInstallBean.getPreDiskPartition(), IBootPartBean.class); + if (CollUtil.isEmpty(partList)) { + sb.append(autoPartition()); + } else { + sb = new StringBuilder(); + sb.append(partitionToXmlSuse(partList)); + } + return sb.toString(); + } else { + return iBootOsInstallBean.getDiskPartition(); + } + } else { + return autoPartition(); + } + } + + @Override + public String autoPartition() { + // suse 自动分区 默认操作 sda 分区设置 /为max swap auto /home xfs 10G /boot auto ext3 + String diskPartition = "\n" + + " \n" + + " /dev/sda\n" + + " true\n" + + " true\n" + + " \n" + + " \n" + + " true\n" + + " false\n" + + " xfs\n" + + " true\n" + + " defaults\n" + + " false\n" + + " /home\n" + + " uuid\n" + + " 131\n" + + " 1\n" + + " false\n" + + " 20480M\n" + + " \n" + + " \n" + + " true\n" + + " false\n" + + " swap\n" + + " true\n" + + " umask=0002,utf8=true\n" + + " false\n" + + " swap\n" + + " uuid\n" + + " 131\n" + + " 2\n" + + " false\n" + + " auto\n" + + " \n" + + " \n" + + " true\n" + + " false\n" + + " vfat\n" + + " true\n" + + " umask=0002,utf8=true\n" + + " false\n" + + " /boot/efi\n" + + " device\n" + + " 259\n" + + " 3\n" + + " false\n" + + " 256M\n" + + " \n" + + " \n" + + " true\n" + + " false\n" + + " ext3\n" + + " true\n" + + " acl,user_xattr\n" + + " false\n" + + " /boot\n" + + " uuid\n" + + " 131\n" + + " 4\n" + + " false\n"; + diskPartition = diskPartition + " 512M\n"; + diskPartition = diskPartition + + " \n" + + " \n" + + " true\n" + + " false\n" + + " ext3\n" + + " true\n" + + " acl,user_xattr\n" + + " false\n" + + " /\n" + + " uuid\n" + + " 131\n" + + " 5\n" + + " false\n" + + " max\n" + + " \n" + + " \n" + + " \n" + + " CT_DISK\n" + + " all\n" + + " \n" + + " "; + return diskPartition; + } + + private String partitionToXmlSuse(List partList) { + //按照 硬盘盘符分组,对组进行处理 + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("\n"); + if (partList.stream().allMatch(partBean -> partBean.getDeviceType().equalsIgnoreCase(PART_DEVICE_TYPE_STANDARDPARTITION))) { + Map> partMap = partList.stream().collect(Collectors.groupingBy(IBootPartBean::getDisk)); + AtomicInteger count = new AtomicInteger(1); + partMap.forEach((disk, part) -> { + stringBuffer.append("\n"); + stringBuffer.append("").append("/dev/").append(disk).append("\n"); + stringBuffer.append("true\n"); + stringBuffer.append("\n"); + part.forEach(partBean -> { + stringBuffer.append("\n"); + if (partBean.getDeviceType().equalsIgnoreCase(PART_DEVICE_TYPE_STANDARDPARTITION)) { + stringBuffer.append("true\n"); + stringBuffer.append("false\n"); + if (partBean.getFsType().equalsIgnoreCase("btrfs")) { + partBean.setFsType("ext3"); + } + stringBuffer.append("").append(partBean.getFsType()).append("\n"); + stringBuffer.append("true\n"); + stringBuffer.append("false\n"); + stringBuffer.append("").append(partBean.getMountPoint()).append(""); + stringBuffer.append("uuid"); + if (partBean.getMountPoint().equals("/boot")) { + stringBuffer.append(" 131\n"); + } else if (partBean.getMountPoint().equals("/boot/efi")) { + stringBuffer.append("259\n"); + if (0 != partBean.getCapacity() && partBean.getCapacity() < 200) { + partBean.setCapacity(200); + } + } else if (partBean.getMountPoint().equals("swap")) { + stringBuffer.append("130\n"); + } else if (partBean.getMountPoint().equals("/")) { + stringBuffer.append("131\n"); + } else { + stringBuffer.append("131\n"); + } + stringBuffer.append("").append(count).append("\n"); + stringBuffer.append("false"); + if (1 == partBean.getCapacity()) { + stringBuffer.append(" max\n"); + } else if (0 == partBean.getCapacity()) { + stringBuffer.append(" auto\n"); + } else { + stringBuffer.append(" ").append(partBean.getCapacity()).append("M").append(""); + } + stringBuffer.append(" \n"); + count.addAndGet(1); + } + }); + stringBuffer.append(" \n"); + stringBuffer.append(" \n"); + stringBuffer.append(" CT_DISK\n"); + stringBuffer.append(" all\n"); + stringBuffer.append("\n"); + }); + stringBuffer.append(" \n"); + } else { + Map> partMap = Maps.newHashMap(); + partList.forEach(partBean -> { + if (partBean.getVolumeGroup() != null) { + String disk = partBean.getVolumeGroup().getDisk(); + if (StrUtil.isEmpty(disk)) { + disk = "sda"; + partBean.getVolumeGroup().setDisk("sda"); + } + if (partMap.containsKey(disk)) { + partMap.get(disk).add(partBean); + } else { + List partBeans = new ArrayList<>(); + partBeans.add(partBean); + partMap.put(disk, partBeans); + } + } + }); + partMap.forEach((disk, part) -> { + stringBuffer.append("\n"); + stringBuffer.append("").append("/dev/").append(disk).append("\n"); + stringBuffer.append("\n"); + List volumeGroupList = new ArrayList<>(); + part.forEach(partBean -> { + IBootPartBean.VolumeGroup volumeGroup = partBean.getVolumeGroup(); + // 判断是否已存在 + boolean isHaveThisGroup = false; + for (int i = 0; i < volumeGroupList.size(); i++) { + if (volumeGroupList.get(i).getName().equals(volumeGroup.getName())) { + isHaveThisGroup = true; + break; + } + } + if (!isHaveThisGroup && (volumeGroup != null)) { + if (volumeGroup.getName().equals("autopartlvm") && volumeGroup.getDisk().equals("auto")) { + stringBuffer.append("\n"); + stringBuffer.append(" lvmos\n"); + stringBuffer.append(" primary\n"); + stringBuffer.append("max\n"); + stringBuffer.append(" \n"); + + } else { + stringBuffer.append("\n"); + stringBuffer.append(" ").append(volumeGroup.getName()).append("\n"); + stringBuffer.append(" primary\n"); + if (1 == volumeGroup.getCapacity()) { + stringBuffer.append("max\n").append("\n"); + } else { + stringBuffer.append("").append(volumeGroup.getCapacity()).append("M\n").append("\n"); + } + } + //将卷组信息存入List,防止重复创建 + volumeGroupList.add(volumeGroup); + } + stringBuffer.append("\n").append("all\n").append("\n"); + }); + for (int j = 0; j < volumeGroupList.size(); j++) { + stringBuffer.append("\n") + .append("/dev/" + volumeGroupList.get(j).getName() + "\n") + .append("true\n") + .append("\n"); + for (IBootPartBean partBean : part) { + if (partBean.getVolumeGroup().getName().equals(volumeGroupList.get(j).getName())) { + stringBuffer.append("\n"); + if (partBean.getVolume().equals("swap")) { + stringBuffer.append("swap\n") + .append("" + partBean.getVolume() + "\n") + .append("" + partBean.getMountPoint() + "\n"); + } else if (partBean.getVolume().equals("/boot/efi")) { + stringBuffer.append("vfat\n") + .append("" + partBean.getVolume() + "\n") + .append("" + partBean.getMountPoint() + "\n"); + } else { + stringBuffer.append("ext3\n") + .append("" + partBean.getVolume() + "\n") + .append("" + partBean.getMountPoint() + "\n"); + } + if (1 == partBean.getCapacity()) { + stringBuffer.append("max\n") + .append("\n"); + } else { + stringBuffer.append("" + partBean.getCapacity() + "M\n") + .append("\n"); + } + } + } + } + stringBuffer.append("\n") + .append("4M\n") + .append("all\n") + .append("\n"); + + }); + stringBuffer.append(" \n"); + } + return stringBuffer.toString(); + } + + @Override + public String createKsFileByUI(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + List replaceBeanList = new ArrayList<>(); + // 网络 + String netConfig = ""; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + String hostName = osNet[1]; + netConfig = "hostname " + hostName + "\n" + netConfig + "\t\trcnetwork restart"; + } + // ks内容 + if (StringUtils.isEmpty(iBootOsInstallBean.getRootPw())) { + iBootOsInstallBean.setRootPw("Inspur1!"); + } + replaceBeanList.add(new ReplaceBean("", "" + iBootOsInstallBean.getRootPw() + "")); + replaceBeanList.add(new ReplaceBean("Asia/Shanghai", "" + iBootOsInstallBean.getTimeZone() + "")); + replaceBeanList.add(new ReplaceBean("en_US", "" + iBootOsInstallBean.getLanguage() + "")); + replaceBeanList.add(new ReplaceBean("", iBootOsInstallBean.getDiskPartition())); + replaceBeanList.add(new ReplaceBean("@post", netConfig)); + replaceBeanList.add(new ReplaceBean("@jobHostId", taskHostId)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml"); + ReplaceUtil.autoReplaceNew(queryKsFileName(), IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml", replaceBeanList); + return IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml"; + } + + @Override + public String createKsFile(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) throws IOException { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + String iBootIp = CommonUtil.getDHCPIp(); + // 网络 + String netConfig = ""; + String[] osNet = osNetConfig(iBootInstallParamBean, sn); + if (osNet.length >= 2) { + netConfig = osNet[0]; + String hostName = osNet[1]; + netConfig = "hostname " + hostName + "\n" + netConfig + "\t\trcnetwork restart"; + } + // ks内容 + String ks = IBootFileUtil.readFileStr(new File(queryKsFileName())); + String script = ks.substring(ks.indexOf(""), ks.lastIndexOf("")) + ""; + String ksContent = iBootOsInstallBean.getKsContent(); + script = script.replace("@post", netConfig).replace("@jobHostId", taskHostId).replace("@ip", iBootIp); + ks = ksContent.substring(0, ksContent.lastIndexOf("")) + "\r\n" + script + "\r\n" + ""; + ks = ks.replace("30100", IBootPathConstant.getIBootPort()); + // 判断如果存在,则先删除 + IBootFileUtil.deleteFile(IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml"); + IBootFileUtil.writeFile(IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml", ks.getBytes()); + if (OperationSystemUtil.isWindows()) { + List replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("\r", "")); + ReplaceUtil.autoReplace(IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml", replaceBeanList); + } else { + String cmd = "sed -i 's/\\r//g' " + IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml"; + ExecCommand execCommand = new ExecCommand(); + execCommand.runLocal(cmd); + } + return IBootPathConstant.SuseTemplateFile + File.separator + mac.replace(":", "") + ".xml"; + } + + @Override + public String[] osNetConfig(IBootInstallParamBean iBootInstallParamBean, String sn) { + String netConfig = ""; + String hostName = "manageos"; + if (StringUtils.isNotEmpty(iBootInstallParamBean.getNetworkBean())) { + List iBootIPSetBeans = JSONUtil.toList(iBootInstallParamBean.getNetworkBean(), IBootIPSetBean.class); + for (IBootIPSetBean iBootIPSetBean : iBootIPSetBeans) { + if (iBootIPSetBean.getSn().equalsIgnoreCase(sn)) { + hostName = iBootIPSetBean.getHostname(); + netConfig = ""; + for (IBootOsIp iBootOsIp : iBootIPSetBean.getOsIpList()) { + netConfig += ("\t\trm -rf /etc/sysconfig/network/ifcfg-$nicName\n" + + "\t\ttouch /etc/sysconfig/network/ifcfg-$nicName\n" + + "\t\techo \"BOOTPROTO='static'\">>/etc/sysconfig/network/ifcfg-$nicName\n" + + "\t\techo \"IPADDR='$ip'\">>/etc/sysconfig/network/ifcfg-$nicName\n" + + "\t\techo \"NETMASK='$netmask'\">>/etc/sysconfig/network/ifcfg-$nicName\n" + + "\t\techo \"NETWORK='$gateway'\">>/etc/sysconfig/network/ifcfg-$nicName\n" + + "\t\techo \"STARTMODE='auto'\">>/etc/sysconfig/network/ifcfg-$nicName\n") + .replace("$nicName", iBootOsIp.getNetInterface()).replace("$ip", iBootOsIp.getIp()).replace("$netmask", iBootOsIp.getNetmask()).replace("$gateway", iBootOsIp.getGateway()); + } + break; + } + } + } + return new String[]{netConfig, hostName}; + } + + @Override + public void insertMacIni(String imageFileId, String ksPath, String mac, String sn, String boodMode) { + String webFileIp = CommonUtil.getWebServerIp(); + String macContent = String.format("\n:%s\ninitrd %s\nkernel %s autoyast=%s install=%s splash=verbose showopts initrd=initrd\nboot" + "\r\n", mac, + (IBootPathConstant.MountImageFile + File.separator + imageFileId + "/boot/x86_64/loader/initrd").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + (IBootPathConstant.MountImageFile + File.separator + imageFileId + "/boot/x86_64/loader/linux").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + ksPath.replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/"), + (IBootPathConstant.MountImageFile + File.separator + imageFileId).replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)).replace(File.separator, "/")); + IBootMacFileUtil.stringAddFile(macContent, IBootPathConstant.MacIniFile); + } + + @Override + public String queryKsFileName() { + return IBootPathConstant.SuseTemplateFile + File.separator + "autoinst.xml"; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootUosOsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootUosOsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a9a6e079b1180ea4bf890b2c163206c913825858 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootUosOsInstallServiceImpl.java @@ -0,0 +1,66 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootInstallParamBean; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootFileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootMacFileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import lombok.extern.slf4j.Slf4j; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/21 + */ +@Slf4j +public class IBootUosOsInstallServiceImpl extends IBootOsInstallServiceImpl { + + @Override + public ResultBean getDefaultKs() { + String content = ""; + String preScript = ""; + String postScript = ""; + try { + content = IBootFileUtil.readFileStr(new File(IBootPathConstant.IBootUosExamplePathDefault)); + } catch (Exception e) { + log.error(e.getMessage()); + } + Map map = new HashMap<>(); + map.put("content", content); + map.put("preScript", preScript); + map.put("postScript", postScript); + return new ResultBean(true, "", map); + } + + @Override + public String autoPartition() { + return "DI_FULLDISK_MODE=true\nDI_FULLDISK_MULTIDISK_DEVICE=\"/dev/sda\"\nskip_partition_page=true\npartition_do_auto_part=true"; + } + + @Override + public String createKsFileByUI(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) { + return IBootPathConstant.MountImageFile + File.separator + iBootInstallParamBean.getIBootOsInstallBean().getImageFileId() + "/oem/settings.ini"; + } + + @Override + public String createKsFile(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) throws IOException { + return IBootPathConstant.MountImageFile + File.separator + iBootInstallParamBean.getIBootOsInstallBean().getImageFileId() + "/oem/settings.ini"; + } + + @Override + public void insertMacIni(String imageFileId, String ksPath, String mac, String sn, String boodMode) { + String webFileIp = CommonUtil.getWebServerIp(); + String macContent = String.format("\n:%s\nkernel linuxefi %s\ninitrd %s ks %s\nboot" + "\r\n", mac, + (IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "live/vmlinuz").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)), + (IBootPathConstant.MountImageFile + File.separator + imageFileId + File.separator + "live/initrd.lz").replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp)), + ksPath.replace(IBootPathConstant.NginxPushPath, String.format("http://%s:32352/", webFileIp))); + IBootMacFileUtil.stringAddFile(macContent, IBootPathConstant.MacIniFile); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootWindowsOsInstallServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootWindowsOsInstallServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cd4ff515509bd1bbc5b99bfa494c520805532a86 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/osinstall/IBootWindowsOsInstallServiceImpl.java @@ -0,0 +1,386 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.json.JSONUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.PimDeployUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.*; +import com.inspur.ispim.cosmos.iboot.base.api.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +; + +/** + * @description + * @auther zhangchen + * @date 2023/09/06 + */ +@Slf4j +@Service +public class IBootWindowsOsInstallServiceImpl extends IBootOsInstallServiceImpl { + @Override + public String createKsFileByUI(IBootInstallParamBean iBootInstallParamBean, String sn, Boolean isBond, String taskHostId, String mac) { + String batPath = createinstallBat(iBootInstallParamBean, sn, taskHostId); + String autoXml = createAutoXml(iBootInstallParamBean, sn, mac); + if (StringUtils.isNotEmpty(batPath) && StringUtils.isNotEmpty(autoXml)) { + return autoXml; + } else { + return ""; + } + } + + @Override + public void insertMacIni(String imageFileId, String ksPath, String mac, String sn, String boodMode) { + String webFileIp = CommonUtil.getWebServerIp(); + String pxeCfg = " cpuid --ext 29 && set arch amd64 || set arch x86\n kernel http://--ip--/wimboot\n initrd http://--ip--/osInstall/ks/windows/--sn--/install.bat install.bat\n initrd http://--ip--/osInstall/ks/windows/--sn--/AUTOUNATTEND.XML AUTOUNATTEND.XML\n initrd http://--ip--/winpe10/boot/bcd BCD\n initrd http://--ip--/winpe10/boot/boot.sdi boot.sdi\n initrd http://--ip--/winpe10/bootmgr.efi bootmgr.efi\n initrd -n boot.wim http://--ip--/winpe10/sources/boot.wim boot.wim\n boot"; + pxeCfg = pxeCfg.replaceAll("--sn--", sn.replaceAll(":", "-")); + pxeCfg = pxeCfg.replaceAll("--ip--", webFileIp + ":32352"); + String macContent = "\n:" + mac + "\n" + pxeCfg + "\r\n"; + IBootMacFileUtil.stringAddFile(macContent, IBootPathConstant.MacIniFile); + } + + public String createinstallBat(IBootInstallParamBean iBootInstallParamBean, String sn, String taskHostId) { + try { + File ksDir = new File(FileUtil.normalize(IBootPathConstant.KsTemplateFile + "/windows/" + sn.replaceAll(":", "-"))); + if (ksDir.exists()) { + FileUtil.del(ksDir); + } + ksDir.mkdir(); + try { + if (OperationSystemUtil.isWindows()) { + FileUtils.copyDirectory(new File(String.join(File.separator, IBootPathConstant.KsTemplateFile, "windows", "sn-example")), new File(ksDir.getAbsolutePath())); + } else { + ExecCommand exec = new ExecCommand(); + exec.runLocal("cp -rf " + IBootPathConstant.KsTemplateFile + "/windows/sn-example/* " + ksDir.getAbsolutePath()); + } + } catch (IOException e) { + log.error(e.getMessage()); + } + String inmanageModuleSecretKey = PimDeployUtil.get().inmanageModuleSecretKey; + //修改install.bat的内容 + String installContent = IBootMacFileUtil.sysFile2String(ksDir.getAbsolutePath() + "/install.bat"); + // 获取仲裁的文件服务器IP写入bat文件 + String iBootIp = CommonUtil.getDHCPIp(); + installContent = installContent.replaceAll("--pwd--", inmanageModuleSecretKey); + installContent = installContent.replaceAll("--server--", iBootIp); + installContent = installContent.replaceAll("--port--", IBootPathConstant.getIBootPort()); + installContent = installContent.replaceAll("--sn--", sn); + installContent = installContent.replaceAll("--path--", "image\\\\" + iBootInstallParamBean.getIBootOsInstallBean().getImageFileId()); + installContent = installContent.replaceAll("--fileserver--", iBootIp); + installContent = installContent.replaceAll("--taskId--", taskHostId);//taskId无用,但不可为空,暂用hostid + installContent = installContent.replaceAll("--jobId--", taskHostId); + IBootMacFileUtil.string2File(installContent, ksDir.getAbsolutePath() + "/install.bat"); + return ksDir.getAbsolutePath() + "/install.bat"; + } catch (Exception e) { + log.error(e.getMessage()); + return ""; + } + } + + public String createAutoXml(IBootInstallParamBean iBootInstallParamBean, String sn, String mac) { + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + //windows配置生成 + try { + String winStr = IBootFileUtil.readFileStr(new File(IBootPathConstant.WindowsKsTemplateFile + File.separator + "autounattend.xml")); + String languages = iBootOsInstallBean.getLanguage(); + //1.1修改安装版本选择 + String strDistributions = ""; + String activeNum = ""; + if (iBootOsInstallBean.getVersion().contains("2012")) { + if (iBootOsInstallBean.getVersion().contains("R2")) { + strDistributions = "Windows Server 2012 R2 SERVERDATACENTER"; + } else { + strDistributions = "Windows Server 2012 SERVERDATACENTER"; + } + activeNum = "W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9"; + } else if (iBootOsInstallBean.getVersion().contains("2016")) { + strDistributions = "Windows Server 2016 SERVERDATACENTER"; + activeNum = "CB7KF-BWN84-R7R2Y-793K2-8XDDG"; + } else if (iBootOsInstallBean.getVersion().contains("2019")) { + strDistributions = "Windows Server 2019 SERVERDATACENTER"; + activeNum = "WMDGN-G9PQG-XVVXX-R3X43-63DFG"; + } else { + strDistributions = "Windows Server 2022 SERVERDATACENTER"; + activeNum = "WX4NM-KYWYW-QJJR4-XV3QB-6VM33"; + } + winStr = winStr.replaceAll("--OSDistributions--", strDistributions); + winStr = winStr.replaceAll("--WinActiveNum--", activeNum); + List partList = JSONUtil.toList(iBootOsInstallBean.getPreDiskPartition(), IBootPartBean.class); + // 修改分区开始磁盘 + boolean isEFIPart = false; + if (CollectionUtil.isEmpty(partList)) { + isEFIPart = true; + } else { + for (IBootPartBean part : partList) { + if (StringUtils.isNotEmpty(part.getInstallType()) && part.getInstallType().equals("EFI")) { + isEFIPart = true; + break; + } + } + } + if (isEFIPart) { + winStr = winStr.replaceAll("--DiskPartStartNo--", "4"); + } else { + winStr = winStr.replaceAll("--DiskPartStartNo--", "2"); + } + //1.2添加分区脚本 + String strDiskPart = ""; + if (CollUtil.isEmpty(partList)) { + strDiskPart = winDefaultPart(); + } else { + strDiskPart = winDiskPartByPartList(partList); + } + winStr = winStr.replaceAll("--WinDiskPart--", strDiskPart); + //1.3修改默认密码 + winStr = winStr.replaceAll("--WinPassword--", iBootOsInstallBean.getRootPw()); + //1.4设置ip类型,以及主机名 + String hostName = ""; + String inbandIp = ""; + String netInterface = ""; + if (languages.equals("zh-CN")) {//替换远程桌面的中文 + netInterface = "以太网"; + } else { + netInterface = "Ethernet0"; + } + if (StringUtils.isNotEmpty(iBootInstallParamBean.getNetworkBean())) {//没有ip的任何设置,则使用dhcp + List iBootIPSetBeans = JSONUtil.toList(iBootInstallParamBean.getNetworkBean(), IBootIPSetBean.class); + for (IBootIPSetBean iBootIPSetBean : iBootIPSetBeans) { + if (iBootIPSetBean.getSn().equalsIgnoreCase(sn)) { + hostName = iBootIPSetBean.getHostname(); + for (IBootOsIp iBootOsIp : iBootIPSetBean.getOsIpList()) { + inbandIp = iBootOsIp.getIp(); + netInterface = iBootOsIp.getNetInterface(); + } + break; + } + } + if (StringUtils.isNotEmpty(inbandIp)) { + winStr = winStr.replaceAll("--WinIsDhcp--", "false"); + winStr = winStr.replaceAll("--WinStaticIp--", inbandIp); + } else { + winStr = winStr.replaceAll("--WinIsDhcp--", "true"); + winStr = winStr.replaceAll("--WinStaticIp--", "127.0.0.1"); + } + } else { + winStr = winStr.replaceAll("--WinIsDhcp--", "true"); + winStr = winStr.replaceAll("--WinStaticIp--", "127.0.0.1"); + } + if (StringUtils.isNotEmpty(hostName)) { + hostName = "" + hostName + ""; + } + winStr = winStr.replaceAll("--computerName--", hostName); + winStr = winStr.replaceAll("--Ethernet--", mac.replaceAll(":", "-")); + //1.5 添加用户 + String userSb = ""; +// String userSb = " \n" + +// " \n" + +// " \n" + +// " " + iBootOsInstallBean.getUserPsw() + "\n" + +// " true</PlainText>\n" + +// " </Password>\n" + +// " <Description>New User</Description>\n" + +// " <DisplayName>" + iBootOsInstallBean.getUserName() + "</DisplayName>\n" + +// " <Group>Administrators</Group>\n" + +// " <Name>" + iBootOsInstallBean.getUserName() + "</Name>\n" + +// " </LocalAccount>\n" + +// " </LocalAccounts>"; + winStr = winStr.replaceAll("--WinAddNewUser--", userSb); + //1.6 替换时区和中英文版本 + if (StringUtils.isEmpty(languages)) {//languages为null,默认为中文 + languages = "zh-CN"; + } + winStr = winStr.replaceAll("--Languages--", languages); + if (languages.equals("zh-CN")) {//替换远程桌面的中文 + winStr = winStr.replaceAll("--WinRemoteDesktop--", "远程桌面"); + } else { + winStr = winStr.replaceAll("--WinRemoteDesktop--", "Remote Desktop"); + } + String timeZone = iBootOsInstallBean.getTimeZone(); + if (StringUtils.isEmpty(timeZone)) {//languages为null,默认为中文 + timeZone = "China Standard Time"; + } + winStr = winStr.replaceAll("--TimeZone--", timeZone); + IBootMacFileUtil.string2File(winStr, String.format("%s/windows/%s/AUTOUNATTEND.XML", IBootPathConstant.KsTemplateFile, sn.replaceAll(":", "-"))); + } catch (IOException e) { + log.error(e.getMessage()); + return ""; + } + return String.format("%s/windows/%s/AUTOUNATTEND.XML", IBootPathConstant.KsTemplateFile, sn.replaceAll(":", "-")); + } + + // windows默认分区配置 + private String winDefaultPart() { + String sb = " <DiskConfiguration>\n" + + " <Disk wcm:action=\"add\">\n" + + " <DiskID>0</DiskID>\n" + + " <WillWipeDisk>true</WillWipeDisk>\n" + + " <CreatePartitions>\n" + + " <CreatePartition wcm:action=\"add\">\n" + + " <Order>1</Order>\n" + + " <Type>Primary</Type>\n" + + " <Size>300</Size>\n" + + " </CreatePartition>\n" + + " <CreatePartition wcm:action=\"add\">\n" + + " <Order>2</Order>\n" + + " <Type>EFI</Type>\n" + + " <Size>100</Size>\n" + + " </CreatePartition>\n" + + " <CreatePartition wcm:action=\"add\">\n" + + " <Order>3</Order>\n" + + " <Type>MSR</Type>\n" + + " <Size>128</Size>\n" + + " </CreatePartition>\n" + + " <CreatePartition wcm:action=\"add\">\n" + + " <Order>4</Order>\n" + + " <Type>Primary</Type>\n" + + " <Extend>true</Extend>\n" + + " </CreatePartition>\n" + + " </CreatePartitions>\n" + + " <ModifyPartitions>\n" + + " <ModifyPartition wcm:action=\"add\">\n" + + " <Order>1</Order>\n" + + " <PartitionID>1</PartitionID>\n" + + " <Label>WINRE</Label>\n" + + " <Format>NTFS</Format>\n" + + " </ModifyPartition>\n" + + " <ModifyPartition wcm:action=\"add\">\n" + + " <Order>2</Order>\n" + + " <PartitionID>2</PartitionID>\n" + + " <Label>System</Label>\n" + + " <Format>FAT32</Format>\n" + + " </ModifyPartition>\n" + + " <ModifyPartition wcm:action=\"add\">\n" + + " <Order>3</Order>\n" + + " <PartitionID>3</PartitionID>\n" + + " </ModifyPartition>\n" + + " <ModifyPartition wcm:action=\"add\">\n" + + " <Order>4</Order>\n" + + " <PartitionID>4</PartitionID>\n" + + " <Label>OS</Label>\n" + + " <Letter>C</Letter>\n" + + " <Format>NTFS</Format>\n" + + " </ModifyPartition>\n" + + " </ModifyPartitions>\n" + + " </Disk>\n" + + " </DiskConfiguration>"; + return sb; + } + + // windows根据界面进行分区 + private String winDiskPartByPartList(List<IBootPartBean> partList) { + boolean isEFIPart = false; + if (partList == null || partList.size() < 1) { + isEFIPart = true; + } else { + for (IBootPartBean part : partList) { + if (StringUtils.isNotEmpty(part.getInstallType()) && part.getInstallType().equals("EFI")) { + isEFIPart = true; + break; + } + } + } + + String sb = " <DiskConfiguration>\n" + + " <Disk wcm:action=\"add\">\n" + + " <DiskID>0</DiskID>\n" + + " <WillWipeDisk>true</WillWipeDisk>\n" + + " <CreatePartitions>\n"; + // 添加create + //默认添加系统分区 + List<IBootPartBean> partBeans = new ArrayList<>(); + if (isEFIPart) { + IBootPartBean recoveryiBootPartBean = new IBootPartBean(); + recoveryiBootPartBean.setCapacity(500); + recoveryiBootPartBean.setVolume("Recovery"); + recoveryiBootPartBean.setDeviceType("Primary"); + recoveryiBootPartBean.setFsType("NTFS"); + recoveryiBootPartBean.setMountPoint("Recovery"); + partBeans.add(recoveryiBootPartBean); + IBootPartBean eFIiBootPartBean = new IBootPartBean(); + eFIiBootPartBean.setCapacity(100); + eFIiBootPartBean.setDeviceType("EFI"); + recoveryiBootPartBean.setVolume("EFI"); + eFIiBootPartBean.setFsType("FAT32"); + eFIiBootPartBean.setMountPoint("EFI"); + partBeans.add(eFIiBootPartBean); + IBootPartBean mSRiBootPartBean = new IBootPartBean(); + mSRiBootPartBean.setCapacity(128); + mSRiBootPartBean.setDeviceType("MSR"); + mSRiBootPartBean.setVolume("MSR"); + mSRiBootPartBean.setFsType("FAT32"); + mSRiBootPartBean.setMountPoint("MSR"); + partBeans.add(mSRiBootPartBean); + } else { + IBootPartBean recoveryiBootPartBean = new IBootPartBean(); + recoveryiBootPartBean.setCapacity(500); + recoveryiBootPartBean.setVolume("Recovery"); + recoveryiBootPartBean.setDeviceType("Primary"); + recoveryiBootPartBean.setFsType("NTFS"); + recoveryiBootPartBean.setMountPoint("Recovery"); + partBeans.add(recoveryiBootPartBean); + } + partBeans.addAll(partList); + int orderCreate = 1; + for (IBootPartBean part : partBeans) { + sb += " <CreatePartition wcm:action=\"add\">\n" + + " <Order>" + orderCreate + "</Order>\n" + + " <Type>" + part.getDeviceType() + "</Type>\n"; + if (part.getCapacity() == 1) { + sb += " <Extend>true</Extend>\n"; + } else { + sb += " <Size>" + part.getCapacity() + "</Size>\n"; + } + sb += " </CreatePartition>\n"; + orderCreate++; + } + sb += " </CreatePartitions>\n" + + " <ModifyPartitions>\n"; + // 添加modify + int orderModify = 1; + for (IBootPartBean part : partBeans) { + // 跳过extended分区 + if (part.getDeviceType().equals("Extended")) { + continue; + } + sb += " <ModifyPartition wcm:action=\"add\">\n" + + " <Order>" + orderModify + "</Order>\n" + + " <PartitionID>" + orderModify + "</PartitionID>\n"; + if (!part.getDeviceType().equals("MSR")) { + String volume = ""; + if (StringUtils.isNotEmpty(part.getVolume())) { + volume = part.getVolume(); + } + sb += " <Label>" + volume + "</Label>\n"; + if (StringUtils.isNotEmpty(part.getMountPoint()) && part.getMountPoint().trim().length() == MagicNumber.M1) { + sb += " <Letter>" + part.getMountPoint() + "</Letter>\n"; + } + sb += " <Format>" + part.getFsType() + "</Format>\n"; + if (part.getMountPoint().equals("Recovery")) { + if (isEFIPart) { + sb += " <TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID>\n"; + } else { + sb += " <Active>true</Active>\n"; + } + } + } + sb += " </ModifyPartition>\n"; + orderModify++; + } + sb += " </ModifyPartitions>\n" + + " </Disk>\n" + + " </DiskConfiguration>"; + ; + return sb; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/CommonTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/CommonTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..27856b703eacae09caf858a11af7aff15a9b0424 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/CommonTemplateCreateServiceImpl.java @@ -0,0 +1,105 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.http.HttpUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.commons.utils.TarUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.service.TemplateCreateService; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.ExecCommand; +import com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall.IBootOsInstallFactory; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.DeviceMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootInabndFileMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * 实现创建模板sh和工具包的接口 + */ +@Slf4j +@Service +public class CommonTemplateCreateServiceImpl implements TemplateCreateService { + + IBootTaskHostMapper iBootTaskHostMapper; + IBootOsInstallFactory iBootOsInstallFactory; + IBootInabndFileMapper iBootInabndFileMapper; + DeviceMapper deviceMapper; + + public CommonTemplateCreateServiceImpl() { + } + + public CommonTemplateCreateServiceImpl(IBootTaskHostMapper iBootTaskHostMapper) { + this.iBootTaskHostMapper = iBootTaskHostMapper; + } + + public CommonTemplateCreateServiceImpl(IBootInabndFileMapper iBootInabndFileMapper) { + this.iBootInabndFileMapper = iBootInabndFileMapper; + } + + public CommonTemplateCreateServiceImpl(IBootTaskHostMapper iBootTaskHostMapper, DeviceMapper deviceMapper) { + this.iBootTaskHostMapper = iBootTaskHostMapper; + this.deviceMapper = deviceMapper; + } + + public CommonTemplateCreateServiceImpl(IBootTaskHostMapper iBootTaskHostMapper, + IBootOsInstallFactory iBootOsInstallFactory, + DeviceMapper deviceMapper) { + this.iBootTaskHostMapper = iBootTaskHostMapper; + this.iBootOsInstallFactory = iBootOsInstallFactory; + this.deviceMapper = deviceMapper; + } + + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + ResultBean resultBean = new ResultBean(true, null, null); + return resultBean; + } + + @Override + public ResultBean putTools(String destPath) { + ResultBean resultBean = new ResultBean(true, null, null); + return resultBean; + } + + @Override + public ResultBean execute(String destPath, IBootTaskHostEntity iBootTaskHostEntity) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + if (OperationSystemUtil.isWindows()) { + TarUtil.compress(destPath, destPath + "start.tar.gz"); + } else { + String cmd = "cd " + destPath + " && chmod +x -R ./* && tar -zcvf " + destPath + "start.tar.gz *"; + ExecCommand exec = new ExecCommand(); + exec.runLocal(cmd); + } + } catch (IOException e) { + log.error(e.getMessage()); + resultBean.setMessage(e.getMessage()); + resultBean.setFlag(false); + return resultBean; + } + File tarfile = new File(FileUtil.normalize(destPath + "start.tar.gz")); + String currentFileMd5 = CommonUtil.md5(tarfile); + Map<String, Object> paramMap = new HashMap<>(); + paramMap.put("file", tarfile); + paramMap.put("md5", currentFileMd5); + String body = HttpUtil.post("http://" + iBootTaskHostEntity.getResourceIp() + ":16061/pushTask", paramMap); + if (!body.contains("success")) {//任务触发失败,将任务置结束 + resultBean.setMessage("调用设备接口失败"); + resultBean.setFlag(false); + return resultBean; + + } + return resultBean; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/CustomTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/CustomTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0d757e7c6fd676e8e11fc096cbbdba6fb0d89d85 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/CustomTemplateCreateServiceImpl.java @@ -0,0 +1,70 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.json.JSONUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.CustomTemplateFileBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootCustomTemplateBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootInbandFileEntity; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootFileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.api.util.ReplaceUtil; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootInabndFileMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * 实现创建模板sh和工具包的接口 + */ +@Slf4j +@Service +public class CustomTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + public CustomTemplateCreateServiceImpl(IBootInabndFileMapper iBootInabndFileMapper) { + super(iBootInabndFileMapper); + } + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + // start脚本,执行探测脚本和验证脚本,上报日志 + String iBootIp = CommonUtil.getDHCPIp(); + IBootCustomTemplateBean iBootCustomTemplateBean = JSONUtil.toBean(param, IBootCustomTemplateBean.class); + List<ReplaceBean> replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("@exeDir", iBootCustomTemplateBean.getExecuteDir())); + replaceBeanList.add(new ReplaceBean("@taskHostId", taskHostId)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + ReplaceUtil.autoReplaceNew(IBootPathConstant.CustomTemplateFile + File.separator + "custom_template.sh", destPath + File.separator + "start.sh", replaceBeanList); + // 创建探测脚本和执行脚本 + String exploreSh = "#!/bin/bash\r\n" + iBootCustomTemplateBean.getExecuteShell(); + String checkSh = "#!/bin/bash\r\n" + iBootCustomTemplateBean.getCheckShell(); + IBootFileUtil.createFile(exploreSh, destPath, "explore.sh"); + IBootFileUtil.createFile(checkSh, destPath, "check.sh"); + // 拷贝所有自定义模板文件 + for (CustomTemplateFileBean customTemplateFileBean : iBootCustomTemplateBean.getExploreFiles()) { + IBootInbandFileEntity iBootInbandFileEntity = iBootInabndFileMapper.getOneById(customTemplateFileBean.getId()); + FileUtils.copyFile(new File(FilenameUtils.normalize(iBootInbandFileEntity.getFullPath())), new File(FilenameUtils.normalize(destPath + File.separator + iBootInbandFileEntity.getName()))); + } + } catch (Exception e) { + log.error("create template shell file error"); + resultBean.setFlag(false); + resultBean.setMessage("create template shell file error"); + return resultBean; + } + return resultBean; + } + + @Override + public ResultBean putTools(String destPath) { + return new ResultBean(true, null, null); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/DeviceRefreshTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/DeviceRefreshTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fd9ecdc74c1ea9082ac9857fa53ea0dfef80bef9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/DeviceRefreshTemplateCreateServiceImpl.java @@ -0,0 +1,56 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + + +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import lombok.extern.slf4j.Slf4j; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; + +import static java.nio.charset.StandardCharsets.UTF_8; + +@Slf4j +public class DeviceRefreshTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + private static final String start = """ + #!/bin/bash + + function log() { + curl -k --location -g --request POST 'http://ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'$1'","jobHostId":"jhid"}' + } + + function report() { + curl -k --location -g --request POST 'http://ip:30100/v1/iboot/taskStatusChange' --header 'Content-Type:application/json' -d '{"jobHostStatus":"'$1'","id":"jhid"}' + } + + response=`curl -k http://127.0.0.1:16061/getDeviceInfo` + if [[ $response = *success* ]]; then + log 'refreshSuccess' + report 'SUCCESS' + exit 0 + else + log 'refreshFail, $response' + report 'FAILED' + exit 1 + fi + """; + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + try (PrintWriter writer = new PrintWriter(destPath + File.separator + "start.sh", UTF_8)) { + writer.write(start.replace("ip", CommonUtil.getDHCPIp()) + .replace("jhid", taskHostId) + .replace("refreshSuccess", Languages.getString("cosmos.iboot.device.refresh.success")) + .replace("refreshFail", Languages.getString("cosmos.iboot.device.refresh.fail")) + .replace("30100", IBootPathConstant.getIBootPort())); + } catch (IOException e) { + log.error(e.getMessage()); + return new ResultBean(false, e.getMessage(), null); + } + return new ResultBean(true, null, null); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/DiskCloneTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/DiskCloneTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2a01d83e5600d0289197dc17e04f002bafe9e408 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/DiskCloneTemplateCreateServiceImpl.java @@ -0,0 +1,82 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.json.JSONUtil; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.commons.utils.FileCopyUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceDiskCloneBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.ExecCommand; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.api.util.ReplaceUtil; +import lombok.extern.slf4j.Slf4j; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import static com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant.DISK_CLONE_FILE; + + +@Slf4j +public class DiskCloneTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + try { + // 生成脚本,替换变量 + DeviceDiskCloneBean diskBackupBean = JSONUtil.toBean(param, DeviceDiskCloneBean.class); + List<ReplaceBean> replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("@addr", CommonUtil.getDHCPIp())); + replaceBeanList.add(new ReplaceBean("@method", diskBackupBean.getMethod().name())); + replaceBeanList.add(new ReplaceBean("@device", String.join(" ", diskBackupBean.getDisk()))); + replaceBeanList.add(new ReplaceBean("@filename", diskBackupBean.getImageName())); + replaceBeanList.add(new ReplaceBean("@hid", taskHostId)); + if (OperationSystemUtil.isWindows()) { + replaceBeanList.add(new ReplaceBean("@nfsdir", "/nfs/iboot/images")); + } else { + replaceBeanList.add(new ReplaceBean("@nfsdir", IBootPathConstant.ImageFile)); + } + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + // 中英文 + replaceBeanList.add(new ReplaceBean("TOOLS INSTALL SUCCESSFULLY", Languages.getString("cosmos.iboot.disk.clone.install"))); + replaceBeanList.add(new ReplaceBean("MOUNT NFS SUCCESSFULLY", Languages.getString("cosmos.iboot.disk.clone.mount.success"))); + replaceBeanList.add(new ReplaceBean("FAILED TO MOUNT NFS", Languages.getString("cosmos.iboot.disk.clone.mount.failed"))); + replaceBeanList.add(new ReplaceBean("BACKUP BEGIN", Languages.getString("cosmos.iboot.disk.clone.backup.begin"))); + replaceBeanList.add(new ReplaceBean("BACKUP END", Languages.getString("cosmos.iboot.disk.clone.backup.end"))); + replaceBeanList.add(new ReplaceBean("RESTORE BEGIN", Languages.getString("cosmos.iboot.disk.clone.restore.begin"))); + replaceBeanList.add(new ReplaceBean("RESTORE END", Languages.getString("cosmos.iboot.disk.clone.restore.end"))); + ReplaceUtil.autoReplaceNew(DISK_CLONE_FILE + File.separator + "start.sh", destPath + File.separator + "start.sh", replaceBeanList); + } catch (Exception e) { + log.error("创建磁盘克隆脚本失败: {}", e.getMessage()); + return new ResultBean(false, Languages.getString(""), null); + } + return new ResultBean(true, null, null); + } + + @Override + public ResultBean execute(String destPath, IBootTaskHostEntity iBootTaskHostEntity) { + try { + if (OperationSystemUtil.isWindows()) { + FileCopyUtil.transferFile(DISK_CLONE_FILE + File.separator + "tools", iBootTaskHostEntity.getResourceIp(), "root", "ibootclient", "/tmp"); + } else { + ExecCommand exec = new ExecCommand(); + // PXE重启可能导致SSH公钥失效,所以清除信息 + exec.runLocal("ssh-keygen -R " + iBootTaskHostEntity.getResourceIp()); + // 重新拷贝公钥 + exec.runLocal("ssh-keyscan " + iBootTaskHostEntity.getResourceIp() + " >> /root/.ssh/known_hosts"); + // 复制安装包 + exec.runLocal("sshpass -p ibootclient scp -r " + DISK_CLONE_FILE + "/tools/* root@" + iBootTaskHostEntity.getResourceIp() + ":/tmp"); + } + } catch (Exception e) { + log.error("复制克隆工具失败: {}", e.getMessage()); + return new ResultBean(false, Languages.getString("REPO_OPERATE_FAILED"), null); + } + return super.execute(destPath, iBootTaskHostEntity); + } +} + + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/NetworkTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/NetworkTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4a6f0bf612004b5dbf16f9d5717391ecdb3370cf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/NetworkTemplateCreateServiceImpl.java @@ -0,0 +1,79 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.json.JSONUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootNetworkCfgBeans; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.api.util.ReplaceUtil; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * 实现创建模板sh和工具包的接口 + */ +@Slf4j +@Service +public class NetworkTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + public NetworkTemplateCreateServiceImpl(IBootTaskHostMapper iBootTaskHostMapper) { + super(iBootTaskHostMapper); + } + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + String iBootIp = CommonUtil.getDHCPIp(); + // 生成start.sh + IBootTaskHostEntity iBootTaskHostEntity = iBootTaskHostMapper.getJobHostStatusById(taskHostId); + IBootNetworkCfgBeans IBootNetworkCfgBeans = JSONUtil.toBean(param, IBootNetworkCfgBeans.class); + // 无网络配置数据 + if (!IBootNetworkCfgBeans.getNetworkCfgBeans().containsKey(iBootTaskHostEntity.getSn())) { + resultBean.setFlag(false); + resultBean.setMessage("no network config data."); + return resultBean; + } + IBootNetworkCfgBeans.NetworkCfgBean networkCfgBean = IBootNetworkCfgBeans.getNetworkCfgBeans().get(iBootTaskHostEntity.getSn()); + if (BeanUtil.isNotEmpty(networkCfgBean)) { + String shPath; + List<ReplaceBean> replaceBeanList = new ArrayList<>(); + if (CommonUtil.isIPv6(networkCfgBean.getIp())) { + shPath = IBootPathConstant.NetworkConfigFile + File.separator + "set_ipv6.sh"; + } else if (CommonUtil.isIPv4(networkCfgBean.getIp())) { + shPath = IBootPathConstant.NetworkConfigFile + File.separator + "set_ipv4.sh"; + } else { + resultBean.setFlag(false); + return resultBean; + } + replaceBeanList.add(new ReplaceBean("@jobhostid", taskHostId)); + replaceBeanList.add(new ReplaceBean("@channel", networkCfgBean.getChannel())); + replaceBeanList.add(new ReplaceBean("@subnet", networkCfgBean.getNetmask())); + replaceBeanList.add(new ReplaceBean("@gateway", networkCfgBean.getGateway())); + replaceBeanList.add(new ReplaceBean("@netIp", networkCfgBean.getIp())); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + ReplaceUtil.autoReplaceNew(shPath, destPath + File.separator + "start.sh", replaceBeanList); + } + } catch (Exception e) { + log.error("create template shell file error"); + resultBean.setFlag(false); + resultBean.setMessage("create template shell file error"); + return resultBean; + } + return resultBean; + } + + @Override + public ResultBean putTools(String destPath) { + return new ResultBean(true, null, null); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/OsExplorerTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/OsExplorerTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8c069afdef654b6b7a15ecf5f9f1706a529f1de5 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/OsExplorerTemplateCreateServiceImpl.java @@ -0,0 +1,120 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import com.inspur.cdc.commons.i18n.Languages; +import com.inspur.cdc.commons.lang.util.CommonCheck; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.IpmiFailEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.IpmiStatusEnum; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.DeviceMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +@Slf4j +public class OsExplorerTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + private static final String IBOOT_USERNAME = "inmanage"; + private static final String IBOOT_PW = "manage1!"; + + public OsExplorerTemplateCreateServiceImpl(IBootTaskHostMapper iBootTaskHostMapper, DeviceMapper deviceMapper) { + super(iBootTaskHostMapper, deviceMapper); + } + + @Override + public ResultBean execute(String destPath, IBootTaskHostEntity iBootTaskHostEntity) { + if (Objects.isNull(iBootTaskHostEntity) || StringUtils.isBlank(iBootTaskHostEntity.getResourceId())) { + return new ResultBean(false, Languages.getString("asset_parameter_error"), null); + } + DeviceEntity deviceEntity = deviceMapper.queryEntityById(iBootTaskHostEntity.getResourceId()); + if (Objects.isNull(deviceEntity)) { + return new ResultBean(false, Languages.getString("resource_not_exist"), null); + } + if (Objects.isNull(deviceEntity.getStatus()) && Objects.isNull(deviceEntity.getIpmiStatus())) { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.device.status.error"), null); + } + if (deviceMapper.queryDevicePxeOnlineById(iBootTaskHostEntity.getResourceId()) && !StringUtils.isBlank(deviceEntity.getDhcpIp())) { + log.error("执行带内系统探测"); + try (HttpResponse response = HttpRequest.get("http://" + deviceEntity.getDhcpIp() + ":16061/getDeviceInfo").execute()) { + if (!response.isOk()) { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.interface.error"), null); + } + } + // 判断是否停留在PXE + IBootTaskHostEntity taskHostEntity = iBootTaskHostMapper.getJobHostStatusById(iBootTaskHostEntity.getId()); + String param = taskHostEntity.getParam(); + if (StringUtils.isNotBlank(param) && param.contains("no") && deviceEntity.getStatus() != DeviceStatusEnum.Offline) { + try (HttpResponse res = HttpRequest.post("http://" + deviceEntity.getDhcpIp() + ":16061/powerSupply").body("{\"type\":\"Shutdown\"}").execute()) { + return new ResultBean(true, Languages.getString("cosmos.iboot.os.explore.success.shutdown"), null); + } catch (Exception e) { + log.error("[{}]执行带内电源管理[{}]", CommonCheck.convertValidLog(deviceEntity.getDhcpIp()), "关机"); + return new ResultBean(true, Languages.getString("cosmos.iboot.os.explore.success.shutdown"), null); + } + } else { + return new ResultBean(true, Languages.getString("cosmos.iboot.os.explore.success"), null); + } + + } + if (deviceEntity.getIpmiStatus() == IpmiStatusEnum.AVAILABLE && StringUtils.isNotBlank(deviceEntity.getManageIp())) { + log.error("执行带外系统探测"); + try { + String mode = "reset"; + String userName = ""; + String password = ""; + if (deviceEntity.getIpmiFail() == IpmiFailEnum.NORMAL) { + userName = deviceEntity.getManageUser(); + password = deviceEntity.getManagePassword(); + } else if (deviceEntity.getIpmiFail() == IpmiFailEnum.NORMAL_IBOOT) { + userName = IBOOT_USERNAME; + password = IBOOT_PW; + } else { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.device.status.error"), null); + } + if (StringUtils.isAnyBlank(userName, password)) { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.device.status.error"), null); + } + mode = CommonUtil.getPowerStatus(deviceEntity.getManageIp(), userName, password).equals("on") ? "reset" : "on"; + if (CommonUtil.setSysBoot(deviceEntity.getManageIp(), userName, password, "pxe") && CommonUtil.powerControl(deviceEntity.getManageIp(), userName, password, mode)) { + // 系统开机等待十分钟 + int i = 0; + while (i < 10) { + log.error("等待PXE重启,已等待[{}]分钟", i); + Thread.sleep(TimeUnit.MINUTES.toMillis(1)); + if (deviceMapper.queryDevicePxeOnlineById(iBootTaskHostEntity.getResourceId())) { + break; + } + i++; + } + if (i == 10) { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.pxe.timeout"), null); + } + + // 判断是否停留在PXE + IBootTaskHostEntity taskHostEntity = iBootTaskHostMapper.getJobHostStatusById(iBootTaskHostEntity.getId()); + String param = taskHostEntity.getParam(); + if (StringUtils.isNotBlank(param) && param.contains("no")) { + if (CommonUtil.powerControl(deviceEntity.getManageIp(), userName, password, "off")) { + return new ResultBean(true, Languages.getString("cosmos.iboot.os.explore.success.shutdown"), null); + } else { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.success.shutdown.fail"), null); + } + } else { + return new ResultBean(true, Languages.getString("cosmos.iboot.os.explore.success"), null); + } + } + } catch (Exception e) { + log.error("获取服务器电源状态异常,默认执行重启操作,{}", e.getMessage()); + } + } else { + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.pxe.error"), null); + } + return new ResultBean(false, Languages.getString("cosmos.iboot.os.explore.pxe.error"), null); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/OsInstallTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/OsInstallTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..06997c874cd4ec24982dd5594f188f099ea8c141 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/OsInstallTemplateCreateServiceImpl.java @@ -0,0 +1,75 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.OSInstallModeEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootInstallParamBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootOsInstallBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.service.IBootOsInstallService; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootFileUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall.IBootOsInstallFactory; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.DeviceMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostMapper; +import lombok.extern.slf4j.Slf4j; + +/** + * 实现创建模板sh和工具包的接口 + */ +@Slf4j +public class OsInstallTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + public OsInstallTemplateCreateServiceImpl(IBootTaskHostMapper iBootTaskHostMapper, + IBootOsInstallFactory iBootOsInstallFactory, + DeviceMapper deviceMapper) { + super(iBootTaskHostMapper, iBootOsInstallFactory, deviceMapper); + } + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + ResultBean resultBean = new ResultBean(true, null, null); + IBootTaskHostEntity iBootTaskHostEntity = iBootTaskHostMapper.getJobHostStatusById(taskHostId); + try { + // 生成ks文件 + IBootInstallParamBean iBootInstallParamBean = JSONUtil.toBean(param, IBootInstallParamBean.class); + IBootOsInstallBean iBootOsInstallBean = iBootInstallParamBean.getIBootOsInstallBean(); + IBootOsInstallService iBootOsInstallService = iBootOsInstallFactory.getOsInstallImpl(iBootOsInstallBean.getImageType(), iBootOsInstallBean.getVersion()); + String ksPath; + if (iBootOsInstallBean.getKsType() == OSInstallModeEnum.SENIOR.getValue()) { // 高级模式 + ksPath = iBootOsInstallService.createKsFile(iBootInstallParamBean, iBootTaskHostEntity.getSn(), iBootInstallParamBean.getIsBond(), taskHostId, iBootTaskHostEntity.getMac()); + } else { // 普通模式 + ksPath = iBootOsInstallService.createKsFileByUI(iBootInstallParamBean, iBootTaskHostEntity.getSn(), iBootInstallParamBean.getIsBond(), taskHostId, iBootTaskHostEntity.getMac()); + } + if (StrUtil.isEmpty(ksPath)) { + resultBean.setFlag(false); + resultBean.setMessage("create ks file error"); + return resultBean; + } + // 复制文件 + iBootOsInstallService.copyFile(iBootOsInstallBean, iBootTaskHostEntity.getSn()); + // 写入MAC.INI + DeviceEntity deviceEntity = deviceMapper.queryEntityById(iBootTaskHostEntity.getResourceId()); + iBootOsInstallService.insertMacIni(iBootOsInstallBean.getImageFileId(), ksPath, iBootTaskHostEntity.getMac(), iBootTaskHostEntity.getSn(), deviceEntity.getBootOption().name()); + // 下发重启动作 + String iBootIp = CommonUtil.getDHCPIp(); + String startSh = iBootOsInstallService.startSh(iBootIp,taskHostId); + IBootFileUtil.createFile(startSh, destPath, "start.sh"); + } catch (Exception e) { + log.error("create os install file error"); + resultBean.setFlag(false); + resultBean.setMessage("create os install file error"); + return resultBean; + } + return resultBean; + } + + @Override + public ResultBean putTools(String destPath) { + return new ResultBean(true, null, null); + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/RaidTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/RaidTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7e254edc793e26d5e453b9dd7dcfa3568bc9aaa1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/RaidTemplateCreateServiceImpl.java @@ -0,0 +1,418 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.RaidLevelEnum; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.raid.*; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.LogicalDisk; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.PhysicalDisk; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.ExecCommand; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.api.util.ReplaceUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 实现创建模板sh和工具包的接口 + */ +@Slf4j +@Service +public class RaidTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + public RaidTemplateCreateServiceImpl() { + super(); + } + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + //创建raid配置的脚本,脚本名称为start.sh + IBootRaidConfigBigTemplateBean iBootInstallParamBean = JSONUtil.toBean(param, IBootRaidConfigBigTemplateBean.class); + StringBuffer cliScript = parseRaidCfg(iBootInstallParamBean); + String iBootIp = CommonUtil.getDHCPIp(); + String shPath = IBootPathConstant.RaidConfigFile + File.separator + "raidConfig.sh"; + List<ReplaceBean> replaceBeanList = new ArrayList<>(); + // todo 通用关键字集成到一个类 + replaceBeanList.add(new ReplaceBean("@taskHostId", taskHostId)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + replaceBeanList.add(new ReplaceBean("@raidConfigCliScript", cliScript.toString())); + ReplaceUtil.autoReplaceNew(shPath, destPath + File.separator + "start.sh", replaceBeanList); + //将校验需要的json串,放到和start.sh同一目录的文件中 + FileUtil.writeUtf8String(JSONUtil.toJsonStr(iBootInstallParamBean.getTemplateBean()), destPath + File.separator + "raid_template.json"); + } catch (Exception e) { + resultBean.setMessage(e.getMessage()); + resultBean.setFlag(false); + return resultBean; + } + return new ResultBean(true, null, null); + } + public StringBuffer parseRaidCfg(IBootRaidConfigBigTemplateBean iBootRaidConfigBigTemplateBean) { + IBootRaidConfigTemplateBean iBootRaidConfigTemplateBean = iBootRaidConfigBigTemplateBean.getTemplateBean(); + List<LogicalDiskForDelete> deleteVolume = iBootRaidConfigBigTemplateBean.getDeleteVolume(); + Map<String, List<LogicalDisk>> raidLogicalDisk = iBootRaidConfigTemplateBean.getRaidLogicalDisk(); + StringBuffer cliScript = new StringBuffer(); + cliScript.append(RaidConfigGrapgicConstant.title).append("\n"); + cliScript.append(RaidConfigGrapgicConstant.pyPath).append("\n"); + String headStr = RaidConfigGrapgicConstant.create_raid; + Map<String, String> cidMap = new HashMap<>(); + List<String> execCidSort = new ArrayList<>(); + List<LogicalDisk> logicalDiskList = new ArrayList<>(); + Map<String, List<String>> partHotSphereMap = new HashMap<>(); + //1、对清空raid配置,首先处理 + if (ObjectUtil.isNotEmpty(iBootRaidConfigTemplateBean.getClearFlag())) { + iBootRaidConfigTemplateBean.getClearFlag().forEach((key, value) -> { + if (value) { + if(StringUtils.isNotEmpty(key)){ + String cid = key.split(":")[0].substring(2, 3); + cliScript.append(headStr).append(" "); + //清空所有raid配置 + cliScript.append(RaidConfigGrapgicConstant.cfg_clear).append(" "); + cliScript.append(cid).append(" ").append("\n"); + } + } + }); + } + //2、处理敏感操作 + if (CollUtil.isNotEmpty(deleteVolume)) { + operDeleteVolum(cliScript,deleteVolume,headStr); + } + //3.将需要建的新的逻辑等统一格式,以list的时候,规整 + if (ObjectUtil.isNotEmpty(raidLogicalDisk)) { + raidLogicalDisk.forEach((key, value) -> { + for (LogicalDisk logicalDisk : value) { + logicalDisk.setRaidCardStr(key); + logicalDiskList.add(logicalDisk); + } + }); + } + //4.对模板中的数据,进行组装创建操作命令 + if (CollUtil.isNotEmpty(logicalDiskList)) { + operLogical(cliScript,logicalDiskList,partHotSphereMap,cidMap,execCidSort,headStr); + } + //5、针对 lsi卡统一做局部热备 + if (!partHotSphereMap.isEmpty()) { + operPartHotSphere(cliScript,partHotSphereMap,headStr); + } + //6 对jobd统一处理 + if (ObjectUtil.isNotEmpty(iBootRaidConfigTemplateBean.getJbodFlag())) { + operJbod(cliScript,iBootRaidConfigTemplateBean,headStr); + } + if (!cidMap.isEmpty()) { + execCidSort.forEach(cid -> { + if (!cidMap.get(cid).contains("SAS3008")) { + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.cfg_init).append(" "); + //CID + cliScript.append(cid).append(" "); + //EID + cliScript.append("all").append(" "); + //op + cliScript.append("fastinit").append(" "); + cliScript.append("\n"); + } + }); + } + //统一调用接口,上报raid配置完成,开始校验 + return cliScript; + } + @Override + public ResultBean putTools(String destPath) { + //将iboot_tool工具放到目标文件 + ResultBean resultBean = new ResultBean(true, null, null); + String toolPath = IBootPathConstant.RaidConfigToolPath; + try { + if (OperationSystemUtil.isWindows()) { + FileUtils.copyDirectory(new File(toolPath), new File(destPath)); + } else { + String cmd = "cp -rp " + toolPath + " " + destPath; + ExecCommand exec = new ExecCommand(); + exec.runLocal(cmd); + } + //统一处理,工具里面的CheckRaid.py的端口号处理了 + List<ReplaceBean> replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + ReplaceUtil.autoReplace(destPath + File.separator + "iboot_tool"+File.separator+"CheckRaid.py", replaceBeanList); + } catch (IOException e) { + log.error("复制文件失败,{}", e.getMessage()); + resultBean.setMessage(e.getMessage()); + resultBean.setFlag(false); + return resultBean; + } + return new ResultBean(true, null, null); + } + private void operDeleteVolum(StringBuffer cliScript, List<LogicalDiskForDelete> deleteVolume, String headStr){ + for (LogicalDiskForDelete logicalDiskForDelete : deleteVolume) { + if (StringUtils.isNotEmpty(logicalDiskForDelete.getOperation()) && logicalDiskForDelete.getOperation().equalsIgnoreCase("delVolume")) { + //删除逻辑盘 + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.delete_volume).append(" "); + cliScript.append(logicalDiskForDelete.getCid()).append(" "); + cliScript.append(logicalDiskForDelete.getVid()).append(" ").append("\n"); + } else if (StringUtils.isNotEmpty(logicalDiskForDelete.getOperation()) && logicalDiskForDelete.getOperation().equalsIgnoreCase("delJobd")) { + //删除JBOD + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.clear_jbod).append(" "); + cliScript.append(logicalDiskForDelete.getCid()).append(" ").append("\n"); + } else if (StringUtils.isNotEmpty(logicalDiskForDelete.getOperation()) && logicalDiskForDelete.getOperation().equalsIgnoreCase("ghotToUG")) { + //删除全局热备 + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.cfg_flag).append(" "); + cliScript.append(logicalDiskForDelete.getCid()).append(" "); + cliScript.append(logicalDiskForDelete.getEid()).append(" "); + cliScript.append(logicalDiskForDelete.getSid()).append(" "); + cliScript.append(LogicalTypeEnum.deletehotspare.getValue()).append(" "); + cliScript.append(logicalDiskForDelete.getCardName()).append(" ").append("\n"); + } else if (StringUtils.isNotEmpty(logicalDiskForDelete.getOperation()) && logicalDiskForDelete.getOperation().equalsIgnoreCase("dhotToUG")) { + //删除局部热备 + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.cfg_flag).append(" "); + cliScript.append(logicalDiskForDelete.getCid()).append(" "); + cliScript.append(logicalDiskForDelete.getEid()).append(" "); + cliScript.append(logicalDiskForDelete.getSid()).append(" "); + cliScript.append(LogicalTypeEnum.deletehotspare.getValue()).append(" "); + cliScript.append(logicalDiskForDelete.getCardName()).append(" ").append("\n"); + } else if (StringUtils.isNotEmpty(logicalDiskForDelete.getOperation()) && logicalDiskForDelete.getOperation().equalsIgnoreCase("dhotToOldLogic")) { + //对现有的逻辑盘做局部热备 + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.cfg_flag).append(" "); + cliScript.append(logicalDiskForDelete.getCid()).append(" "); + cliScript.append(logicalDiskForDelete.getEid()).append(" "); + cliScript.append(logicalDiskForDelete.getSid()).append(" "); + cliScript.append(LogicalTypeEnum.dedicatedoldhotspare.getValue()).append(" "); + cliScript.append(logicalDiskForDelete.getCardName().split(":")[2]).append(" "); + //逻辑磁盘dg + cliScript.append(logicalDiskForDelete.getDg()).append(" "); + //PMC LSI + cliScript.append(logicalDiskForDelete.getCardName().split(":")[1]).append(" "); + cliScript.append("\n"); + } + } + } + private void operLogical(StringBuffer cliScript,List<LogicalDisk> logicalDiskList,Map<String, List<String>> partHotSphereMap,Map<String, String> cidMap,List<String> execCidSort,String headStr){ + Map<String, AtomicInteger> flags = new HashMap<>(); + logicalDiskList.forEach(logicalDisk -> { + String raidType = RaidTypeEnum.LSI.getValue(); + String raidModel = ""; + String key = logicalDisk.getRaidCardStr(); + StringBuilder slotS = new StringBuilder(); + if(StringUtils.isNotEmpty(key)){ + raidType = key.split(":")[1]; + raidModel = key.split(":")[2].replaceAll(" ", ""); + if (raidType.equalsIgnoreCase(RaidTypeEnum.LSI.getValue())) { + String cid = key.split(":")[0].substring(2, 3); + if (!cidMap.containsKey(cid)) { + cidMap.put(cid, key.split(":")[2]); + execCidSort.add(cid); + } + } + } + //jbod不做任何处理 + if (!(logicalDisk.getRaidLevel() != null && logicalDisk.getRaidLevel().equals(RaidLevelEnum.JBOD))) { + //创建raid,且逻辑盘的VID为null,null代表新做的盘 + if (logicalDisk.getType().equalsIgnoreCase(LogicalTypeEnum.logical.getValue()) && StringUtils.isEmpty(logicalDisk.getVid())) { + cliScript.append(headStr).append(" "); + //raid创建 配置区分标志 + cliScript.append(RaidConfigGrapgicConstant.create_flag).append(" "); + //slotID拼接处理 + for (PhysicalDisk physicalDisk : logicalDisk.getPhysicalDiskList()) { + slotS.append(physicalDisk.getEid() + ":" + physicalDisk.getSlot()).append(","); + } + String raidLevel = logicalDisk.getRaidLevel().name(); + cliScript.append(raidLevel.replace("RAID", "").toLowerCase()).append(" ");//raid level + String cid = key.split(":")[0].substring(2); + if (!flags.containsKey(cid)) { + flags.put(cid, new AtomicInteger(0)); + } + cliScript.append(cid).append(" "); //CID + cliScript.append(slotS.substring(0, slotS.length() - 1)).append(" ");//EID:SID + cliScript.append("MAX").append(" "); + cliScript.append(logicalDisk.getName()).append(" "); + if (StringUtils.isNotEmpty(logicalDisk.getStrip())) { + cliScript.append(logicalDisk.getStrip()).append(" "); + } else { + cliScript.append("null").append(" "); + } + if (StringUtils.isNotEmpty(logicalDisk.getReadPolicy()) && !"not support".equals(logicalDisk.getReadPolicy())) { + cliScript.append(logicalDisk.getReadPolicy()).append(" "); + } else { + cliScript.append("null").append(" "); + } + if (StringUtils.isNotEmpty(logicalDisk.getWritePolicy()) && !"not support".equals(logicalDisk.getWritePolicy())) { + cliScript.append(logicalDisk.getWritePolicy()).append(" "); + } else { + cliScript.append("null").append(" "); + } + if (StringUtils.isNotEmpty(logicalDisk.getIoPolicy()) && !"not support".equals(logicalDisk.getIoPolicy())) { + cliScript.append(logicalDisk.getIoPolicy()).append(" "); + } else { + cliScript.append("null").append(" "); + } + if (StringUtils.isNotEmpty(logicalDisk.getPdperarray())) { // 子组硬盘数 + cliScript.append(logicalDisk.getPdperarray()).append(" "); + } else { + cliScript.append("null").append(" "); + } + //该卡做了清空全部配置 + cliScript.append("no").append(" "); + if (raidType.equalsIgnoreCase(RaidTypeEnum.LSI.getValue())) { + cliScript.append("null").append(" "); + } else { + // pm8060 method 不支持 default + // todo 7.3 按raidmodel单独实现 + if (raidModel.contains("PM8060")) { + cliScript.append("quick").append(" "); + } else { + cliScript.append("default").append(" "); + } + } + cliScript.append(raidModel).append(" "); + if (StringUtils.isNotEmpty(logicalDisk.getCachePolicy())) { // PD缓存 + cliScript.append(logicalDisk.getCachePolicy()).append(" "); + } else { + cliScript.append("default").append(" "); + } + cliScript.append("\n"); + //是否启动盘 + if (logicalDisk.isBoot()) { + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.op_raid).append(" "); + //CID + cliScript.append(key.split(":")[0].substring(2)).append(" "); + //逻辑磁盘名称 + cliScript.append(logicalDisk.getName()).append(" "); + //PMC LSI 用于判断去logical id 还是 DriveGroup + cliScript.append(key.split(":")[1]).append(" "); + cliScript.append("\n"); + } + } + if (CollUtil.isNotEmpty(logicalDisk.getPartHotDisk()) && StringUtils.isEmpty(logicalDisk.getVid())) {//只需要给新做逻辑盘处理局部热备 + for (PhysicalDisk physicalDisk : logicalDisk.getPartHotDisk()) { + if (!raidType.equalsIgnoreCase(RaidTypeEnum.LSI.getValue())) { + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.cfg_flag).append(" "); + //CID + cliScript.append(key.split(":")[0].substring(2)).append(" "); + //EID + cliScript.append(logicalDisk.getEid()).append(" "); + //SLOT ID + cliScript.append(physicalDisk.getSlot()).append(" "); + //OP + cliScript.append(LogicalTypeEnum.dedicatedhotspare.getValue()).append(" "); + cliScript.append(raidModel).append(" "); + //逻辑磁盘名称 + cliScript.append(logicalDisk.getName()).append(" "); + //PMC LSI + cliScript.append(key.split(":")[1]).append(" "); + cliScript.append("\n"); + } else {// 对于LSI卡一个盘做多个逻辑盘的局部热备,不能分开做 单独处理 + String id = raidModel + ":" + physicalDisk.getCid() + ":" + physicalDisk.getEid() + ":" + physicalDisk.getSlot(); + if (partHotSphereMap.containsKey(id)) { + partHotSphereMap.get(id).add(logicalDisk.getName()); + } else { + List<String> logicalNameList = new ArrayList<>(); + logicalNameList.add(logicalDisk.getName()); + partHotSphereMap.put(id, logicalNameList); + } + } + } + //全局热备 + } else if (logicalDisk.getType().equalsIgnoreCase("hot")) { + for (PhysicalDisk physicalDisk : logicalDisk.getPhysicalDiskList()) { + boolean ischeck = true; + if (StringUtils.isNotEmpty(physicalDisk.getContent())) { + RaidDriveBean raidDriveBean = JSONUtil.toBean(physicalDisk.getContent(), RaidDriveBean.class); + if (StringUtils.isNotEmpty(raidDriveBean.getGlobalHot())) { + ischeck = false; + } + } + if (ischeck) { + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.cfg_flag).append(" "); + //CID + cliScript.append(key.split(":")[0].substring(2)).append(" "); + //EID + cliScript.append(physicalDisk.getEid()).append(" "); + //SLOT ID + cliScript.append(physicalDisk.getSlot()).append(" "); + //OP + cliScript.append(LogicalTypeEnum.globalhotspare.getValue()).append(" "); + cliScript.append(raidModel).append(" "); + // 参数凑数没有意义 + cliScript.append("1").append(" ").append("1").append(" "); + cliScript.append("\n"); + } + } + } + } + }); + } + private void operPartHotSphere(StringBuffer cliScript,Map<String, List<String>> partHotSphereMap,String headStr){ + partHotSphereMap.forEach((key, value) -> { + if(StringUtils.isNotEmpty(key)){ + String raidModel = key.split(":")[0]; + String cid = key.split(":")[1]; + String sid = key.split(":")[3]; + String eid = key.split(":")[2]; + String logicalName = String.join(",", value); + cliScript.append(headStr).append(" "); + cliScript.append(RaidConfigGrapgicConstant.cfg_flag).append(" "); + //CID + cliScript.append(cid).append(" "); + //EID + cliScript.append(eid).append(" "); + //SLOT ID + cliScript.append(sid).append(" "); + //OP + cliScript.append(LogicalTypeEnum.dedicatedhotspare.getValue()).append(" "); + cliScript.append(raidModel).append(" "); + //逻辑磁盘名称 + cliScript.append(logicalName).append(" "); + //PMC LSI + cliScript.append(RaidTypeEnum.LSI.getValue()).append(" "); + cliScript.append("\n"); + } + }); + } + private void operJbod(StringBuffer cliScript,IBootRaidConfigTemplateBean iBootRaidConfigTemplateBean,String headStr){ + iBootRaidConfigTemplateBean.getJbodFlag().forEach((key, value) -> { + if (value) { + String cid = key.split(":")[0].substring(2, 3); + String raidModel = key.split(":")[0]; + cliScript.append(headStr).append(" "); + //raid创建 配置区分标志 + cliScript.append(RaidConfigGrapgicConstant.cfg_flag).append(" "); + //CID + cliScript.append(cid).append(" "); + //EID + cliScript.append("all").append(" "); + //SID + cliScript.append("all").append(" "); +// } + cliScript.append(LogicalTypeEnum.makejbod.getValue()).append(" "); + cliScript.append(raidModel).append(" "); + //no use param + cliScript.append("0").append(" "); + cliScript.append("0").append(" "); + cliScript.append("\n"); + } + }); + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/StressTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/StressTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..17ac56ae001dd48bcb92b85e988eba0e7b40fdc1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/StressTemplateCreateServiceImpl.java @@ -0,0 +1,76 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.json.JSONUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootStressTestBean; +import com.inspur.ispim.cosmos.iboot.base.api.util.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * 实现创建模板sh和工具包的接口 + */ +@Slf4j +@Service +public class StressTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + public StressTemplateCreateServiceImpl() { + super(); + } + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + // 创建start脚本,直接执行压力测试脚本 + String iBootIp = CommonUtil.getDHCPIp(); + String startShell = "#!/bin/bash\n" + "sh stress_test.sh"; + IBootFileUtil.createFile(startShell, destPath, "start.sh"); + // 创建压力测试脚本,直接替换参数 + IBootStressTestBean iBootStressTestBean = JSONUtil.toBean(param, IBootStressTestBean.class); + List<ReplaceBean> replaceBeanList = new ArrayList<>(); + replaceBeanList.add(new ReplaceBean("@cpuMinutes", String.valueOf(iBootStressTestBean.getCpuMinutes()))); + replaceBeanList.add(new ReplaceBean("@cpuPercent", String.valueOf(iBootStressTestBean.getCpuPercent()))); + replaceBeanList.add(new ReplaceBean("@memoryMinutes", String.valueOf(iBootStressTestBean.getMemoryMinutes()))); + replaceBeanList.add(new ReplaceBean("@interval", String.valueOf(iBootStressTestBean.getInterval()))); + replaceBeanList.add(new ReplaceBean("@taskHostId", taskHostId)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + ReplaceUtil.autoReplaceNew(IBootPathConstant.StressTestFile + File.separator + "stress_test.sh", destPath + File.separator + "stress_test.sh", replaceBeanList); + } catch (Exception e) { + log.error("create template shell file error"); + resultBean.setFlag(false); + resultBean.setMessage("create template shell file error"); + return resultBean; + } + return resultBean; + } + + @Override + public ResultBean putTools(String destPath) { + ResultBean resultBean = new ResultBean(true, null, null); + // 直接拷贝压力测试组件 + String cpCommand = "cp -r " + IBootPathConstant.StressTestFile + File.separator + "tool/* " + destPath; + try { + if (OperationSystemUtil.isWindows()) { + FileUtils.copyDirectory(new File(IBootPathConstant.StressTestFile + File.separator + "tool"), new File(destPath)); + } else { + ExecCommand exec = new ExecCommand(); + exec.runLocal(cpCommand); + } + } catch (Exception e) { + log.error("put tools file error"); + resultBean.setFlag(false); + resultBean.setMessage("put tools file error"); + return resultBean; + } + return resultBean; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/TaskTemplateFactory.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/TaskTemplateFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..fcca40ba55a63629f1836b0d1b9ddd5338ea17ce --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/TaskTemplateFactory.java @@ -0,0 +1,84 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.TemplateTypeEnum; +import com.inspur.ispim.cosmos.iboot.base.api.service.TemplateCreateService; +import com.inspur.ispim.cosmos.iboot.base.core.impl.osinstall.IBootOsInstallFactory; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.DeviceMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootInabndFileMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostMapper; +import lombok.extern.slf4j.Slf4j; + +/** + * @description + * @auther zhangchen + * @date 2023/8/08 + */ +@Slf4j +public class TaskTemplateFactory { + + /** + * 标记模板类型 + */ + private final IBootTaskHostMapper iBootTaskHostMapper; + private final IBootOsInstallFactory iBootOsInstallFactory; + private final IBootInabndFileMapper iBootInabndFileMapper; + + private final DeviceMapper deviceMapper; + + public TaskTemplateFactory(IBootTaskHostMapper iBootTaskHostMapper, + IBootOsInstallFactory iBootOsInstallFactory, + IBootInabndFileMapper iBootInabndFileMapper, + DeviceMapper deviceMapper) { + this.iBootTaskHostMapper = iBootTaskHostMapper; + this.iBootOsInstallFactory = iBootOsInstallFactory; + this.iBootInabndFileMapper = iBootInabndFileMapper; + this.deviceMapper = deviceMapper; + } + + /** + * 根据模板类型获取实现类 + * + * @param templateType + * @return + */ + public TemplateCreateService getCreateTemplateImpl(String templateType) { + TemplateCreateService templateCreateService = null; + try { + TemplateTypeEnum templateTypeEnum= TemplateTypeEnum.valueOf(templateType); + switch (templateTypeEnum) { + case USER_CONF: + templateCreateService = new UserTemplateCreateServiceImpl(iBootTaskHostMapper, deviceMapper); + break; + case RAID_SET_CONF: + templateCreateService = new RaidTemplateCreateServiceImpl(); + break; + case NETWORK_CONF: + templateCreateService = new NetworkTemplateCreateServiceImpl(iBootTaskHostMapper); + break; + case STRESS_TEST: + templateCreateService = new StressTemplateCreateServiceImpl(); + break; + case CUSTOM_TEMPLATE: + templateCreateService = new CustomTemplateCreateServiceImpl(iBootInabndFileMapper); + break; + case OS_INSTALL: + templateCreateService = new OsInstallTemplateCreateServiceImpl(iBootTaskHostMapper, iBootOsInstallFactory, deviceMapper); + break; + case DEVICE_REFRESH: + templateCreateService = new DeviceRefreshTemplateCreateServiceImpl(); + break; + case OS_EXPLORE: + templateCreateService = new OsExplorerTemplateCreateServiceImpl(iBootTaskHostMapper, deviceMapper); + break; + case DISK_CLONE, DISK_RESTORE: + templateCreateService = new DiskCloneTemplateCreateServiceImpl(); + break; + default: + templateCreateService = new CommonTemplateCreateServiceImpl(); + } + } catch (Exception e) { + log.error("get TemplateCreateService error:" + e.getMessage()); + } + return templateCreateService; + } +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/UserTemplateCreateServiceImpl.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/UserTemplateCreateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b39d2cf828f76a60f9e22d303972a6097f074cdc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/impl/templatecreate/UserTemplateCreateServiceImpl.java @@ -0,0 +1,172 @@ +package com.inspur.ispim.cosmos.iboot.base.core.impl.templatecreate; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.inspur.cdc.commons.lang.deployUtil.utils.OperationSystemUtil; +import com.inspur.ispim.cosmos.commons.utils.TarUtil; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ReplaceBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.ResultBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.IBootUserCfgBeans; +import com.inspur.ispim.cosmos.iboot.base.api.bean.template.UserCfgBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import com.inspur.ispim.cosmos.iboot.base.api.util.CommonUtil; +import com.inspur.ispim.cosmos.iboot.base.api.util.ExecCommand; +import com.inspur.ispim.cosmos.iboot.base.api.util.IBootPathConstant; +import com.inspur.ispim.cosmos.iboot.base.api.util.ReplaceUtil; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.DeviceMapper; +import com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 实现创建模板sh和工具包的接口 + */ +@Slf4j +@Service +public class UserTemplateCreateServiceImpl extends CommonTemplateCreateServiceImpl { + + public UserTemplateCreateServiceImpl(IBootTaskHostMapper iBootTaskHostMapper, DeviceMapper deviceMapper) { + super(iBootTaskHostMapper, deviceMapper); + } + + @Override + public ResultBean createTemplateShFile(String destPath, String taskHostId, String param) { + ResultBean resultBean = new ResultBean(true, null, null); + try { + String iBootIp = CommonUtil.getDHCPIp(); + String webFileIp = CommonUtil.getWebServerIp(); + // 生成start.sh + IBootTaskHostEntity iBootTaskHostEntity = iBootTaskHostMapper.getJobHostStatusById(taskHostId); + List<UserCfgBean> userCfgBeans = JSONUtil.toBean(param, IBootUserCfgBeans.class).getUserCfgBeans(); + UserCfgBean userCfgBean = userCfgBeans.get(0); + if (StringUtils.isNotEmpty(userCfgBean.getSn())) { // 设备管理 + for (UserCfgBean userCfgBean1 : userCfgBeans) { + if (userCfgBean1.getSn().equalsIgnoreCase(iBootTaskHostEntity.getSn())) { + userCfgBean = userCfgBean1; + break; + } + } + } + String shPath; + List<ReplaceBean> replaceBeanList = new ArrayList<>(); + if (userCfgBean.isDelete()) { // 删除用户 + shPath = IBootPathConstant.UserConfigFile + File.separator + "delete_user.sh"; + replaceBeanList.add(new ReplaceBean("@username", userCfgBean.getUsername())); + } else { // 添加/编辑用户 + shPath = IBootPathConstant.UserConfigFile + File.separator + "operate_user.sh"; + replaceBeanList.add(new ReplaceBean("@username", userCfgBean.getUsername())); + replaceBeanList.add(new ReplaceBean("@password", userCfgBean.getUserPw())); + switch (userCfgBean.getPrivilege()) { + case "Admin" -> userCfgBean.setPrivilege("4"); + case "User" -> userCfgBean.setPrivilege("2"); + case "Operator" -> userCfgBean.setPrivilege("3"); + default -> userCfgBean.setPrivilege("15"); + } + replaceBeanList.add(new ReplaceBean("@privilege", userCfgBean.getPrivilege())); + } + if (StringUtils.isEmpty(userCfgBean.getId())) { + userCfgBean.setId("-1"); + } + replaceBeanList.add(new ReplaceBean("@id", userCfgBean.getId())); + replaceBeanList.add(new ReplaceBean("@taskHostId", taskHostId)); + replaceBeanList.add(new ReplaceBean("@ip", iBootIp)); + replaceBeanList.add(new ReplaceBean("30100", IBootPathConstant.getIBootPort())); + ReplaceUtil.autoReplaceNew(shPath, destPath + File.separator + "start.sh", replaceBeanList); + } catch (Exception e) { + log.error("create template shell file error"); + resultBean.setFlag(false); + resultBean.setMessage("create template shell file error"); + return resultBean; + } + return resultBean; + } + + @Override + public ResultBean putTools(String destPath) { + return new ResultBean(true, null, null); + } + + @Override + public ResultBean execute(String destPath, IBootTaskHostEntity iBootTaskHostEntity) { + ResultBean resultBean = new ResultBean(true, null, null); + // 执行前先判断pxe是否启动 + if (!deviceMapper.queryDevicePxeOnlineById(iBootTaskHostEntity.getResourceId())) { + int i = 10; + // 3分钟循环一次,循环10次 + while (i > 0) { + try { + Thread.sleep(180 * 1000L); + } catch (Exception e) { + log.error(e.getMessage()); + } + if (deviceMapper.queryDevicePxeOnlineById(iBootTaskHostEntity.getResourceId())) { + break; + } + i--; + } + if (i == 0) { // 超时 + resultBean.setFlag(false); + resultBean.setMessage("wait for pxe-start timeout."); + return resultBean; + } + } + // 如果resourceIp为空,再循环取一次 + if (StringUtils.isEmpty(iBootTaskHostEntity.getResourceIp())) { + int i = 10; + // 3分钟循环一次,循环10次 + while (i > 0) { + iBootTaskHostEntity.setResourceIp(deviceMapper.queryEntityById(iBootTaskHostEntity.getResourceId()).getDhcpIp()); + if (StringUtils.isNotEmpty(iBootTaskHostEntity.getResourceIp())) { + break; + } + try { + Thread.sleep(180 * 1000L); + } catch (Exception e) { + log.error(e.getMessage()); + } + i--; + } + if (i == 0) { // 超时 + resultBean.setFlag(false); + resultBean.setMessage("wait for pxe-callback timeout."); + return resultBean; + } + } + try { + if (OperationSystemUtil.isWindows()) { + TarUtil.compress(destPath, destPath + "start.tar.gz"); + } else { + String cmd = "cd " + destPath + " && chmod +x -R ./* && tar -zcvf " + destPath + "start.tar.gz *"; + ExecCommand exec = new ExecCommand(); + exec.runLocal(cmd); + } + } catch (IOException e) { + resultBean.setMessage(e.getMessage()); + resultBean.setFlag(false); + return resultBean; + } + File tarfile = new File(FileUtil.normalize(destPath + "start.tar.gz")); + String currentFileMd5 = CommonUtil.md5(tarfile); + Map<String, Object> paramMap = new HashMap<>(); + paramMap.put("file", tarfile); + paramMap.put("md5", currentFileMd5); + String body = HttpUtil.post("http://" + iBootTaskHostEntity.getResourceIp() + ":16061/pushTask", paramMap); + if (!body.contains("success")) {//任务触发失败,将任务置结束 + resultBean.setMessage("调用设备接口失败"); + resultBean.setFlag(false); + return resultBean; + + } + return resultBean; + } + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/DeviceMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/DeviceMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d937cf224d44f7f60ac71fe8e6e1584894393054 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/DeviceMapper.java @@ -0,0 +1,50 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.device.DeviceQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.DeviceShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity; +import org.apache.ibatis.annotations.Param; +import tk.mybatis.mapper.common.BaseMapper; + +import java.util.List; + + +public interface DeviceMapper extends BaseMapper<DeviceEntity> { + +// @Select("select resource_id from cosmos_iboot_device where user_id = #{userId}") +// List<String> getFavoritesResourceIdsByUserId(@Param("userId") String userId); + + List<DeviceEntity> queryListWithPage(@Param("query") DeviceQueryBean query); + + List<DeviceEntity> querySingRaidInfo(@Param("query") DeviceQueryBean query); + + DeviceEntity querySingRaidByMd5(@Param("md5") String md5); + + List<String> queryModelList(@Param("vendor") String vendor); + + List<String> queryVendorList(); + + int batchDeleteNotBusyDevice(@Param("query") DeviceQueryBean query); + + int updateStatus(); + + int updateIpmiStatusById(@Param("device") DeviceEntity deviceEntity); + + int updateBySn(@Param("device") DeviceEntity deviceEntity); + + int updateById(@Param("device") DeviceEntity deviceEntity); + + int updateHeartBeatBySn(@Param("sn") String sn, @Param("ip") String ip); + + List<DeviceEntity> getAll(); + + List<DeviceEntity> queryListBySn(@Param("query") List<String> sn); + + int batchInsert(@Param("device") List<DeviceEntity> deviceEntities); + + DeviceEntity queryEntityById(@Param("id") String id); + + boolean queryDevicePxeOnlineById(@Param("query") String id); + + DeviceShowBean getDeviceShow(); +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootImageXmlMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootImageXmlMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3c7becd7767ba0221850d50c4b0ec930792b0329 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootImageXmlMapper.java @@ -0,0 +1,14 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootImageXmlEntity; +import org.apache.ibatis.annotations.Param; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/17 + */ +public interface IBootImageXmlMapper extends BaseMapper<IBootImageXmlEntity> { + String queryByImageId(@Param("imageId") String imageId); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootInabndFileMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootInabndFileMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..b72208f2b977edc221b2d77509ca6a3945b57ab8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootInabndFileMapper.java @@ -0,0 +1,20 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootInbandFileEntity; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/9 + */ +@Repository +public interface IBootInabndFileMapper extends BaseMapper<IBootInbandFileEntity> { + + IBootInbandFileEntity getOneById(@Param("id") String id); + + int deleteById(@Param("id") String id); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootRaidConfigXmlMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootRaidConfigXmlMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..a4b21909227b0204aee53ad619d5390dc581866b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootRaidConfigXmlMapper.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRaidConfigXmlEntity; +import org.apache.ibatis.annotations.Param; +import tk.mybatis.mapper.common.BaseMapper; + + +/** + * @description + * @auther gengzhicheng + * @date 2023/4/14 + */ +public interface IBootRaidConfigXmlMapper extends BaseMapper<IBootRaidConfigXmlEntity> { + + IBootRaidConfigXmlEntity getByModelAndType(@Param("model") String model, @Param("type") String type); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootRepositoryImageMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootRepositoryImageMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0a238e9bb2015d83877affe833a851675412cf3e --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootRepositoryImageMapper.java @@ -0,0 +1,39 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.IBootOtherSupportedImageBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.image.ImageQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRepositoryImageEntity; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @author zhangchen + * @description 仓库镜像表,专门存储ISO镜像数据访问层接口 + * @date 2023/08/01 10:22:57 + */ +@Repository +public interface IBootRepositoryImageMapper extends BaseMapper<IBootRepositoryImageEntity> { + + List<IBootRepositoryImageEntity> getByConditions(@Param("query") ImageQueryBean query); + + List<IBootRepositoryImageEntity> getYumImageList(); + + List<IBootRepositoryImageEntity> getAll(); + + List<IBootOtherSupportedImageBean> selectSupportedImageAll(); + + /** + * 根据ID获取单个 + * + * @param id + * @return + */ + IBootRepositoryImageEntity getByID(@Param("id") String id); + + void deleteById(@Param("id") String id); + + IBootRepositoryImageEntity getByFileName(@Param("fileName") String fileName); +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootStressDataMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootStressDataMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..a71c3786fb1dd622441c1f49f87a43f9cf2a491d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootStressDataMapper.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressDataEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface IBootStressDataMapper extends BaseMapper<IBootStressDataEntity> { + + List<IBootStressDataEntity> getStressData(@Param("jobHostId") String jobHostId); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootStressTessServerMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootStressTessServerMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..497d4c0ec42145f22bfd4b3b55d0c483d5f21ba6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootStressTessServerMapper.java @@ -0,0 +1,21 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressTestServerEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface IBootStressTessServerMapper extends BaseMapper<IBootStressTestServerEntity> { + + IBootStressTestServerEntity getById(@Param("jobHostId") String jobHostId); + + List<IBootStressTestServerEntity> getListByTaskId(@Param("query") IBootTaskQueryBean iBootTaskQueryBean); + + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHistoryMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHistoryMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..8b1e0d09baa8ec5e0f01206a93615b2e291b33f2 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHistoryMapper.java @@ -0,0 +1,23 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TotalBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHistoryEntity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +public interface IBootTaskHistoryMapper extends BaseMapper<IBootTaskHistoryEntity> { + + List<IBootTaskHistoryEntity> getByConditions(@Param("query") IBootTaskQueryBean query); + + IBootTaskHistoryEntity getTaskHistoryByTaskId(@Param("taskId") String taskId); + + int deleteByTaskId(@Param("taskId") String taskId); + + TotalBean getTotal(); + + List<IBootTaskHistoryEntity> getTaskHistoryListTopten(); +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostHistoryMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostHistoryMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..822a434e62a2ad4a29f6617899f29877521835a9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostHistoryMapper.java @@ -0,0 +1,36 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.bean.index.TemplateShowBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostHistoryEntity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +public interface IBootTaskHostHistoryMapper extends BaseMapper<IBootTaskHostHistoryEntity> { + + List<IBootTaskHostHistoryEntity> getByConditions(@Param("query") IBootTaskQueryBean query); + + List<IBootTaskHostHistoryEntity> getListByTaskId(@Param("query") IBootTaskQueryBean query); + + List<IBootTaskHostHistoryEntity> getFailListByTaskId(@Param("taskId") String taskId); + + IBootTaskJobBean getIBootTaskJobByTaskId(@Param("taskId") String taskId); + + IBootTaskHostHistoryEntity getListByTaskHostId(@Param("taskHostId") String taskHostId); + + List<IBootTaskHostHistoryEntity> jobHost2History(@Param("taskId") String taskId, @Param("countstart") int countstart, @Param("counthost") int counthost); + + int getHost2HistoryCount(@Param("taskId") String taskId); + + List<IBootTaskHostHistoryEntity> getHostListByTaskId(@Param("taskId") String taskId); + + int deleteByTaskId(@Param("taskId") String taskId); + + List<TemplateShowBean> getTemplateShow(); + + List<TemplateShowBean> getImageShow(); +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostLogMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..25c7d4b5c9d937a5ce49f37b5d829b27a7117ca8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostLogMapper.java @@ -0,0 +1,13 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostLogEntity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +public interface IBootTaskHostLogMapper extends BaseMapper<IBootTaskHostLogEntity> { + + List<IBootTaskHostLogEntity> getByConditions(@Param("jobHostId") String jobHostId); +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e145ba4ec5b75f4d58d2a3a308d2cd705d5ec68d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskHostMapper.java @@ -0,0 +1,38 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface IBootTaskHostMapper extends BaseMapper<IBootTaskHostEntity> { + + List<IBootTaskHostEntity> getByConditions(@Param("query") IBootTaskQueryBean query); + + List<IBootTaskHostEntity> selectAllHost(); + + List<IBootTaskHostEntity> getListByTaskId(@Param("taskId") String taskId, @Param("countstart") int countstart, @Param("counthost") int counthost); + + int getListCountByTaskId(@Param("taskId") String taskId); + + List<IBootTaskHostEntity> getListByQuery(@Param("query") IBootTaskQueryBean query); + + IBootTaskJobBean getIBootTaskJobByTaskId(@Param("taskId") String taskId); + + List<IBootTaskHostEntity> getRunningWaitingListByTaskId(@Param("taskId") String taskId); + + IBootTaskHostEntity getJobHostStatusById(@Param("id") String id); + + List<IBootTaskHostEntity> getWaitingTaskHostList(@Param("limitCount") int limitCount); + + int deleteByTaskId(@Param("taskId") String taskId); + + int getRunningCount(); +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..1c8b3bc6f23dcfb48d799c9c95b4622414ececb3 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTaskMapper.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskEntity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +public interface IBootTaskMapper extends BaseMapper<IBootTaskEntity> { + + List<IBootTaskEntity> getByConditions(@Param("query") IBootTaskQueryBean query); + + List<IBootTaskEntity> getByTemplateId(@Param("templateId") String templateId); + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTemplateMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTemplateMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..30f10ed57928aefaa144c4b3158a499d56cbc9fd --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTemplateMapper.java @@ -0,0 +1,25 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.bean.IBootTemplateQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTemplateEntity; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/7 + */ +@Repository +public interface IBootTemplateMapper extends BaseMapper<IBootTemplateEntity> { + + List<IBootTemplateEntity> getByConditions(@Param("query") IBootTemplateQueryBean query); + + IBootTemplateEntity getByID(@Param("id") String id); + + List<IBootTemplateEntity> getByName(@Param("name") String name); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTimezoneMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTimezoneMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..fb87b49476a4a4919c41b945b3c5ae1a7ce45242 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/IBootTimezoneMapper.java @@ -0,0 +1,18 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.cdc.combo.mybatis.tkmapper.BaseMapper; +import com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTimezoneEntity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @description + * @auther gengzhicheng + * @date 2023/8/15 + */ +public interface IBootTimezoneMapper extends BaseMapper<IBootTimezoneEntity> { + + List<IBootTimezoneEntity> getBySysType(@Param("systemType") String systemType); + +} diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/TaskHostMapper.java b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/TaskHostMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e51ef9bdae45328a73f5698598c19496e9baccae --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/java/com/inspur/ispim/cosmos/iboot/base/core/mapper/TaskHostMapper.java @@ -0,0 +1,17 @@ +package com.inspur.ispim.cosmos.iboot.base.core.mapper; + +import com.inspur.ispim.cosmos.iboot.base.api.bean.TaskQueryBean; +import com.inspur.ispim.cosmos.iboot.base.api.entity.TaskHostEntity; +import org.apache.ibatis.annotations.Param; +import tk.mybatis.mapper.common.BaseMapper; + +import java.util.List; + + +public interface TaskHostMapper extends BaseMapper<TaskHostEntity> { + + List<TaskHostEntity> getList(@Param("query") TaskQueryBean query); + + List<TaskHostEntity> getReadyTaskBySN(@Param("sn") String sn); + +} \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230809101100__iboot_init.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230809101100__iboot_init.sql new file mode 100644 index 0000000000000000000000000000000000000000..3508f454e5cde3bc393db96f1eb067cb7bc6f4bc --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230809101100__iboot_init.sql @@ -0,0 +1,23 @@ +SET +FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- Table structure for cosmos_iboot_device +-- ---------------------------- +DROP TABLE IF EXISTS `cosmos_iboot_device`; +CREATE TABLE `cosmos_iboot_device` +( + `pk` int(11) NOT NULL COMMENT '主键', + `id` varchar(11) COLLATE utf8_bin NOT NULL COMMENT '主键ID', + `sn` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'SN', + `dhcp_ip` varchar(64) COLLATE utf8_bin DEFAULT NULL, + `status` enum('Offline','Online','Busy') COLLATE utf8_bin DEFAULT 'Offline', + `vendor` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '厂商', + `model` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '机型', + `creator` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '创建者', + `updater` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '更新者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`pk`), + KEY `resource_id` (`sn`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ISIB设备主表'; diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230816100001__iboot_base_init.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230816100001__iboot_base_init.sql new file mode 100644 index 0000000000000000000000000000000000000000..9560eaccca047012a1cfbaf0b49abbdfac92525b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230816100001__iboot_base_init.sql @@ -0,0 +1,190 @@ +DROP TABLE IF EXISTS `cosmos_iboot_task`; +CREATE TABLE `cosmos_iboot_task` +( + `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '任务名', + `task_status` enum('HISTORY','RUNNING','PAUSE','UNSTART','WAITING') CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT 'RUNNING' COMMENT '状态,需要根据single表维护的', + `start_time` datetime(0) NULL DEFAULT NULL, + `end_time` datetime(0) NULL DEFAULT NULL, + `cron` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '循环任务的表达式', + `execute_time` datetime(0) NULL DEFAULT NULL COMMENT '定时任务的指定执行时间', + `execute_type` enum('TIMED','CYCLE','RUNTIME') CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT 'RUNTIME' COMMENT '默认是即时任务', + `create_user` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '创建人', + `pk` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '业务主键', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `template_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '关联模板id', + `template_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '关联模板类型', + `template_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '关联模板明长城', + PRIMARY KEY (`pk`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '任务' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for cosmos_iboot_task_history +-- ---------------------------- +DROP TABLE IF EXISTS `cosmos_iboot_task_history`; +CREATE TABLE `cosmos_iboot_task_history` +( + `task_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `task_status` enum('UNSTART','RUNNING','HISTORY') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'HISTORY', + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `start_time` datetime(0) NULL DEFAULT NULL, + `end_time` datetime(0) NULL DEFAULT NULL, + `execute_type` enum('TIMED','RUNTIME','CYCLE') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'RUNTIME', + `execute_time` datetime(0) NULL DEFAULT NULL, + `cron` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + `pk` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '业务主键', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `excute_user` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '执行人', + `template_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板id', + `template_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板名称', + `template_type` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模板类型', + PRIMARY KEY (`pk`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 289 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for cosmos_iboot_task_host +-- ---------------------------- +DROP TABLE IF EXISTS `cosmos_iboot_task_host`; +CREATE TABLE `cosmos_iboot_task_host` +( + `task_id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '任务id,与iboot_task表id关联', + `resource_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '设备id', + `job_host_status` enum('FAILED','SUCCESS','RUNNING','WAITING') CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'WAITING' COMMENT '子任务对应设备的状态', + `start_time` datetime(0) NULL DEFAULT NULL, + `end_time` datetime(0) NULL DEFAULT NULL, + `process` int(10) UNSIGNED NULL DEFAULT NULL, + `msg` longtext CHARACTER SET utf8 COLLATE utf8_bin NULL, + `pk` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '业务主键', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `param` longtext CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT '模板参数(每个设备可能不同)', + `template_type` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '模板类型', + `template_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '模板类型', + `sn` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '设备sn', + `resource_ip` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '设备ip', + `mac` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'mac', + PRIMARY KEY (`pk`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE, + UNIQUE INDEX `taskId_jobId_resourceId`(`task_id`, `resource_id`) USING BTREE, + INDEX `taskId_resourceId`(`task_id`, `resource_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '子任务对应设备的' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for cosmos_iboot_task_host_history +-- ---------------------------- +DROP TABLE IF EXISTS `cosmos_iboot_task_host_history`; +CREATE TABLE `cosmos_iboot_task_host_history` +( + `job_host_id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `task_id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `resource_ip` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `resource_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `mac` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `job_host_status` enum('FAILED','SUCCESS','RUNNING','WAITING') CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT 'WAITING' COMMENT '子任务对应设备的状态', + `start_time` datetime(0) NULL DEFAULT NULL, + `end_time` datetime(0) NULL DEFAULT NULL, + `process` int(10) UNSIGNED NULL DEFAULT NULL, + `msg` longtext CHARACTER SET utf8 COLLATE utf8_bin NULL, + `pk` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '业务主键', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `model` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `sn` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `param` longtext CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT '执行参数,每个设备可能不同', + PRIMARY KEY (`pk`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 412 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '历史子任务对应设备的' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for cosmos_iboot_task_host_log +-- ---------------------------- +DROP TABLE IF EXISTS `cosmos_iboot_task_host_log`; +CREATE TABLE `cosmos_iboot_task_host_log` +( + `content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + `task_id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `resource_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `job_host_id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL, + `pk` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '业务主键', + `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`pk`) USING BTREE, + UNIQUE INDEX `id`(`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_bin COMMENT = '子任务对应设备的执行日志记录表' ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS `starlet_control_iboot_template`; +CREATE TABLE `starlet_control_iboot_template` +( + `name` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '模板名称', + `description` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '描述', + `content` longtext COLLATE utf8_bin COMMENT '模板内容', + `model` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '机型', + `template_type` enum('OS_INSTALL','OS_EXPLORE','STRESS_TEST','RAID_CONF','USER_CONF') COLLATE utf8_bin DEFAULT NULL COMMENT '模板类型', + `real_model` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '映射机型', + `vendor` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '厂商', + `create_user` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '创建者', + `update_user` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '修改者', + `is_show` tinyint(3) unsigned DEFAULT NULL COMMENT '是否展示', + `raid_models` longtext COLLATE utf8_bin COMMENT 'RAID配置', + `is_clear` tinyint(3) unsigned DEFAULT NULL COMMENT '是否清空配置', + `pk` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) COLLATE utf8_bin NOT NULL COMMENT '业务主键', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `architecture` enum('def','arm','mips','x86_64') COLLATE utf8_bin DEFAULT 'x86_64' COMMENT '机器架构', + PRIMARY KEY (`pk`), + UNIQUE KEY `id` (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=DYNAMIC; + +DROP TABLE IF EXISTS `starlet_control_iboot_inband_file`; +CREATE TABLE `starlet_control_iboot_inband_file` +( + `name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '名称,改名之后的', + `original_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '原始文件名,包括后缀名', + `full_path` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '绝对路径', + `pk` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '业务主键', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `md5` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '文件MD5值', + `architecture` enum('arm','mips','x86_64') CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT 'x86_64' COMMENT '架构', + PRIMARY KEY (`pk`), + UNIQUE KEY `id` (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC; + +DROP TABLE IF EXISTS `cosmos_iboot_device`; +CREATE TABLE `cosmos_iboot_device` +( + `pk` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) COLLATE utf8_bin NOT NULL COMMENT '业务主键', + `sn` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'SN', + `dhcp_ip` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'DHCP IP', + `manage_ip` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '管理IP', + `status` enum('Offline','Online','Busy') COLLATE utf8_bin DEFAULT NULL COMMENT '设备状态', + `ipmi_status` enum('UNAVAILABLE','AVAILABLE') COLLATE utf8_bin DEFAULT NULL COMMENT 'IPMI状态', + `ipmi_fail` enum('CREDENTIALS','CONNECTION','CONFIGURATION','NORMAL') COLLATE utf8_bin DEFAULT NULL COMMENT 'IPMI失败原因', + `manage_channel` enum('SHARELINK','DEDICATED') COLLATE utf8_bin DEFAULT NULL COMMENT '管理通道', + `manage_user` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '管理用户', + `manage_password` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '管理密码', + `network_device` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '网络设备', + `boot_option` enum('UEFI','LEGACY') COLLATE utf8_bin DEFAULT NULL COMMENT '启动方式', + `architecture` enum('arm','mips','x86_64') COLLATE utf8_bin DEFAULT NULL COMMENT '架构', + `vendor` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '厂商', + `model` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '机型', + `create_user` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '创建用户', + `update_user` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT '更新用户', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `heartbeat_time` datetime DEFAULT NULL COMMENT '心跳时间', + PRIMARY KEY (`pk`), + KEY `resource_id` (`sn`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='ISIB设备主表'; + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230818144500__iboot_device.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230818144500__iboot_device.sql new file mode 100644 index 0000000000000000000000000000000000000000..863475f498fda8b282c853af57570b54c0c57577 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230818144500__iboot_device.sql @@ -0,0 +1,8 @@ +-- ---------------------------- +-- Table structure for cosmos_iboot_device +-- ---------------------------- +ALTER TABLE `cosmos_iboot_device` MODIFY COLUMN `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间'; +ALTER TABLE `cosmos_iboot_device` MODIFY COLUMN `update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间'; + +ALTER TABLE `cosmos_iboot_device` + ADD COLUMN `manage_account` enum('ON','OFF') COLLATE utf8_bin DEFAULT NULL COMMENT '管理账户状态'; diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230823152000__iboot_device.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230823152000__iboot_device.sql new file mode 100644 index 0000000000000000000000000000000000000000..b3e590d53297f667a6bc9fff43c11fee68958f3d --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230823152000__iboot_device.sql @@ -0,0 +1,7 @@ +-- ---------------------------- +-- Table structure for cosmos_iboot_device +-- ---------------------------- +ALTER TABLE `cosmos_iboot_device` + ADD COLUMN `system_info` longtext COLLATE utf8_bin COMMENT '基础信息'; +ALTER TABLE `cosmos_iboot_device` + ADD COLUMN `storage_info` longtext COLLATE utf8_bin COMMENT '存储信息'; \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230905200200__iboot_device.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230905200200__iboot_device.sql new file mode 100644 index 0000000000000000000000000000000000000000..024325d404a583709e2d929b73b80fdc073fd262 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230905200200__iboot_device.sql @@ -0,0 +1,7 @@ +-- ---------------------------- +-- Table structure for cosmos_iboot_device +-- ---------------------------- +ALTER TABLE `cosmos_iboot_device` + ADD COLUMN `manage_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '管理用户id'; + +ALTER TABLE `starlet_control_iboot_template` MODIFY COLUMN `template_type` enum('DEVICE_REFRESH','OS_INSTALL','OS_EXPLORE','STRESS_TEST','RAID_CONF','USER_CONF') COLLATE utf8_bin DEFAULT NULL COMMENT '模板类型'; \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230906164601__iboot_device.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230906164601__iboot_device.sql new file mode 100644 index 0000000000000000000000000000000000000000..7f4774d4bb70ec1370e955a979385a378db880f7 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230906164601__iboot_device.sql @@ -0,0 +1,4 @@ +-- ---------------------------- +-- Table structure for cosmos_iboot_device +-- ---------------------------- +ALTER TABLE `starlet_control_iboot_template` MODIFY COLUMN `template_type` enum('NETWORK_CONF','DEVICE_REFRESH','OS_INSTALL','OS_EXPLORE','STRESS_TEST','RAID_CONF','USER_CONF') COLLATE utf8_bin DEFAULT NULL COMMENT '模板类型'; \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230925143201__iboot_task.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230925143201__iboot_task.sql new file mode 100644 index 0000000000000000000000000000000000000000..7fd538cd8594520f0681034372f83561c25aea53 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20230925143201__iboot_task.sql @@ -0,0 +1,2 @@ +ALTER TABLE `cosmos_iboot_task_history` + MODIFY COLUMN `task_status` enum('UNSTART','RUNNING','HISTORY','FAILED','SUCCESS') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'HISTORY' AFTER `task_id`; \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231008171901__iboot_device.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231008171901__iboot_device.sql new file mode 100644 index 0000000000000000000000000000000000000000..0aac0201be8010a80a6c10eb9b6b16a46cd12fc1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231008171901__iboot_device.sql @@ -0,0 +1,8 @@ +-- ---------------------------- +-- Table structure for cosmos_iboot_device +-- ---------------------------- +ALTER TABLE `starlet_control_iboot_template` MODIFY COLUMN `template_type` enum('CUSTOM_TEMPLATE', 'NETWORK_CONF','DEVICE_REFRESH','OS_INSTALL','OS_EXPLORE','STRESS_TEST','RAID_CONF','USER_CONF') COLLATE utf8_bin DEFAULT NULL COMMENT '模板类型'; + +ALTER TABLE `cosmos_iboot_device` + ADD COLUMN `single_storage_info` longtext NULL COMMENT '简单式存储信息结构' AFTER `manage_id`, +ADD COLUMN `single_storage_md` varchar(64) NULL COMMENT '简单式存储信息结构的MD5' AFTER `single_storage_info`; \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231010142701__iboot_temp.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231010142701__iboot_temp.sql new file mode 100644 index 0000000000000000000000000000000000000000..53b428f996dd22511decc91a321b4eeefd38fd06 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231010142701__iboot_temp.sql @@ -0,0 +1,35 @@ +RENAME +TABLE starlet_control_iboot_inband_file TO cosmos_iboot_inband_file; +RENAME +TABLE starlet_control_iboot_template TO cosmos_iboot_template; + +SET +FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- Table structure for cosmos_iboot_stress_data +-- ---------------------------- +DROP TABLE IF EXISTS `cosmos_iboot_stress_data`; +CREATE TABLE `cosmos_iboot_stress_data` +( + `pk` bigint NOT NULL AUTO_INCREMENT, + `id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'id', + `job_host_id` varchar(64) DEFAULT NULL, + `ip` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `sn` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '序列号', + `inlet_temperature` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT '进风口温度', + `outlet_temperature` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT '出风口温度', + `total_power` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT '总功率', + `cpu_temperature` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT 'cpu温度', + `cpu_power` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT 'cpu功率', + `cpu_rate_user` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT 'cpu用户利用率', + `cpu_rate_system` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT 'cpu系统利用率', + `cpu_rate_idle` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT 'cpu空闲利用率', + `memory_rate` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT '内存利用率', + `memory_power` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT '内存功率', + `ecc_cpu0` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '', + `ecc_cpu1` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '', + `ecc_reason` longtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin, + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + PRIMARY KEY (`pk`, `id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC; diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231017110000__iboot_device.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231017110000__iboot_device.sql new file mode 100644 index 0000000000000000000000000000000000000000..18044229a479f2092f20316fb343078223e94f19 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231017110000__iboot_device.sql @@ -0,0 +1 @@ +ALTER TABLE `cosmos_iboot_device` MODIFY COLUMN `ipmi_fail` enum('CREDENTIALS','CONNECTION','CONFIGURATION','NORMAL','NORMAL_IBOOT') COLLATE utf8_bin DEFAULT NULL COMMENT 'IPMI失败原因'; \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231023113901__iboot_stress.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231023113901__iboot_stress.sql new file mode 100644 index 0000000000000000000000000000000000000000..806a84a61ca6308c009e01a4ae77ad5117ba9773 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231023113901__iboot_stress.sql @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS `cosmos_iboot_stress_server`; +CREATE TABLE `cosmos_iboot_stress_server` +( + `pk` bigint NOT NULL AUTO_INCREMENT, + `id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT 'id', + `job_host_id` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `ip` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `sn` varchar(36) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '序列号', + `num` bigint DEFAULT NULL, + `status` varchar(36) DEFAULT NULL, + `update_time` datetime DEFAULT NULL, + `task_id` varchar(64) DEFAULT NULL, + PRIMARY KEY (`pk`, `id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC; + + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231030140201__iboot_file.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231030140201__iboot_file.sql new file mode 100644 index 0000000000000000000000000000000000000000..faf5f9c5a387987e2d0994dd956c4a2e2fabe0fa --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231030140201__iboot_file.sql @@ -0,0 +1,20 @@ +-- ---------------------------- +-- Table structure for cosmos_iboot_inband_file +-- ---------------------------- +DROP TABLE IF EXISTS `cosmos_iboot_inband_file`; +CREATE TABLE `cosmos_iboot_inband_file` +( + `name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '名称,改名之后的', + `original_name` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '原始文件名,包括后缀名', + `full_path` varchar(512) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '绝对路径', + `pk` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '逻辑主键', + `id` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '业务主键', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `md5` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '文件MD5值', + `architecture` enum('arm','mips','x86_64') CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT 'x86_64' COMMENT '架构', + PRIMARY KEY (`pk`), + UNIQUE KEY `id` (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC; + + diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231107110201__iboot_template.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231107110201__iboot_template.sql new file mode 100644 index 0000000000000000000000000000000000000000..295920fbf1b432e27d72db7b282e377cda6877cf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231107110201__iboot_template.sql @@ -0,0 +1,8 @@ +ALTER TABLE `cosmos_iboot_template` + MODIFY COLUMN `template_type` enum('CUSTOM_TEMPLATE','NETWORK_CONF','DEVICE_REFRESH','OS_INSTALL','OS_EXPLORE','STRESS_TEST','RAID_CONF','DISK_CLONE','USER_CONF','RAID_SET_CONF') CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '模板类型' AFTER `model`; +update cosmos_iboot_template +set template_type='RAID_SET_CONF' +WHERE template_type = 'RAID_CONF'; + +ALTER TABLE `cosmos_iboot_template` + MODIFY COLUMN `template_type` enum('CUSTOM_TEMPLATE','NETWORK_CONF','DEVICE_REFRESH','OS_INSTALL','OS_EXPLORE','STRESS_TEST','DISK_CLONE','USER_CONF','RAID_SET_CONF') CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '模板类型' AFTER `model`; diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231205150500__iboot_template.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231205150500__iboot_template.sql new file mode 100644 index 0000000000000000000000000000000000000000..fe76b0d172cf36029e062efb53700368ec2e92f9 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231205150500__iboot_template.sql @@ -0,0 +1,3 @@ +-- 新增模板类型:DISK_RESTORE +ALTER TABLE `cosmos_iboot_template` + MODIFY COLUMN `template_type` enum('CUSTOM_TEMPLATE','NETWORK_CONF','DEVICE_REFRESH','OS_INSTALL','OS_EXPLORE','STRESS_TEST','DISK_CLONE','DISK_RESTORE','USER_CONF','RAID_SET_CONF') CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NULL DEFAULT NULL COMMENT '模板类型' AFTER `model`; diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231214134701__iboot_task.sql b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231214134701__iboot_task.sql new file mode 100644 index 0000000000000000000000000000000000000000..84dec91e13c72221cdb78c797c1611799bfe9efd --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/db/V20231214134701__iboot_task.sql @@ -0,0 +1,2 @@ +ALTER TABLE `cosmos_iboot_task_history` + MODIFY COLUMN `task_status` enum('UNSTART','RUNNING','HISTORY','FAILED','SUCCESS','PART_SUCCESS') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'HISTORY' AFTER `task_id`; \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/i18n/iboot_message_en_US.properties b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/i18n/iboot_message_en_US.properties new file mode 100644 index 0000000000000000000000000000000000000000..85c4a3c69718edb4e453c5480bb266ba725ac701 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/i18n/iboot_message_en_US.properties @@ -0,0 +1,157 @@ +cosmos.iboot.device.parameter.error=Parameter error +cosmos.iboot.device.parameter.null.error=Parameter null +cosmos.iboot.device.resource.is.exists=Resource already exists +cosmos.iboot.device.resource.not.exist=Resource don't exists +cosmos.iboot.device.acceptance.result.success=Success +cosmos.iboot.device.import.fail.serial=Serial cannot be null! +cosmos.image.exist.error=has be template used delete fail and other images has success +cosmos.iboot.device.sync.task.error=There is a synchronization task in progress. +cosmos.iboot.device.refresh.success=Device refresh success. +cosmos.iboot.device.refresh.fail=Device refresh failed. +cosmos.iboot.device.busy=Device is busy. +iboot.device.file.oversize=File size over {0}M +iboot_MD5_ERROR=Params MD5 ,not match file MD5 +asset_parameter_error=Parameter error +resource_not_exist=Resource don't exists +cosmos.iboot.template.get.list.failed=Get template list failed +cosmos.iboot.template.save.param_error=template param error\uFF0Cplease check +cosmos.iboot.template.name.not.duplicate={0} already exit can not add duplicate +cosmos.iboot.template.save.failed=Save template info failed +cosmos.iboot.template.raid.get.list.failed=Get raid model list failed +cosmos.iboot.template.get.base.info.failed=Get template info failed +cosmos.iboot.template.update.failed=Update template info failed +cosmos.iboot.template.delete.failed=Delete template info failed +cosmos.iboot.template.batch.delete.failed=Batch delete template info failed +cosmos.iboot.template.delete.intask.failed=Template excuting task delete failed +iboot_DATA_EXCEPTION=data exception +cosmos.iboot.arrange.resource.null=Resources is null +cosmos.iboot.template.start.failed=Template start failed +cosmos.iboot.template.os.install.failed=OsInstall start failed +cosmos.iboot.template.net.config.failed=NetworkConfig start failed +iboot_PARAMETER_IS_NULL_OR_ERROR=Parameter is null or error +iboot.default.ks=get default ks content fail +iboot.script.preview=preview script content fail +cosmos.iboot.osinstall_template_query.baseE.failed=os install component error +control.iboot.bond.script=get bond script fail +control.iboot.os.preview=preview osinstall data fail +control.iboot.net.preview=preview network config data fail +control.iboot.stress.history=get stresstest history fail +control.iboot.stress.data=get stresstest data fail +cosmos.iboot.stress.data.report.failed=get stress collect reports data failed +cosmos.iboot.stress.data.get.list.failed=Get stress data list failed +iboot.execute.fail=Task execute fail Exception is +starlet.iboot.raid.config.xml.error=Raid Config is illegal +RAID_BEAN_NULL=raid config file bean is null +cosmos.iboot.device.dependence.mode.not.support.async=Dependence mode not support async. +cosmos.iboot.device.parameter.null={0} can't be null. +cosmos.iboot.device.parameter.whitespace=Username and password can't contain whitespace. +cosmos.iboot.device.parameter.username=Username +cosmos.iboot.device.parameter.password=Password +cosmos.iboot.device.parameter.account=Management Account +cosmos.iboot.device.storage.report.error=No storage information reported. +cosmos.iboot.device.storage.parse.error=Storage information parse error. +cosmos.iboot.device.storage.serial.unknown=Unknown Drive {0} +cosmos.iboot.device.storage.volume.unknown=Unknown Volume {0} +cosmos.iboot.device.storage.controller.unknown=Unknown Controller {0} +cosmos.iboot.device.network.address.error=Failed to get management network list. +cosmos.iboot.device.network.address.invalid=No valid management network acquired. +cosmos.iboot.device.network.success=Management network configure successful. +cosmos.iboot.device.network.failed=Management network configure failed. +cosmos.iboot.device.network.range.error=DHCP start address and end address error. +cosmos.iboot.device.network.valid.error=DHCP start address must smaller than end address. +cosmos.iboot.task.taskstop=Task has been stoped +cosmos.iboot.task.taskstart=Task has been start +cosmos.iboot.task.taskreTry=Retry +cosmos.iboot.device.template.file.error=File format error +cosmos.iboot.longtime=The system has detected an abnormality in the task and has forcibly terminated id +cosmos.iboot.os.explore.success=OS Explore is complete. +cosmos.iboot.os.explore.success.shutdown=OS Explore is complete, and the device has been shut down. +cosmos.iboot.os.explore.success.shutdown.fail=OS Explore is complete, and the device failed to shut down. +cosmos.iboot.os.explore.device.status.error=Device status error. +cosmos.iboot.os.explore.device.busy.error=Device is busy, and can't shut down now. +cosmos.iboot.os.explore.device.busy.ip.error=The device's DHCP IP is empty and the device is busy, so PXE reboot cannot be executed. +cosmos.iboot.os.explore.pxe.error=PXE boot setting failed. +cosmos.iboot.os.explore.pxe.timeout=Timeout waiting for device PXE boot. +cosmos.iboot.os.explore.pxe.boot.error=Anomaly occurred during device boot. +cosmos.iboot.os.explore.interface.error=Os explorer interface request failed. +cosmos.iboot.disk.clone.install=Tools install successfully. +cosmos.iboot.disk.clone.mount.success=Mount NFS successfully. +cosmos.iboot.disk.clone.mount.failed=Failed to mount NFS. +cosmos.iboot.disk.clone.backup.begin=Backup begin. +cosmos.iboot.disk.clone.backup.end=Backup end. +cosmos.iboot.disk.clone.restore.begin=Restore begin. +cosmos.iboot.disk.clone.restore.end=Restore end. +cosmos.iboot.network.os.error=Current operating system does not support this function. +#-------------------------------Mr.G---------------------------------------# +cosmos.iboot.deleteVolume=Delete Volume +cosmos.iboot.deleteJbod=Delete JBOD +cosmos.iboot.deleteGlobal=Delete HOT_SPARE +cosmos.iboot.page.sort.field.not.exist=The sort field does not exist +REPO_BUNDLE_FILE_NAME_ILLEGAL=File extension name is Illegal +CONTROL_UPLOAD_FILE_FAIL=Upload file fail +os.config.import.template.file.path=/usr/local/assetTemplate/ +REPO_OPERATE_FAILED=Operate failed! +iboot.osinstall.bond.error=Please input more than two eth-names +iboot.osinstall.bond.duplicate=Please not input duplicate eth-name +iboot.excel.net.tip=1.Please fill in all cells correctly, otherwise be considered invalid data.\r\n2.'Channel' default value is '1', '8' may be invalid. +iboot.excel.os.tip=1.Do not add the same resource repeatedly.\r\n2.Before network configuration,make sure the network card infomation is normal.\r\n3.Make sure the hostname doesn't contain special character, eg @#*_. +iboot.excel.bond.tip=1.Do not add the same resource repeatedly.\r\n2.Before network configuration,make sure the network card infomation is normal. +iboot.template.duplicate=Template name duplicate. +iboot.template.pk.noexsit=Template is not exsit. +iboot.template.param.error=Template param error. +cosmos.control.raidconfig.raid={0} not support local hot +cosmos.control.raidconfig.raid.checkcount={0} relevance disk num must exceed {1} +cosmos.control.raidconfig.raid.checknumeven={0} relevance disk num must exceed {1} and must even number +cosmos.control.raidconfig.raid.checknumnoeven={0} relevance disk num must exceed {1} and must uneven number +cosmos.control.raidconfig.raid.checknosupport=not support this raid level +cosmos.control.raidconfig.raid.checkdisksize=local hot volume must exceed min logical drive volume +#-------------------------------log zhongyingwen start---------------------------------------# +createfailed=Logical Disk Create Failed +createsuccess=Logical Disk Create Success +diskstatus=DISK status is +checkfailed=Check Failed +checksuccess=Check Success +jbodfailed=JBOD ON Failed +jbodsuccess=JBOD ON Success +raidcheckfailed=Raid Check finish Result is Failed +raidchecksuccess=Raid Check finish Result is Success +iboot.execute.dhcpip.no.exist=Device DHCP_IP not exist +raidConfigFinish=Raid config finish,checking +OSRUNNING=OS Install is running +OSFINISH=OS Install is finished +USERNAMEFAIL=Set username fail +PASSWORDFAIL=Set password fail +ENABLEFAIL=Enable user fail +PRIVILEGEFAIL=Set privilege fail +ADDUSER=Add user success +EDITUSER=Edit user success +NOUSER=User not exsit +DELETEUSER=Delete user success +DELETEFAIL=Delete user fail +CHANNELFAIL=Set channel fail +IPFAIL=Set ip fail +SUBNETFAIL=Set netmask fail +GATEWAYFAIL=Set gateway fail +NETWORKSET=Set network success +IPV6FAIL=Set ipv6 fail +CUSTOMEXEFAIL=Custom Template execute fail +CUSTOMEXE=Custom Template execute success +CUSTOMCHECKFAIL=Custom Template check result fail +CUSTOMCHECK=Custom Template check result success +STRESSBEGIN=Stress Test start +STRESSFINISH=Stress Test complete +STRESSCOLLECT=Collecting Stress Test data... +STRESSEXIST=Stress Test process exist +STRESSFAIL=Stress Test fail +STRESSECCREASON=Stress test ECC data over 6000 +STRESSECCEXCEP=Stress test ECC code exception +device_refresh=Device Refresh +os_explorer=OS Explorer +template_add_bmc_user=Add BMC user: {0} +template_modify_bmc_user=Modify BMC user: {0} +template_delete_bmc_user=Delete BMC user: {0} +template_install_OS=Install Operating System: {0} +template_config_BMC_IP=Config BMC IP +iboot.stress.data.suc=collect stress data success +iboot.stress.data.exc=collect stress data exception +#-------------------------------log zhongyingwen end---------------------------------------# diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/i18n/iboot_message_zh_CN.properties b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/i18n/iboot_message_zh_CN.properties new file mode 100644 index 0000000000000000000000000000000000000000..a03aff8065f0a4a74f5a61911ade1aa0f942d5d4 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/i18n/iboot_message_zh_CN.properties @@ -0,0 +1,157 @@ +cosmos.iboot.device.parameter.error=\u53C2\u6570\u9519\u8BEF +cosmos.iboot.device.parameter.null.error=\u53C2\u6570\u4E3A\u7A7A +cosmos.iboot.device.resource.is.exists=\u8D44\u6E90\u5DF2\u5B58\u5728 +cosmos.iboot.device.resource.not.exist=\u8D44\u6E90\u4E0D\u5B58\u5728 +cosmos.iboot.device.acceptance.result.success=\u6210\u529F +cosmos.iboot.device.import.fail.serial=\u5E8F\u5217\u53F7\u4E0D\u80FD\u4E3A\u7A7A\uFF01 +cosmos.image.exist.error=\u5DF2\u88AB\u6A21\u677F\u4F7F\u7528\uFF0C\u672A\u5220\u9664\uFF0C\u5176\u4ED6\u955C\u50CF\u5DF2\u88AB\u5220\u9664 +cosmos.iboot.task.taskstop=\u4EFB\u52A1\u88AB\u5F3A\u5236\u7EC8\u6B62 +cosmos.iboot.task.taskstart=\u4EFB\u52A1\u5F00\u59CB\u6267\u884C +cosmos.iboot.task.taskreTry=\u91CD\u8BD5 +cosmos.iboot.device.sync.task.error=\u5B58\u5728\u6267\u884C\u4E2D\u7684\u540C\u6B65\u4EFB\u52A1. +cosmos.iboot.device.refresh.success=\u8BBE\u5907\u5237\u65B0\u6210\u529F. +cosmos.iboot.device.refresh.fail=\u8BBE\u5907\u5237\u65B0\u5931\u8D25. +cosmos.iboot.device.busy=\u8BBE\u5907\u5FD9\u788C. +iboot.device.file.oversize=\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7{0}M +iboot_MD5_ERROR=\u8F93\u5165\u5F97md5\u503C\u4E0E\u6587\u4EF6\u751F\u6210\u5F97md5\u503C\u4E0D\u5339\u914D +asset_parameter_error=\u53C2\u6570\u9519\u8BEF +resource_not_exist=\u8D44\u6E90\u4E0D\u5B58\u5728 +cosmos.iboot.template.get.list.failed=\u6A21\u677F\u5217\u8868\u83B7\u53D6\u5931\u8D25 +cosmos.iboot.template.save.param_error=\u6A21\u677F\u53C2\u6570\u4E3A\u7A7A\uFF0C\u8BF7\u586B\u5199\u6B63\u786E\u7684\u683C\u5F0F +cosmos.iboot.template.name.not.duplicate={0} \u540D\u79F0\u5DF2\u5B58\u5728,\u8BF7\u52FF\u91CD\u590D\u6DFB\u52A0 +cosmos.iboot.template.save.failed=\u6A21\u677F\u65B0\u589E\u5931\u8D25 +cosmos.iboot.template.raid.get.list.failed=\u6A21\u578B\u5217\u8868\u83B7\u53D6\u5931\u8D25 +cosmos.iboot.template.get.base.info.failed=\u6A21\u677F\u8BE6\u60C5\u83B7\u53D6\u5931\u8D25 +cosmos.iboot.template.update.failed=\u6A21\u677F\u4FEE\u6539\u5931\u8D25 +cosmos.iboot.template.delete.failed=\u6A21\u677F\u5220\u9664\u5931\u8D25 +cosmos.iboot.template.batch.delete.failed=\u6A21\u677F\u6279\u91CF\u5220\u9664\u5931\u8D25 +iboot_DATA_EXCEPTION=\u6570\u636E\u5F02\u5E38 +cosmos.iboot.arrange.resource.null=\u8D44\u6E90\u5217\u8868\u4E3A\u7A7A +cosmos.iboot.template.start.failed=\u6A21\u677F\u5E94\u7528\u5931\u8D25 +cosmos.iboot.template.os.install.failed=\u7CFB\u7EDF\u5B89\u88C5\u5E94\u7528\u5931\u8D25 +cosmos.iboot.template.net.config.failed=\u7F51\u7EDC\u914D\u7F6E\u5E94\u7528\u5931\u8D25 +iboot_PARAMETER_IS_NULL_OR_ERROR=\u53C2\u6570\u4E3A\u7A7A\u6216\u4E0D\u5408\u6CD5 +iboot.default.ks=\u83B7\u53D6\u9ED8\u8BA4ks\u5185\u5BB9\u5931\u8D25 +iboot.script.preview=\u9884\u89C8\u811A\u672C\u5185\u5BB9\u5931\u8D25 +control.iboot.bond.script=\u83B7\u53D6bond\u811A\u672C\u5931\u8D25 +control.iboot.os.preview=\u9884\u89C8\u7CFB\u7EDF\u5B89\u88C5\u6570\u636E\u5931\u8D25 +control.iboot.net.preview=\u9884\u89C8\u7F51\u7EDC\u914D\u7F6E\u6570\u636E\u5931\u8D25 +control.iboot.stress.history=\u83B7\u53D6\u538B\u529B\u6D4B\u8BD5\u5386\u53F2\u5931\u8D25 +control.iboot.stress.data=\u83B7\u53D6\u538B\u529B\u6D4B\u8BD5\u5386\u53F2\u6570\u636E +cosmos.iboot.stress.data.report.failed=\u83B7\u53D6\u538B\u529B\u6D4B\u8BD5\u56FE\u8868\u6570\u636E\u5931\u8D25 +cosmos.iboot.stress.data.get.list.failed=\u538B\u529B\u6D4B\u8BD5\u6570\u636E\u5217\u8868\u83B7\u53D6\u5931\u8D25 +cosmos.iboot.osinstall_template_query.baseE.failed=\u7CFB\u7EDF\u5B89\u88C5\u6A21\u677F\u73AF\u5883\u89E3\u6790\u9519\u8BEF +cosmos.iboot.template.delete.intask.failed=\u6A21\u677F\u6B63\u5728\u88AB\u4EFB\u52A1\u6267\u884C\uFF0C\u5220\u9664\u5931\u8D25 +starlet.iboot.raid.config.xml.error=RAID\u914D\u7F6E\u4E0D\u5408\u89C4 +RAID_BEAN_NULL=RAID\u914D\u7F6E\u5185\u5BB9\u4E3A\u7A7A +cosmos.iboot.device.dependence.mode.not.support.async=\u72EC\u7ACB\u90E8\u7F72\u6A21\u5F0F\u4E0B\u4E0D\u652F\u6301\u8D44\u4EA7\u540C\u6B65 +cosmos.iboot.device.parameter.null={0}\u4E0D\u80FD\u4E3A\u7A7A. +cosmos.iboot.device.parameter.whitespace=\u7528\u6237\u540d\u4e0e\u5bc6\u7801\u4e0d\u53ef\u5305\u542b\u7a7a\u683c\u3002 +cosmos.iboot.device.parameter.username=\u7528\u6237\u540D +cosmos.iboot.device.parameter.password=\u5BC6\u7801 +cosmos.iboot.device.parameter.account=\u65B0\u5EFA\u7BA1\u7406\u8D26\u53F7 +cosmos.iboot.device.storage.report.error=\u8BBE\u5907\u6682\u672A\u4E0A\u62A5\u5B58\u50A8\u4FE1\u606F. +cosmos.iboot.device.storage.parse.error=\u5B58\u50A8\u4FE1\u606F\u89E3\u6790\u5931\u8D25. +cosmos.iboot.device.storage.serial.unknown=\u672a\u77e5\u78c1\u76d8 {0} +cosmos.iboot.device.storage.volume.unknown=\u672a\u77e5\u903b\u8f91\u78c1\u76d8 {0} +cosmos.iboot.device.storage.controller.unknown=\u672a\u77e5\u78c1\u76d8\u63a7\u5236\u5668 {0} +cosmos.iboot.device.network.address.error=\u83B7\u53D6\u7BA1\u7406\u7F51\u7EDCIP\u5217\u8868\u5931\u8D25. +cosmos.iboot.device.network.address.invalid=\u6CA1\u6709\u53EF\u7528\u7684\u7BA1\u7406\u7F51\u7EDC. +cosmos.iboot.device.network.manage.success=\u7BA1\u7406\u7F51\u7EDC\u914D\u7F6E\u6210\u529F. +cosmos.iboot.device.network.manage.failed=\u7BA1\u7406\u7F51\u7EDC\u914D\u7F6E\u5931\u8D25. +cosmos.iboot.device.network.range.error=DHCP\u7F51\u7EDC\u8D77\u59CB\u548C\u7EC8\u6B62\u5730\u5740\u4E0D\u5C5E\u4E8EDHCP IP\u6307\u5B9A\u7684\u6709\u6548\u8303\u56F4. +cosmos.iboot.device.network.valid.error=DHCP\u7F51\u7EDC\u8D77\u59CB\u5730\u5740\u9700\u8981\u5C0F\u4E8E\u7EC8\u6B62\u5730\u5740. +cosmos.iboot.device.template.file.error=\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF +cosmos.iboot.longtime=\u7CFB\u7EDF\u68C0\u6D4B\u5230\u4EFB\u52A1\u5F02\u5E38\uFF0C\u5DF2\u5F3A\u5236\u7EC8\u6B62 +cosmos.iboot.os.explore.success=\u7CFB\u7EDF\u63A2\u6D4B\u5B8C\u6210. +cosmos.iboot.os.explore.success.shutdown=\u7CFB\u7EDF\u63A2\u6D4B\u5B8C\u6210\uFF0C\u8BBE\u5907\u5173\u673A\u3002 +cosmos.iboot.os.explore.success.shutdown.fail=\u7CFB\u7EDF\u63A2\u6D4B\u5B8C\u6210\uFF0C\u8BBE\u5907\u5173\u673A\u5931\u8D25\u3002 +cosmos.iboot.os.explore.device.status.error=\u8BBE\u5907\u72B6\u6001\u9519\u8BEF\u3002 +cosmos.iboot.os.explore.device.busy.error=\u8BBE\u5907\u5F53\u524D\u5FD9\u788C\uFF0C\u4E0D\u53EF\u5173\u673A\u3002 +cosmos.iboot.os.explore.device.busy.ip.error=\u8BBE\u5907\u5F53\u524D\u5FD9\u788C\u4E14DHCP IP\u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u6267\u884CPXE\u91CD\u542F\u8FDB\u884C\u7CFB\u7EDF\u63A2\u6D4B\u3002 +cosmos.iboot.os.explore.pxe.error=\u8BBE\u7F6EPXE\u542F\u52A8\u5931\u8D25\u3002 +cosmos.iboot.os.explore.pxe.timeout=\u7B49\u5F85PXE\u542F\u52A8\u8D85\u65F6\u3002 +cosmos.iboot.os.explore.pxe.boot.error=\u7B49\u5F85PXE\u542F\u52A8\u5F02\u5E38\u3002 +cosmos.iboot.os.explore.interface.error=\u7CFB\u7EDF\u63A2\u6D4B\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25\u3002 +cosmos.iboot.disk.clone.install=\u5DE5\u5177\u5B89\u88C5\u6210\u529F +cosmos.iboot.disk.clone.mount.success=NFS\u6302\u8F7D\u6210\u529F +cosmos.iboot.disk.clone.mount.failed=NFS\u6302\u8F7D\u5931\u8D25 +cosmos.iboot.disk.clone.backup.begin=\u514B\u9686\u5F00\u59CB +cosmos.iboot.disk.clone.backup.end=\u514B\u9686\u7ED3\u675F +cosmos.iboot.disk.clone.restore.begin=\u8FD8\u539F\u5F00\u59CB +cosmos.iboot.disk.clone.restore.end=\u8FD8\u539F\u7ED3\u675F +cosmos.iboot.network.os.error=\u5F53\u524D\u64CD\u4F5C\u7CFB\u7EDF\u4E0D\u652F\u6301\u6B64\u529F\u80FD\u3002 +#-------------------------------Mr.G---------------------------------------# +cosmos.iboot.deleteVolume=\u5220\u9664\u903B\u8F91\u76D8 +cosmos.iboot.deleteJbod=\u5220\u9664JBOD +cosmos.iboot.deleteGlobal=\u5220\u9664\u5168\u5C40\u70ED\u5907 +cosmos.iboot.page.sort.field.not.exist=\u6392\u5E8F\u5B57\u6BB5\u4E0D\u5B58\u5728 +REPO_BUNDLE_FILE_NAME_ILLEGAL=\u6587\u4EF6\u540E\u7F00\u540D\u975E\u6CD5 +CONTROL_UPLOAD_FILE_FAIL=\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25 +os.config.import.template.file.path=/usr/local/assetTemplate/ +REPO_OPERATE_FAILED=\u64CD\u4F5C\u5931\u8D25 +iboot.osinstall.bond.error=\u8BF7\u8F93\u5165\u81F3\u5C11\u4E24\u4E2A\u7F51\u53E3\u540D +iboot.osinstall.bond.duplicate=\u8BF7\u52FF\u8F93\u5165\u91CD\u590D\u7684\u7F51\u53E3\u540D +iboot.excel.net.tip=1.\u8BF7\u6B63\u786E\u7684\u586B\u5199\u6240\u6709\u5355\u5143\u683C\uFF0C\u5426\u5219\u4F1A\u89C6\u4E3A\u65E0\u6548\u6570\u636E\r\n2.\u901A\u9053\u9ED8\u8BA4\u503C\u4E3A'1'\uFF0C'8'\u53EF\u80FD\u65E0\u6548 +iboot.excel.os.tip=1.\u8BF7\u52FF\u6DFB\u52A0\u91CD\u590D\u7684\u8D44\u6E90\u3002\r\n2.\u914D\u7F6E\u7F51\u7EDC\u524D\uFF0C\u8BF7\u786E\u8BA4\u7F51\u5361\u4FE1\u606F\u53EF\u7528\u3002\r\n3.\u8BF7\u786E\u8BA4\u4E3B\u673A\u540D\u4E0D\u5305\u542B\u7279\u6B8A\u5B57\u7B26\uFF0C\u6BD4\u5982 @#*_\u3002 +iboot.excel.bond.tip=1.\u8BF7\u52FF\u6DFB\u52A0\u91CD\u590D\u7684\u8D44\u6E90\u3002\r\n2.\u914D\u7F6E\u7F51\u7EDC\u524D\uFF0C\u8BF7\u786E\u8BA4\u7F51\u5361\u4FE1\u606F\u53EF\u7528\u3002 +iboot.template.duplicate=\u6A21\u677F\u540D\u91CD\u590D +iboot.template.pk.noexsit=\u6A21\u677F\u4E0D\u5B58\u5728 +iboot.template.param.error=\u6A21\u677F\u53C2\u6570\u65E0\u6548 +cosmos.control.raidconfig.raid={0} \u4E0D\u652F\u6301\u5C40\u90E8\u70ED\u5907 +cosmos.control.raidconfig.raid.checkcount={0} \u5173\u8054\u786C\u76D8\u6570\u91CF\u81F3\u5C11{1}\u5757 +cosmos.control.raidconfig.raid.checknumeven={0} \u5173\u8054\u786C\u76D8\u6570\u91CF\u81F3\u5C11{1}\u5757\u5E76\u4E14\u5FC5\u987B\u4E3A\u5076\u6570 +cosmos.control.raidconfig.raid.checknumnoeven={0} \u5173\u8054\u786C\u76D8\u6570\u91CF\u81F3\u5C11{1}\u5757\u5E76\u4E14\u5FC5\u987B\u4E3A\u5947\u6570 +cosmos.control.raidconfig.raid.checknosupport=\u6682\u4E0D\u652F\u6301\u8BE5raid\u7EA7\u522B +cosmos.control.raidconfig.raid.checkdisksize=\u5C40\u90E8\u70ED\u5907\u76D8\u5BB9\u91CF\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E\u903B\u8F91\u76D8\u6700\u5C0F\u786C\u76D8\u5BB9\u91CF +#-------------------------------log \u4E2D\u82F1\u6587 start---------------------------------------# +createfailed=\u903B\u8F91\u76D8\u521B\u5EFA\u5931\u8D25 +createsuccess=\u903B\u8F91\u76D8\u521B\u5EFA\u6210\u529F +diskstatus=\u786C\u76D8\u72B6\u6001\u4E3A +checkfailed=\u6821\u9A8C\u5931\u8D25 +checksuccess=\u6821\u9A8C\u6210\u529F +jbodfailed=JBOD\u5F00\u542F\u5931\u8D25 +jbodsuccess=JBOD\u5F00\u542F\u6210\u529F +raidcheckfailed=Raid\u914D\u7F6E\u6821\u9A8C\u5B8C\u6210,\u7ED3\u679C\u4E3A\u5931\u8D25 +raidchecksuccess=Raid\u914D\u7F6E\u6821\u9A8C\u5B8C\u6210,\u7ED3\u679C\u4E3A\u6210\u529F +iboot.execute.fail=\u4EFB\u52A1\u5206\u53D1\u5F02\u5E38\uFF0C\u5F02\u5E38\u4FE1\u606F\u4E3A +iboot.execute.dhcpip.no.exist=\u8BBE\u5907DHCP_IP\u4E0D\u5B58\u5728 +raidConfigFinish=Raid\u914D\u7F6E\u5B8C\u6210\uFF0C\u7ED3\u679C\u6821\u9A8C\u5F00\u59CB +OSRUNNING=\u7CFB\u7EDF\u5B89\u88C5\u6B63\u5728\u6267\u884C +OSFINISH=\u7CFB\u7EDF\u5B89\u88C5\u5DF2\u5B8C\u6210 +USERNAMEFAIL=\u7528\u6237\u540D\u8BBE\u7F6E\u5931\u8D25 +PASSWORDFAIL=\u5BC6\u7801\u8BBE\u7F6E\u5931\u8D25 +ENABLEFAIL=\u542F\u7528\u7528\u6237\u5931\u8D25 +PRIVILEGEFAIL=\u6743\u9650\u8BBE\u7F6E\u5931\u8D25 +ADDUSER=\u65B0\u589E\u7528\u6237\u6210\u529F +EDITUSER=\u7F16\u8F91\u7528\u6237\u6210\u529F +NOUSER=\u7528\u6237\u4E0D\u5B58\u5728 +DELETEUSER=\u5220\u9664\u7528\u6237\u6210\u529F +DELETEFAIL=\u5220\u9664\u7528\u6237\u5931\u8D25 +CHANNELFAIL=\u8BBE\u7F6E\u901A\u9053\u5931\u8D25 +IPFAIL=\u8BBE\u7F6EIP\u5931\u8D25 +SUBNETFAIL=\u8BBE\u7F6E\u5B50\u7F51\u63A9\u7801\u5931\u8D25 +GATEWAYFAIL=\u8BBE\u7F6E\u7F51\u5173\u5931\u8D25 +NETWORKSET=\u7F51\u7EDC\u914D\u7F6E\u6210\u529F +IPV6FAIL=\u8BBE\u7F6EIPV6\u5931\u8D25 +CUSTOMEXEFAIL=\u81EA\u5B9A\u4E49\u6A21\u677F\u6267\u884C\u5931\u8D25 +CUSTOMEXE=\u81EA\u5B9A\u4E49\u6A21\u677F\u6267\u884C\u6210\u529F +CUSTOMCHECKFAIL=\u81EA\u5B9A\u4E49\u6A21\u677F\u68C0\u67E5\u7ED3\u679C\u5931\u8D25 +CUSTOMCHECK=\u81EA\u5B9A\u4E49\u6A21\u677F\u68C0\u67E5\u7ED3\u679C\u6210\u529F +STRESSBEGIN=\u538B\u529B\u6D4B\u8BD5\u5F00\u59CB +STRESSFINISH=\u538B\u529B\u6D4B\u8BD5\u5B8C\u6210 +STRESSCOLLECT=\u6B63\u5728\u91C7\u96C6\u538B\u529B\u6D4B\u8BD5\u6570\u636E +STRESSEXIST=\u538B\u529B\u6D4B\u8BD5\u4EFB\u52A1\u5DF2\u5B58\u5728 +STRESSFAIL=\u538B\u529B\u6D4B\u8BD5\u5931\u8D25 +STRESSECCREASON=\u538B\u529B\u6D4B\u8BD5ECC\u6570\u636E\u8D85\u8FC76000 +STRESSECCEXCEP=\u538B\u529B\u6D4B\u8BD5ECC\u7A0B\u5E8F\u5F02\u5E38 +device_refresh=\u5237\u65B0 +os_explorer=\u7CFB\u7EDF\u63A2\u6D4B +template_add_bmc_user=\u65B0\u589EBMC\u7528\u6237: {0} +template_modify_bmc_user=\u4FEE\u6539BMC\u7528\u6237: {0} +template_delete_bmc_user=\u5220\u9664BMC\u7528\u6237: {0} +template_install_OS=\u5B89\u88C5\u64CD\u4F5C\u7CFB\u7EDF: {0} +template_config_BMC_IP=\u914D\u7F6E\u7BA1\u7406\u7F51\u7EDC +iboot.stress.data.suc=\u6570\u636E\u91C7\u96C6\u6210\u529F +iboot.stress.data.exc=\u6570\u636E\u91C7\u96C6\u5F02\u5E38 +#-------------------------------log \u4E2D\u82F1\u6587 end---------------------------------------# \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/iboot.properties b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/iboot.properties new file mode 100644 index 0000000000000000000000000000000000000000..483d9716aa95369abecc24b2715e003dbe222fd1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/iboot.properties @@ -0,0 +1 @@ +com.inspur.pim.iboot.switch=true diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/DeviceMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/DeviceMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4bcaa75600ceac3cccc4fb4edb2ffb505d454fad --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/DeviceMapper.xml @@ -0,0 +1,381 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.DeviceMapper"> + <resultMap id="deviceBean" type="com.inspur.ispim.cosmos.iboot.base.api.entity.DeviceEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="sn" jdbcType="VARCHAR" property="sn"/> + <result column="dhcp_ip" jdbcType="VARCHAR" property="dhcpIp"/> + <result column="manage_ip" jdbcType="VARCHAR" property="manageIp"/> + <result column="model" jdbcType="VARCHAR" property="model"/> + <result column="vendor" jdbcType="VARCHAR" property="vendor"/> + <result column="network_device" jdbcType="VARCHAR" property="networkDevice"/> + <result column="status" jdbcType="VARCHAR" property="status"/> + <result column="ipmi_status" jdbcType="VARCHAR" property="ipmiStatus"/> + <result column="ipmi_fail" jdbcType="VARCHAR" property="ipmiFail"/> + <result column="manage_channel" jdbcType="VARCHAR" property="manageChannel"/> + <result column="manage_user" jdbcType="VARCHAR" property="manageUser"/> + <result column="manage_password" jdbcType="VARCHAR" property="managePassword"/> + <result column="manage_id" jdbcType="VARCHAR" property="manageId"/> + <result column="manage_account" jdbcType="VARCHAR" property="manageAccount"/> + <result column="boot_option" jdbcType="VARCHAR" property="bootOption"/> + <result column="architecture" jdbcType="VARCHAR" property="architecture"/> + <result column="system_info" jdbcType="VARCHAR" property="systemInfo"/> + <result column="storage_info" jdbcType="VARCHAR" property="storageInfo"/> + <result column="single_storage_info" jdbcType="VARCHAR" property="singleStorageInfo"/> + <result column="single_storage_md" jdbcType="VARCHAR" property="singleStorageMd"/> + <result column="create_user" jdbcType="VARCHAR" property="createUser"/> + <result column="update_user" jdbcType="VARCHAR" property="updateUser"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + <result column="heartbeat_time" jdbcType="DATE" property="heartbeatTime"/> + <result column="deviceNum" jdbcType="INTEGER" property="deviceNum"/> + </resultMap> + <resultMap id="deviceShowBean" type="com.inspur.ispim.cosmos.iboot.base.api.bean.index.DeviceShowBean"> + <result column="total" jdbcType="INTEGER" property="total"/> + <result column="offlineNum" jdbcType="INTEGER" property="offlineNum"/> + <result column="busyNum" jdbcType="INTEGER" property="busyNum"/> + <result column="freeNum" jdbcType="INTEGER" property="freeNum"/> + </resultMap> + <sql id="all_column"> + pk,id,create_time,update_time,sn,dhcp_ip,manage_ip,model,vendor,network_device,status,ipmi_status,ipmi_fail,manage_channel,manage_account,manage_user,manage_password,manage_id,boot_option,architecture,create_user,update_user,system_info,storage_info + </sql> + + <sql id="inner_column"> + pk,id,sn,heartbeat_time,manage_ip,manage_user,manage_password,manage_account + </sql> + + <select id="queryListWithPage" resultMap="deviceBean"> + SELECT + <include refid="all_column"> + </include> + FROM cosmos_iboot_device + <where> + 1 = 1 + <if test="query.antiIds != null and query.antiIds.size() > 0"> + AND id NOT IN + <foreach collection="query.antiIds" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </if> + <if test="query.containsIds != null and query.containsIds.size() > 0"> + AND id IN + <foreach collection="query.containsIds" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </if> + <if test="query.keyword != null and query.keyword !=''"> + AND (UPPER(sn) LIKE CONCAT('%',UPPER(#{query.keyword}),'%') + OR UPPER(dhcp_ip) LIKE CONCAT('%',UPPER(#{query.keyword}),'%')) + </if> + <if test="query.status != null"> + AND status = #{query.status} + </if> + <if test="query.ipmiStatus != null"> + AND ipmi_status = #{query.ipmiStatus} + </if> + <if test="query.networkDevice != null and query.networkDevice !=''"> + AND network_device = #{query.networkDevice} + </if> + <if test="query.md5 != null and query.md5 !=''"> + AND single_storage_md = #{query.md5} + </if> + <if test="query.vendor != null and query.vendor !=''"> + AND vendor = #{query.vendor} + </if> + <if test="query.model != null and query.model !=''"> + AND model = #{query.model} + </if> + <if test="query.manageIp != null and query.manageIp !=''"> + AND manage_ip = #{query.manageIp} + </if> + <if test="query.manageChannel != null"> + AND manage_channel = #{query.manageChannel} + </if> + <if test="query.bootOption != null"> + AND boot_option = #{query.bootOption} + </if> + <if test="query.architecture != null"> + AND architecture = #{query.architecture} + </if> + </where> + <if test="query.field != null and query.field != ''"> + ORDER BY ${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + <select id="querySingRaidInfo" resultMap="deviceBean"> + select DISTINCT single_storage_info,single_storage_md,count(1) deviceNum from cosmos_iboot_device + where 1=1 and single_storage_info is not null + <if test="query.keyword != null and query.keyword !=''"> + AND (UPPER(sn) LIKE CONCAT('%',UPPER(#{query.keyword}),'%') + OR UPPER(dhcp_ip) LIKE CONCAT('%',UPPER(#{query.keyword}),'%')) + </if> + GROUP BY single_storage_md + </select> + <select id="querySingRaidByMd5" resultMap="deviceBean"> + select DISTINCT single_storage_info + from cosmos_iboot_device where single_storage_md=#{md5} + </select> + + <select id="queryVendorList" resultType="java.lang.String"> + SELECT DISTINCT(vendor) FROM cosmos_iboot_device WHERE vendor IS NOT NULL + </select> + + <select id="queryModelList" resultType="java.lang.String"> + SELECT DISTINCT(model) FROM cosmos_iboot_device + <where> + model IS NOT NULL + <if test="vendor != null and vendor !=''"> + AND vendor = #{vendor} + </if> + </where> + </select> + + <delete id="batchDeleteNotBusyDevice"> + DELETE FROM cosmos_iboot_device + <where> + status != 'Busy' + <if test="query.selectAll and query.antiIds != null and query.antiIds.size() > 0"> + AND id NOT IN + <foreach collection="query.antiIds" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </if> + <if test="query.containsIds != null and query.containsIds.size() > 0"> + AND id IN + <foreach collection="query.containsIds" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </if> + <if test="query.keyword != null and query.keyword !=''"> + AND (UPPER(sn) LIKE CONCAT('%',UPPER(#{query.keyword}),'%') + OR UPPER(dhcp_ip) LIKE CONCAT('%',UPPER(#{query.keyword}),'%')) + </if> + <if test="query.status != null"> + AND status = #{query.status} + </if> + <if test="query.ipmiStatus != null"> + AND ipmi_status = #{query.ipmiStatus} + </if> + <if test="query.networkDevice != null and query.networkDevice !=''"> + AND network_device = #{query.networkDevice} + </if> + <if test="query.vendor != null and query.vendor !=''"> + AND vendor = #{query.vendor} + </if> + <if test="query.model != null and query.model !=''"> + AND model = #{query.model} + </if> + <if test="query.manageIp != null and query.manageIp !=''"> + AND manage_ip = #{query.manageIp} + </if> + <if test="query.manageChannel != null"> + AND manage_channel = #{query.manageChannel} + </if> + <if test="query.bootOption != null"> + AND boot_option = #{query.bootOption} + </if> + <if test="query.architecture != null"> + AND architecture = #{query.architecture} + </if> + </where> + </delete> + + <update id="updateStatus"> + UPDATE cosmos_iboot_device + SET `status` = 'Offline' + WHERE + (( + (heartbeat_time IS NULL) + OR (NOW() - heartbeat_time > 10) + ) + AND `status` != 'Busy' ) + OR + ( + `status` = 'Busy' AND sn not in (select sn from cosmos_iboot_task_host where job_host_status = 'RUNNING') + ) + </update> + + <update id="updateIpmiStatusById"> + <if test="device != null and device.id != null and device.id != ''"> + UPDATE cosmos_iboot_device + <set> + ipmi_status = #{device.ipmiStatus}, + ipmi_fail = #{device.ipmiFail} + </set> + <where> + id = #{device.id} + </where> + </if> + </update> + + <update id="updateBySn"> + <if test="device.sn != null and device.sn != ''"> + UPDATE cosmos_iboot_device + <set> + <if test="device.dhcpIp != null and device.dhcpIp !=''"> + dhcp_ip = #{device.dhcpIp}, + </if> + <if test="device.manageIp != null and device.manageIp !=''"> + manage_ip = #{device.manageIp}, + </if> + <if test="device.model != null and device.model !=''"> + model = #{device.model}, + </if> + <if test="device.vendor != null and device.vendor !=''"> + vendor = #{device.vendor}, + </if> + <if test="device.networkDevice != null and device.networkDevice !=''"> + network_device = #{device.networkDevice}, + </if> + <if test="device.architecture != null"> + architecture = #{device.architecture}, + </if> + <if test="device.status != null"> + status = #{device.status}, + </if> + <if test="device.bootOption != null"> + boot_option = #{device.bootOption}, + </if> + <if test="device.manageChannel != null"> + manage_channel = #{device.manageChannel}, + </if> + <if test="device.manageAccount != null"> + manage_account = #{device.manageAccount}, + </if> + <if test="device.systemInfo != null and device.systemInfo !=''"> + system_info = #{device.systemInfo}, + </if> + <if test="device.storageInfo != null and device.storageInfo !=''"> + storage_info = #{device.storageInfo}, + </if> + <if test="device.singleStorageInfo != null and device.singleStorageInfo !=''"> + single_storage_info = #{device.singleStorageInfo}, + </if> + <if test="device.singleStorageMd != null and device.singleStorageMd !=''"> + single_storage_md = #{device.singleStorageMd}, + </if> + update_time = NOW() + </set> + <where> + sn = #{device.sn} + </where> + </if> + </update> + + <update id="updateById"> + <if test="device.id != null and device.id != ''"> + UPDATE cosmos_iboot_device + <set> + <if test="device.sn != null and device.sn != ''"> + sn = #{device.sn}, + </if> + manage_ip = #{device.manageIp}, + manage_user = #{device.manageUser}, + manage_password = #{device.managePassword}, + <if test="device.manageId != null and device.manageId != ''"> + manage_id = #{device.manageId}, + </if> + <if test="device.manageAccount != null"> + manage_account = #{device.manageAccount}, + </if> + <if test="device.ipmiStatus != null"> + ipmi_status = #{device.ipmiStatus}, + </if> + <if test="device.ipmiFail != null"> + ipmi_fail = #{device.ipmiFail}, + </if> + update_time = NOW() + </set> + <where> + id = #{device.id} + </where> + </if> + </update> + + <update id="updateHeartBeatBySn"> + <if test="sn != null and sn != '' and ip != null and ip != ''"> + UPDATE cosmos_iboot_device + <set> + `status` = ( + CASE status + WHEN 'Offline' THEN + 'Online' + ELSE + status + END + ), + dhcp_ip = #{ip}, + heartbeat_time = NOW() + </set> + <where> + sn = #{sn} + </where> + </if> + </update> + + <select id="getAll" resultMap="deviceBean"> + SELECT + <include refid="inner_column"> + </include> + FROM cosmos_iboot_device + </select> + + <select id="queryEntityById" resultMap="deviceBean"> + SELECT + <include refid="all_column"> + </include> + FROM cosmos_iboot_device + <where> + id = #{id} + </where> + </select> + + <select id="queryListBySn" resultMap="deviceBean"> + <if test="query != null and query.size() > 0"> + SELECT + <include refid="all_column"> + </include> + FROM cosmos_iboot_device + <where> + sn IN + <foreach collection="query" item="sn" open="(" separator="," close=")"> + #{sn} + </foreach> + </where> + </if> + </select> + + <insert id="batchInsert"> + <if test="device != null and device.size() > 0"> + INSERT INTO cosmos_iboot_device + (id,sn,status,manage_account,manage_ip,manage_user,manage_password,manage_id,ipmi_status,ipmi_fail,create_user) + VALUES + <foreach collection="device" item="item" open="" separator="," close=""> + (#{item.id},#{item.sn},#{item.status},#{item.manageAccount},#{item.manageIp},#{item.manageUser},#{item.managePassword},#{item.manageId},#{item.ipmiStatus},#{item.ipmiFail},#{item.createUser}) + </foreach> + </if> + </insert> + + <select id="queryDevicePxeOnlineById" resultType="boolean"> + <if test="query != null and query != ''"> + SELECT + CASE + WHEN NOW() - heartbeat_time &lt;= 10 THEN TRUE + ELSE FALSE + END AS s + FROM `cosmos_iboot_device` + WHERE id = #{query} + </if> + </select> + <select id="getDeviceShow" resultMap="deviceShowBean"> + select * from (select count(1) total from cosmos_iboot_device) t1, + (select count(1) offlineNum from cosmos_iboot_device where `status`='Offline') t2, + (select count(1) freeNum from cosmos_iboot_device where `status`='Online') t3, + (select count(1) busyNum from cosmos_iboot_device where `status`='Busy') t4 + </select> + +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootImageXmlMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootImageXmlMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..ae69934561e2d4c577a4417591de37fb40cd84ee --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootImageXmlMapper.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootImageXmlMapper"> + <resultMap id="arrangeBase" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootImageXmlEntity"> + <id column="pk" jdbcType="BIGINT" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="image_id" jdbcType="VARCHAR" property="imageId"/> + <result column="enviroment" jdbcType="VARCHAR" property="enviroment"/> + </resultMap> + + <select id="queryByImageId" resultType="java.lang.String"> + select enviroment from starlet_control_image_xml + where image_id=#{imageId} + + </select> + +</mapper> diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootInbandFileMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootInbandFileMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..67aaf73ad6343cd97813e9dbab053b5897145b84 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootInbandFileMapper.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootInabndFileMapper"> + <resultMap id="BaseResultMap" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootInbandFileEntity"> + <id column="pk" jdbcType="BIGINT" property="pk"/> + <id column="id" jdbcType="VARCHAR" property="id"/> + <result column="name" jdbcType="VARCHAR" property="name"/> + <result column="original_name" jdbcType="VARCHAR" property="originalName"/> + <result column="full_path" jdbcType="VARCHAR" property="fullPath"/> + <result column="md5" jdbcType="VARCHAR" property="md5"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + <result column="architecture" jdbcType="VARCHAR" property="architecture"/> + </resultMap> + + <select id="getOneById" resultMap="BaseResultMap"> + select `id`,`name`,original_name,full_path,create_time,update_time,md5 + from cosmos_iboot_inband_file + where id =#{id} + </select> + + <delete id="deleteById"> + delete from cosmos_iboot_inband_file + where id =#{id} + </delete> + +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootRaidConfigXmlMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootRaidConfigXmlMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..be4b603174250410ab5cb362db40a72fb43dada0 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootRaidConfigXmlMapper.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootRaidConfigXmlMapper"> + <resultMap id="BaseResultMap" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRaidConfigXmlEntity"> + <id column="pk" jdbcType="BIGINT" property="pk"/> + <id column="id" jdbcType="VARCHAR" property="id"/> + <result column="model" jdbcType="VARCHAR" property="model"/> + <result column="type" jdbcType="VARCHAR" property="type"/> + <result column="content" jdbcType="VARCHAR" property="content"/> + <result column="remark_cn" jdbcType="VARCHAR" property="remarkCn"/> + <result column="remark_en" jdbcType="VARCHAR" property="remarkEn"/> + </resultMap> + <select id="getByModelAndType" resultMap="BaseResultMap"> + SELECT pk,id,model,`type`,content,remark_cn,remark_en + FROM starlet_control_raid_config_xml WHERE 1=1 + <if test="model != null and model != ''"> + and #{model} like concat('%',model,'%') + </if> + <if test="type != null and type != ''"> + and `type` = #{type} + </if> + </select> +</mapper> diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootRepositoryImageMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootRepositoryImageMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..1eefd9c052b17d6b61a488bac3fd12c6896e97cd --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootRepositoryImageMapper.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootRepositoryImageMapper"> + <resultMap id="BaseResultMap" + type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootRepositoryImageEntity"> + <id column="pk" jdbcType="BIGINT" property="pk"/> + <id column="id" jdbcType="VARCHAR" property="id"/> + <result column="name" jdbcType="VARCHAR" property="name"/> + <result column="original_name" jdbcType="VARCHAR" property="originalName"/> + <result column="full_path" jdbcType="VARCHAR" property="fullPath"/> + <result column="is_has_ks" jdbcType="BIT" property="hasKs"/> + <result column="is_custom_image" jdbcType="BIT" property="customImage"/> + <result column="image_type" jdbcType="VARCHAR" property="imageType"/> + <result column="is_show" jdbcType="BIT" property="show"/> + <result column="insource" jdbcType="BIT" property="insource"/> + <result column="tempuse" jdbcType="BIT" property="tempuse"/> + <result column="version" jdbcType="VARCHAR" property="version"/> + <result column="architecture" jdbcType="VARCHAR" property="architecture"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + <result column="create_user" jdbcType="VARCHAR" property="createUser"/> + <result column="update_user" jdbcType="VARCHAR" property="updateUser"/> + </resultMap> + <resultMap id="SupportImageResultMap" + type="com.inspur.ispim.cosmos.iboot.base.api.bean.image.IBootOtherSupportedImageBean"> + <id column="pk" jdbcType="BIGINT" property="pk"/> + <id column="id" jdbcType="VARCHAR" property="id"/> + <result column="image_type" jdbcType="VARCHAR" property="imageType"/> + <result column="version" jdbcType="VARCHAR" property="version"/> + <result column="is_need_ks" jdbcType="BIT" property="needKs"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + </resultMap> + <select id="getByID" resultMap="BaseResultMap"> + SELECT distinct i.pk,i.id,i.`name`,i.original_name,i.full_path,i.is_has_ks,i.is_custom_image,i.image_type,i.is_show,i.version,i.architecture,i.create_time + ,i.update_time,i.create_user,i.update_user,i.insource,(CASE WHEN t.id is null then 0 else 1 end) as tempuse + FROM starlet_control_repository_image i LEFT JOIN cosmos_iboot_template t on t.content like CONCAT('%',i.id,'%') and t.is_show='1' + WHERE i.id= #{id} + </select> + <delete id="deleteById" parameterType="String"> + delete from starlet_control_repository_image WHERE id= #{id} + </delete> + <select id="getByFileName" resultMap="BaseResultMap"> + SELECT pk,id,`name`,original_name,full_path,is_has_ks,is_custom_image,image_type,is_show,version,architecture,create_time + ,update_time,create_user,update_user,insource + FROM starlet_control_repository_image a WHERE a.name= #{fileName} + </select> + <select id="getAll" resultMap="BaseResultMap"> + SELECT pk,id,`name`,original_name,full_path,is_has_ks,is_custom_image,image_type,is_show,version,architecture,create_time + ,update_time,create_user,update_user,insource + FROM starlet_control_repository_image + </select> + <select id="selectSupportedImageAll" resultMap="SupportImageResultMap"> + SELECT pk,id,image_type,version,is_need_ks,create_time,update_time + FROM starlet_control_other_supported_image + </select> + <select id="getYumImageList" resultMap="BaseResultMap"> + SELECT pk,id,`name`,original_name,full_path,is_has_ks,is_custom_image,image_type,is_show,version,architecture,create_time + ,update_time,create_user,update_user,insource + FROM starlet_control_repository_image + where image_type not in ('Windows','ESXI','Ubuntu') + and (insource=0 or insource is null ) + </select> + <select id="getByConditions" resultMap="BaseResultMap"> + select distinct i.pk,i.id,i.`name`,i.original_name,i.full_path,i.is_has_ks,i.is_custom_image,i.image_type,i.is_show,i.version,i.architecture,i.create_time + ,i.update_time,i.create_user,i.update_user,i.insource,(CASE WHEN t.id is null then 0 else 1 end) as tempuse + from starlet_control_repository_image i LEFT JOIN cosmos_iboot_template t on t.content like CONCAT('%',i.id,'%') and t.is_show='1' + where + 1=1 + <if test=" query.name != null and query.name != ''"> + and i.name like concat('%',#{query.name},'%') + </if> + <if test=" query.originalName != null and query.originalName != ''"> + and i.original_name like concat('%',#{query.originalName},'%') + </if> + <if test=" query.imageType != null"> + and i.image_type = #{query.imageType} + </if> + <if test="query.architecture != null and query.architecture != ''"> + and i.`architecture`= #{query.architecture} + </if> + <if test="query.field != null and query.field != ''"> + order by ${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> +</mapper> diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootStressDataMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootStressDataMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..984ddb84f4b961e6a5901517581c2cc262a399d4 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootStressDataMapper.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootStressDataMapper"> + <resultMap id="BaseResultMap" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressDataEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="job_host_id" jdbcType="VARCHAR" property="jobHostId"/> + <result column="ip" jdbcType="VARCHAR" property="ip"/> + <result column="sn" jdbcType="VARCHAR" property="sn"/> + <result column="inlet_temperature" jdbcType="VARCHAR" property="inletTemperature"/> + <result column="outlet_temperature" jdbcType="VARCHAR" property="outletTemperature"/> + <result column="total_power" jdbcType="VARCHAR" property="totalPower"/> + <result column="cpu_temperature" jdbcType="VARCHAR" property="cpuTemperature"/> + <result column="cpu_power" jdbcType="VARCHAR" property="cpuPower"/> + <result column="cpu_rate_user" jdbcType="VARCHAR" property="cpuRateUser"/> + <result column="cpu_rate_system" jdbcType="VARCHAR" property="cpuRateSystem"/> + <result column="cpu_rate_idle" jdbcType="VARCHAR" property="cpuRateIdle"/> + <result column="memory_rate" jdbcType="VARCHAR" property="memoryRate"/> + <result column="memory_power" jdbcType="VARCHAR" property="memoryPower"/> + <result column="ecc_cpu0" jdbcType="VARCHAR" property="eccCPU0"/> + <result column="ecc_cpu1" jdbcType="VARCHAR" property="eccCPU1"/> + <result column="ecc_reason" jdbcType="VARCHAR" property="eccReason"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + </resultMap> + + <select id="getStressData" resultMap="BaseResultMap"> + select * + from cosmos_iboot_stress_data + where job_host_id = #{jobHostId} + order by create_time asc + </select> + +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootStressTestServerMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootStressTestServerMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..5ed4d2f16aa105a38a7a858177415075defb5eb1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootStressTestServerMapper.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootStressTessServerMapper"> + <resultMap id="BaseResultMap" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootStressTestServerEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="task_id" jdbcType="VARCHAR" property="taskId"/> + <result column="job_host_id" jdbcType="VARCHAR" property="jobHostId"/> + <result column="ip" jdbcType="VARCHAR" property="ip"/> + <result column="sn" jdbcType="VARCHAR" property="sn"/> + <result column="num" jdbcType="INTEGER" property="num"/> + <result column="status" jdbcType="VARCHAR" property="status"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + </resultMap> + + <select id="getById" resultMap="BaseResultMap"> + select * + from cosmos_iboot_stress_server + where job_host_id = #{jobHostId} + </select> + + <select id="getListByTaskId" resultMap="BaseResultMap"> + select * + from cosmos_iboot_stress_server + where task_id = #{query.taskId} + <if test=" query.status != null "> + and status = #{status} + </if> + <if test="query.field != null and query.field != ''"> + order by ${query.field} + </if> + <if test="query.keyword != null and query.keyword !=''"> + AND (UPPER(sn) LIKE CONCAT('%',UPPER(#{query.keyword}),'%') + OR UPPER(ip) LIKE CONCAT('%',UPPER(#{query.keyword}),'%')) + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHistoryMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHistoryMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4857b40e4f095942a2b83d13a78c8dbd273429d8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHistoryMapper.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHistoryMapper"> + <resultMap id="taskBean" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHistoryEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="name" jdbcType="VARCHAR" property="name"/> + <result column="task_status" jdbcType="VARCHAR" property="taskStatus"/> + <result column="cron" jdbcType="VARCHAR" property="cron"/> + <result column="excute_user" jdbcType="VARCHAR" property="excuteUser"/> + <result column="task_id" jdbcType="VARCHAR" property="taskId"/> + <result column="execute_type" jdbcType="VARCHAR" property="executeType"/> + <result column="execute_time" jdbcType="TIMESTAMP" property="executeTime"/> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> + <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + <result column="template_id" jdbcType="VARCHAR" property="templateId"/> + <result column="template_name" jdbcType="VARCHAR" property="templateName"/> + <result column="template_type" jdbcType="VARCHAR" property="templateType"/> + </resultMap> + <resultMap id="totalBean" type="com.inspur.ispim.cosmos.iboot.base.api.bean.index.TotalBean"> + <result column="deviceNum" jdbcType="INTEGER" property="deviceNum"/> + <result column="taskNum" jdbcType="INTEGER" property="taskNum"/> + <result column="templateNum" jdbcType="INTEGER" property="templateNum"/> + <result column="imageNum" jdbcType="INTEGER" property="imageNum"/> + </resultMap> + + <select id="getByConditions" resultMap="taskBean"> + SELECT DISTINCT t.pk,t.id,t.`name`,t.task_id,t.task_status,t.cron,t.excute_user,t.execute_type,t.execute_time,t.start_time,t.end_time,t.create_time,t.update_time, + t.template_id,t.template_name,t.template_type + FROM cosmos_iboot_task_history t,cosmos_iboot_task_host_history h + where + t.task_id=h.task_id + <if test=" query.name != null and query.name != ''"> + and t.name like concat('%',#{query.name},'%') + </if> + <if test=" query.templateType != null and query.templateType != ''"> + and t.template_type = #{query.templateType} + </if> + <if test=" query.sn != null and query.sn != ''"> + and h.sn like concat('%',#{query.sn},'%') + </if> + <if test="query.field != null and query.field != ''"> + order by t.${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + <select id="getTaskHistoryByTaskId" resultMap="taskBean"> + SELECT pk,id,`name`,task_id,task_status,cron,excute_user,execute_type,execute_time,start_time,end_time,create_time,update_time,template_id,template_name,template_type + FROM cosmos_iboot_task_history + where task_id=#{taskId} + </select> + <delete id="deleteByTaskId"> + delete from cosmos_iboot_task_history + where task_id =#{taskId} + </delete> + <select id="getTotal" resultMap="totalBean"> + select * from (select count(1) deviceNum from cosmos_iboot_device) t1, + (select count(1) taskNum from cosmos_iboot_task_history) t2, + (select count(1) templateNum from cosmos_iboot_template where is_show=1) t3, + (select count(1) imageNum from starlet_control_repository_image ) t4 + </select> + <select id="getTaskHistoryListTopten" resultMap="taskBean"> + select * from cosmos_iboot_task_history where start_time is not null + ORDER BY start_time desc limit 10 + </select> +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostHistoryMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostHistoryMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..44734836d9144fe3f4024dc5e8d2299fd0d949bf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostHistoryMapper.xml @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostHistoryMapper"> + <resultMap id="taskHostBean" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostHistoryEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="task_id" jdbcType="VARCHAR" property="taskId"/> + <result column="job_host_id" jdbcType="VARCHAR" property="jobHostId"/> + <result column="resource_id" jdbcType="VARCHAR" property="resourceId"/> + <result column="resource_ip" jdbcType="VARCHAR" property="resourceIp"/> + <result column="mac" jdbcType="VARCHAR" property="mac"/> + <result column="sn" jdbcType="VARCHAR" property="sn"/> + <result column="model" jdbcType="VARCHAR" property="model"/> + <result column="job_host_status" jdbcType="VARCHAR" property="jobHostStatus"/> + <result column="msg" jdbcType="VARCHAR" property="msg"/> + <result column="param" jdbcType="VARCHAR" property="param"/> + <result column="process" jdbcType="INTEGER" property="process"/> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> + <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + </resultMap> + <resultMap id="taskJobBean" type="com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean"> + <result column="successNum" jdbcType="INTEGER" property="successNum"/> + <result column="failNum" jdbcType="INTEGER" property="failNum"/> + <result column="waitNum" jdbcType="INTEGER" property="waitNum"/> + <result column="runningNum" jdbcType="INTEGER" property="runningNum"/> + </resultMap> + <resultMap id="templateShowBean" type="com.inspur.ispim.cosmos.iboot.base.api.bean.index.TemplateShowBean"> + <result column="name" jdbcType="VARCHAR" property="name"/> + <result column="type" jdbcType="VARCHAR" property="type"/> + <result column="number" jdbcType="INTEGER" property="number"/> + </resultMap> + + <select id="getByConditions" resultMap="taskHostBean"> + SELECT pk,id,task_id,job_host_id,resource_id,resource_ip,mac,sn,model,job_host_status,msg,process,start_time,end_time,create_time,update_time,param + FROM cosmos_iboot_task_host_history + where + 1=1 + <if test=" query.taskStatus != null"> + and job_host_status like concat('%',#{query.taskStatus},'%') + </if> + <if test="query.field != null and query.field != ''"> + order by ${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + <select id="getListByTaskId" resultMap="taskHostBean"> + SELECT pk,id,task_id,job_host_id,resource_id,resource_ip,mac,sn,model,job_host_status,msg,process,start_time,end_time,create_time,update_time,param + FROM cosmos_iboot_task_host_history + where task_id=#{query.taskId} + <if test=" query.name != null and query.name != ''"> + and (sn like concat('%',#{query.name},'%') + or resource_ip like concat('%',#{query.name},'%')) + </if> + <if test=" query.taskStatus != null"> + and job_host_status = #{query.taskStatus} + </if> + <if test="query.field != null and query.field != ''"> + order by ${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + <select id="getIBootTaskJobByTaskId" resultMap="taskJobBean"> + SELECT SUM(CASE WHEN job_host_status ='FAILED' THEN 1 ELSE 0 END) as failNum, + SUM(CASE WHEN job_host_status ='SUCCESS' THEN 1 ELSE 0 END) as successNum, + SUM(CASE WHEN job_host_status ='RUNNING' THEN 1 ELSE 0 END) as runningNum, + SUM(CASE WHEN job_host_status ='WAITING' THEN 1 ELSE 0 END) as waitNum + FROM cosmos_iboot_task_host_history + where task_id=#{taskId} + </select> + <select id="getFailListByTaskId" resultMap="taskHostBean"> + SELECT h.pk,h.id,h.task_id,h.job_host_id,h.resource_id,h.resource_ip,h.mac,h.sn,h.model,h.job_host_status,h.msg, + h.process,h.start_time,h.end_time,h.create_time,h.update_time,h.param + FROM cosmos_iboot_task_host_history h,cosmos_iboot_device d + where d.sn=h.sn + and task_id=#{taskId} + and d.status='Online' + and job_host_status='FAILED' + </select> + <select id="getListByTaskHostId" resultMap="taskHostBean"> + SELECT h.pk,h.id,h.task_id,h.job_host_id,h.resource_id,h.resource_ip,h.mac,h.sn,h.model,h.job_host_status,h.msg, + h.process,h.start_time,h.end_time,h.create_time,h.update_time,h.param + FROM cosmos_iboot_task_host_history h,cosmos_iboot_device d + where d.sn=h.sn + and d.status='Online' + and job_host_id=#{taskHostId} + </select> + <select id="jobHost2History" resultMap="taskHostBean"> + SELECT id,task_id,id as job_host_id,resource_id,resource_ip,sn,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,mac + FROM cosmos_iboot_task_host + where task_id=#{taskId} limit #{countstart} , #{counthost} + </select> + <select id="getHost2HistoryCount" resultType="java.lang.Integer"> + SELECT count(1) + FROM cosmos_iboot_task_host + where task_id=#{taskId} + </select> + <select id="getHostListByTaskId" resultMap="taskHostBean"> + SELECT id,task_id,id as job_host_id,resource_id,resource_ip,sn,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,mac + FROM cosmos_iboot_task_host_history + where task_id=#{taskId} + </select> + <delete id="deleteByTaskId"> + delete from cosmos_iboot_task_host_history + where task_id =#{taskId} + </delete> + <select id="getTemplateShow" resultMap="templateShowBean"> + select tmp.template_name name,tmp.template_type type,tmp.excuteNum number from + (select t.template_name,t.template_type,count(1) excuteNum from cosmos_iboot_task_history t,cosmos_iboot_task_host_history h + where h.task_id=t.task_id group by t.template_name,t.template_type) tmp order by excuteNum desc limit 5 + </select> + <select id="getImageShow" resultMap="templateShowBean"> + select image_type `name`,count(1) number from starlet_control_repository_image where image_type is not null GROUP BY image_type + </select> +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostLogMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..73a349d09ed075135223944f70bc9e01ec09f222 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostLogMapper.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostLogMapper"> + <resultMap id="taskHostLogBean" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostLogEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="task_id" jdbcType="VARCHAR" property="taskId"/> + <result column="resource_id" jdbcType="VARCHAR" property="resourceId"/> + <result column="job_host_id" jdbcType="VARCHAR" property="jobHostId"/> + <result column="content" jdbcType="VARCHAR" property="content"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + </resultMap> + + <select id="getByConditions" resultMap="taskHostLogBean"> + SELECT pk,id,task_id,resource_id,job_host_id,content,create_time,update_time + FROM cosmos_iboot_task_host_log + where job_host_id=#{jobHostId} + </select> +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..e4793d8db4d237e64f3e915e35f5984a7c9ba875 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskHostMapper.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskHostMapper"> + <resultMap id="taskHostBean" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskHostEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="resource_id" jdbcType="VARCHAR" property="resourceId"/> + <result column="job_host_status" jdbcType="VARCHAR" property="jobHostStatus"/> + <result column="msg" jdbcType="VARCHAR" property="msg"/> + <result column="param" jdbcType="VARCHAR" property="param"/> + <result column="template_type" jdbcType="VARCHAR" property="templateType"/> + <result column="template_id" jdbcType="VARCHAR" property="templateId"/> + <result column="sn" jdbcType="VARCHAR" property="sn"/> + <result column="resource_ip" jdbcType="VARCHAR" property="resourceIp"/> + <result column="mac" jdbcType="VARCHAR" property="mac"/> + <result column="process" jdbcType="INTEGER" property="process"/> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> + <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + </resultMap> + <resultMap id="taskJobBean" type="com.inspur.ispim.cosmos.iboot.base.api.bean.task.IBootTaskJobBean"> + <result column="successNum" jdbcType="INTEGER" property="successNum"/> + <result column="failNum" jdbcType="INTEGER" property="failNum"/> + <result column="waitNum" jdbcType="INTEGER" property="waitNum"/> + <result column="runningNum" jdbcType="INTEGER" property="runningNum"/> + </resultMap> + + <select id="getByConditions" resultMap="taskHostBean"> + SELECT pk,id,resource_id,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,template_type,template_id,sn,resource_ip,mac + FROM cosmos_iboot_task_host + where + 1=1 + <if test=" query.taskStatus != null"> + and job_host_status = #{query.taskStatus} + </if> + <if test=" query.name != null and query.name != ''"> + and (sn like concat('%',#{query.name},'%') + or resource_ip like concat('%',#{query.name},'%')) + </if> + <if test="query.field != null and query.field != ''"> + order by ${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + <select id="selectAllHost" resultMap="taskHostBean"> + SELECT pk,id,resource_id,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,template_type,template_id,sn,resource_ip,mac + FROM cosmos_iboot_task_host + where + 1=1 + </select> + <select id="getListByTaskId" resultMap="taskHostBean"> + SELECT pk,id,resource_id,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,template_type,template_id,sn,resource_ip,mac + FROM cosmos_iboot_task_host + where task_id=#{taskId} limit #{countstart} , #{counthost} + </select> + <select id="getListCountByTaskId" resultType="java.lang.Integer"> + SELECT count(1) + FROM cosmos_iboot_task_host + where task_id=#{taskId} + </select> + <select id="getListByQuery" resultMap="taskHostBean"> + SELECT pk,id,resource_id,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,template_type,template_id,sn,resource_ip,mac + FROM cosmos_iboot_task_host + where task_id=#{query.taskId} + <if test=" query.name != null and query.name != ''"> + and (sn like concat('%',#{query.name},'%') + or resource_ip like concat('%',#{query.name},'%')) + </if> + <if test=" query.taskStatus != null"> + and job_host_status like concat('%',#{query.taskStatus},'%') + </if> + <if test="query.field != null and query.field != ''"> + order by ${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + <select id="getIBootTaskJobByTaskId" resultMap="taskJobBean"> + SELECT SUM(CASE WHEN job_host_status ='FAILED' THEN 1 ELSE 0 END) as failNum, + SUM(CASE WHEN job_host_status ='SUCCESS' THEN 1 ELSE 0 END) as successNum, + SUM(CASE WHEN job_host_status ='RUNNING' THEN 1 ELSE 0 END) as runningNum, + SUM(CASE WHEN job_host_status ='WAITING' THEN 1 ELSE 0 END) as waitNum + FROM cosmos_iboot_task_host + where task_id=#{taskId} + </select> + <select id="getRunningWaitingListByTaskId" resultMap="taskHostBean"> + SELECT pk,id,resource_id,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,template_type,template_id,sn,resource_ip,mac + FROM cosmos_iboot_task_host + where task_id=#{taskId} + and job_host_status in ('WAITING','RUNNING') + </select> + <select id="getJobHostStatusById" resultMap="taskHostBean"> + SELECT pk,id,task_id,resource_id,job_host_status,msg,process,start_time,end_time,create_time,update_time,param,template_type,template_id,sn,resource_ip,mac + FROM cosmos_iboot_task_host + where id=#{id} + </select> + <select id="getWaitingTaskHostList" resultMap="taskHostBean"> + select distinct tmp.* from (SELECT distinct h.pk,h.id,h.resource_id,h.job_host_status,h.msg,h.process,h.start_time,h.end_time,h.create_time,h.update_time,h.param,h.template_type,h.template_id,h.sn,d.dhcp_ip resource_ip,h.mac + FROM cosmos_iboot_task_host h,cosmos_iboot_device d where h.sn=d.sn and job_host_status='WAITING' and d.status in ('Online') + union all + SELECT distinct h.pk,h.id,h.resource_id,h.job_host_status,h.msg,h.process,h.start_time,h.end_time,h.create_time,h.update_time,h.param,h.template_type,h.template_id,h.sn,d.dhcp_ip resource_ip,h.mac + FROM cosmos_iboot_task_host h,cosmos_iboot_device d where h.sn=d.sn and job_host_status='WAITING' and h.template_type='OS_EXPLORE' and d.status not in ('Busy')) tmp + ORDER BY create_time limit #{limitCount} + </select> + <select id="getRunningCount" resultType="int"> + SELECT count(1) + FROM cosmos_iboot_task_host + where job_host_status='RUNNING' + </select> + <delete id="deleteByTaskId"> + delete from cosmos_iboot_task_host + where task_id =#{taskId} + </delete> +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..565c444da15d4107e119b4ed2bb1f30a3c7bbf74 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTaskMapper.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTaskMapper"> + <resultMap id="taskBean" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTaskEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="name" jdbcType="VARCHAR" property="name"/> + <result column="task_status" jdbcType="VARCHAR" property="taskStatus"/> + <result column="cron" jdbcType="VARCHAR" property="cron"/> + <result column="create_user" jdbcType="VARCHAR" property="createUser"/> + <result column="execute_type" jdbcType="VARCHAR" property="executeType"/> + <result column="execute_time" jdbcType="TIMESTAMP" property="executeTime"/> + <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/> + <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + <result column="template_id" jdbcType="VARCHAR" property="templateId"/> + <result column="template_name" jdbcType="VARCHAR" property="templateName"/> + <result column="template_type" jdbcType="VARCHAR" property="templateType"/> + </resultMap> + + <select id="getByConditions" resultMap="taskBean"> + SELECT distinct t.pk,t.id,t.`name`,t.task_status,t.cron,t.create_user,t.execute_type,t.execute_time,t.start_time,t.end_time,t.create_time,t.update_time, + t.template_id,t.template_name,t.template_type + FROM cosmos_iboot_task t,cosmos_iboot_task_host h + where + t.id=h.task_id + <if test=" query.name != null and query.name != ''"> + and t.name like concat('%',#{query.name},'%') + </if> + <if test=" query.taskStatus != null"> + and t.task_status like concat('%',#{query.taskStatus},'%') + </if> + <if test=" query.templateName != null and query.templateName != ''"> + and t.template_name = #{query.templateName} + </if> + <if test=" query.templateType != null and query.templateType != ''"> + and t.template_type = #{query.templateType} + </if> + <if test=" query.sn != null and query.sn != ''"> + and h.sn = #{query.sn} + </if> + <if test=" query.taskStatus != null and query.taskStatus != ''"> + and t.task_status = #{query.taskStatus} + </if> + <if test="query.field != null and query.field != ''"> + order by t.${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + + <select id="getByTemplateId" resultMap="taskBean"> + SELECT * + FROM cosmos_iboot_task + WHERE 1 = 1 + <if test=" templateId != null and templateId != '' "> + AND template_id = #{templateId} + </if> + </select> + +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTemplateMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTemplateMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a93f91e0c699edaafcb3af77aa7b73d841bdc0b1 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTemplateMapper.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTemplateMapper"> + <resultMap id="BaseResultMap" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTemplateEntity"> + <id column="pk" jdbcType="BIGINT" property="pk"/> + <id column="id" jdbcType="VARCHAR" property="id"/> + <result column="name" jdbcType="VARCHAR" property="name"/> + <result column="description" jdbcType="VARCHAR" property="description"/> + <result column="content" jdbcType="VARCHAR" property="content"/> + <result column="model" jdbcType="VARCHAR" property="model"/> + <result column="real_model" jdbcType="VARCHAR" property="realModel"/> + <result column="template_type" jdbcType="VARCHAR" property="templateType"/> + <result column="vendor" jdbcType="VARCHAR" property="vendor"/> + <result column="create_user" jdbcType="VARCHAR" property="createUser"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_user" jdbcType="VARCHAR" property="updateUser"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + <result column="is_show" jdbcType="BIT" property="show"/> + <result column="raid_models" jdbcType="VARCHAR" property="raidModels"/> + <result column="is_clear" jdbcType="BIT" property="clear"/> + <result column="architecture" jdbcType="VARCHAR" property="architecture"/> + </resultMap> + + <sql id="all_column"> + pk,id,name,description,content,model,real_model,template_type,vendor,create_user, + create_time,update_user,update_time,is_show,raid_models,is_clear,architecture + </sql> + + <select id="getByID" resultMap="BaseResultMap"> + SELECT + <include refid="all_column"> + </include> + FROM cosmos_iboot_template WHERE id = #{id} + </select> + + <select id="getByName" resultMap="BaseResultMap"> + SELECT + <include refid="all_column"> + </include> + FROM cosmos_iboot_template WHERE name = #{name} and is_show = 1 + </select> + + <select id="getByConditions" resultMap="BaseResultMap"> + select + <include refid="all_column"> + </include> + from cosmos_iboot_template + where + is_show = 1 + <if test=" query.name != null and query.name != ''"> + and name like concat('%',#{query.name},'%') + </if> + <if test=" query.model != null and query.model != ''"> + and model like concat('%',#{query.model},'%') + </if> + <if test=" query.vendor != null and query.vendor != ''"> + and vendor = #{query.vendor} + </if> + <if test=" query.createTimeStart != null "> + and create_time &gt; #{query.createTimeStart} + </if> + <if test=" query.createTimeEnd != null"> + and create_time &lt; #{query.createTimeEnd} + </if> + <if test=" query.createUserID != null and query.createUserID != ''"> + and create_user = #{query.createUserID} + </if> + <if test=" query.updateUserID != null and query.updateUserID != ''"> + and update_user = #{query.updateUserID} + </if> + <if test="query.templateType != null and query.templateType.size() > 0"> + and template_type IN + <foreach collection="query.templateType" item="templateType" open="(" separator="," close=")"> + #{templateType} + </foreach> + </if> + <if test="query.field != null and query.field != ''"> + order by ${query.field} + </if> + <if test="query.dir != null and query.dir != ''"> + ${query.dir} + </if> + </select> + +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTimezoneMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTimezoneMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4f22e1717f6aa00f60c4255d0a2fc4bf655019bf --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/IBootTimezoneMapper.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.IBootTimezoneMapper"> + <resultMap id="BaseResultMap" type="com.inspur.ispim.cosmos.iboot.base.api.entity.IBootTimezoneEntity"> + <id column="pk" jdbcType="BIGINT" property="pk"/> + <id column="id" jdbcType="VARCHAR" property="id"/> + <result column="timezone_key" jdbcType="VARCHAR" property="timezoneKey"/> + <result column="timezone_value" jdbcType="VARCHAR" property="timezoneValue"/> + <result column="system_type" jdbcType="VARCHAR" property="systemType"/> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> + </resultMap> + + <select id="getBySysType" resultMap="BaseResultMap"> + SELECT timezone_key,timezone_value + FROM starlet_control_timezone + WHERE 1 = 1 + <if test="systemType != null and systemType != ''"> + AND system_type = #{systemType} + </if> + </select> + +</mapper> diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/TaskHostMapper.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/TaskHostMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..3471b7464e673d3c35c32d84f6a7f17eae6d5de6 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/mapper/TaskHostMapper.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.inspur.ispim.cosmos.iboot.base.core.mapper.TaskHostMapper"> + <resultMap id="taskHostBean" type="com.inspur.ispim.cosmos.iboot.base.api.entity.TaskHostEntity"> + <result column="pk" jdbcType="INTEGER" property="pk"/> + <result column="id" jdbcType="VARCHAR" property="id"/> + <result column="sn" jdbcType="VARCHAR" property="sn"/> + <result column="para" jdbcType="VARCHAR" property="para"/> + <result column="status" jdbcType="VARCHAR" property="status"/> + <result column="creator" jdbcType="VARCHAR" property="creator"/> + <result column="updater" jdbcType="VARCHAR" property="updater"/> + <result column="create_time" jdbcType="DATE" property="createTime"/> + <result column="update_time" jdbcType="DATE" property="updateTime"/> + </resultMap> + + <select id="getList" resultMap="taskHostBean"> + SELECT * FROM cosmos_iboot_task_host + <where> + <choose> + <when test="query.containsIds != null and query.containsIds.size() != 0"> + and id in + <foreach collection="query.containsIds" item="id" open="(" + separator="," close=")"> + #{id} + </foreach> + </when> + <otherwise> + <if test="query.antiIds != null and query.antiIds.size() > 0"> + and a.id not in + <foreach collection="query.antiIds" item="antiSelectionId" + open="(" separator="," close=")"> + #{antiSelectionId} + </foreach> + </if> + <if test="query.keyword != null and query.keyword !=''"> + and UPPER(sn) like + UPPER(CONCAT('%',#{query.keyword},'%')) + or UPPER(status) like + UPPER(CONCAT('%',#{query.keyword},'%'))) + </if> + </otherwise> + </choose> + </where> + </select> + + <select id="getReadyTaskBySN" resultMap="taskHostBean"> + + SELECT * FROM cosmos_iboot_task_host + + </select> +</mapper> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/template/device_upload_template_en_US.xlsx b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/template/device_upload_template_en_US.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..2f950027623dfad54e21e51f205ec4631857ad2e Binary files /dev/null and b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/template/device_upload_template_en_US.xlsx differ diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/template/device_upload_template_zh_CN.xlsx b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/template/device_upload_template_zh_CN.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..5e856b53332b483f0b0f51d18deb140d096616c2 Binary files /dev/null and b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/cosmos-biz-iboot-base-core/src/main/resources/template/device_upload_template_zh_CN.xlsx differ diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/pom.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..d170e1b363a5cf47589eb5a6dd41eeccc29da7b2 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/cosmos-biz-iboot-base/pom.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>cosmos-biz-iboot</artifactId> + <groupId>com.inspur.cosmos.biz.iboot</groupId> + <version>${revision}</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cosmos-biz-iboot-base</artifactId> + <modules> + <module>cosmos-biz-iboot-base-api</module> + <module>cosmos-biz-iboot-base-core</module> + <module>cosmos-biz-iboot-base-application</module> + </modules> + <groupId>com.inspur.cosmos.biz.iboot.base</groupId> + <name>Cosmos Biz Iboot Base</name> + <packaging>pom</packaging> + + <dependencies> + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </dependency> + <dependency> + <groupId>com.inspur.cdc.starters</groupId> + <artifactId>cdc-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>com.trilead</groupId> + <artifactId>trilead-ssh2</artifactId> + </dependency> + <dependency> + <groupId>com.inspur.cosmos.biz</groupId> + <artifactId>cosmos-biz-commons</artifactId> + </dependency> + <!--> + 将mybatis放到整个工程的位置,因为页面会返回page信息,page需要在api包中使用 + <!--> + <dependency> + <groupId>com.inspur.cdc.combo</groupId> + <artifactId>cdc-combo-mybatis</artifactId> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi</artifactId> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/pom.xml b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..7a8a6eadf6564d4c21249d7b00d0cb0533c76464 --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/cosmos-biz-iboot/pom.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>cosmos-biz</artifactId> + <groupId>com.inspur.cosmos.biz</groupId> + <version>${revision}</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cosmos-biz-iboot</artifactId> + <modules> + <module>cosmos-biz-iboot-base</module> + </modules> + <groupId>com.inspur.cosmos.biz.iboot</groupId> + <name>Cosmos Biz Iboot</name> + <packaging>pom</packaging> + + <dependencies> + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </dependency> + <dependency> + <groupId>com.inspur.cdc.starters</groupId> + <artifactId>cdc-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>com.trilead</groupId> + <artifactId>trilead-ssh2</artifactId> + </dependency> + <dependency> + <groupId>com.inspur.cosmos.biz</groupId> + <artifactId>cosmos-biz-commons</artifactId> + </dependency> + <!--> + 将mybatis放到整个工程的位置,因为页面会返回page信息,page需要在api包中使用 + <!--> + <dependency> + <groupId>com.inspur.cdc.combo</groupId> + <artifactId>cdc-combo-mybatis</artifactId> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi</artifactId> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-biz/pom.xml b/InManageBoot-iboot/cosmos-biz/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b21b534222308260de333d0cac51505df004992b --- /dev/null +++ b/InManageBoot-iboot/cosmos-biz/pom.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>com.inspur.cosmos</groupId> + <artifactId>cosmos-parent</artifactId> + <version>${revision}</version> + <relativePath>../cosmos-parent</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cosmos-biz</artifactId> + <modules> + <module>cosmos-biz-iboot</module> + </modules> + <groupId>com.inspur.cosmos.biz</groupId> + <name>Cosmos Biz</name> + <packaging>pom</packaging> +</project> \ No newline at end of file diff --git a/InManageBoot-iboot/cosmos-dependencies/pom.xml b/InManageBoot-iboot/cosmos-dependencies/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..14f96b5b913c43fb33d46c97bb1f03de9779b34f --- /dev/null +++ b/InManageBoot-iboot/cosmos-dependencies/pom.xml @@ -0,0 +1,385 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>cosmos</artifactId> + <groupId>com.inspur.cosmos</groupId> + <version>${revision}</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cosmos-dependencies</artifactId> + <name>Cosmos Dependencies</name> + <packaging>pom</packaging> + <properties> + <cdc.version>1.5.0-SNAPSHOT</cdc.version> + <sofa.version>4.0.0</sofa.version> + <ipaddress.version>5.2.1</ipaddress.version> + <poi.version>3.15</poi.version> + <log4j.version>2.19.0</log4j.version> + <utool.version>1.0</utool.version> + <adapter.sdk.version>V6.2.5-SNAPSHOT</adapter.sdk.version> + <adapter.plugin.version>V6.2.4-SNAPSHOT</adapter.plugin.version> + <net.sf.json-lib.version>2.4</net.sf.json-lib.version> + <commons-beanutils.version>1.9.4</commons-beanutils.version> + <org.syslog.version>0.9.30</org.syslog.version> + <hutool.version>5.8.22</hutool.version> + <spring-ldap.version>3.1.0</spring-ldap.version> + <adapter2.version>1.0-SNAPSHOT</adapter2.version> + <adapter2-boot-starter.version>1.1.0-SNAPSHOT</adapter2-boot-starter.version> + <commons-compress.version>1.21</commons-compress.version> + <commmons-collections4.version>4.1</commmons-collections4.version> + <gson.version>2.8.9</gson.version> + <httpclient.version>5.2.1</httpclient.version> + <elasticsearch.version>8.7.1</elasticsearch.version> + <logback.version>1.4.8</logback.version> + <jakarta.xml.bind.version>4.0.0</jakarta.xml.bind.version> + + <activiti.version>7.1.0.M6</activiti.version> + <jaxb.version>4.0.3</jaxb.version> + <itextpdf.version>5.5.13.2</itextpdf.version> + <vmware.version>1.0.0</vmware.version> + <vmware.vim25.version>6.5.0</vmware.vim25.version> + <vmware.vsphere.sdk.version>6.7.0</vmware.vsphere.sdk.version> + <aopalliance.version>1.0</aopalliance.version> + <commons-logging.version>1.1.1</commons-logging.version> + <jna.version>4.4.0</jna.version> + <dom4j.version>2.1.3</dom4j.version> + <ant.version>1.10.12</ant.version> + <isowriter>2.1.0</isowriter> + <loop-fs-iso-impl>2.0.1</loop-fs-iso-impl> + <diagnose.cbb.version>1.0.0-SNAPSHOT</diagnose.cbb.version> + </properties> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>com.inspur.cdc</groupId> + <artifactId>cdc-boot-dependencies</artifactId> + <version>${cdc.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>${log4j.version}</version> + </dependency> + <dependency> + <groupId>com.alipay.sofa</groupId> + <artifactId>sofaboot-dependencies</artifactId> + <version>${sofa.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> + <groupId>org.springframework.ldap</groupId> + <artifactId>spring-ldap-core</artifactId> + <version>${spring-ldap.version}</version> + </dependency> + <dependency> + <groupId>cn.hutool</groupId> + <artifactId>hutool-all</artifactId> + <version>${hutool.version}</version> + </dependency> + + <dependency> + <groupId>com.inspur.cosmos.biz.iboot.base</groupId> + <artifactId>cosmos-biz-iboot-base-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.inspur.cosmos.biz.iboot.base</groupId> + <artifactId>cosmos-biz-iboot-base-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.inspur.cosmos.biz.iboot</groupId> + <artifactId>cosmos-biz-iboot-base</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.inspur.cosmos.biz.iboot.inmanage</groupId> + <artifactId>cosmos-biz-iboot-inmanage</artifactId> + <version>${project.version}</version> + </dependency> + + + <dependency> + <groupId>aopalliance</groupId> + <artifactId>aopalliance</artifactId> + <version>${aopalliance.version}</version> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>${commons-logging.version}</version> + </dependency> + <dependency> + <groupId>net.java.dev.jna</groupId> + <artifactId>jna</artifactId> + <version>${jna.version}</version> + </dependency> + + + <dependency> + <groupId>org.dom4j</groupId> + <artifactId>dom4j</artifactId> + <version>${dom4j.version}</version> + </dependency> + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + <version>${ant.version}</version> + </dependency> + <dependency> + <groupId>com.inspur.cosmos.biz</groupId> + <artifactId>cosmos-biz-commons</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.github.seancfoley</groupId> + <artifactId>ipaddress</artifactId> + <version>${ipaddress.version}</version> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi</artifactId> + <version>${poi.version}</version> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + <version>${poi.version}</version> + </dependency> + <dependency> + <groupId>net.sf.json-lib</groupId> + <artifactId>json-lib</artifactId> + <version>${net.sf.json-lib.version}</version> + </dependency> + <dependency> + <groupId>org.syslog4j</groupId> + <artifactId>syslog4j</artifactId> + <version>${org.syslog.version}</version> + </dependency> + <dependency> + <groupId>commons-beanutils</groupId> + <artifactId>commons-beanutils</artifactId> + <version>${commons-beanutils.version}</version> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcprov-jdk15on</artifactId> + <version>1.69</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcpkix-jdk15on</artifactId> + <version>1.69</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>com.jcraft</groupId> + <artifactId>jzlib</artifactId> + <version>1.1.3</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>net.i2p.crypto</groupId> + <artifactId>eddsa</artifactId> + <version>0.3.0</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>com.itextpdf.tool</groupId> + <artifactId>xmlworker</artifactId> + <version>${itextpdf.version}</version> + </dependency> + <dependency> + <groupId>com.thoughtworks.xstream</groupId> + <artifactId>xstream</artifactId> + <version>1.4.20</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents.client5</groupId> + <artifactId>httpclient5</artifactId> + <version>${httpclient.version}</version> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>2.0.1</version> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-client</artifactId> + <version>3.6.3.Final</version> + </dependency> + <dependency> + <groupId>org.jboss.resteasy</groupId> + <artifactId>resteasy-multipart-provider</artifactId> + <version>3.6.3.Final</version> + </dependency> + <dependency> + <groupId>com.thoughtworks.xstream</groupId> + <artifactId>xstream</artifactId> + <version>1.4.20</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>${logback.version}</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>${logback.version}</version> + </dependency> + <dependency> + <groupId>com.itextpdf</groupId> + <artifactId>itextpdf</artifactId> + <version>${itextpdf.version}</version> + </dependency> + <dependency> + <groupId>commons-net</groupId> + <artifactId>commons-net</artifactId> + <version>3.9.0</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>${commons-compress.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-collections4</artifactId> + <version>${commmons-collections4.version}</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>${gson.version}</version> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <version>${jakarta.xml.bind.version}</version> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <version>4.0.0</version> + </dependency> + + + <dependency> + <groupId>org.activiti</groupId> + <artifactId>activiti-bpmn-model</artifactId> + <version>${activiti.version}</version> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-core</artifactId> + <version>${jaxb.version}</version> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>${jaxb.version}</version> + </dependency> + <dependency> + <groupId>com.github.stephenc.java-iso-tools</groupId> + <artifactId>iso9660-writer</artifactId> + <version>${isowriter}</version> + </dependency> + <dependency> + <groupId>com.github.stephenc.java-iso-tools</groupId> + <artifactId>loop-fs-iso-impl</artifactId> + <version>${loop-fs-iso-impl}</version> + </dependency> + </dependencies> + </dependencyManagement> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>flatten-maven-plugin</artifactId> + <version>1.1.0</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <!-- <compilerArgs>-parameters</compilerArgs>--> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <version>3.0.0</version> + </plugin> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <inherited>true</inherited> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.codehaus.mojo</groupId> + <artifactId>flatten-maven-plugin</artifactId> + <versionRange>[1.0.0,)</versionRange> + <goals> + <goal>flatten</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore/> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>flatten-maven-plugin</artifactId> + <inherited>false</inherited> + <configuration> + <updatePomFile>true</updatePomFile> + <outputDirectory>${project.build.directory}/effective-pom</outputDirectory> + <flattenMode>bom</flattenMode> + <pomElements> + <pluginManagement>keep</pluginManagement> + <properties>keep</properties> + <repositories>remove</repositories> + </pomElements> + </configuration> + <executions> + <execution> + <id>flatten</id> + <phase>process-resources</phase> + <goals> + <goal>flatten</goal> + </goals> + </execution> + <execution> + <id>flatten.clean</id> + <phase>clean</phase> + <goals> + <goal>clean</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/InManageBoot-iboot/cosmos-parent/pom.xml b/InManageBoot-iboot/cosmos-parent/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..4f4bca8c9590264364c2682ff40d7f823aaf07d8 --- /dev/null +++ b/InManageBoot-iboot/cosmos-parent/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>cosmos-dependencies</artifactId> + <groupId>com.inspur.cosmos</groupId> + <version>${revision}</version> + <relativePath>../cosmos-dependencies</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cosmos-parent</artifactId> + <name>Cosmos Parent</name> + <packaging>pom</packaging> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <maven.compiler.encoding>UTF-8</maven.compiler.encoding> + <java.version>17</java.version> + </properties> + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <encoding>${maven.compiler.encoding}</encoding> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>flatten-maven-plugin</artifactId> + <inherited>true</inherited> + <executions> + <execution> + <id>flatten</id> + <phase>process-resources</phase> + <goals> + <goal>flatten</goal> + </goals> + <configuration> + <updatePomFile>true</updatePomFile> + <outputDirectory>${project.build.directory}/effective-pom</outputDirectory> + <flattenMode>oss</flattenMode> + <pomElements> + <dependencyManagement>remove</dependencyManagement> + <distributionManagement>remove</distributionManagement> + <repositories>remove</repositories> + </pomElements> + </configuration> + </execution> + <execution> + <id>flatten.clean</id> + <phase>clean</phase> + <goals> + <goal>clean</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/InManageBoot-iboot/pom.xml b/InManageBoot-iboot/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..8550ae51d35032f9d5b403bd9b8534a0c40b766b --- /dev/null +++ b/InManageBoot-iboot/pom.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.inspur.cosmos</groupId> + <artifactId>cosmos</artifactId> + <name>Cosmos</name> + <modules> + <module>cosmos-dependencies</module> + <module>cosmos-parent</module> + <module>cosmos-biz</module> + </modules> + <packaging>pom</packaging> + <version>${revision}</version> + <properties> + <revision>1.3.0-SNAPSHOT</revision> + <main.basedir>${basedir}</main.basedir> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + <distributionManagement> + <repository> + <id>releases</id> + <url>http://100.18.33.154:8081/repository/releases/</url> + </repository> + <snapshotRepository> + <id>snapshots</id> + <url>http://100.18.33.154:8081/repository/snapshots/</url> + </snapshotRepository> + </distributionManagement> +</project> \ No newline at end of file diff --git a/InManageBoot-iboot/tag.sh b/InManageBoot-iboot/tag.sh new file mode 100644 index 0000000000000000000000000000000000000000..3f414b4b802abfbc7d1c381ac9442c76a9214ae0 --- /dev/null +++ b/InManageBoot-iboot/tag.sh @@ -0,0 +1,35 @@ + +#1. 修改快照版本,snapshot -> release +#2. 打 release tag +#4. + +#1. 修改快照版本,snapshot -> release +#2. 打 tag +# 打tag并 +OLD_VERSION='1.0.0' +NEW_VERSION='1.0.1-SNAPSHOT' +sed -i "s/<revision>$OLD_VERSION<\/revision>/<revision>$NEW_VERSION<\/revision>/g" pom.xml +git add . +git commit -m "$NEW_VERSION" + +echo "tag? yes or no" +read shouldTag +if [ $shouldTag =="yes" ]; then + git tag $NEW_VERSION + echo "tag success" +else + echo "no tag" +fi + + +# push tag and commit +echo "push ? yes or no" +read shouldPush +if [ $shouldPush =="yes" ]; then + git push --tags origin + git push + echo "push success" +else + echo "not push" + exit -1 +fi diff --git a/InManageBoot-installer/controlfile/result/webservice/MAC.ini b/InManageBoot-installer/controlfile/result/webservice/MAC.ini new file mode 100644 index 0000000000000000000000000000000000000000..c7fd28cb715dcfc8197f3adf61f2f86a6a6aea82 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/MAC.ini @@ -0,0 +1,33 @@ +#!ipxe +set filepath http://192.168.1.2:16000/ +set bootfilepath ${filepath}/livecd +goto ${netX/mac} || goto IBOOTCLIENT + +:IBOOTCLIENT + iseq ${platform} efi && goto is_efi || goto not_efi +:is_efi + set base http://192.168.1.2:16000/livecd + initrd ${base}/initrd.img + chain ${base}/vmlinuz initrd=initrd.img root=live:${base}/squashfs.img + +:not_efi + set base http://192.168.1.2:16000/livecd + kernel ${base}/vmlinuz root=live:${base}/squashfs.img + initrd ${base}/initrd.img + boot + + + + + + + + + + + + + + + + diff --git a/InManageBoot-installer/controlfile/result/webservice/dhcpip b/InManageBoot-installer/controlfile/result/webservice/dhcpip new file mode 100644 index 0000000000000000000000000000000000000000..2e6b2fe4ac125fce5e57f7346537cf7107aab715 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/dhcpip @@ -0,0 +1 @@ +192.168.1.2 \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/livecd/readme.txt b/InManageBoot-installer/controlfile/result/webservice/livecd/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..92383d685e813a94560070afbf5682c34b3bf9d3 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/livecd/readme.txt @@ -0,0 +1,2 @@ +存放Iboot内存OS +此处在安装时,通过livecd解压出三个文件 \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/menu.ipxe b/InManageBoot-installer/controlfile/result/webservice/menu.ipxe new file mode 100644 index 0000000000000000000000000000000000000000..a73916e5c856b9228d259f8bc567d0155f3aebbe --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/menu.ipxe @@ -0,0 +1,28 @@ +#!ipxe + set menu-default IBOOTCLIENT + isset ${ip} || dhcp +route + + +:start + menu IBOOT CLIENT Menu + item --gap -- -------------------------------- BOOT -------------------------------- + item IBOOTCLIENT IBOOT CLIENT LIVECD + item --gap -- ---------------------------- Advanced options ------------------------ + item --key r reboot reboot computer -- r + item --key x exit Exit iPXE and continue BIOS boot -- x + choose --timeout 3000 --default ${menu-default} selected + goto ${selected} + +:reboot + reboot + +:exit + exit + +:IBOOTCLIENT + chain http://192.168.1.2:16000/MAC.ini + + + + diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond0.sh b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond0.sh new file mode 100644 index 0000000000000000000000000000000000000000..b5ca30c47ae768991212facde2d485bc812c714a --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond0.sh @@ -0,0 +1,5 @@ +nmcli con add type bond con-name $name ifname bond0 mode balance-rr +# nmcli con del eth0 +# nmcli con add type bond-slave ifname eth0 master $name +nmcli con modify $name ipv4.address $ip4 ipv4.gateway $gw4 ipv4.method manual +nmcli con up $name \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond1.sh b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond1.sh new file mode 100644 index 0000000000000000000000000000000000000000..ee01b67b98dc14e538bc538243401daef881d8cb --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond1.sh @@ -0,0 +1,5 @@ +nmcli con add type bond con-name $name ifname bond1 mode active-backup +# nmcli con del eth0 +# nmcli con add type bond-slave ifname eth0 master $name +nmcli con modify $name ipv4.address $ip4 ipv4.gateway $gw4 ipv4.method manual +nmcli con up $name \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond2.sh b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond2.sh new file mode 100644 index 0000000000000000000000000000000000000000..7641a73a491229fe1f572376ea7085241e521b42 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond2.sh @@ -0,0 +1,5 @@ +nmcli con add type bond con-name $name ifname bond2 mode balance-xor +# nmcli con del eth0 +# nmcli con add type bond-slave ifname eth0 master $name +nmcli con modify $name ipv4.address $ip4 ipv4.gateway $gw4 ipv4.method manual +nmcli con up $name \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond3.sh b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond3.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f015a5a60878bcb9d8e993bc001b6922c09bac5 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond3.sh @@ -0,0 +1,5 @@ +nmcli con add type bond con-name $name ifname bond3 mode broadcast +# nmcli con del eth0 +# nmcli con add type bond-slave ifname eth0 master $name +nmcli con modify $name ipv4.address $ip4 ipv4.gateway $gw4 ipv4.method manual +nmcli con up $name \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond4.sh b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond4.sh new file mode 100644 index 0000000000000000000000000000000000000000..a03ae448f86ea2618fe389afef1755372ff3f200 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond4.sh @@ -0,0 +1,5 @@ +nmcli con add type bond con-name $name ifname bond4 mode 802.3ad +# nmcli con del eth0 +# nmcli con add type bond-slave ifname eth0 master $name +nmcli con modify $name ipv4.address $ip4 ipv4.gateway $gw4 ipv4.method manual +nmcli con up $name \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond5.sh b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond5.sh new file mode 100644 index 0000000000000000000000000000000000000000..5b0f57663d24ee5d87cc4c64b61c5d203bf70ee3 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond5.sh @@ -0,0 +1,5 @@ +nmcli con add type bond con-name $name ifname bond5 mode balance-tlb +# nmcli con del eth0 +# nmcli con add type bond-slave ifname eth0 master $name +nmcli con modify $name ipv4.address $ip4 ipv4.gateway $gw4 ipv4.method manual +nmcli con up $name \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond6.sh b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond6.sh new file mode 100644 index 0000000000000000000000000000000000000000..b5c862cb22940e70f3664743a24fd3bb159d1bd0 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/bond/pim_bond6.sh @@ -0,0 +1,5 @@ +nmcli con add type bond con-name $name ifname bond6 mode balance-alb +# nmcli con del eth0 +# nmcli con add type bond-slave ifname eth0 master $name +nmcli con modify $name ipv4.address $ip4 ipv4.gateway $gw4 ipv4.method manual +nmcli con up $name \ No newline at end of file diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/esxi/esxiks.cfg b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/esxi/esxiks.cfg new file mode 100644 index 0000000000000000000000000000000000000000..5385ed9b5cf5817253c9753e2f622d4b6871739a --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/esxi/esxiks.cfg @@ -0,0 +1,44 @@ +# +# Sample scripted installation file +# + +# Accept the VMware End User License Agreement +vmaccepteula + +# Set the root password for the DCUI and Tech Support Mode +rootpw 123456a? + +# The install media is in the remote image + +# 此示例为自动分区规范,适用于ESXI等操作系统 +# This is a example of disk auto partition for ESXI + +#clearpartition +#clearpart --firstdisk=local --overwritevmfs +#install --firstdisk=local --overwritevmfs + +diskPartition + +# Set the network to DHCP on the first network adapter +network --bootproto=dhcp + +reboot + + +%pre --interpreter=python +@pre + +%firstboot --interpreter=busybox +@post1 + +%firstboot --interpreter=python +@post2 + + + + + + + + + diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/esxi/esxiks_example.cfg b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/esxi/esxiks_example.cfg new file mode 100644 index 0000000000000000000000000000000000000000..b0eed55f9f4eabf80173328e6ae8ef8e3944d1bb --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/esxi/esxiks_example.cfg @@ -0,0 +1,26 @@ +# +# Sample scripted installation file +# 此示例为默认自动引导配置,适用于ESXI操作系统 +# + +# Accept the VMware End User License Agreement +# 跳过自定义设置 +vmaccepteula + +# Set the root password for the DCUI and Tech Support Mode +# root用户密码设置 +rootpw 123456a? + +# The install media is in the CD-ROM drive +# 分区设置 +#clearpart --firstdisk=local --overwritevmfs +#install --firstdisk=local --overwritevmfs + +# Set the network to DHCP on the first network adapter +# 网络设置 +network --bootproto=dhcp + +reboot + + + diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/ks.cfg b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/ks.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4cc9e97eb19782020adc103f81af90b834299afc --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/ks.cfg @@ -0,0 +1,74 @@ + +%pre +#!/bin/bash +curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'os#install#start'","jobHostId":"'@jobHostId'"}' +@hostname +%end + +# System authorization information +auth --enableshadow --passalgo=sha512 + +# Use remote installation media +url --url=@path + +# Use graphical install +graphical + +# Run the Setup Agent on first boot +firstboot --disable + +# System language +lang zh_CN + +# keyboard us +keyboard --vckeymap=us --xlayouts='us' + +# Network information eth0 +%include /tmp/net-include +#network --bootproto=static --device=eth0 --gateway=100.7.47.254 --ip=100.7.37.57 --netmask=255.255.240.0 --activate +#network --bootproto=static --device=eth1 --ip=192.168.100.2 --netmask=255.255.255.0 --nameserver= --activate +#network --hostname=ispimos +#network --bootproto static + +eula --agreed + +# Root password +rootpw 123456a? + +# System timezone +timezone Asia/Shanghai --isUtc --nontp + + +# System bootloader configuration +bootloader --location=mbr + +diskPartition +#clearpart --all --initlabel +#part swap --fstype=swap --size=16384 +#part /boot --fstype=ext4 --size=500 +#part /boot/efi --fstype=efi --size=256 +#part / --fstype=ext4 --size=1 --grow + +reboot --eject +#eula --agreed +#shutdown + +%packages +@^baseE +@core +@base +firewalld +%end + +%post --log=/root/ks-post.log +cat >> /etc/rc.local <<'EOF' +@bond +>/etc/rc.local +EOF +chmod +x /etc/rc.local +curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'os#install#success'","jobHostId":"'@jobHostId'"}' +curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskStatusChange' --header 'Content-Type:application/json' --data '{"jobHostStatus":"'SUCCESS'","id":"'@jobHostId'"}' +%end + +%addon com_redhat_kdump --enable --reserve-mb='auto' +%end diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/ks_example.cfg b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/ks_example.cfg new file mode 100644 index 0000000000000000000000000000000000000000..8ab6f48cf1b024fecc9685d0c5dc81660c963961 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/ks_example.cfg @@ -0,0 +1,89 @@ +#此示例为默认自动引导配置,适用于CentOS/RHEL/Kylin等操作系统 + +#前置脚本 +%pre +#please add pre script at here +#请把前置脚本添加在这个地方 +%end + +#此示例为默认自动引导配置,适用于CentOS/RHEL/Kylin等操作系统 + +# 系统认证设置 +# System authorization information +auth --enableshadow --passalgo=sha512 + +#使用远程安装 +# Use remote installation media +url --url=@path + +#安装过程是否图形化 +# Use graphical install +graphical + +#第一次启动是否使用引导 +# Run the Setup Agent on first boot +firstboot --disable + +#系统语言设置 +# System language +lang zh_CN + +#键盘布局设置 +# keyboard us +keyboard --vckeymap=us --xlayouts='us' + +#网络设置 +# Network information eth0 +#network --bootproto=static --device=eth0 --gateway=100.7.47.254 --ip=100.7.37.57 --netmask=255.255.240.0 --activate +#network --bootproto=static --device=eth1 --ip=192.168.100.2 --netmask=255.255.255.0 --nameserver= --activate +#network --hostname=ispimos +#network --bootproto static + +#是否默认勾选许可协议 +eula --agreed + + +#root 密码设置 +# Root password +rootpw 123456a? + +#时区设置 +# System timezone +timezone Asia/Shanghai --isUtc --nontp + + +#分区引导设置 +# System bootloader configuration +bootloader --location=mbr + +#分区设置 +#clearpart --all --initlabel +#part swap --fstype=swap --size=16384 +#part /boot --fstype=ext4 --size=500 +#part /boot/efi --fstype=efi --size=256 +#part / --fstype=ext4 --size=1 --grow + +#重启设置 +reboot --eject +#eula --agreed +#shutdown + +#安装环境和工具设置 +%packages +@^baseE +@core +@base +firewalld +%end + +#此示例为默认自动引导配置,适用于CentOS/RHEL/Kylin等操作系统 + +#后置脚本设置 +%post --log=/root/ks-post.log +#please add post script at here +#请把后置脚本添加在这个地方 +%end + +#是否启用kdump +%addon com_redhat_kdump --enable --reserve-mb='auto' +%end diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/kylin/kylin_example.cfg b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/kylin/kylin_example.cfg new file mode 100644 index 0000000000000000000000000000000000000000..20dfb61e2e7cfbb1f065df21d99afc34fb00116c --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/kylin/kylin_example.cfg @@ -0,0 +1,89 @@ +#此示例为默认自动引导配置,适用于CentOS/RHEL/Kylin等操作系统 + +#前置脚本 +%pre +#please add pre script at here +#请把前置脚本添加在这个地方 +%end + +#此示例为默认自动引导配置,适用于CentOS/RHEL/Kylin等操作系统 + +# 系统认证设置 +# System authorization information +auth --enableshadow --passalgo=sha512 + +#使用远程安装 +# Use remote installation media +url --url=@path + +#安装过程是否图形化 +# Use graphical install +graphical + +#第一次启动是否使用引导 +# Run the Setup Agent on first boot +firstboot --disable + +#系统语言设置 +# System language +lang zh_CN + +#键盘布局设置 +# keyboard us +keyboard --vckeymap=us --xlayouts='us' + +#网络设置 +# Network information eth0 +#network --bootproto=static --device=eth0 --gateway=100.7.47.254 --ip=100.7.37.57 --netmask=255.255.240.0 --activate +#network --bootproto=static --device=eth1 --ip=192.168.100.2 --netmask=255.255.255.0 --nameserver= --activate +#network --hostname=ispimos +#network --bootproto static + +#是否默认勾选许可协议 +eula --agreed + + +#root 密码设置 +# Root password +rootpw 123456a? + +#时区设置 +# System timezone +timezone Asia/Shanghai --isUtc --nontp + + +#分区引导设置 +# System bootloader configuration +bootloader --location=mbr + +#分区设置 +#clearpart --all --initlabel +#part swap --fstype=swap --size=16384 +#part /boot --fstype=ext4 --size=500 +#part /boot/efi --fstype=efi --size=256 +#part / --fstype=ext4 --size=1 --grow + +#重启设置 +reboot --eject +#eula --agreed +#shutdown + +#安装环境和工具设置 +%packages +@^baseE +@core +@base +firewalld +%end + +#此示例为默认自动引导配置,适用于CentOS/RHEL/Kylin等操作系统 + +#后置脚本设置 +%post --log=/root/ks-post.log +#please add post script at here +#请把后置脚本添加在这个地方 +%end + +#是否启用kdump +%addon com_redhat_kdump --enable +%end diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/kylin/kylinks.cfg b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/kylin/kylinks.cfg new file mode 100644 index 0000000000000000000000000000000000000000..5e5e162505b71d42b7d5d308324a07989443503a --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/kylin/kylinks.cfg @@ -0,0 +1,73 @@ + +%pre +#!/bin/bash +curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'os#install#start'","jobHostId":"'@jobHostId'"}' +@hostname +%end + +# System authorization information +auth --enableshadow --passalgo=sha512 + +# Use remote installation media +url --url=@path + +# Use graphical install +graphical + +# Run the Setup Agent on first boot +firstboot --disable + +# System language +lang zh_CN + +# keyboard us +keyboard --vckeymap=us --xlayouts='us' + +# Network information eth0 +%include /tmp/net-include +#network --bootproto=static --device=eth0 --gateway=100.7.47.254 --ip=100.7.37.57 --netmask=255.255.240.0 --activate +#network --bootproto=static --device=eth1 --ip=192.168.100.2 --netmask=255.255.255.0 --nameserver= --activate +#network --hostname=ispimos +#network --bootproto static + +eula --agreed + +# Root password +rootpw 123456a? + +# System timezone +timezone Asia/Shanghai --isUtc --nontp + + +# System bootloader configuration +bootloader --location=mbr + +diskPartition +#clearpart --all --initlabel +#part swap --fstype=swap --size=16384 +#part /boot --fstype=ext4 --size=500 +#part /boot/efi --fstype=efi --size=256 +#part / --fstype=ext4 --size=1 --grow + +reboot --eject +#eula --agreed +#shutdown + +%packages +@^baseE +@core +@base +firewalld +%end + +%post --log=/root/ks-post.log +cat >> /etc/rc.local <<'EOF' +>/etc/rc.local +EOF +chmod +x /etc/rc.local +curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'os#install#success'","jobHostId":"'@jobHostId'"}' +curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskStatusChange' --header 'Content-Type:application/json' --data '{"jobHostStatus":"'SUCCESS'","id":"'@jobHostId'"}' +%end + +%addon com_redhat_kdump --enable +%end diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse/autoinst.xml b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse/autoinst.xml new file mode 100644 index 0000000000000000000000000000000000000000..4ea72145d05a596f302d9d60e3e7e5571641947d --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse/autoinst.xml @@ -0,0 +1,1288 @@ +<?xml version="1.0"?> +<!DOCTYPE profile> +<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> + <add-on> + <add_on_products config:type="list"/> + </add-on> + <bootloader> + <global> + <default>SUSE Linux Enterprise Server</default> + <lines_cache_id>2</lines_cache_id> + <prompt>true</prompt> + <secure-boot>off</secure-boot> + <timeout config:type="integer">80</timeout> + </global> + <initrd_modules config:type="list"> + <initrd_module> + <module>ahci</module> + </initrd_module> + <initrd_module> + <module>mptspi</module> + </initrd_module> + <initrd_module> + <module>ata_piix</module> + </initrd_module> + <initrd_module> + <module>ata_generic</module> + </initrd_module> + </initrd_modules> + <loader_type>default</loader_type> + </bootloader> + <ca_mgm> + <CAName>YaST_Default_CA</CAName> + <ca_commonName>YaST Default CA (linux-siic)</ca_commonName> + <country>CN</country> + <locality></locality> + <organisation></organisation> + <organisationUnit></organisationUnit> + <password>ENTER PASSWORD HERE</password> + <server_commonName>linux-siic.suse</server_commonName> + <server_email>postmaster@suse</server_email> + <state></state> + <takeLocalServerName config:type="boolean">false</takeLocalServerName> + </ca_mgm> + <deploy_image> + <image_installation config:type="boolean">false</image_installation> + </deploy_image> + <firewall> + <FW_ALLOW_FW_BROADCAST_DMZ>no</FW_ALLOW_FW_BROADCAST_DMZ> + <FW_ALLOW_FW_BROADCAST_EXT>no</FW_ALLOW_FW_BROADCAST_EXT> + <FW_ALLOW_FW_BROADCAST_INT>no</FW_ALLOW_FW_BROADCAST_INT> + <FW_BOOT_FULL_INIT>no</FW_BOOT_FULL_INIT> + <FW_CONFIGURATIONS_DMZ/> + <FW_CONFIGURATIONS_EXT/> + <FW_CONFIGURATIONS_INT/> + <FW_DEV_DMZ/> + <FW_DEV_EXT/> + <FW_DEV_INT/> + <FW_FORWARD_ALWAYS_INOUT_DEV/> + <FW_FORWARD_MASQ/> + <FW_IGNORE_FW_BROADCAST_DMZ>no</FW_IGNORE_FW_BROADCAST_DMZ> + <FW_IGNORE_FW_BROADCAST_EXT>yes</FW_IGNORE_FW_BROADCAST_EXT> + <FW_IGNORE_FW_BROADCAST_INT>no</FW_IGNORE_FW_BROADCAST_INT> + <FW_IPSEC_TRUST>no</FW_IPSEC_TRUST> + <FW_LOAD_MODULES/> + <FW_LOG_ACCEPT_ALL>no</FW_LOG_ACCEPT_ALL> + <FW_LOG_ACCEPT_CRIT>yes</FW_LOG_ACCEPT_CRIT> + <FW_LOG_DROP_ALL>no</FW_LOG_DROP_ALL> + <FW_LOG_DROP_CRIT>yes</FW_LOG_DROP_CRIT> + <FW_MASQUERADE>no</FW_MASQUERADE> + <FW_PROTECT_FROM_INT>no</FW_PROTECT_FROM_INT> + <FW_ROUTE>no</FW_ROUTE> + <FW_SERVICES_ACCEPT_DMZ/> + <FW_SERVICES_ACCEPT_EXT/> + <FW_SERVICES_ACCEPT_INT/> + <FW_SERVICES_ACCEPT_RELATED_DMZ/> + <FW_SERVICES_ACCEPT_RELATED_EXT/> + <FW_SERVICES_ACCEPT_RELATED_INT/> + <FW_SERVICES_DMZ_IP/> + <FW_SERVICES_DMZ_RPC/> + <FW_SERVICES_DMZ_TCP/> + <FW_SERVICES_DMZ_UDP/> + <FW_SERVICES_EXT_IP/> + <FW_SERVICES_EXT_RPC/> + <FW_SERVICES_EXT_TCP/> + <FW_SERVICES_EXT_UDP/> + <FW_SERVICES_INT_IP/> + <FW_SERVICES_INT_RPC/> + <FW_SERVICES_INT_TCP/> + <FW_SERVICES_INT_UDP/> + <FW_STOP_KEEP_ROUTING_STATE>no</FW_STOP_KEEP_ROUTING_STATE> + <enable_firewall config:type="boolean">true</enable_firewall> + <start_firewall config:type="boolean">true</start_firewall> + </firewall> + <general> + <ask-list config:type="list"/> + <mode> + <confirm config:type="boolean">false</confirm> + </mode> + <proposals config:type="list"/> + <signature-handling> + <accept_file_without_checksum config:type="boolean">true</accept_file_without_checksum> + <accept_non_trusted_gpg_key config:type="boolean">true</accept_non_trusted_gpg_key> + <accept_unknown_gpg_key config:type="boolean">true</accept_unknown_gpg_key> + <accept_unsigned_file config:type="boolean">true</accept_unsigned_file> + <accept_verification_failed config:type="boolean">false</accept_verification_failed> + <import_gpg_key config:type="boolean">true</import_gpg_key> + </signature-handling> + <storage/> + </general> + <groups config:type="list"> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>100</gid> + <group_password>x</group_password> + <groupname>users</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>25</gid> + <group_password>x</group_password> + <groupname>at</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>62</gid> + <group_password>x</group_password> + <groupname>man</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>9</gid> + <group_password>x</group_password> + <groupname>kmem</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>489</gid> + <group_password>x</group_password> + <groupname>scard</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>482</gid> + <group_password>x</group_password> + <groupname>adm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>16</gid> + <group_password>x</group_password> + <groupname>dialout</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>5</gid> + <group_password>x</group_password> + <groupname>tty</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>20</gid> + <group_password>x</group_password> + <groupname>cdrom</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>496</gid> + <group_password>x</group_password> + <groupname>input</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>487</gid> + <group_password>x</group_password> + <groupname>brlapi</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>488</gid> + <group_password>x</group_password> + <groupname>rtkit</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>494</gid> + <group_password>x</group_password> + <groupname>nscd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>3</gid> + <group_password>x</group_password> + <groupname>sys</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>17</gid> + <group_password>x</group_password> + <groupname>audio</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>7</gid> + <group_password>x</group_password> + <groupname>lp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>59</gid> + <group_password>x</group_password> + <groupname>maildrop</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>10</gid> + <group_password>x</group_password> + <groupname>wheel</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>497</gid> + <group_password>x</group_password> + <groupname>tape</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>493</gid> + <group_password>x</group_password> + <groupname>systemd-journal</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>54</gid> + <group_password>x</group_password> + <groupname>lock</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>0</gid> + <group_password>x</group_password> + <groupname>root</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>492</gid> + <group_password>x</group_password> + <groupname>systemd-timesync</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>491</gid> + <group_password>x</group_password> + <groupname>kvm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>71</gid> + <group_password>x</group_password> + <groupname>ntadmin</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>15</gid> + <group_password>x</group_password> + <groupname>shadow</groupname> + <userlist>vnc</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>484</gid> + <group_password>x</group_password> + <groupname>vnc</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>499</gid> + <group_password>x</group_password> + <groupname>messagebus</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>41</gid> + <group_password>x</group_password> + <groupname>xok</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>486</gid> + <group_password>x</group_password> + <groupname>pulse</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65534</gid> + <group_password>x</group_password> + <groupname>nogroup</groupname> + <userlist>nobody</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>495</gid> + <group_password>x</group_password> + <groupname>polkitd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>483</gid> + <group_password>x</group_password> + <groupname>gdm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>490</gid> + <group_password>x</group_password> + <groupname>ntp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>21</gid> + <group_password>x</group_password> + <groupname>console</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>2</gid> + <group_password>x</group_password> + <groupname>daemon</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>33</gid> + <group_password>x</group_password> + <groupname>video</groupname> + <userlist>gdm</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>498</gid> + <group_password>x</group_password> + <groupname>sshd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>19</gid> + <group_password>x</group_password> + <groupname>floppy</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>8</gid> + <group_password>x</group_password> + <groupname>www</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>485</gid> + <group_password>x</group_password> + <groupname>pulse-access</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>32</gid> + <group_password>x</group_password> + <groupname>public</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65533</gid> + <group_password>x</group_password> + <groupname>nobody</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>14</gid> + <group_password>x</group_password> + <groupname>uucp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>43</gid> + <group_password>x</group_password> + <groupname>modem</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>40</gid> + <group_password>x</group_password> + <groupname>games</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>12</gid> + <group_password>x</group_password> + <groupname>mail</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>51</gid> + <group_password>x</group_password> + <groupname>postfix</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>13</gid> + <group_password>x</group_password> + <groupname>news</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>1</gid> + <group_password>x</group_password> + <groupname>bin</groupname> + <userlist>daemon</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>42</gid> + <group_password>x</group_password> + <groupname>trusted</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>22</gid> + <group_password>x</group_password> + <groupname>utmp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>6</gid> + <group_password>x</group_password> + <groupname>disk</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>49</gid> + <group_password>x</group_password> + <groupname>ftp</groupname> + <userlist/> + </group> + </groups> + <host> + <hosts config:type="list"> + <hosts_entry> + <host_address>127.0.0.1</host_address> + <names config:type="list"> + <name>localhost</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>::1</host_address> + <names config:type="list"> + <name>localhost ipv6-localhost ipv6-loopback</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>fe00::0</host_address> + <names config:type="list"> + <name>ipv6-localnet</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff00::0</host_address> + <names config:type="list"> + <name>ipv6-mcastprefix</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::1</host_address> + <names config:type="list"> + <name>ipv6-allnodes</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::2</host_address> + <names config:type="list"> + <name>ipv6-allrouters</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::3</host_address> + <names config:type="list"> + <name>ipv6-allhosts</name> + </names> + </hosts_entry> + </hosts> + </host> + <kdump> + <add_crash_kernel config:type="boolean">true</add_crash_kernel> + <crash_kernel config:type="list"> + <listentry>165M,high</listentry> + <listentry>72M,low</listentry> + </crash_kernel> + <crash_xen_kernel>237M\&lt;4G</crash_xen_kernel> + <general> + <KDUMPTOOL_FLAGS/> + <KDUMP_COMMANDLINE/> + <KDUMP_COMMANDLINE_APPEND/> + <KDUMP_CONTINUE_ON_ERROR>true</KDUMP_CONTINUE_ON_ERROR> + <KDUMP_COPY_KERNEL>yes</KDUMP_COPY_KERNEL> + <KDUMP_CPUS/> + <KDUMP_DUMPFORMAT>lzo</KDUMP_DUMPFORMAT> + <KDUMP_DUMPLEVEL>31</KDUMP_DUMPLEVEL> + <KDUMP_FREE_DISK_SIZE>64</KDUMP_FREE_DISK_SIZE> + <KDUMP_HOST_KEY/> + <KDUMP_IMMEDIATE_REBOOT>yes</KDUMP_IMMEDIATE_REBOOT> + <KDUMP_KEEP_OLD_DUMPS>5</KDUMP_KEEP_OLD_DUMPS> + <KDUMP_KERNELVER/> + <KDUMP_NETCONFIG>auto</KDUMP_NETCONFIG> + <KDUMP_NET_TIMEOUT>30</KDUMP_NET_TIMEOUT> + <KDUMP_NOTIFICATION_CC/> + <KDUMP_NOTIFICATION_TO/> + <KDUMP_POSTSCRIPT/> + <KDUMP_PRESCRIPT/> + <KDUMP_REQUIRED_PROGRAMS/> + <KDUMP_SAVEDIR>/var/crash</KDUMP_SAVEDIR> + <KDUMP_SMTP_PASSWORD/> + <KDUMP_SMTP_SERVER/> + <KDUMP_SMTP_USER/> + <KDUMP_TRANSFER/> + <KDUMP_VERBOSE>3</KDUMP_VERBOSE> + <KEXEC_OPTIONS/> + </general> + </kdump> + <keyboard> + <keymap>english-us</keymap> + </keyboard> + <language> + <language>en_US</language> + <languages/> + </language> + <login_settings/> + <networking> + <dhcp_options> + <dhclient_client_id/> + <dhclient_hostname_option>AUTO</dhclient_hostname_option> + </dhcp_options> + <dns> + <dhcp_hostname config:type="boolean">false</dhcp_hostname> + <domain>suse</domain> + <hostname>ispimos</hostname> + <resolv_conf_policy>auto</resolv_conf_policy> + <write_hostname config:type="boolean">false</write_hostname> + </dns> + <interfaces config:type="list"> + <interface> + <bootproto>static</bootproto> + <device>eth0</device> + <ipaddr>100.2.230.95</ipaddr> + <name>Ethernet Card 0</name> + <netmask>255.255.255.0</netmask> + <prefixlen>24</prefixlen> + <startmode>auto</startmode> + </interface> + <interface> + <bootproto>static</bootproto> + <device>lo</device> + <firewall>no</firewall> + <ipaddr>127.0.0.1</ipaddr> + <netmask>255.0.0.0</netmask> + <network>127.0.0.0</network> + <prefixlen>8</prefixlen> + <startmode>nfsroot</startmode> + <usercontrol>no</usercontrol> + </interface> + </interfaces> + <ipv6 config:type="boolean">true</ipv6> + <keep_install_network config:type="boolean">true</keep_install_network> + <managed config:type="boolean">false</managed> + <routing> + <ip_forward config:type="boolean">false</ip_forward> + </routing> + </networking> + <!--diskPartition--> + <report> + <errors> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">0</timeout> + </errors> + <messages> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">10</timeout> + </messages> + <warnings> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">10</timeout> + </warnings> + <yesno_messages> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">10</timeout> + </yesno_messages> + </report> + <software> + <image/> + <install_recommended config:type="boolean">true</install_recommended> + <instsource/> + <packages config:type="list"> + <package>desktop-translations</package> + <package>grub2-x86_64-efi</package> + <package>mokutil</package> + <package>shim</package> + <package>yast2-trans-en_US</package> + </packages> + <patterns config:type="list"> + <pattern>Minimal</pattern> + <pattern>base</pattern> + <pattern>laptop</pattern> + </patterns> + <remove-packages config:type="list"> + <package>Mesa</package> + <package>fonts-config</package> + <package>ft2demos</package> + <package>libasound2</package> + <package>libdrm</package> + <package>libmysqlclient_r15</package> + <package>libpciaccess0</package> + <package>libqt4</package> + <package>libqt4-qt3support</package> + <package>libqt4-sql</package> + <package>libqt4-sql-mysql</package> + <package>libqt4-sql-sqlite</package> + <package>libqt4-x11</package> + <package>pcmciautils</package> + <package>sendmail</package> + <package>xorg-x11-fonts</package> + <package>xorg-x11-fonts-core</package> + <package>xorg-x11-libXfixes</package> + <package>xorg-x11-libXmu</package> + <package>xorg-x11-libXp</package> + <package>xorg-x11-libXpm</package> + <package>xorg-x11-libXprintUtil</package> + <package>xorg-x11-libXrender</package> + <package>xorg-x11-libXv</package> + <package>xorg-x11-libfontenc</package> + <package>xorg-x11-libs</package> + <package>xorg-x11-libxkbfile</package> + <package>yast2-qt</package> + <package>yast2-qt-pkg</package> + </remove-packages> + </software> + <timezone> + <hwclock>UTC</hwclock> + <timezone>Asia/Shanghai</timezone> + </timezone> + <user_defaults> + <expire/> + <group>100</group> + <groups/> + <home>/home</home> + <inactive>-1</inactive> + <no_groups config:type="boolean">true</no_groups> + <shell>/bin/bash</shell> + <skel>/etc/skel</skel> + <umask>022</umask> + </user_defaults> + <users config:type="list"> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for rpcbind</fullname> + <gid>65534</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>495</uid> + <user_password>!</user_password> + <username>rpc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for D-Bus</fullname> + <gid>499</gid> + <home>/var/run/dbus</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>499</uid> + <user_password>!</user_password> + <username>messagebus</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>PulseAudio daemon</fullname> + <gid>486</gid> + <home>/var/lib/pulseaudio</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>487</uid> + <user_password>!</user_password> + <username>pulse</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for polkitd</fullname> + <gid>495</gid> + <home>/var/lib/polkit</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>497</uid> + <user_password>!</user_password> + <username>polkitd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>WWW daemon apache</fullname> + <gid>8</gid> + <home>/var/lib/wwwrun</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>30</uid> + <user_password>*</user_password> + <username>wwwrun</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>RealtimeKit</fullname> + <gid>488</gid> + <home>/proc</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>488</uid> + <user_password>!</user_password> + <username>rtkit</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Gnome Display Manager daemon</fullname> + <gid>483</gid> + <home>/var/lib/gdm</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>484</uid> + <user_password>!</user_password> + <username>gdm</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Daemon</fullname> + <gid>2</gid> + <home>/sbin</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>2</uid> + <user_password>*</user_password> + <username>daemon</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NTP daemon</fullname> + <gid>490</gid> + <home>/var/lib/ntp</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>74</uid> + <user_password>!</user_password> + <username>ntp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for nscd</fullname> + <gid>494</gid> + <home>/run/nscd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>496</uid> + <user_password>!</user_password> + <username>nscd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>SSH daemon</fullname> + <gid>498</gid> + <home>/var/lib/sshd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>498</uid> + <user_password>!</user_password> + <username>sshd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Printing daemon</fullname> + <gid>7</gid> + <home>/var/spool/lpd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>4</uid> + <user_password>*</user_password> + <username>lp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Batch jobs daemon</fullname> + <gid>25</gid> + <home>/var/spool/atjobs</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>25</uid> + <user_password>!</user_password> + <username>at</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Manual pages viewer</fullname> + <gid>62</gid> + <home>/var/cache/man</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>13</uid> + <user_password>*</user_password> + <username>man</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for VNC</fullname> + <gid>484</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>485</uid> + <user_password>!</user_password> + <username>vnc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NFS statd daemon</fullname> + <gid>65534</gid> + <home>/var/lib/nfs</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>490</uid> + <user_password>!</user_password> + <username>statd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Smart Card Reader</fullname> + <gid>489</gid> + <home>/var/run/pcscd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>489</uid> + <user_password>!</user_password> + <username>scard</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>News system</fullname> + <gid>13</gid> + <home>/etc/news</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>9</uid> + <user_password>*</user_password> + <username>news</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>openslp daemon</fullname> + <gid>2</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>494</uid> + <user_password>!</user_password> + <username>openslp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>bin</fullname> + <gid>1</gid> + <home>/bin</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>1</uid> + <user_password>*</user_password> + <username>bin</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Time Synchronization</fullname> + <gid>492</gid> + <home>/</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>492</uid> + <user_password>!!</user_password> + <username>systemd-timesync</username> + </user> + <user> + <encrypted config:type="boolean">false</encrypted> + <fullname>root</fullname> + <gid>0</gid> + <home>/root</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>0</uid> + <!--rootPsw--> + <username>root</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>FTP account</fullname> + <gid>49</gid> + <home>/srv/ftp</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>40</uid> + <user_password>*</user_password> + <username>ftp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for GeoClue D-Bus service</fullname> + <gid>65534</gid> + <home>/var/lib/srvGeoClue</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>486</uid> + <user_password>!</user_password> + <username>srvGeoClue</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>nobody</fullname> + <gid>65533</gid> + <home>/var/lib/nobody</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>65534</uid> + <user_password>*</user_password> + <username>nobody</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Unix-to-Unix CoPy system</fullname> + <gid>14</gid> + <home>/etc/uucp</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>10</uid> + <user_password>*</user_password> + <username>uucp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Secure FTP User</fullname> + <gid>65534</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>491</uid> + <user_password>!</user_password> + <username>ftpsecure</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Games account</fullname> + <gid>100</gid> + <home>/var/games</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>12</uid> + <user_password>*</user_password> + <username>games</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Mailer daemon</fullname> + <gid>12</gid> + <home>/var/spool/clientmqueue</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>8</uid> + <user_password>*</user_password> + <username>mail</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Postfix Daemon</fullname> + <gid>51</gid> + <home>/var/spool/postfix</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>51</uid> + <user_password>!</user_password> + <username>postfix</username> + </user> + </users> + <scripts> + <pre-scripts config:type="list"> + <script> + <filename>pre.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[ + curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'OSRUNNING'","jobHostId":"'@jobHostId'"}' + ]]> + </source> + </script> + </pre-scripts> + <post-scripts config:type="list"> + <script> + <network_needed config:type="boolean">true</network_needed> + <filename>post.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[ + curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'OSFINISH'","jobHostId":"'@jobHostId'"}' + curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskStatusChange' --header 'Content-Type:application/json' --data '{"jobHostStatus":"'SUCCESS'","id":"'@jobHostId'"}' + @post + ]]> + </source> + </script> + </post-scripts> + <init-scripts config:type="list"> + <script> + <filename>post.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[]]></source> + </script> + </init-scripts> + </scripts> +</profile> diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse/autoinst_example.xml b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse/autoinst_example.xml new file mode 100644 index 0000000000000000000000000000000000000000..ff9315e69f2b096ffe669ab36b095fe9ca19bc03 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse/autoinst_example.xml @@ -0,0 +1,1378 @@ +<?xml version="1.0"?> +<!DOCTYPE profile> +<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> + <add-on> + <add_on_products config:type="list"/> + </add-on> + <bootloader> + <global> + <default>SUSE Linux Enterprise Server</default> + <lines_cache_id>2</lines_cache_id> + <prompt>true</prompt> + <secure-boot>off</secure-boot> + <timeout config:type="integer">80</timeout> + </global> + <initrd_modules config:type="list"> + <initrd_module> + <module>ahci</module> + </initrd_module> + <initrd_module> + <module>mptspi</module> + </initrd_module> + <initrd_module> + <module>ata_piix</module> + </initrd_module> + <initrd_module> + <module>ata_generic</module> + </initrd_module> + </initrd_modules> + <loader_type>default</loader_type> + </bootloader> + <ca_mgm> + <CAName>YaST_Default_CA</CAName> + <ca_commonName>YaST Default CA (linux-siic)</ca_commonName> + <country>CN</country> + <locality></locality> + <organisation></organisation> + <organisationUnit></organisationUnit> + <password>ENTER PASSWORD HERE</password> + <server_commonName>linux-siic.suse</server_commonName> + <server_email>postmaster@suse</server_email> + <state></state> + <takeLocalServerName config:type="boolean">false</takeLocalServerName> + </ca_mgm> + <deploy_image> + <image_installation config:type="boolean">false</image_installation> + </deploy_image> + <firewall> + <FW_ALLOW_FW_BROADCAST_DMZ>no</FW_ALLOW_FW_BROADCAST_DMZ> + <FW_ALLOW_FW_BROADCAST_EXT>no</FW_ALLOW_FW_BROADCAST_EXT> + <FW_ALLOW_FW_BROADCAST_INT>no</FW_ALLOW_FW_BROADCAST_INT> + <FW_BOOT_FULL_INIT>no</FW_BOOT_FULL_INIT> + <FW_CONFIGURATIONS_DMZ/> + <FW_CONFIGURATIONS_EXT/> + <FW_CONFIGURATIONS_INT/> + <FW_DEV_DMZ/> + <FW_DEV_EXT/> + <FW_DEV_INT/> + <FW_FORWARD_ALWAYS_INOUT_DEV/> + <FW_FORWARD_MASQ/> + <FW_IGNORE_FW_BROADCAST_DMZ>no</FW_IGNORE_FW_BROADCAST_DMZ> + <FW_IGNORE_FW_BROADCAST_EXT>yes</FW_IGNORE_FW_BROADCAST_EXT> + <FW_IGNORE_FW_BROADCAST_INT>no</FW_IGNORE_FW_BROADCAST_INT> + <FW_IPSEC_TRUST>no</FW_IPSEC_TRUST> + <FW_LOAD_MODULES/> + <FW_LOG_ACCEPT_ALL>no</FW_LOG_ACCEPT_ALL> + <FW_LOG_ACCEPT_CRIT>yes</FW_LOG_ACCEPT_CRIT> + <FW_LOG_DROP_ALL>no</FW_LOG_DROP_ALL> + <FW_LOG_DROP_CRIT>yes</FW_LOG_DROP_CRIT> + <FW_MASQUERADE>no</FW_MASQUERADE> + <FW_PROTECT_FROM_INT>no</FW_PROTECT_FROM_INT> + <FW_ROUTE>no</FW_ROUTE> + <FW_SERVICES_ACCEPT_DMZ/> + <FW_SERVICES_ACCEPT_EXT/> + <FW_SERVICES_ACCEPT_INT/> + <FW_SERVICES_ACCEPT_RELATED_DMZ/> + <FW_SERVICES_ACCEPT_RELATED_EXT/> + <FW_SERVICES_ACCEPT_RELATED_INT/> + <FW_SERVICES_DMZ_IP/> + <FW_SERVICES_DMZ_RPC/> + <FW_SERVICES_DMZ_TCP/> + <FW_SERVICES_DMZ_UDP/> + <FW_SERVICES_EXT_IP/> + <FW_SERVICES_EXT_RPC/> + <FW_SERVICES_EXT_TCP/> + <FW_SERVICES_EXT_UDP/> + <FW_SERVICES_INT_IP/> + <FW_SERVICES_INT_RPC/> + <FW_SERVICES_INT_TCP/> + <FW_SERVICES_INT_UDP/> + <FW_STOP_KEEP_ROUTING_STATE>no</FW_STOP_KEEP_ROUTING_STATE> + <enable_firewall config:type="boolean">true</enable_firewall> + <start_firewall config:type="boolean">true</start_firewall> + </firewall> + <general> + <ask-list config:type="list"/> + <mode> + <confirm config:type="boolean">false</confirm> + </mode> + <proposals config:type="list"/> + <signature-handling> + <accept_file_without_checksum config:type="boolean">true</accept_file_without_checksum> + <accept_non_trusted_gpg_key config:type="boolean">true</accept_non_trusted_gpg_key> + <accept_unknown_gpg_key config:type="boolean">true</accept_unknown_gpg_key> + <accept_unsigned_file config:type="boolean">true</accept_unsigned_file> + <accept_verification_failed config:type="boolean">false</accept_verification_failed> + <import_gpg_key config:type="boolean">true</import_gpg_key> + </signature-handling> + <storage/> + </general> + <groups config:type="list"> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>100</gid> + <group_password>x</group_password> + <groupname>users</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>25</gid> + <group_password>x</group_password> + <groupname>at</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>62</gid> + <group_password>x</group_password> + <groupname>man</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>9</gid> + <group_password>x</group_password> + <groupname>kmem</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>489</gid> + <group_password>x</group_password> + <groupname>scard</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>482</gid> + <group_password>x</group_password> + <groupname>adm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>16</gid> + <group_password>x</group_password> + <groupname>dialout</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>5</gid> + <group_password>x</group_password> + <groupname>tty</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>20</gid> + <group_password>x</group_password> + <groupname>cdrom</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>496</gid> + <group_password>x</group_password> + <groupname>input</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>487</gid> + <group_password>x</group_password> + <groupname>brlapi</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>488</gid> + <group_password>x</group_password> + <groupname>rtkit</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>494</gid> + <group_password>x</group_password> + <groupname>nscd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>3</gid> + <group_password>x</group_password> + <groupname>sys</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>17</gid> + <group_password>x</group_password> + <groupname>audio</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>7</gid> + <group_password>x</group_password> + <groupname>lp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>59</gid> + <group_password>x</group_password> + <groupname>maildrop</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>10</gid> + <group_password>x</group_password> + <groupname>wheel</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>497</gid> + <group_password>x</group_password> + <groupname>tape</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>493</gid> + <group_password>x</group_password> + <groupname>systemd-journal</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>54</gid> + <group_password>x</group_password> + <groupname>lock</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>0</gid> + <group_password>x</group_password> + <groupname>root</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>492</gid> + <group_password>x</group_password> + <groupname>systemd-timesync</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>491</gid> + <group_password>x</group_password> + <groupname>kvm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>71</gid> + <group_password>x</group_password> + <groupname>ntadmin</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>15</gid> + <group_password>x</group_password> + <groupname>shadow</groupname> + <userlist>vnc</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>484</gid> + <group_password>x</group_password> + <groupname>vnc</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>499</gid> + <group_password>x</group_password> + <groupname>messagebus</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>41</gid> + <group_password>x</group_password> + <groupname>xok</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>486</gid> + <group_password>x</group_password> + <groupname>pulse</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65534</gid> + <group_password>x</group_password> + <groupname>nogroup</groupname> + <userlist>nobody</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>495</gid> + <group_password>x</group_password> + <groupname>polkitd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>483</gid> + <group_password>x</group_password> + <groupname>gdm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>490</gid> + <group_password>x</group_password> + <groupname>ntp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>21</gid> + <group_password>x</group_password> + <groupname>console</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>2</gid> + <group_password>x</group_password> + <groupname>daemon</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>33</gid> + <group_password>x</group_password> + <groupname>video</groupname> + <userlist>gdm</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>498</gid> + <group_password>x</group_password> + <groupname>sshd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>19</gid> + <group_password>x</group_password> + <groupname>floppy</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>8</gid> + <group_password>x</group_password> + <groupname>www</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>485</gid> + <group_password>x</group_password> + <groupname>pulse-access</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>32</gid> + <group_password>x</group_password> + <groupname>public</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65533</gid> + <group_password>x</group_password> + <groupname>nobody</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>14</gid> + <group_password>x</group_password> + <groupname>uucp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>43</gid> + <group_password>x</group_password> + <groupname>modem</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>40</gid> + <group_password>x</group_password> + <groupname>games</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>12</gid> + <group_password>x</group_password> + <groupname>mail</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>51</gid> + <group_password>x</group_password> + <groupname>postfix</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>13</gid> + <group_password>x</group_password> + <groupname>news</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>1</gid> + <group_password>x</group_password> + <groupname>bin</groupname> + <userlist>daemon</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>42</gid> + <group_password>x</group_password> + <groupname>trusted</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>22</gid> + <group_password>x</group_password> + <groupname>utmp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>6</gid> + <group_password>x</group_password> + <groupname>disk</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>49</gid> + <group_password>x</group_password> + <groupname>ftp</groupname> + <userlist/> + </group> + </groups> + <host> + <hosts config:type="list"> + <hosts_entry> + <host_address>127.0.0.1</host_address> + <names config:type="list"> + <name>localhost</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>::1</host_address> + <names config:type="list"> + <name>localhost ipv6-localhost ipv6-loopback</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>fe00::0</host_address> + <names config:type="list"> + <name>ipv6-localnet</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff00::0</host_address> + <names config:type="list"> + <name>ipv6-mcastprefix</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::1</host_address> + <names config:type="list"> + <name>ipv6-allnodes</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::2</host_address> + <names config:type="list"> + <name>ipv6-allrouters</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::3</host_address> + <names config:type="list"> + <name>ipv6-allhosts</name> + </names> + </hosts_entry> + </hosts> + </host> + <kdump> + <add_crash_kernel config:type="boolean">true</add_crash_kernel> + <crash_kernel config:type="list"> + <listentry>165M,high</listentry> + <listentry>72M,low</listentry> + </crash_kernel> + <crash_xen_kernel>237M\&lt;4G</crash_xen_kernel> + <general> + <KDUMPTOOL_FLAGS/> + <KDUMP_COMMANDLINE/> + <KDUMP_COMMANDLINE_APPEND/> + <KDUMP_CONTINUE_ON_ERROR>true</KDUMP_CONTINUE_ON_ERROR> + <KDUMP_COPY_KERNEL>yes</KDUMP_COPY_KERNEL> + <KDUMP_CPUS/> + <KDUMP_DUMPFORMAT>lzo</KDUMP_DUMPFORMAT> + <KDUMP_DUMPLEVEL>31</KDUMP_DUMPLEVEL> + <KDUMP_FREE_DISK_SIZE>64</KDUMP_FREE_DISK_SIZE> + <KDUMP_HOST_KEY/> + <KDUMP_IMMEDIATE_REBOOT>yes</KDUMP_IMMEDIATE_REBOOT> + <KDUMP_KEEP_OLD_DUMPS>5</KDUMP_KEEP_OLD_DUMPS> + <KDUMP_KERNELVER/> + <KDUMP_NETCONFIG>auto</KDUMP_NETCONFIG> + <KDUMP_NET_TIMEOUT>30</KDUMP_NET_TIMEOUT> + <KDUMP_NOTIFICATION_CC/> + <KDUMP_NOTIFICATION_TO/> + <KDUMP_POSTSCRIPT/> + <KDUMP_PRESCRIPT/> + <KDUMP_REQUIRED_PROGRAMS/> + <KDUMP_SAVEDIR>/var/crash</KDUMP_SAVEDIR> + <KDUMP_SMTP_PASSWORD/> + <KDUMP_SMTP_SERVER/> + <KDUMP_SMTP_USER/> + <KDUMP_TRANSFER/> + <KDUMP_VERBOSE>3</KDUMP_VERBOSE> + <KEXEC_OPTIONS/> + </general> + </kdump> + <keyboard> + <keymap>english-us</keymap> + </keyboard> + <language> + <language>en_US</language> + <languages/> + </language> + <login_settings/> + <networking> + <dhcp_options> + <dhclient_client_id/> + <dhclient_hostname_option>AUTO</dhclient_hostname_option> + </dhcp_options> + <dns> + <dhcp_hostname config:type="boolean">false</dhcp_hostname> + <domain>suse</domain> + <!--hostname config 主机名 设置--> + <hostname>ispimos</hostname> + <resolv_conf_policy>auto</resolv_conf_policy> + <write_hostname config:type="boolean">false</write_hostname> + </dns> + <!-- ip config ip 设置 --> + <interfaces config:type="list"> + <interface> + <bootproto>static</bootproto> + <device>eth0</device> + <ipaddr>100.2.230.95</ipaddr> + <name>Ethernet Card 0</name> + <netmask>255.255.255.0</netmask> + <prefixlen>24</prefixlen> + <startmode>auto</startmode> + </interface> + <interface> + <bootproto>static</bootproto> + <device>lo</device> + <firewall>no</firewall> + <ipaddr>127.0.0.1</ipaddr> + <netmask>255.0.0.0</netmask> + <network>127.0.0.0</network> + <prefixlen>8</prefixlen> + <startmode>nfsroot</startmode> + <usercontrol>no</usercontrol> + </interface> + </interfaces> + <!-- ip config ip 设置--> + <ipv6 config:type="boolean">true</ipv6> + <keep_install_network config:type="boolean">true</keep_install_network> + <managed config:type="boolean">false</managed> + <routing> + <ip_forward config:type="boolean">false</ip_forward> + </routing> + </networking> +<!--硬盘分区 disk partition--> + <partitioning config:type="list"> + <drive> + <device>/dev/sda</device> + <enable_snapshots config:type="boolean">true</enable_snapshots> + <initialize config:type="boolean">true</initialize> + <partitions config:type="list"> + <partition> + <create config:type="boolean">true</create> + <crypt_fs config:type="boolean">false</crypt_fs> + <filesystem config:type="symbol">xfs</filesystem> + <format config:type="boolean">true</format> + <fstopt>defaults</fstopt> + <loop_fs config:type="boolean">false</loop_fs> + <mount>/home</mount> + <mountby config:type="symbol">uuid</mountby> + <partition_id config:type="integer">131</partition_id> + <partition_nr config:type="integer">1</partition_nr> + <resize config:type="boolean">false</resize> + <size>10240M</size> + </partition> + <partition> + <create config:type="boolean">true</create> + <crypt_fs config:type="boolean">false</crypt_fs> + <filesystem config:type="symbol">swap</filesystem> + <format config:type="boolean">true</format> + <fstopt>umask=0002,utf8=true</fstopt> + <loop_fs config:type="boolean">false</loop_fs> + <mount>swap</mount> + <mountby config:type="symbol">uuid</mountby> + <partition_id config:type="integer">131</partition_id> + <partition_nr config:type="integer">2</partition_nr> + <resize config:type="boolean">false</resize> + <size>auto</size> + </partition> + <partition> + <create config:type="boolean">true</create> + <crypt_fs config:type="boolean">false</crypt_fs> + <filesystem config:type="symbol">vfat</filesystem> + <format config:type="boolean">true</format> + <fstopt>umask=0002,utf8=true</fstopt> + <loop_fs config:type="boolean">false</loop_fs> + <mount>/boot/efi</mount> + <mountby config:type="symbol">device</mountby> + <partition_id config:type="integer">259</partition_id> + <partition_nr config:type="integer">3</partition_nr> + <resize config:type="boolean">false</resize> + <size>200M</size> + </partition> + <partition> + <create config:type="boolean">true</create> + <crypt_fs config:type="boolean">false</crypt_fs> + <filesystem config:type="symbol">ext3</filesystem> + <format config:type="boolean">true</format> + <fstopt>acl,user_xattr</fstopt> + <loop_fs config:type="boolean">false</loop_fs> + <mount>/boot</mount> + <mountby config:type="symbol">uuid</mountby> + <partition_id config:type="integer">131</partition_id> + <partition_nr config:type="integer">4</partition_nr> + <resize config:type="boolean">false</resize> + <size>auto</size> + </partition> + <partition> + <create config:type="boolean">true</create> + <crypt_fs config:type="boolean">false</crypt_fs> + <filesystem config:type="symbol">ext3</filesystem> + <format config:type="boolean">true</format> + <fstopt>acl,user_xattr</fstopt> + <loop_fs config:type="boolean">false</loop_fs> + <mount>/</mount> + <mountby config:type="symbol">uuid</mountby> + <partition_id config:type="integer">131</partition_id> + <partition_nr config:type="integer">5</partition_nr> + <resize config:type="boolean">false</resize> + <size>max</size> + </partition> + </partitions> + <pesize/> + <type config:type="symbol">CT_DISK</type> + <use>all</use> + </drive> + </partitioning> + <!--硬盘分区 disk partition--> + <report> + <errors> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">0</timeout> + </errors> + <messages> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">10</timeout> + </messages> + <warnings> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">10</timeout> + </warnings> + <yesno_messages> + <log config:type="boolean">true</log> + <show config:type="boolean">true</show> + <timeout config:type="integer">10</timeout> + </yesno_messages> + </report> + <!--software select 软件选择--> + <software> + <image/> + <install_recommended config:type="boolean">true</install_recommended> + <instsource/> + <packages config:type="list"> + <package>desktop-translations</package> + <package>grub2-x86_64-efi</package> + <package>mokutil</package> + <package>shim</package> + <package>yast2-trans-en_US</package> + </packages> + <patterns config:type="list"> + <pattern>Minimal</pattern> + <pattern>base</pattern> + <pattern>laptop</pattern> + </patterns> + <remove-packages config:type="list"> + <package>Mesa</package> + <package>fonts-config</package> + <package>ft2demos</package> + <package>libasound2</package> + <package>libdrm</package> + <package>libmysqlclient_r15</package> + <package>libpciaccess0</package> + <package>libqt4</package> + <package>libqt4-qt3support</package> + <package>libqt4-sql</package> + <package>libqt4-sql-mysql</package> + <package>libqt4-sql-sqlite</package> + <package>libqt4-x11</package> + <package>pcmciautils</package> + <package>sendmail</package> + <package>xorg-x11-fonts</package> + <package>xorg-x11-fonts-core</package> + <package>xorg-x11-libXfixes</package> + <package>xorg-x11-libXmu</package> + <package>xorg-x11-libXp</package> + <package>xorg-x11-libXpm</package> + <package>xorg-x11-libXprintUtil</package> + <package>xorg-x11-libXrender</package> + <package>xorg-x11-libXv</package> + <package>xorg-x11-libfontenc</package> + <package>xorg-x11-libs</package> + <package>xorg-x11-libxkbfile</package> + <package>yast2-qt</package> + <package>yast2-qt-pkg</package> + </remove-packages> + </software> + <!--software select 软件选择--> + <!--timezone 时区--> + <timezone> + <hwclock>UTC</hwclock> + <timezone>Asia/Shanghai</timezone> + </timezone> + <!--timezone 时区--> + <user_defaults> + <expire/> + <group>100</group> + <groups/> + <home>/home</home> + <inactive>-1</inactive> + <no_groups config:type="boolean">true</no_groups> + <shell>/bin/bash</shell> + <skel>/etc/skel</skel> + <umask>022</umask> + </user_defaults> + <users config:type="list"> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for rpcbind</fullname> + <gid>65534</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>495</uid> + <user_password>!</user_password> + <username>rpc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for D-Bus</fullname> + <gid>499</gid> + <home>/var/run/dbus</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>499</uid> + <user_password>!</user_password> + <username>messagebus</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>PulseAudio daemon</fullname> + <gid>486</gid> + <home>/var/lib/pulseaudio</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>487</uid> + <user_password>!</user_password> + <username>pulse</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for polkitd</fullname> + <gid>495</gid> + <home>/var/lib/polkit</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>497</uid> + <user_password>!</user_password> + <username>polkitd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>WWW daemon apache</fullname> + <gid>8</gid> + <home>/var/lib/wwwrun</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>30</uid> + <user_password>*</user_password> + <username>wwwrun</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>RealtimeKit</fullname> + <gid>488</gid> + <home>/proc</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>488</uid> + <user_password>!</user_password> + <username>rtkit</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Gnome Display Manager daemon</fullname> + <gid>483</gid> + <home>/var/lib/gdm</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>484</uid> + <user_password>!</user_password> + <username>gdm</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Daemon</fullname> + <gid>2</gid> + <home>/sbin</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>2</uid> + <user_password>*</user_password> + <username>daemon</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NTP daemon</fullname> + <gid>490</gid> + <home>/var/lib/ntp</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>74</uid> + <user_password>!</user_password> + <username>ntp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for nscd</fullname> + <gid>494</gid> + <home>/run/nscd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>496</uid> + <user_password>!</user_password> + <username>nscd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>SSH daemon</fullname> + <gid>498</gid> + <home>/var/lib/sshd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>498</uid> + <user_password>!</user_password> + <username>sshd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Printing daemon</fullname> + <gid>7</gid> + <home>/var/spool/lpd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>4</uid> + <user_password>*</user_password> + <username>lp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Batch jobs daemon</fullname> + <gid>25</gid> + <home>/var/spool/atjobs</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>25</uid> + <user_password>!</user_password> + <username>at</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Manual pages viewer</fullname> + <gid>62</gid> + <home>/var/cache/man</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>13</uid> + <user_password>*</user_password> + <username>man</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for VNC</fullname> + <gid>484</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>485</uid> + <user_password>!</user_password> + <username>vnc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NFS statd daemon</fullname> + <gid>65534</gid> + <home>/var/lib/nfs</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>490</uid> + <user_password>!</user_password> + <username>statd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Smart Card Reader</fullname> + <gid>489</gid> + <home>/var/run/pcscd</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>489</uid> + <user_password>!</user_password> + <username>scard</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>News system</fullname> + <gid>13</gid> + <home>/etc/news</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>9</uid> + <user_password>*</user_password> + <username>news</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>openslp daemon</fullname> + <gid>2</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>494</uid> + <user_password>!</user_password> + <username>openslp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>bin</fullname> + <gid>1</gid> + <home>/bin</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>1</uid> + <user_password>*</user_password> + <username>bin</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Time Synchronization</fullname> + <gid>492</gid> + <home>/</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>492</uid> + <user_password>!!</user_password> + <username>systemd-timesync</username> + </user> + <!--root config root用户设置--> + <user> + <encrypted config:type="boolean">false</encrypted> + <fullname>root</fullname> + <gid>0</gid> + <home>/root</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>0</uid> + <user_password>$6$vvvauV0ZX.Qr$TaieYlYUpaXrnLbweWoSVjrJUATU11KSDBSHzpfBaZQIQ.sl7pGzB0iHH6ZShG7Pv1JxN.Wl.4tp88MqFKqm60</user_password> + <username>root</username> + </user> + <!--root config root用户设置--> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>FTP account</fullname> + <gid>49</gid> + <home>/srv/ftp</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>40</uid> + <user_password>*</user_password> + <username>ftp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for GeoClue D-Bus service</fullname> + <gid>65534</gid> + <home>/var/lib/srvGeoClue</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>486</uid> + <user_password>!</user_password> + <username>srvGeoClue</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>nobody</fullname> + <gid>65533</gid> + <home>/var/lib/nobody</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>65534</uid> + <user_password>*</user_password> + <username>nobody</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Unix-to-Unix CoPy system</fullname> + <gid>14</gid> + <home>/etc/uucp</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>10</uid> + <user_password>*</user_password> + <username>uucp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Secure FTP User</fullname> + <gid>65534</gid> + <home>/var/lib/empty</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>491</uid> + <user_password>!</user_password> + <username>ftpsecure</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Games account</fullname> + <gid>100</gid> + <home>/var/games</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>12</uid> + <user_password>*</user_password> + <username>games</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Mailer daemon</fullname> + <gid>12</gid> + <home>/var/spool/clientmqueue</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>8</uid> + <user_password>*</user_password> + <username>mail</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Postfix Daemon</fullname> + <gid>51</gid> + <home>/var/spool/postfix</home> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>51</uid> + <user_password>!</user_password> + <username>postfix</username> + </user> + </users> + <scripts> + <pre-scripts config:type="list"> + <script> + <filename>pre.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[ + # please insert pre script at here 请在这个地方添加前置脚本 + ]]> + </source> + </script> + </pre-scripts> + <post-scripts config:type="list"> + <script> + <network_needed config:type="boolean">true</network_needed> + <filename>post.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[ + # please insert post script at here 请在这个地方添加后置脚本 + ]]> + </source> + </script> + </post-scripts> + <init-scripts config:type="list"> + <script> + <filename>init.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[]]></source> + </script> + </init-scripts> + </scripts> +</profile> diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse15/autoinst.xml b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse15/autoinst.xml new file mode 100644 index 0000000000000000000000000000000000000000..b22a30dba1a6167a401af136b15dd7adf12f6780 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse15/autoinst.xml @@ -0,0 +1,1367 @@ +<?xml version="1.0"?> +<!DOCTYPE profile> +<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> + <add-on> + <add_on_others config:type="list"/> + <add_on_products config:type="list"> + <listentry> + <media_url>@path</media_url> + <product>sle-module-basesystem</product> + <product_dir>/Module-Basesystem</product_dir> + </listentry> + <listentry> + <media_url>@path</media_url> + <product>sle-module-development-tools</product> + <product_dir>/Module-Development-Tools</product_dir> + </listentry> + <listentry> + <media_url>@path</media_url> + <product>sle-module-desktop-applications</product> + <product_dir>/Module-Desktop-Applications</product_dir> + </listentry> + </add_on_products> + </add-on> + <general> + <mode> + <confirm config:type="boolean">false</confirm> + </mode> + </general> + <bootloader> + <global> + <cpu_mitigations>auto</cpu_mitigations> + <gfxmode>auto</gfxmode> + <hiddenmenu>false</hiddenmenu> + <os_prober>true</os_prober> + <secure_boot>true</secure_boot> + <terminal>gfxterm</terminal> + <timeout config:type="integer">8</timeout> + <update_nvram>true</update_nvram> + <xen_kernel_append>vga=gfx-1024x768x16 crashkernel=314M\&lt;4G</xen_kernel_append> + </global> + <loader_type>default</loader_type> + </bootloader> + <firewall> + <default_zone>public</default_zone> + <enable_firewall config:type="boolean">true</enable_firewall> + <log_denied_packets>off</log_denied_packets> + <start_firewall config:type="boolean">false</start_firewall> + <zones config:type="list"> + <zone> + <description>Unsolicited incoming network packets are rejected. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>block</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>Block</short> + <target>%%REJECT%%</target> + </zone> + <zone> + <description>For computers in your demilitarized zone that are publicly-accessible with limited access to your internal network. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>dmz</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>ssh</service> + </services> + <short>DMZ</short> + <target>default</target> + </zone> + <zone> + <description>All network connections are accepted.</description> + <interfaces config:type="list"> + <interface>docker0</interface> + </interfaces> + <masquerade config:type="boolean">false</masquerade> + <name>docker</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>docker</short> + <target>ACCEPT</target> + </zone> + <zone> + <description>Unsolicited incoming network packets are dropped. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>drop</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>Drop</short> + <target>DROP</target> + </zone> + <zone> + <description>For use on external networks. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">true</masquerade> + <name>external</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>ssh</service> + </services> + <short>External</short> + <target>default</target> + </zone> + <zone> + <description>For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>home</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + <service>mdns</service> + <service>samba-client</service> + <service>ssh</service> + </services> + <short>Home</short> + <target>default</target> + </zone> + <zone> + <description>For use on internal networks. You mostly trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>internal</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + <service>mdns</service> + <service>samba-client</service> + <service>ssh</service> + </services> + <short>Internal</short> + <target>default</target> + </zone> + <zone> + <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>public</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + </services> + <short>Public</short> + <target>default</target> + </zone> + <zone> + <description>All network connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>trusted</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>Trusted</short> + <target>ACCEPT</target> + </zone> + <zone config:type="map"> + <description>For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>work</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + <service>ssh</service> + </services> + <short>Work</short> + <target>default</target> + </zone> + </zones> + </firewall> + <groups config:type="list"> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>100</gid> + <group_password>x</group_password> + <groupname>users</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>1</gid> + <group_password>x</group_password> + <groupname>bin</groupname> + <userlist>daemon</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>489</gid> + <group_password>x</group_password> + <groupname>input</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65533</gid> + <group_password>x</group_password> + <groupname>nogroup</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>59</gid> + <group_password>x</group_password> + <groupname>maildrop</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>463</gid> + <group_password>x</group_password> + <groupname>vnc</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>15</gid> + <group_password>x</group_password> + <groupname>shadow</groupname> + <userlist>vnc</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>484</gid> + <group_password>x</group_password> + <groupname>audit</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>479</gid> + <group_password>x</group_password> + <groupname>polkitd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>477</gid> + <group_password>x</group_password> + <groupname>rtkit</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>472</gid> + <group_password>x</group_password> + <groupname>systemd-coredump</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>474</gid> + <group_password>x</group_password> + <groupname>systemd-resolve</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>62</gid> + <group_password>x</group_password> + <groupname>man</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>481</gid> + <group_password>!</group_password> + <groupname>srvGeoClue</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>495</gid> + <group_password>x</group_password> + <groupname>lock</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>71</gid> + <group_password>x</group_password> + <groupname>ntadmin</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>469</gid> + <group_password>x</group_password> + <groupname>chrony</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>486</gid> + <group_password>x</group_password> + <groupname>tape</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>496</gid> + <group_password>x</group_password> + <groupname>kmem</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>499</gid> + <group_password>x</group_password> + <groupname>messagebus</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>480</gid> + <group_password>!</group_password> + <groupname>flatpak</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>466</gid> + <group_password>x</group_password> + <groupname>colord</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65534</gid> + <group_password>x</group_password> + <groupname>nobody</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>490</gid> + <group_password>x</group_password> + <groupname>disk</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>478</gid> + <group_password>x</group_password> + <groupname>brlapi</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>467</gid> + <group_password>x</group_password> + <groupname>pulse-access</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>468</gid> + <group_password>x</group_password> + <groupname>pulse</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>494</gid> + <group_password>x</group_password> + <groupname>utmp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>464</gid> + <group_password>x</group_password> + <groupname>nm-openconnect</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>465</gid> + <group_password>x</group_password> + <groupname>nm-openvpn</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>483</gid> + <group_password>x</group_password> + <groupname>tftp</groupname> + <userlist>tftp,dnsmasq</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>5</gid> + <group_password>x</group_password> + <groupname>tty</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>462</gid> + <group_password>x</group_password> + <groupname>gdm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>475</gid> + <group_password>x</group_password> + <groupname>systemd-network</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>491</gid> + <group_password>x</group_password> + <groupname>dialout</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>470</gid> + <group_password>x</group_password> + <groupname>scard</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>493</gid> + <group_password>x</group_password> + <groupname>audio</groupname> + <userlist>pulse</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>473</gid> + <group_password>x</group_password> + <groupname>systemd-timesync</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>476</gid> + <group_password>x</group_password> + <groupname>systemd-journal</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>42</gid> + <group_password>x</group_password> + <groupname>trusted</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>51</gid> + <group_password>x</group_password> + <groupname>postfix</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>498</gid> + <group_password>!</group_password> + <groupname>mail</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>482</gid> + <group_password>!</group_password> + <groupname>sshd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>497</gid> + <group_password>x</group_password> + <groupname>wheel</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>487</gid> + <group_password>x</group_password> + <groupname>render</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>485</gid> + <group_password>x</group_password> + <groupname>video</groupname> + <userlist>gdm</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>488</gid> + <group_password>x</group_password> + <groupname>lp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>471</gid> + <group_password>x</group_password> + <groupname>nscd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>0</gid> + <group_password>x</group_password> + <groupname>root</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>492</gid> + <group_password>x</group_password> + <groupname>cdrom</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>36</gid> + <group_password>x</group_password> + <groupname>kvm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>2</gid> + <group_password>x</group_password> + <groupname>daemon</groupname> + <userlist/> + </group> + </groups> + <host> + <hosts config:type="list"> + <hosts_entry> + <host_address>127.0.0.1</host_address> + <names config:type="list"> + <name>localhost</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>::1</host_address> + <names config:type="list"> + <name>localhost ipv6-localhost ipv6-loopback</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>fe00::0</host_address> + <names config:type="list"> + <name>ipv6-localnet</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff00::0</host_address> + <names config:type="list"> + <name>ipv6-mcastprefix</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::1</host_address> + <names config:type="list"> + <name>ipv6-allnodes</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::2</host_address> + <names config:type="list"> + <name>ipv6-allrouters</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::3</host_address> + <names config:type="list"> + <name>ipv6-allhosts</name> + </names> + </hosts_entry> + </hosts> + </host> + <kdump> + <add_crash_kernel config:type="boolean">true</add_crash_kernel> + <crash_kernel config:type="list"> + <listentry>242M,high</listentry> + <listentry>72M,low</listentry> + </crash_kernel> + <crash_xen_kernel>314M\&lt;4G</crash_xen_kernel> + <general> + <KDUMPTOOL_FLAGS/> + <KDUMP_COMMANDLINE/> + <KDUMP_COMMANDLINE_APPEND/> + <KDUMP_CONTINUE_ON_ERROR>true</KDUMP_CONTINUE_ON_ERROR> + <KDUMP_COPY_KERNEL>yes</KDUMP_COPY_KERNEL> + <KDUMP_CPUS/> + <KDUMP_DUMPFORMAT>lzo</KDUMP_DUMPFORMAT> + <KDUMP_DUMPLEVEL>31</KDUMP_DUMPLEVEL> + <KDUMP_FREE_DISK_SIZE>64</KDUMP_FREE_DISK_SIZE> + <KDUMP_HOST_KEY/> + <KDUMP_IMMEDIATE_REBOOT>yes</KDUMP_IMMEDIATE_REBOOT> + <KDUMP_KEEP_OLD_DUMPS>5</KDUMP_KEEP_OLD_DUMPS> + <KDUMP_KERNELVER/> + <KDUMP_NETCONFIG>auto</KDUMP_NETCONFIG> + <KDUMP_NET_TIMEOUT>30</KDUMP_NET_TIMEOUT> + <KDUMP_NOTIFICATION_CC/> + <KDUMP_NOTIFICATION_TO/> + <KDUMP_POSTSCRIPT/> + <KDUMP_PRESCRIPT/> + <KDUMP_REQUIRED_PROGRAMS/> + <KDUMP_SAVEDIR>/var/crash</KDUMP_SAVEDIR> + <KDUMP_SMTP_PASSWORD/> + <KDUMP_SMTP_SERVER/> + <KDUMP_SMTP_USER/> + <KDUMP_TRANSFER/> + <KDUMP_VERBOSE>3</KDUMP_VERBOSE> + <KEXEC_OPTIONS/> + </general> + </kdump> + <keyboard> + <keymap>english-us</keymap> + </keyboard> + <language> + <language>en_US</language> + <languages/> + </language> + <networking> + <dns> + <dhcp_hostname config:type="boolean">false</dhcp_hostname> + <!--hostname config 主机名 设置--> + <hostname>ispimos</hostname> + <resolv_conf_policy>auto</resolv_conf_policy> + </dns> + <ipv6 config:type="boolean">true</ipv6> + <keep_install_network config:type="boolean">true</keep_install_network> + <managed config:type="boolean">false</managed> + </networking> + <ntp-client> + <ntp_policy>auto</ntp_policy> + <ntp_servers config:type="list"/> + <ntp_sync>manual</ntp_sync> + </ntp-client> + <!--硬盘分区 disk partition--> + <!--diskPartition--> + <!--software select 软件选择--> + <software> + <install_recommended config:type="boolean">true</install_recommended> + <instsource/> + <packages config:type="list"> + <package>xfsprogs</package> + <package>snapper</package> + <package>sled-release</package> + <package>sle-module-desktop-applications-release</package> + <package>sle-module-basesystem-release</package> + <package>shim</package> + <package>openssh</package> + <package>numactl</package> + <package>mokutil</package> + <package>kexec-tools</package> + <package>kdump</package> + <package>irqbalance</package> + <package>grub2-x86_64-efi</package> + <package>glibc</package> + <package>firewalld</package> + <!--<package>e2fsprogs</package> + <package>dosfstools</package> + <package>btrfsprogs</package> + <package>autoyast2</package>--> + </packages> + <patterns config:type="list"> + <pattern>apparmor</pattern> + <pattern>base</pattern> + <pattern>basesystem</pattern> + <pattern>basic_desktop</pattern> + <pattern>enhanced_base</pattern> + <pattern>fonts</pattern> + <pattern>gnome</pattern> + <pattern>gnome_basic</pattern> + <pattern>gnome_basis</pattern> + <pattern>gnome_imaging</pattern> + <pattern>gnome_multimedia</pattern> + <pattern>gnome_x11</pattern> + <pattern>minimal_base</pattern> + <pattern>office</pattern> + <pattern>x11</pattern> + <pattern>x11_enhanced</pattern> + <pattern>x11_yast</pattern> + <!--<pattern>yast2_basis</pattern> + <pattern>yast2_desktop</pattern> + <pattern>yast2_server</pattern>--> + </patterns> + <products config:type="list"> + <product>SLED</product> + </products> + </software> + <!--timezone 时区--> + <timezone> + <timezone>Asia/Shanghai</timezone> + </timezone> + <user_defaults> + <expire/> + <group>100</group> + <groups/> + <home>/home</home> + <inactive>-1</inactive> + <no_groups config:type="boolean">true</no_groups> + <shell>/bin/bash</shell> + <skel>/etc/skel</skel> + <umask>022</umask> + </user_defaults> + <users config:type="list"> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for polkitd</fullname> + <gid>479</gid> + <home>/var/lib/polkit</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>491</uid> + <user_password>!</user_password> + <username>polkitd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>RealtimeKit</fullname> + <gid>477</gid> + <home>/proc</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>490</uid> + <user_password>!</user_password> + <username>rtkit</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Resolver</fullname> + <gid>474</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>474</uid> + <user_password>!*</user_password> + <username>systemd-resolve</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Manual pages viewer</fullname> + <gid>62</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>13</uid> + <user_password>!</user_password> + <username>man</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Core Dumper</fullname> + <gid>472</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>472</uid> + <user_password>!*</user_password> + <username>systemd-coredump</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for GeoClue D-Bus service</fullname> + <gid>481</gid> + <home>/var/lib/srvGeoClue</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>493</uid> + <user_password>!</user_password> + <username>srvGeoClue</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>bin</fullname> + <gid>1</gid> + <home>/bin</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>1</uid> + <user_password>!</user_password> + <username>bin</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for VNC</fullname> + <gid>463</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>461</uid> + <user_password>!</user_password> + <username>vnc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for rpcbind</fullname> + <gid>65534</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>471</uid> + <user_password>!</user_password> + <username>rpc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for colord</fullname> + <gid>466</gid> + <home>/var/lib/colord</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>464</uid> + <user_password>!</user_password> + <username>colord</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>nobody</fullname> + <gid>65534</gid> + <home>/var/lib/nobody</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>65534</uid> + <user_password>!</user_password> + <username>nobody</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>PulseAudio daemon</fullname> + <gid>468</gid> + <home>/var/lib/pulseaudio</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>466</uid> + <user_password>!</user_password> + <username>pulse</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NetworkManager user for OpenConnect</fullname> + <gid>464</gid> + <home>/var/lib/nm-openconnect</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>462</uid> + <user_password>!</user_password> + <username>nm-openconnect</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NetworkManager user for OpenVPN</fullname> + <gid>465</gid> + <home>/var/lib/openvpn</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>463</uid> + <user_password>!</user_password> + <username>nm-openvpn</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>TFTP account</fullname> + <gid>483</gid> + <home>/srv/tftpboot</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>497</uid> + <user_password>!</user_password> + <username>tftp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Chrony Daemon</fullname> + <gid>469</gid> + <home>/var/lib/chrony</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>467</uid> + <user_password>!</user_password> + <username>chrony</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for D-Bus</fullname> + <gid>499</gid> + <home>/run/dbus</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/bin/false</shell> + <uid>499</uid> + <user_password>!</user_password> + <username>messagebus</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>usbmuxd daemon</fullname> + <gid>65533</gid> + <home>/var/lib/usbmuxd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>465</uid> + <user_password>!</user_password> + <username>usbmux</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Flatpak system helper</fullname> + <gid>480</gid> + <home>/home/flatpak</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>492</uid> + <user_password>!</user_password> + <username>flatpak</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname/> + <gid>100</gid> + <home>/run/gnome-initial-setup/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>459</uid> + <user_password>!</user_password> + <username>gnome-initial-setup</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Smart Card Reader</fullname> + <gid>470</gid> + <home>/var/run/pcscd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>468</uid> + <user_password>!</user_password> + <username>scard</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Time Synchronization</fullname> + <gid>473</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>473</uid> + <user_password>!*</user_password> + <username>systemd-timesync</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Postfix Daemon</fullname> + <gid>51</gid> + <home>/var/spool/postfix</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>51</uid> + <user_password>!</user_password> + <username>postfix</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Mailer daemon</fullname> + <gid>498</gid> + <home>/var/spool/clientmqueue</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>498</uid> + <user_password>!</user_password> + <username>mail</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Gnome Display Manager daemon</fullname> + <gid>462</gid> + <home>/var/lib/gdm</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>460</uid> + <user_password>!</user_password> + <username>gdm</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Network Management</fullname> + <gid>475</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>475</uid> + <user_password>!*</user_password> + <username>systemd-network</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NFS statd daemon</fullname> + <gid>65533</gid> + <home>/var/lib/nfs</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>469</uid> + <user_password>!</user_password> + <username>statd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Printing daemon</fullname> + <gid>488</gid> + <home>/var/spool/lpd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>495</uid> + <user_password>!</user_password> + <username>lp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for nscd</fullname> + <gid>471</gid> + <home>/run/nscd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>470</uid> + <user_password>!</user_password> + <username>nscd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>dnsmasq</fullname> + <gid>65533</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>496</uid> + <user_password>!</user_password> + <username>dnsmasq</username> + </user> + <!--root config root用户设置--> + <user> + <authorized_keys config:type="list"/> + <encrypted config:type="boolean">false</encrypted> + <fullname>root</fullname> + <gid>0</gid> + <home>/root</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>0</uid> + <!--rootPsw--> + <username>root</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Daemon</fullname> + <gid>2</gid> + <home>/sbin</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>2</uid> + <user_password>!</user_password> + <username>daemon</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>SSH daemon</fullname> + <gid>482</gid> + <home>/var/lib/sshd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>494</uid> + <user_password>!</user_password> + <username>sshd</username> + </user> + </users> + <scripts> + <post-scripts config:type="list"> + <script> + <filename>post.sh</filename> + <interpreter>shell</interpreter> + <source><![CDATA[ + curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskLogAccept' --header 'Content-Type:application/json' -d '{"content":"'OSFINISH'","jobHostId":"'@jobHostId'"}' + curl -k --location -g --request POST 'http://@ip:30100/v1/iboot/taskStatusChange' --header 'Content-Type:application/json' --data '{"jobHostStatus":"'SUCCESS'","id":"'@jobHostId'"}' + @post + ]]> + </source> + </script> + </post-scripts> + </scripts> +</profile> diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse15/autoinst_example.xml b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse15/autoinst_example.xml new file mode 100644 index 0000000000000000000000000000000000000000..93df147b487aec01d742fd67ad881451b1fb2663 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/suse15/autoinst_example.xml @@ -0,0 +1,1384 @@ +<?xml version="1.0"?> +<!DOCTYPE profile> +<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> + <add-on> + <add_on_others config:type="list"/> + <add_on_products config:type="list"> + <listentry> + <media_url>@path</media_url> + <product>sle-module-basesystem</product> + <product_dir>/Module-Basesystem</product_dir> + </listentry> + <listentry> + <media_url>@path</media_url> + <product>sle-module-development-tools</product> + <product_dir>/Module-Development-Tools</product_dir> + </listentry> + <listentry> + <media_url>@path</media_url> + <product>sle-module-desktop-applications</product> + <product_dir>/Module-Desktop-Applications</product_dir> + </listentry> + </add_on_products> + </add-on> + <general> + <mode> + <confirm config:type="boolean">false</confirm> + </mode> + </general> + <bootloader> + <global> + <cpu_mitigations>auto</cpu_mitigations> + <gfxmode>auto</gfxmode> + <hiddenmenu>false</hiddenmenu> + <os_prober>true</os_prober> + <secure_boot>true</secure_boot> + <terminal>gfxterm</terminal> + <timeout config:type="integer">8</timeout> + <update_nvram>true</update_nvram> + <xen_kernel_append>vga=gfx-1024x768x16 crashkernel=314M\&lt;4G</xen_kernel_append> + </global> + <loader_type>default</loader_type> + </bootloader> + <firewall> + <default_zone>public</default_zone> + <enable_firewall config:type="boolean">true</enable_firewall> + <log_denied_packets>off</log_denied_packets> + <start_firewall config:type="boolean">false</start_firewall> + <zones config:type="list"> + <zone> + <description>Unsolicited incoming network packets are rejected. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>block</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>Block</short> + <target>%%REJECT%%</target> + </zone> + <zone> + <description>For computers in your demilitarized zone that are publicly-accessible with limited access to your internal network. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>dmz</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>ssh</service> + </services> + <short>DMZ</short> + <target>default</target> + </zone> + <zone> + <description>All network connections are accepted.</description> + <interfaces config:type="list"> + <interface>docker0</interface> + </interfaces> + <masquerade config:type="boolean">false</masquerade> + <name>docker</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>docker</short> + <target>ACCEPT</target> + </zone> + <zone> + <description>Unsolicited incoming network packets are dropped. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>drop</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>Drop</short> + <target>DROP</target> + </zone> + <zone> + <description>For use on external networks. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">true</masquerade> + <name>external</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>ssh</service> + </services> + <short>External</short> + <target>default</target> + </zone> + <zone> + <description>For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>home</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + <service>mdns</service> + <service>samba-client</service> + <service>ssh</service> + </services> + <short>Home</short> + <target>default</target> + </zone> + <zone> + <description>For use on internal networks. You mostly trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>internal</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + <service>mdns</service> + <service>samba-client</service> + <service>ssh</service> + </services> + <short>Internal</short> + <target>default</target> + </zone> + <zone> + <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>public</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + </services> + <short>Public</short> + <target>default</target> + </zone> + <zone> + <description>All network connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>trusted</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"/> + <short>Trusted</short> + <target>ACCEPT</target> + </zone> + <zone config:type="map"> + <description>For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> + <interfaces config:type="list"/> + <masquerade config:type="boolean">false</masquerade> + <name>work</name> + <ports config:type="list"/> + <protocols config:type="list"/> + <services config:type="list"> + <service>dhcpv6-client</service> + <service>ssh</service> + </services> + <short>Work</short> + <target>default</target> + </zone> + </zones> + </firewall> + <groups config:type="list"> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>100</gid> + <group_password>x</group_password> + <groupname>users</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>1</gid> + <group_password>x</group_password> + <groupname>bin</groupname> + <userlist>daemon</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>489</gid> + <group_password>x</group_password> + <groupname>input</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65533</gid> + <group_password>x</group_password> + <groupname>nogroup</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>59</gid> + <group_password>x</group_password> + <groupname>maildrop</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>463</gid> + <group_password>x</group_password> + <groupname>vnc</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>15</gid> + <group_password>x</group_password> + <groupname>shadow</groupname> + <userlist>vnc</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>484</gid> + <group_password>x</group_password> + <groupname>audit</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>479</gid> + <group_password>x</group_password> + <groupname>polkitd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>477</gid> + <group_password>x</group_password> + <groupname>rtkit</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>472</gid> + <group_password>x</group_password> + <groupname>systemd-coredump</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>474</gid> + <group_password>x</group_password> + <groupname>systemd-resolve</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>62</gid> + <group_password>x</group_password> + <groupname>man</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>481</gid> + <group_password>!</group_password> + <groupname>srvGeoClue</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>495</gid> + <group_password>x</group_password> + <groupname>lock</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>71</gid> + <group_password>x</group_password> + <groupname>ntadmin</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>469</gid> + <group_password>x</group_password> + <groupname>chrony</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>486</gid> + <group_password>x</group_password> + <groupname>tape</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>496</gid> + <group_password>x</group_password> + <groupname>kmem</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>499</gid> + <group_password>x</group_password> + <groupname>messagebus</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>480</gid> + <group_password>!</group_password> + <groupname>flatpak</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>466</gid> + <group_password>x</group_password> + <groupname>colord</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>65534</gid> + <group_password>x</group_password> + <groupname>nobody</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>490</gid> + <group_password>x</group_password> + <groupname>disk</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>478</gid> + <group_password>x</group_password> + <groupname>brlapi</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>467</gid> + <group_password>x</group_password> + <groupname>pulse-access</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>468</gid> + <group_password>x</group_password> + <groupname>pulse</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>494</gid> + <group_password>x</group_password> + <groupname>utmp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>464</gid> + <group_password>x</group_password> + <groupname>nm-openconnect</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>465</gid> + <group_password>x</group_password> + <groupname>nm-openvpn</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>483</gid> + <group_password>x</group_password> + <groupname>tftp</groupname> + <userlist>tftp,dnsmasq</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>5</gid> + <group_password>x</group_password> + <groupname>tty</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>462</gid> + <group_password>x</group_password> + <groupname>gdm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>475</gid> + <group_password>x</group_password> + <groupname>systemd-network</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>491</gid> + <group_password>x</group_password> + <groupname>dialout</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>470</gid> + <group_password>x</group_password> + <groupname>scard</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>493</gid> + <group_password>x</group_password> + <groupname>audio</groupname> + <userlist>pulse</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>473</gid> + <group_password>x</group_password> + <groupname>systemd-timesync</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>476</gid> + <group_password>x</group_password> + <groupname>systemd-journal</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>42</gid> + <group_password>x</group_password> + <groupname>trusted</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>51</gid> + <group_password>x</group_password> + <groupname>postfix</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>498</gid> + <group_password>!</group_password> + <groupname>mail</groupname> + <userlist>postfix</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>482</gid> + <group_password>!</group_password> + <groupname>sshd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>497</gid> + <group_password>x</group_password> + <groupname>wheel</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>487</gid> + <group_password>x</group_password> + <groupname>render</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>485</gid> + <group_password>x</group_password> + <groupname>video</groupname> + <userlist>gdm</userlist> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>488</gid> + <group_password>x</group_password> + <groupname>lp</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>471</gid> + <group_password>x</group_password> + <groupname>nscd</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>0</gid> + <group_password>x</group_password> + <groupname>root</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>492</gid> + <group_password>x</group_password> + <groupname>cdrom</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>36</gid> + <group_password>x</group_password> + <groupname>kvm</groupname> + <userlist/> + </group> + <group> + <encrypted config:type="boolean">true</encrypted> + <gid>2</gid> + <group_password>x</group_password> + <groupname>daemon</groupname> + <userlist/> + </group> + </groups> + <host> + <hosts config:type="list"> + <hosts_entry> + <host_address>127.0.0.1</host_address> + <names config:type="list"> + <name>localhost</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>::1</host_address> + <names config:type="list"> + <name>localhost ipv6-localhost ipv6-loopback</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>fe00::0</host_address> + <names config:type="list"> + <name>ipv6-localnet</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff00::0</host_address> + <names config:type="list"> + <name>ipv6-mcastprefix</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::1</host_address> + <names config:type="list"> + <name>ipv6-allnodes</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::2</host_address> + <names config:type="list"> + <name>ipv6-allrouters</name> + </names> + </hosts_entry> + <hosts_entry> + <host_address>ff02::3</host_address> + <names config:type="list"> + <name>ipv6-allhosts</name> + </names> + </hosts_entry> + </hosts> + </host> + <kdump> + <add_crash_kernel config:type="boolean">true</add_crash_kernel> + <crash_kernel config:type="list"> + <listentry>242M,high</listentry> + <listentry>72M,low</listentry> + </crash_kernel> + <crash_xen_kernel>314M\&lt;4G</crash_xen_kernel> + <general> + <KDUMPTOOL_FLAGS/> + <KDUMP_COMMANDLINE/> + <KDUMP_COMMANDLINE_APPEND/> + <KDUMP_CONTINUE_ON_ERROR>true</KDUMP_CONTINUE_ON_ERROR> + <KDUMP_COPY_KERNEL>yes</KDUMP_COPY_KERNEL> + <KDUMP_CPUS/> + <KDUMP_DUMPFORMAT>lzo</KDUMP_DUMPFORMAT> + <KDUMP_DUMPLEVEL>31</KDUMP_DUMPLEVEL> + <KDUMP_FREE_DISK_SIZE>64</KDUMP_FREE_DISK_SIZE> + <KDUMP_HOST_KEY/> + <KDUMP_IMMEDIATE_REBOOT>yes</KDUMP_IMMEDIATE_REBOOT> + <KDUMP_KEEP_OLD_DUMPS>5</KDUMP_KEEP_OLD_DUMPS> + <KDUMP_KERNELVER/> + <KDUMP_NETCONFIG>auto</KDUMP_NETCONFIG> + <KDUMP_NET_TIMEOUT>30</KDUMP_NET_TIMEOUT> + <KDUMP_NOTIFICATION_CC/> + <KDUMP_NOTIFICATION_TO/> + <KDUMP_POSTSCRIPT/> + <KDUMP_PRESCRIPT/> + <KDUMP_REQUIRED_PROGRAMS/> + <KDUMP_SAVEDIR>/var/crash</KDUMP_SAVEDIR> + <KDUMP_SMTP_PASSWORD/> + <KDUMP_SMTP_SERVER/> + <KDUMP_SMTP_USER/> + <KDUMP_TRANSFER/> + <KDUMP_VERBOSE>3</KDUMP_VERBOSE> + <KEXEC_OPTIONS/> + </general> + </kdump> + + <keyboard> + <keymap>english-us</keymap> + </keyboard> + <language> + <language>en_US</language> + <languages/> + </language> + <networking> + <dns> + <dhcp_hostname config:type="boolean">false</dhcp_hostname> + <!--hostname config 主机名 设置--> + <hostname>ispimos</hostname> + <resolv_conf_policy>auto</resolv_conf_policy> + </dns> + <ipv6 config:type="boolean">true</ipv6> + <keep_install_network config:type="boolean">true</keep_install_network> + <managed config:type="boolean">false</managed> + </networking> + <ntp-client> + <ntp_policy>auto</ntp_policy> + <ntp_servers config:type="list"/> + <ntp_sync>manual</ntp_sync> + </ntp-client> + <!--硬盘分区 disk partition--> + <!--<partitioning config:type="list"> + </partitioning>--> + <!--diskPartition--> + + <!--software select 软件选择--> + <software> + <install_recommended config:type="boolean">true</install_recommended> + <instsource/> + <packages config:type="list"> + <package>xfsprogs</package> + <package>snapper</package> + <package>sled-release</package> + <package>sle-module-desktop-applications-release</package> + <package>sle-module-basesystem-release</package> + <package>shim</package> + <package>openssh</package> + <package>numactl</package> + <package>mokutil</package> + <package>kexec-tools</package> + <package>kdump</package> + <package>irqbalance</package> + <package>grub2-x86_64-efi</package> + <package>glibc</package> + <package>firewalld</package> + </packages> + <patterns config:type="list"> + <pattern>apparmor</pattern> + <pattern>base</pattern> + <pattern>basesystem</pattern> + <pattern>basic_desktop</pattern> + <pattern>enhanced_base</pattern> + <pattern>fonts</pattern> + <pattern>gnome</pattern> + <pattern>gnome_basic</pattern> + <pattern>gnome_basis</pattern> + <pattern>gnome_imaging</pattern> + <pattern>gnome_multimedia</pattern> + <pattern>gnome_x11</pattern> + <pattern>minimal_base</pattern> + <pattern>office</pattern> + <pattern>x11</pattern> + <pattern>x11_enhanced</pattern> + <pattern>x11_yast</pattern> + </patterns> + <products config:type="list"> + <product>SLED</product> + </products> + </software> + <!--timezone 时区--> + <timezone> + <timezone>Asia/Shanghai</timezone> + </timezone> + <user_defaults> + <expire/> + <group>100</group> + <groups/> + <home>/home</home> + <inactive>-1</inactive> + <no_groups config:type="boolean">true</no_groups> + <shell>/bin/bash</shell> + <skel>/etc/skel</skel> + <umask>022</umask> + </user_defaults> + <users config:type="list"> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for polkitd</fullname> + <gid>479</gid> + <home>/var/lib/polkit</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>491</uid> + <user_password>!</user_password> + <username>polkitd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>RealtimeKit</fullname> + <gid>477</gid> + <home>/proc</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>490</uid> + <user_password>!</user_password> + <username>rtkit</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Resolver</fullname> + <gid>474</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>474</uid> + <user_password>!*</user_password> + <username>systemd-resolve</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Manual pages viewer</fullname> + <gid>62</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>13</uid> + <user_password>!</user_password> + <username>man</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Core Dumper</fullname> + <gid>472</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>472</uid> + <user_password>!*</user_password> + <username>systemd-coredump</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for GeoClue D-Bus service</fullname> + <gid>481</gid> + <home>/var/lib/srvGeoClue</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>493</uid> + <user_password>!</user_password> + <username>srvGeoClue</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>bin</fullname> + <gid>1</gid> + <home>/bin</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>1</uid> + <user_password>!</user_password> + <username>bin</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for VNC</fullname> + <gid>463</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>461</uid> + <user_password>!</user_password> + <username>vnc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for rpcbind</fullname> + <gid>65534</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>471</uid> + <user_password>!</user_password> + <username>rpc</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>user for colord</fullname> + <gid>466</gid> + <home>/var/lib/colord</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>464</uid> + <user_password>!</user_password> + <username>colord</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>nobody</fullname> + <gid>65534</gid> + <home>/var/lib/nobody</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>65534</uid> + <user_password>!</user_password> + <username>nobody</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>PulseAudio daemon</fullname> + <gid>468</gid> + <home>/var/lib/pulseaudio</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>466</uid> + <user_password>!</user_password> + <username>pulse</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NetworkManager user for OpenConnect</fullname> + <gid>464</gid> + <home>/var/lib/nm-openconnect</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>462</uid> + <user_password>!</user_password> + <username>nm-openconnect</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NetworkManager user for OpenVPN</fullname> + <gid>465</gid> + <home>/var/lib/openvpn</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>463</uid> + <user_password>!</user_password> + <username>nm-openvpn</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>TFTP account</fullname> + <gid>483</gid> + <home>/srv/tftpboot</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>497</uid> + <user_password>!</user_password> + <username>tftp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Chrony Daemon</fullname> + <gid>469</gid> + <home>/var/lib/chrony</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>467</uid> + <user_password>!</user_password> + <username>chrony</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for D-Bus</fullname> + <gid>499</gid> + <home>/run/dbus</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/bin/false</shell> + <uid>499</uid> + <user_password>!</user_password> + <username>messagebus</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>usbmuxd daemon</fullname> + <gid>65533</gid> + <home>/var/lib/usbmuxd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>465</uid> + <user_password>!</user_password> + <username>usbmux</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Flatpak system helper</fullname> + <gid>480</gid> + <home>/home/flatpak</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>492</uid> + <user_password>!</user_password> + <username>flatpak</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname/> + <gid>100</gid> + <home>/run/gnome-initial-setup/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>459</uid> + <user_password>!</user_password> + <username>gnome-initial-setup</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Smart Card Reader</fullname> + <gid>470</gid> + <home>/var/run/pcscd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>468</uid> + <user_password>!</user_password> + <username>scard</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Time Synchronization</fullname> + <gid>473</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>473</uid> + <user_password>!*</user_password> + <username>systemd-timesync</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Postfix Daemon</fullname> + <gid>51</gid> + <home>/var/spool/postfix</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>51</uid> + <user_password>!</user_password> + <username>postfix</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Mailer daemon</fullname> + <gid>498</gid> + <home>/var/spool/clientmqueue</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>498</uid> + <user_password>!</user_password> + <username>mail</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Gnome Display Manager daemon</fullname> + <gid>462</gid> + <home>/var/lib/gdm</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>460</uid> + <user_password>!</user_password> + <username>gdm</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>systemd Network Management</fullname> + <gid>475</gid> + <home>/</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/usr/sbin/nologin</shell> + <uid>475</uid> + <user_password>!*</user_password> + <username>systemd-network</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>NFS statd daemon</fullname> + <gid>65533</gid> + <home>/var/lib/nfs</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>469</uid> + <user_password>!</user_password> + <username>statd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Printing daemon</fullname> + <gid>488</gid> + <home>/var/spool/lpd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>495</uid> + <user_password>!</user_password> + <username>lp</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>User for nscd</fullname> + <gid>471</gid> + <home>/run/nscd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>470</uid> + <user_password>!</user_password> + <username>nscd</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>dnsmasq</fullname> + <gid>65533</gid> + <home>/var/lib/empty</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/false</shell> + <uid>496</uid> + <user_password>!</user_password> + <username>dnsmasq</username> + </user> + <!--root config root用户设置--> + <user> + <authorized_keys config:type="list"/> + <encrypted config:type="boolean">false</encrypted> + <fullname>root</fullname> + <gid>0</gid> + <home>/root</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/bin/bash</shell> + <uid>0</uid> + <!--rootPsw--> + <username>root</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>Daemon</fullname> + <gid>2</gid> + <home>/sbin</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>2</uid> + <user_password>!</user_password> + <username>daemon</username> + </user> + <user> + <encrypted config:type="boolean">true</encrypted> + <fullname>SSH daemon</fullname> + <gid>482</gid> + <home>/var/lib/sshd</home> + <home_btrfs_subvolume config:type="boolean">false</home_btrfs_subvolume> + <password_settings> + <expire/> + <flag/> + <inact/> + <max/> + <min/> + <warn/> + </password_settings> + <shell>/sbin/nologin</shell> + <uid>494</uid> + <user_password>!</user_password> + <username>sshd</username> + </user> + </users> + <pre-scripts config:type="list"> + <script> + <filename>pre.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[ + # please insert pre script at here 请在这个地方添加前置脚本 + ]]> + </source> + </script> + </pre-scripts> + <post-scripts config:type="list"> + <script> + <network_needed config:type="boolean">true</network_needed> + <filename>post.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[ + # please insert post script at here 请在这个地方添加后置脚本 + ]]> + </source> + </script> + </post-scripts> + <init-scripts config:type="list"> + <script> + <filename>post.sh</filename> + <debug config:type="boolean">true</debug> + <location></location> + <interpreter>shell</interpreter> + <source><![CDATA[]]></source> + </script> + </init-scripts> +</profile> diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/windows/sn-example/autounattend.xml b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/windows/sn-example/autounattend.xml new file mode 100644 index 0000000000000000000000000000000000000000..195b09b18b1c4b12358f4ea183255f0b76dd335c --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/windows/sn-example/autounattend.xml @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="generalize"> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + --computerName-- + <ProductKey>--WinActiveNum--</ProductKey> + <ShowWindowsLive>false</ShowWindowsLive> + <DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet> + <TimeZone>--TimeZone--</TimeZone> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <FirewallGroups> + <FirewallGroup wcm:action="add" wcm:keyValue="1"> + <Active>true</Active> + <Group>--WinRemoteDesktop--</Group> + <Profile>all</Profile> + </FirewallGroup> + </FirewallGroups> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>--WinIsDhcp--</DhcpEnabled> + <Metric>20</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <Identifier>--Ethernet--</Identifier> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">--WinStaticIp--/24</IpAddress> + </UnicastIpAddresses> + </Interface> + </Interfaces> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>--WinPassword--</Value> + <PlainText>true</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>1</LogonCount> + <Username>Administrator</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <PlainText>true</PlainText> + <Value>--WinPassword--</Value> + </AdministratorPassword> + --WinAddNewUser-- + </UserAccounts> + </component> + <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <SystemLocale>--Languages--</SystemLocale> + <UILanguage>--Languages--</UILanguage> + <UILanguageFallback>--Languages--</UILanguageFallback> + <UserLocale>--Languages--</UserLocale> + <InputLocale>--Languages--</InputLocale> + </component> + </settings> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallFrom> + <Path>install.wim</Path> + <MetaData wcm:action="add"> + <Key>/IMAGE/NAME</Key> + <Value>--OSDistributions--</Value> + </MetaData> + </InstallFrom> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>--DiskPartStartNo--</PartitionID> + </InstallTo> + <WillShowUI>OnError</WillShowUI> + </OSImage> + </ImageInstall> + <UserData> + <ProductKey> + <WillShowUI>OnError</WillShowUI> + <Key>--WinActiveNum--</Key> + </ProductKey> + <AcceptEula>true</AcceptEula> + </UserData> + <EnableFirewall>true</EnableFirewall> + <EnableNetwork>true</EnableNetwork> + --WinDiskPart-- + </component> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <SetupUILanguage> + <UILanguage>--Languages--</UILanguage> + </SetupUILanguage> + <InputLocale>--Languages--</InputLocale> + <SystemLocale>--Languages--</SystemLocale> + <UILanguage>--Languages--</UILanguage> + <UserLocale>--Languages--</UserLocale> + <UILanguageFallback>zh-CN</UILanguageFallback> + </component> + <component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DriverPaths> + <PathAndCredentials wcm:action="add" wcm:keyValue="1"> + <Path>y:\windows_drivers\winpe</Path> + </PathAndCredentials> + </DriverPaths> + </component> + </settings> + <settings pass="offlineServicing"> + <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DriverPaths> + <PathAndCredentials wcm:action="add" wcm:keyValue="1"> + <Path>y:\windows_drivers\drivers</Path> + </PathAndCredentials> + </DriverPaths> + </component> + <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <EnableLUA>false</EnableLUA> + </component> + </settings> + <cpi:offlineImage cpi:source="catalog://osinstall/image/windows/clg/install_windows server 2012 r2 serverdatacenter.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/windows/sn-example/install.bat b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/windows/sn-example/install.bat new file mode 100644 index 0000000000000000000000000000000000000000..8a71f89f884479f6fbd643a9431794a67426c05e --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/osInstall/ks/windows/sn-example/install.bat @@ -0,0 +1,25 @@ +wpeinit +ping -n 5 127.0.0.1 > nul + +move AUTOUNATTEND.XML / +cd / +set _SERVER=--server-- +set _PORT=--port-- +set _SN=--sn-- +set _IMAGE_PATH=--path-- +set _FILE_SERVER=--fileserver-- +set _TASK_ID=--taskId-- +set _JOB_ID=--jobId-- + +net use * /del + +ping -n 5 %_SERVER% + +net use y: \\%_SERVER%\sambaroot 123456a? /user:isib + +ping -n 5 %_FILE_SERVER% + +net use y: \\%_FILE_SERVER%\sambaroot 123456a? /user:isib + +rem start install +%systemdrive%\start.cmd %_SERVER% %_PORT% %_SN% %_IMAGE_PATH% %_FILE_SERVER% %_TASK_ID% %_JOB_ID% diff --git a/InManageBoot-installer/controlfile/result/webservice/osInstall/mount/readme.txt b/InManageBoot-installer/controlfile/result/webservice/osInstall/mount/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/InManageBoot-installer/controlfile/result/webservice/webserverip b/InManageBoot-installer/controlfile/result/webservice/webserverip new file mode 100644 index 0000000000000000000000000000000000000000..2e6b2fe4ac125fce5e57f7346537cf7107aab715 --- /dev/null +++ b/InManageBoot-installer/controlfile/result/webservice/webserverip @@ -0,0 +1 @@ +192.168.1.2 \ No newline at end of file diff --git a/InManageBoot-ui/README.md b/InManageBoot-ui/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b87cb00449efa5b6131f56b7e45cc63eddf37373 --- /dev/null +++ b/InManageBoot-ui/README.md @@ -0,0 +1,46 @@ +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.\ +You will also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. + +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/README.md b/README.md index ddcdc6bf9f3b6dde77a799f56c160e4d09fa65eb..75fccb4f489bde4c3b09c31c7943b4279a4ecb8a 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,168 @@ # InManageBoot -#### 介绍 -InManage Boot服务器部署平台是面向数据中心基础设施的批量开局管理方案,围绕资源管理、RAID配置、系统部署和迁移等功能,构建服务器统一的裸机批量管理平台,能有效地帮助用户提高运维效率、降低运维成本,保障数据中心快速投产、可靠稳定的运行。 +## 介绍 -#### 软件架构 -软件架构说明 +InManageBoot服务器部署平台是面向数据中心基础设施的批量开局管理方案,面向企业和IDC行业提供服务器批量初始化管理,支撑客户对服务器设备在生命周期各阶段易用、高效的运维管理,为用户带来极致体验。 +该软件实现对服务器的可视化管理,提供对服务器的设备管理、阵列卡管理、系统安装、用户配置、系统克隆、压力测试等全生命周期的管理能力,有效帮助运维人员提高运维效率、降低运维成本,保障数据中心快速投产、稳定的运行,所有操作支持一站式完成,无人值守,高效运维。 -#### 安装教程 +InManageBoot软件可广泛应用于数据中心运营商和企业客户,能够在互联网、金融、电信等众多行业领域场景下,帮助用户快速完成服务器阵列卡配置、系统安装等初始化工作。 -1. xxxx -2. xxxx -3. xxxx +传统模式下,物理机安装依赖人工手动用光盘或U盘安装,硬件种类繁多,一台台配置更加复杂。面对大规模应用上线,物理机交付的滞后性会成为制约业务发展的瓶颈。所以必须要解决标准化和自动化问题,才能满足大规模部署的需求。 -#### 使用说明 +## 软件架构 -1. xxxx -2. xxxx -3. xxxx +![pFZFkm4.png](https://s11.ax1x.com/2024/01/22/pFZFkm4.png) -#### 参与贡献 -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +## 产品功能 +InManage Boot软件是浪潮信息公司研发的,面向服务器全生命周期的带内自动化运维管理解决方案。 -#### 特技 +### 设备管理 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +轻量级资产管理,InManageBoot支持服务器资源的集中管理,支持批量导入、单个添加设备信息,为后续的功能使用提供数据支持。 +管理范围包括:浪潮信息通用服务器、AI智能服务器及机柜、刀片、机架服务器,支持裸机的管理。 +管理功能包括:设备电源管理、刷新设备信息、系统探测、系统克隆、网络管理、设备查询、设备编辑、设备删除功能。 + +### 模板 + +支持多种任务的模板创建。可支持的模板功能如下: +- 阵列卡管理模板 + - InManageBoot软件提供批量修改RAID配置的功能,支持自定义指令设置。 + - 支持LSI、PMC两大阵列卡厂商的主流RAID配置,同时支持多阵列卡配置。 +- 系统安装模板 + - 支持从仓库镜像模块手动导入OS镜像,对导入的OS镜像进行管理系统安装。 + - InManageBoot支持使用带内网络,挂载OS镜像,提供操作系统批量自动安装的功能,可同时支持50台以上设备批量部署OS,能够单日完成1000+OS部署任务。系统安装前,可选择基础环境、设置挂载点、磁盘选择等分区操作。 +- 用户配置模板 + - InManageBoot软件支持配置BMC的用户模板。可自定义创建或者修改BMC的管理员用户密码。 +- 压力测试模板 + - InManageBoot软件提供服务器性能测试功能,批量测试设备CPU、内存等配件的性能,并导出测试数据,验证设备性能是否达到要求。在测试之前可以设置采集周期和测试频率。 +- 自定义模板 + - InManageBoot软件支持用户自定义模板。支持上传自定义的脚本、工具。并将自定义的脚本工具分发到待执行服务器批量执行。 + +### 镜像 + +- 支持操作系统镜像的管理。包括系统镜像的添加、删除、修改。 +- 支持磁盘镜像的还原功能。 + +### 任务管理 + +- 支持客户通过“作业”查看任务当前进度,主要展示的任务信息包括:任务名称、执行类型、任务状态、开始时间、结束时间、任务进展、已耗时。 +- 支持作业的停止、搜索 +- 用户可以对历史作业进行管理,查看作业执行日志或删除已经完成的作业。 + +### 设置 + +通过服务管理、工作IP管理,实现对InManageBoot软件本身的配置管理,保证InManageBoot软件的稳定和鲁棒性。 +- 服务管理 +InManageBoot软件提供服务管理的功能 对InManageBoot Server服务器所需服务的查看与管理,实时查看DHCP、DNS、SAMBA、NGINX、TFTP服务状态,支持服务的启停管理。 +- 工作IP管理 +可以选择开局交付的工作IP,确定后基于此IP开启DHCP服务。 + + +## 关键技术特性 + +- 自动化运维,支撑全生命周期设备管理 +InManageBoot提供多种场景部署能力,从出厂裸机初始化场景(未配置带外网络),到生产环境自动化运维,提供丰富的管理模板,为自动化运维提供全面支持。 +- 裸机一站式部署,支持一键上架 +InManageBoot提供从系统探测、硬件配置、操作系统部署一站式部署的能力,使服务器从零配置到上线生产环境,一键完成。 +- 任务自由编排,提供多场景运维能力 +基于“资产-操作-编排-作业”的产品技术架构,任务结构自由编排,灵活组合,支持管理网络搭建,raid批量配置;自定义指定批量下发,操作系统批量部署和配置等运维各种场景。 +- 大规模部署技术架构,缩短上线周期 +优化传统PXE技术缺陷,单节点模式可保证并发50台以上设备批量任务执行,单日完成1000+服务器上架。 +- 无需预配置网络环境,即插即用 +与带外部署操作系统需要依赖带外网络环境不同,基于PXE技术的InManageBoot不需要依赖任何预配置网络环境,只需要服务端与客户端网络可达,避免大规模部署前需要批量配置带外网络的痛点。 +- 精准日志,执行结果指令级别追溯 +执行日志精确到每一条指令,快速统计、查看执行结果和准确率;支持查看历史任务日志。 +- 传统PXE技术优化,提升数据传输性能 +InManageBoot批量上架是基于PXE技术实现的大规模批量部署功能,但较于传统PXE,InManageBoot采用的PXE方案的优势在于可以通过HTTP方式传输InManageBoot客户端,拥有远高于TFTP服务的传输速度,并通过简易的配置可以同时支持Legacy和UEFI两种启动方式。 + +## 安装部署 + +### 系统依赖 + +- RedHat/CentOS 7.0以上版本,对系统安装的包没有要求,最小化安装即可 +- 关闭防火墙 +``` + service iptables stop + chkconfig iptables off +``` +- 关闭selinux(需重启生效) +``` + sed -i.bak '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux +``` + +### 基础组件安装 +- mysql安装 +安装mysql8.0及以上版本,可在mysql官网下载最新安装版本 +[https://www.mysql.com/downloads/](https://www.mysql.com/downloads/) +- nfs安装 +使用命令安装nfs组件:``yum install nfs-utils`` +- tftp组件安装 +使用命令安装tftp组件:``yum install tftp tftp-server`` +- samba组件安装 +使用命令安装samba组件:``yum install samba`` +- nginx组件安装 +使用命令安装nginx组件:``yum install nginx`` +- xinetd组件安装 +使用命令安装xinetd组件:``yum install xinetd`` +- dhcp组件安装 +使用命令安装dhcp组件:``yum install dhcp`` +- java组件安装 +使用命令安装java组件:``yum install java-17-openjdk`` + +### 基础组件配置 +- mysql组件配置 + +1. 使用配置中的my.cnf文件替换/etc/my.cnf文件 +2. 拷贝项目中的add_index.sql文件至/usr/local/ibootcfg/lib/目录 +2. 初始化mysql密码,执行如下命令 +``` + mkdir -p /opt/inmanage/mysql + systemctl stop mysqld + mysqld --initialize --console + chown -R mysql:mysql /opt/inmanage/mysql + systemctl start mysqld + mysql_init_password=`cat /opt/inmanage/mysql/mysqld-error.log | grep "root@localhost:" | awk -F "root@localhost:" '{print $2}'` + mysqladmin -uroot -p${mysql_init_password} password 'Inspur1!' + mysql -uroot -p${inmanage_module_secret_key} -e "CREATE USER 'inmanagedba'@'%' IDENTIFIED BY '${inmanage_module_secret_key}';" + mysql -uroot -p${inmanage_module_secret_key} -e "USE mysql;UPDATE user SET host = '%' WHERE user = 'root';FLUSH PRIVILEGES;" + mysql -uroot -p${inmanage_module_secret_key} -e "CREATE DATABASE IF NOT EXISTS inmanagedb DEFAULT charset utf8 COLLATE utf8_bin;" + mysql -uroot -p${inmanage_module_secret_key} -e "GRANT ALL PRIVILEGES ON inmanagedb.* TO inmanagedba@'%';" + mysql -uroot -p${inmanage_module_secret_key} -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;FLUSH PRIVILEGES;" + mysql -uroot -p${inmanage_module_secret_key} inmanagedb < /usr/local/ibootcfg/lib/add_index.sql +``` + +- samba配置 +1. 拷贝smb-sample.conf至/etc/samba/smb.conf +2. 执行配置命令 +``` +mkdir -p /usr/local/samba/windows_driver +mkdir -p /usr/local/samba/image +chmod -R 755 /usr/local/samba +groupadd sambagroup > /dev/null 2>&1 +useradd isib -g sambagroup -s /sbinlogin > /dev/null 2>&1 +(echo 'Inspur1!';echo 'Inspur1!') | smbpasswd -s -a isib +``` + +- nginx配置 +1. 拷贝nginx.conf至/etc/nginx/nginx.conf + +- tftp配置 +1. 拷贝tftp-sample文件至/etc/xinetd.d/tftp +2. 执行配置命令 +``` +mkdir -p /usr/local/tftpboot/ +cp -rf ibootcfg/data/iboot/init/ibootInstall/cfg/{ipxe.efi,snponly.efi,undionly.kpxe} /usr/local/tftpboot/ +chmod -R 755 /usr/local/tftpboot/ +``` + +- dhcp配置 +1. 拷贝dhcpd-sample.conf至/etc/dhcp/dhcpd.conf + + + +## 项目地址 + +* [https://gitee.com/anolis/InManageBoot](https://gitee.com/anolis/InManageBoot)