update v1.2.0
This commit is contained in:
parent
eb6fd372ba
commit
3a27221f4a
@ -1,47 +0,0 @@
|
|||||||
From 34007d0d2fba94e43fbaf294d18cb2fc68857116 Mon Sep 17 00:00:00 2001
|
|
||||||
From: gaoruoshu <gaoruoshu@huawei.com>
|
|
||||||
Date: Wed, 9 Aug 2023 15:07:04 +0800
|
|
||||||
Subject: [PATCH 1/3] bugfix: transfer can only save file to specified dir
|
|
||||||
|
|
||||||
---
|
|
||||||
analysis/engine/transfer.py | 10 +++++++---
|
|
||||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/analysis/engine/transfer.py b/analysis/engine/transfer.py
|
|
||||||
index 7fa5777..154f3df 100644
|
|
||||||
--- a/analysis/engine/transfer.py
|
|
||||||
+++ b/analysis/engine/transfer.py
|
|
||||||
@@ -31,7 +31,7 @@ LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class Transfer(Resource):
|
|
||||||
"""restful api for transfer"""
|
|
||||||
- file_path = "/etc/atuned/"
|
|
||||||
+ file_path = "/etc/atuned/{service}"
|
|
||||||
|
|
||||||
def post(self):
|
|
||||||
"""provide the method of post"""
|
|
||||||
@@ -40,15 +40,19 @@ class Transfer(Resource):
|
|
||||||
file_obj = request.files.get("file")
|
|
||||||
service = request.form.get("service")
|
|
||||||
|
|
||||||
+ target_path = self.file_path.format(service=service)
|
|
||||||
+ dir_name, _ = os.path.split(os.path.abspath(save_path))
|
|
||||||
+ if not dir_name == target_path:
|
|
||||||
+ return "illegal path to save file", 400
|
|
||||||
+
|
|
||||||
if service == "classification":
|
|
||||||
os.makedirs(ANALYSIS_DATA_PATH, exist_ok=True)
|
|
||||||
- file_name = ANALYSIS_DATA_PATH + save_path.split(self.file_path + service)[1][1:]
|
|
||||||
+ file_name = ANALYSIS_DATA_PATH + save_path.split(target_path)[1][1:]
|
|
||||||
current_app.logger.info(file_name)
|
|
||||||
file_obj.save(file_name)
|
|
||||||
return file_name, 200
|
|
||||||
|
|
||||||
file_obj.save(save_path)
|
|
||||||
- target_path = self.file_path + service
|
|
||||||
res = utils.extract_file(save_path, target_path)
|
|
||||||
os.remove(save_path)
|
|
||||||
return res, 200
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
From 09c719964b362fa358c705a7b7e24bb02a1259bb Mon Sep 17 00:00:00 2001
|
|
||||||
From: zhoupengcheng <zhoupengcheng11@huawei.com>
|
|
||||||
Date: Wed, 8 Nov 2023 12:32:43 +0800
|
|
||||||
Subject: [PATCH] 0001-define-fix-privilege-escalation.patch
|
|
||||||
|
|
||||||
---
|
|
||||||
modules/client/profile/profile_define.go | 16 +++++++++++++++-
|
|
||||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/modules/client/profile/profile_define.go b/modules/client/profile/profile_define.go
|
|
||||||
index 87b3781..24e31d3 100644
|
|
||||||
--- a/modules/client/profile/profile_define.go
|
|
||||||
+++ b/modules/client/profile/profile_define.go
|
|
||||||
@@ -19,6 +19,7 @@ import (
|
|
||||||
SVC "gitee.com/openeuler/A-Tune/common/service"
|
|
||||||
"gitee.com/openeuler/A-Tune/common/utils"
|
|
||||||
"fmt"
|
|
||||||
+ "regexp"
|
|
||||||
"io/ioutil"
|
|
||||||
|
|
||||||
"github.com/go-ini/ini"
|
|
||||||
@@ -88,11 +89,22 @@ func profileDefined(ctx *cli.Context) error {
|
|
||||||
if err := profileDefineCheck(ctx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ detectRule := `[./].*`
|
|
||||||
+ detectPathchar := regexp.MustCompile(detectRule)
|
|
||||||
+
|
|
||||||
serviceType := ctx.Args().Get(0)
|
|
||||||
+ if detectPathchar.MatchString(serviceType) {
|
|
||||||
+ return fmt.Errorf("serviceType:%s cannot contain special path characters '/' or '.' ", serviceType)
|
|
||||||
+ }
|
|
||||||
if !utils.IsInputStringValid(serviceType) {
|
|
||||||
return fmt.Errorf("input:%s is invalid", serviceType)
|
|
||||||
}
|
|
||||||
applicationName := ctx.Args().Get(1)
|
|
||||||
+ if detectPathchar.MatchString(applicationName) {
|
|
||||||
+ return fmt.Errorf("applicationName:%s cannot contain special path characters '/' or '.' ", applicationName)
|
|
||||||
+ }
|
|
||||||
if !utils.IsInputStringValid(applicationName) {
|
|
||||||
return fmt.Errorf("input:%s is invalid", applicationName)
|
|
||||||
}
|
|
||||||
@@ -100,7 +112,9 @@ func profileDefined(ctx *cli.Context) error {
|
|
||||||
if !utils.IsInputStringValid(scenarioName) {
|
|
||||||
return fmt.Errorf("input:%s is invalid", scenarioName)
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+ if detectPathchar.MatchString(scenarioName) {
|
|
||||||
+ return fmt.Errorf("scenarioName:%s cannot contain special path characters '/' or '.' ", scenarioName)
|
|
||||||
+ }
|
|
||||||
data, err := ioutil.ReadFile(ctx.Args().Get(3))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
@ -1,290 +0,0 @@
|
|||||||
From 65d2dc509e851d138154ee6a8a3ff3acb3780a30 Mon Sep 17 00:00:00 2001
|
|
||||||
From: gaoruoshu <gaoruoshu@huawei.com>
|
|
||||||
Date: Wed, 9 Aug 2023 19:15:07 +0800
|
|
||||||
Subject: [PATCH 2/3] bugfix: training model can only save file to specified
|
|
||||||
dir
|
|
||||||
|
|
||||||
---
|
|
||||||
analysis/default_config.py | 1 +
|
|
||||||
analysis/engine/parser.py | 4 +--
|
|
||||||
analysis/engine/train.py | 38 ++++++++++++++++++----
|
|
||||||
api/profile/profile.pb.go | 6 ++--
|
|
||||||
api/profile/profile.proto | 2 +-
|
|
||||||
common/models/training.go | 2 +-
|
|
||||||
modules/client/profile/profile_train.go | 42 +++++++++----------------
|
|
||||||
modules/server/profile/profile.go | 4 +--
|
|
||||||
8 files changed, 56 insertions(+), 43 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/analysis/default_config.py b/analysis/default_config.py
|
|
||||||
index cf56ac2..7c921cc 100644
|
|
||||||
--- a/analysis/default_config.py
|
|
||||||
+++ b/analysis/default_config.py
|
|
||||||
@@ -23,6 +23,7 @@ GRPC_CERT_PATH = '/etc/atuned/grpc_certs'
|
|
||||||
ANALYSIS_DATA_PATH = '/var/atune_data/analysis/'
|
|
||||||
TUNING_DATA_PATH = '/var/atune_data/tuning/'
|
|
||||||
TUNING_DATA_DIRS = ['running', 'finished', 'error']
|
|
||||||
+TRAINING_MODEL_PATH = '/usr/libexec/atuned/analysis/models/'
|
|
||||||
|
|
||||||
|
|
||||||
def get_or_default(config, section, key, value):
|
|
||||||
diff --git a/analysis/engine/parser.py b/analysis/engine/parser.py
|
|
||||||
index c16089f..c36c74d 100644
|
|
||||||
--- a/analysis/engine/parser.py
|
|
||||||
+++ b/analysis/engine/parser.py
|
|
||||||
@@ -69,8 +69,8 @@ CLASSIFICATION_POST_PARSER.add_argument('model',
|
|
||||||
TRAIN_POST_PARSER = reqparse.RequestParser()
|
|
||||||
TRAIN_POST_PARSER.add_argument('datapath', required=True,
|
|
||||||
help="The datapath can not be null")
|
|
||||||
-TRAIN_POST_PARSER.add_argument('outputpath', required=True,
|
|
||||||
- help="The output path can not be null")
|
|
||||||
+TRAIN_POST_PARSER.add_argument('modelname', required=True,
|
|
||||||
+ help="The model name can not be null")
|
|
||||||
TRAIN_POST_PARSER.add_argument('modelpath', required=True,
|
|
||||||
help="The model path can not be null")
|
|
||||||
|
|
||||||
diff --git a/analysis/engine/train.py b/analysis/engine/train.py
|
|
||||||
index 9fdca46..7608660 100644
|
|
||||||
--- a/analysis/engine/train.py
|
|
||||||
+++ b/analysis/engine/train.py
|
|
||||||
@@ -22,6 +22,7 @@ from flask_restful import Resource
|
|
||||||
|
|
||||||
from analysis.optimizer.workload_characterization import WorkloadCharacterization
|
|
||||||
from analysis.engine.parser import TRAIN_POST_PARSER
|
|
||||||
+from analysis.default_config import TRAINING_MODEL_PATH
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ LOGGER = logging.getLogger(__name__)
|
|
||||||
class Training(Resource):
|
|
||||||
"""provide the method of post for training"""
|
|
||||||
model_path = "modelpath"
|
|
||||||
- output_path = "outputpath"
|
|
||||||
+ model_name = "modelname"
|
|
||||||
data_path = "datapath"
|
|
||||||
|
|
||||||
def post(self):
|
|
||||||
@@ -40,18 +41,43 @@ class Training(Resource):
|
|
||||||
LOGGER.info(args)
|
|
||||||
|
|
||||||
model_path = args.get(self.model_path)
|
|
||||||
- output_path = args.get(self.output_path)
|
|
||||||
+ model_name = args.get(self.model_name)
|
|
||||||
data_path = args.get(self.data_path)
|
|
||||||
|
|
||||||
+ valid, err = valid_model_name(model_name)
|
|
||||||
+ if not valid:
|
|
||||||
+ return "Illegal model name provide: {}".format(err), 400
|
|
||||||
+
|
|
||||||
characterization = WorkloadCharacterization(model_path)
|
|
||||||
try:
|
|
||||||
+ output_path = TRAINING_MODEL_PATH + model_name
|
|
||||||
characterization.retrain(data_path, output_path)
|
|
||||||
except Exception as err:
|
|
||||||
LOGGER.error(err)
|
|
||||||
abort(500)
|
|
||||||
|
|
||||||
- if os.path.isdir(data_path):
|
|
||||||
- shutil.rmtree(data_path)
|
|
||||||
- else:
|
|
||||||
- os.remove(data_path)
|
|
||||||
return {}, 200
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+def valid_model_name(name):
|
|
||||||
+ file_name, file_ext = os.path.splitext(name)
|
|
||||||
+
|
|
||||||
+ if file_ext != ".m":
|
|
||||||
+ return False, "the ext of model name should be .m"
|
|
||||||
+
|
|
||||||
+ if file_name in ['scaler', 'aencoder', 'tencoder', 'default_clf', 'total_clf', 'throughput_performance_clf']:
|
|
||||||
+ return False, "model name cannot be set as default_clf/scaler/aencoder/tencoder/throughput_performance_clf/total_clf"
|
|
||||||
+
|
|
||||||
+ for ind, char in enumerate(file_name):
|
|
||||||
+ if 'a' <= char <= 'z':
|
|
||||||
+ continue
|
|
||||||
+ if 'A' <= char <= 'Z':
|
|
||||||
+ continue
|
|
||||||
+ if '0' <= char <= '9':
|
|
||||||
+ continue
|
|
||||||
+ if ind != 0 and ind != len(file_name) - 1 and char == '_':
|
|
||||||
+ continue
|
|
||||||
+ return False, "model name cannot contains special character"
|
|
||||||
+
|
|
||||||
+ return True, None
|
|
||||||
+
|
|
||||||
diff --git a/api/profile/profile.pb.go b/api/profile/profile.pb.go
|
|
||||||
index dba166d..81a6757 100644
|
|
||||||
--- a/api/profile/profile.pb.go
|
|
||||||
+++ b/api/profile/profile.pb.go
|
|
||||||
@@ -493,7 +493,7 @@ func (m *CollectFlag) GetType() string {
|
|
||||||
|
|
||||||
type TrainMessage struct {
|
|
||||||
DataPath string `protobuf:"bytes,1,opt,name=DataPath,proto3" json:"DataPath,omitempty"`
|
|
||||||
- OutputPath string `protobuf:"bytes,2,opt,name=OutputPath,proto3" json:"OutputPath,omitempty"`
|
|
||||||
+ ModelName string `protobuf:"bytes,2,opt,name=ModelName,proto3" json:"ModelName,omitempty"`
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
@@ -531,9 +531,9 @@ func (m *TrainMessage) GetDataPath() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
-func (m *TrainMessage) GetOutputPath() string {
|
|
||||||
+func (m *TrainMessage) GetModelName() string {
|
|
||||||
if m != nil {
|
|
||||||
- return m.OutputPath
|
|
||||||
+ return m.ModelName
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
diff --git a/api/profile/profile.proto b/api/profile/profile.proto
|
|
||||||
index 2a6e751..29cf91e 100755
|
|
||||||
--- a/api/profile/profile.proto
|
|
||||||
+++ b/api/profile/profile.proto
|
|
||||||
@@ -84,7 +84,7 @@ message CollectFlag {
|
|
||||||
|
|
||||||
message TrainMessage {
|
|
||||||
string DataPath = 1;
|
|
||||||
- string OutputPath = 2;
|
|
||||||
+ string ModelName = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DetectMessage {
|
|
||||||
diff --git a/common/models/training.go b/common/models/training.go
|
|
||||||
index 3cc9d60..9497261 100644
|
|
||||||
--- a/common/models/training.go
|
|
||||||
+++ b/common/models/training.go
|
|
||||||
@@ -24,7 +24,7 @@ import (
|
|
||||||
type Training struct {
|
|
||||||
DataPath string `json:"datapath"`
|
|
||||||
ModelPath string `json:"modelpath"`
|
|
||||||
- OutputPath string `json:"outputpath"`
|
|
||||||
+ ModelName string `json:"modelname"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Post method call training service
|
|
||||||
diff --git a/modules/client/profile/profile_train.go b/modules/client/profile/profile_train.go
|
|
||||||
index f4e68cb..a645bc3 100644
|
|
||||||
--- a/modules/client/profile/profile_train.go
|
|
||||||
+++ b/modules/client/profile/profile_train.go
|
|
||||||
@@ -18,9 +18,9 @@ import (
|
|
||||||
"gitee.com/openeuler/A-Tune/common/client"
|
|
||||||
SVC "gitee.com/openeuler/A-Tune/common/service"
|
|
||||||
"gitee.com/openeuler/A-Tune/common/utils"
|
|
||||||
+ "gitee.com/openeuler/A-Tune/common/config"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
- "os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
|
||||||
@@ -39,8 +39,8 @@ var trainCommand = cli.Command{
|
|
||||||
Value: "",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
- Name: "output_file,o",
|
|
||||||
- Usage: "the model to be generated",
|
|
||||||
+ Name: "model_name,m",
|
|
||||||
+ Usage: "the model name of generate model",
|
|
||||||
Value: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
@@ -48,9 +48,9 @@ var trainCommand = cli.Command{
|
|
||||||
desc := `
|
|
||||||
training a new model with the self collected data, data_path option specified
|
|
||||||
the path that storage the collected data, the collected data must have more
|
|
||||||
- than two workload type. output_file specified the file path where to store
|
|
||||||
+ than two workload type. model_name specified the name of model to be generated
|
|
||||||
the trained model, which must be end with .m.
|
|
||||||
- example: atune-adm train --data_path=./data --output_file=./model/trained.m`
|
|
||||||
+ example: atune-adm train --data_path=/home/data --model_name=trained.m`
|
|
||||||
return desc
|
|
||||||
}(),
|
|
||||||
Action: train,
|
|
||||||
@@ -82,13 +82,13 @@ func checkTrainCtx(ctx *cli.Context) error {
|
|
||||||
return fmt.Errorf("input:%s is invalid", dataPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
- outputPath := ctx.String("output_file")
|
|
||||||
- if outputPath == "" {
|
|
||||||
+ modelName := ctx.String("model_name")
|
|
||||||
+ if modelName == "" {
|
|
||||||
_ = cli.ShowCommandHelp(ctx, "train")
|
|
||||||
- return fmt.Errorf("error: output_file must be specified")
|
|
||||||
+ return fmt.Errorf("error: model_name must be specified")
|
|
||||||
}
|
|
||||||
- if !utils.IsInputStringValid(outputPath) {
|
|
||||||
- return fmt.Errorf("input:%s is invalid", outputPath)
|
|
||||||
+ if !utils.IsInputStringValid(modelName) {
|
|
||||||
+ return fmt.Errorf("input:%s is invalid", modelName)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
@@ -103,23 +103,8 @@ func train(ctx *cli.Context) error {
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
- outputPath, err := filepath.Abs(ctx.String("output_file"))
|
|
||||||
- if err != nil {
|
|
||||||
- return err
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- dir := filepath.Dir(outputPath)
|
|
||||||
|
|
||||||
- exist, err := utils.PathExist(dir)
|
|
||||||
- if err != nil {
|
|
||||||
- return err
|
|
||||||
- }
|
|
||||||
- if !exist {
|
|
||||||
- err = os.MkdirAll(dir, utils.FilePerm)
|
|
||||||
- if err != nil {
|
|
||||||
- return err
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ modelName := ctx.String("model_name")
|
|
||||||
|
|
||||||
c, err := client.NewClientFromContext(ctx)
|
|
||||||
if err != nil {
|
|
||||||
@@ -128,7 +113,7 @@ func train(ctx *cli.Context) error {
|
|
||||||
defer c.Close()
|
|
||||||
|
|
||||||
svc := PB.NewProfileMgrClient(c.Connection())
|
|
||||||
- stream, err := svc.Training(CTX.Background(), &PB.TrainMessage{DataPath: dataPath, OutputPath: outputPath})
|
|
||||||
+ stream, err := svc.Training(CTX.Background(), &PB.TrainMessage{DataPath: dataPath, ModelName: modelName})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
@@ -145,6 +130,7 @@ func train(ctx *cli.Context) error {
|
|
||||||
}
|
|
||||||
utils.Print(reply)
|
|
||||||
}
|
|
||||||
- fmt.Println("the model generate path:", outputPath)
|
|
||||||
+ modelPath := fmt.Sprintf("%s/models/%s", config.DefaultAnalysisPath, modelName)
|
|
||||||
+ fmt.Println("the model generate path:", modelPath)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
diff --git a/modules/server/profile/profile.go b/modules/server/profile/profile.go
|
|
||||||
index 3264167..70047ca 100644
|
|
||||||
--- a/modules/server/profile/profile.go
|
|
||||||
+++ b/modules/server/profile/profile.go
|
|
||||||
@@ -1137,7 +1137,7 @@ func (s *ProfileServer) Training(message *PB.TrainMessage, stream PB.ProfileMgr_
|
|
||||||
}
|
|
||||||
|
|
||||||
DataPath := message.GetDataPath()
|
|
||||||
- OutputPath := message.GetOutputPath()
|
|
||||||
+ ModelName := message.GetModelName()
|
|
||||||
|
|
||||||
compressPath, err := utils.CreateCompressFile(DataPath)
|
|
||||||
if err != nil {
|
|
||||||
@@ -1156,7 +1156,7 @@ func (s *ProfileServer) Training(message *PB.TrainMessage, stream PB.ProfileMgr_
|
|
||||||
|
|
||||||
trainBody := new(models.Training)
|
|
||||||
trainBody.DataPath = trainPath
|
|
||||||
- trainBody.OutputPath = OutputPath
|
|
||||||
+ trainBody.ModelName = ModelName
|
|
||||||
trainBody.ModelPath = path.Join(config.DefaultAnalysisPath, "models")
|
|
||||||
|
|
||||||
success, err := trainBody.Post()
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
From 8c411e610d702daf9e7505c1500163c481f7ed69 Mon Sep 17 00:00:00 2001
|
|
||||||
From: zhoupengcheng <zhoupengcheng11@huawei.com>
|
|
||||||
Date: Wed, 1 Nov 2023 17:45:05 +0800
|
|
||||||
Subject: [PATCH] 0002-define-fix-privilege-escalation.patch
|
|
||||||
|
|
||||||
---
|
|
||||||
modules/server/profile/profile.go | 26 +++++++++++++++++++++++++-
|
|
||||||
1 file changed, 25 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/modules/server/profile/profile.go b/modules/server/profile/profile.go
|
|
||||||
index 5cdaa9a..cbf48b9 100644
|
|
||||||
--- a/modules/server/profile/profile.go
|
|
||||||
+++ b/modules/server/profile/profile.go
|
|
||||||
@@ -1277,8 +1277,32 @@ func (s *ProfileServer) Define(ctx context.Context, message *PB.DefineMessage) (
|
|
||||||
applicationName := message.GetApplicationName()
|
|
||||||
scenarioName := message.GetScenarioName()
|
|
||||||
content := string(message.GetContent())
|
|
||||||
- profileName := serviceType + "-" + applicationName + "-" + scenarioName
|
|
||||||
|
|
||||||
+ detectRule := `[./].*`
|
|
||||||
+ detectPathchar := regexp.MustCompile(detectRule)
|
|
||||||
+
|
|
||||||
+ if detectPathchar.MatchString(serviceType) {
|
|
||||||
+ return &PB.Ack{}, fmt.Errorf("serviceType:%s cannot contain special path characters '/' or '.' ", serviceType)
|
|
||||||
+ }
|
|
||||||
+ if !utils.IsInputStringValid(serviceType) {
|
|
||||||
+ return &PB.Ack{}, fmt.Errorf("input:%s is invalid", serviceType)
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if detectPathchar.MatchString(applicationName) {
|
|
||||||
+ return &PB.Ack{}, fmt.Errorf("applicationName:%s cannot contain special path characters '/' or '.' ", applicationName)
|
|
||||||
+ }
|
|
||||||
+ if !utils.IsInputStringValid(applicationName) {
|
|
||||||
+ return &PB.Ack{}, fmt.Errorf("input:%s is invalid", applicationName)
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if detectPathchar.MatchString(scenarioName) {
|
|
||||||
+ return &PB.Ack{}, fmt.Errorf("scenarioName:%s cannot contain special path characters '/' or '.' ", scenarioName)
|
|
||||||
+ }
|
|
||||||
+ if !utils.IsInputStringValid(scenarioName) {
|
|
||||||
+ return &PB.Ack{}, fmt.Errorf("input:%s is invalid", scenarioName)
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ profileName := serviceType + "-" + applicationName + "-" + scenarioName
|
|
||||||
workloadTypeExist, err := sqlstore.ExistWorkloadType(profileName)
|
|
||||||
if err != nil {
|
|
||||||
return &PB.Ack{}, err
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
@ -1,211 +0,0 @@
|
|||||||
From 4b357a57599ed623abbe094838d22895dc22fb5a Mon Sep 17 00:00:00 2001
|
|
||||||
From: gaoruoshu <gaoruoshu@huawei.com>
|
|
||||||
Date: Wed, 9 Aug 2023 21:41:10 +0800
|
|
||||||
Subject: [PATCH 3/3] bugfix: collection res can only save file to specified
|
|
||||||
dir
|
|
||||||
|
|
||||||
---
|
|
||||||
Makefile | 3 +++
|
|
||||||
api/profile/profile.pb.go | 6 ++---
|
|
||||||
api/profile/profile.proto | 2 +-
|
|
||||||
common/config/config.go | 1 +
|
|
||||||
modules/client/profile/profile_collection.go | 24 ++++++--------------
|
|
||||||
modules/server/profile/profile.go | 11 +++++----
|
|
||||||
6 files changed, 21 insertions(+), 26 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index 5d9d317..bcac447 100755
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -53,6 +53,7 @@ cleanall: clean
|
|
||||||
rm -rf $(DESTDIR)/var/lib/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/run/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/atuned/
|
|
||||||
+ rm -rf $(DESTDIR)/var/atune_data/
|
|
||||||
|
|
||||||
db:
|
|
||||||
sqlite3 database/atuned.db ".read database/init.sql"
|
|
||||||
@@ -78,6 +79,7 @@ libinstall:
|
|
||||||
rm -rf $(DESTDIR)/var/lib/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/run/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/atuned/
|
|
||||||
+ rm -rf $(DESTDIR)/var/atune_data/
|
|
||||||
mkdir -p $(DESTDIR)/etc/atuned/tuning
|
|
||||||
mkdir -p $(DESTDIR)/etc/atuned/rules
|
|
||||||
mkdir -p $(DESTDIR)/etc/atuned/training
|
|
||||||
@@ -90,6 +92,7 @@ libinstall:
|
|
||||||
mkdir -p $(DESTDIR)/var/lib/atuned
|
|
||||||
mkdir -p $(DESTDIR)/var/run/atuned
|
|
||||||
mkdir -p $(DESTDIR)/var/atuned
|
|
||||||
+ mkdir -p $(DESTDIR)/var/atune_data/collection
|
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/share/bash-completion/completions
|
|
||||||
install -m 640 pkg/daemon_profile_server.so $(DESTDIR)$(PREFIX)/lib/atuned/modules
|
|
||||||
install -m 750 pkg/atune-adm $(BINDIR)
|
|
||||||
diff --git a/api/profile/profile.pb.go b/api/profile/profile.pb.go
|
|
||||||
index dba166d..4e70c41 100644
|
|
||||||
--- a/api/profile/profile.pb.go
|
|
||||||
+++ b/api/profile/profile.pb.go
|
|
||||||
@@ -408,7 +408,7 @@ type CollectFlag struct {
|
|
||||||
Interval int64 `protobuf:"varint,1,opt,name=Interval,proto3" json:"Interval,omitempty"`
|
|
||||||
Duration int64 `protobuf:"varint,2,opt,name=Duration,proto3" json:"Duration,omitempty"`
|
|
||||||
Workload string `protobuf:"bytes,3,opt,name=Workload,proto3" json:"Workload,omitempty"`
|
|
||||||
- OutputPath string `protobuf:"bytes,4,opt,name=OutputPath,proto3" json:"OutputPath,omitempty"`
|
|
||||||
+ OutputDir string `protobuf:"bytes,4,opt,name=OutputDir,proto3" json:"OutputDir,omitempty"`
|
|
||||||
Block string `protobuf:"bytes,5,opt,name=Block,proto3" json:"Block,omitempty"`
|
|
||||||
Network string `protobuf:"bytes,6,opt,name=Network,proto3" json:"Network,omitempty"`
|
|
||||||
Type string `protobuf:"bytes,7,opt,name=Type,proto3" json:"Type,omitempty"`
|
|
||||||
@@ -463,9 +463,9 @@ func (m *CollectFlag) GetWorkload() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
-func (m *CollectFlag) GetOutputPath() string {
|
|
||||||
+func (m *CollectFlag) GetOutputDir() string {
|
|
||||||
if m != nil {
|
|
||||||
- return m.OutputPath
|
|
||||||
+ return m.OutputDir
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
diff --git a/api/profile/profile.proto b/api/profile/profile.proto
|
|
||||||
index 2a6e751..71d8ceb 100755
|
|
||||||
--- a/api/profile/profile.proto
|
|
||||||
+++ b/api/profile/profile.proto
|
|
||||||
@@ -76,7 +76,7 @@ message CollectFlag {
|
|
||||||
int64 Interval = 1;
|
|
||||||
int64 Duration = 2;
|
|
||||||
string Workload = 3;
|
|
||||||
- string OutputPath = 4;
|
|
||||||
+ string OutputDir = 4;
|
|
||||||
string Block = 5;
|
|
||||||
string Network = 6;
|
|
||||||
string Type = 7;
|
|
||||||
diff --git a/common/config/config.go b/common/config/config.go
|
|
||||||
index 4bd70a6..b9d2b66 100644
|
|
||||||
--- a/common/config/config.go
|
|
||||||
+++ b/common/config/config.go
|
|
||||||
@@ -55,6 +55,7 @@ const (
|
|
||||||
DefaultCheckerPath = "/usr/share/atuned/checker/"
|
|
||||||
DefaultBackupPath = "/usr/share/atuned/backup/"
|
|
||||||
DefaultTuningLogPath = "/var/atuned"
|
|
||||||
+ DefaultCollectionPath = "/var/atune_data/collection/"
|
|
||||||
)
|
|
||||||
|
|
||||||
// log config
|
|
||||||
diff --git a/modules/client/profile/profile_collection.go b/modules/client/profile/profile_collection.go
|
|
||||||
index 26b8d65..2873dac 100644
|
|
||||||
--- a/modules/client/profile/profile_collection.go
|
|
||||||
+++ b/modules/client/profile/profile_collection.go
|
|
||||||
@@ -20,7 +20,6 @@ import (
|
|
||||||
"gitee.com/openeuler/A-Tune/common/utils"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
- "path/filepath"
|
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
|
||||||
CTX "golang.org/x/net/context"
|
|
||||||
@@ -48,8 +47,8 @@ var collectionCommand = cli.Command{
|
|
||||||
Value: 1200,
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
- Name: "output_path,o",
|
|
||||||
- Usage: "the output path of the collecting data",
|
|
||||||
+ Name: "output_dir,o",
|
|
||||||
+ Usage: "the output dir name of the collecting data, full dir path would be /var/atune_data/collection/{output_dir}",
|
|
||||||
Value: "",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
@@ -71,8 +70,8 @@ var collectionCommand = cli.Command{
|
|
||||||
Description: func() string {
|
|
||||||
desc := `
|
|
||||||
collect data for train machine learning model, you must set the command options
|
|
||||||
- which has no default value, the output_path must be a absolute path.
|
|
||||||
- example: atune-adm collection -f mysql -i 5 -d 1200 -o /home -b sda -n eth0 -t mysql`
|
|
||||||
+ which has no default value.
|
|
||||||
+ example: atune-adm collection -f mysql -i 5 -d 1200 -o tmp -b sda -n eth0 -t mysql`
|
|
||||||
return desc
|
|
||||||
}(),
|
|
||||||
Action: collection,
|
|
||||||
@@ -118,9 +117,9 @@ func checkCollectionCtx(ctx *cli.Context) error {
|
|
||||||
return fmt.Errorf("error: app type must be specified")
|
|
||||||
}
|
|
||||||
|
|
||||||
- if ctx.String("output_path") == "" {
|
|
||||||
+ if ctx.String("output_dir") == "" {
|
|
||||||
_ = cli.ShowCommandHelp(ctx, "collection")
|
|
||||||
- return fmt.Errorf("error: output_path must be specified")
|
|
||||||
+ return fmt.Errorf("error: output_dir must be specified")
|
|
||||||
}
|
|
||||||
|
|
||||||
if ctx.Int64("interval") < 1 || ctx.Int64("interval") > 60 {
|
|
||||||
@@ -131,10 +130,6 @@ func checkCollectionCtx(ctx *cli.Context) error {
|
|
||||||
return fmt.Errorf("error: collection duration value must be bigger than interval*10")
|
|
||||||
}
|
|
||||||
|
|
||||||
- if !filepath.IsAbs(ctx.String("output_path")) {
|
|
||||||
- return fmt.Errorf("error: output path must be absolute path")
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -149,16 +144,11 @@ func collection(ctx *cli.Context) error {
|
|
||||||
}
|
|
||||||
defer c.Close()
|
|
||||||
|
|
||||||
- outputPath := ctx.String("output_path")
|
|
||||||
- outputPath, err = filepath.Abs(outputPath)
|
|
||||||
- if err != nil {
|
|
||||||
- return err
|
|
||||||
- }
|
|
||||||
message := PB.CollectFlag{
|
|
||||||
Interval: ctx.Int64("interval"),
|
|
||||||
Duration: ctx.Int64("duration"),
|
|
||||||
Workload: ctx.String("filename"),
|
|
||||||
- OutputPath: outputPath,
|
|
||||||
+ OutputDir: ctx.String("output_dir"),
|
|
||||||
Block: ctx.String("disk"),
|
|
||||||
Network: ctx.String("network"),
|
|
||||||
Type: ctx.String("app_type"),
|
|
||||||
diff --git a/modules/server/profile/profile.go b/modules/server/profile/profile.go
|
|
||||||
index 3264167..ec1e739 100644
|
|
||||||
--- a/modules/server/profile/profile.go
|
|
||||||
+++ b/modules/server/profile/profile.go
|
|
||||||
@@ -1019,8 +1019,8 @@ func (s *ProfileServer) Collection(message *PB.CollectFlag, stream PB.ProfileMgr
|
|
||||||
return fmt.Errorf("input:%s is invalid", message.GetWorkload())
|
|
||||||
}
|
|
||||||
|
|
||||||
- if valid := utils.IsInputStringValid(message.GetOutputPath()); !valid {
|
|
||||||
- return fmt.Errorf("input:%s is invalid", message.GetOutputPath())
|
|
||||||
+ if valid, _ := regexp.MatchString("^[a-zA-Z]+(_[a-zA-Z0-9]+)*$", message.GetOutputDir()); !valid {
|
|
||||||
+ return fmt.Errorf("output dir:%s is invalid", message.GetOutputDir())
|
|
||||||
}
|
|
||||||
|
|
||||||
if valid := utils.IsInputStringValid(message.GetType()); !valid {
|
|
||||||
@@ -1049,12 +1049,13 @@ func (s *ProfileServer) Collection(message *PB.CollectFlag, stream PB.ProfileMgr
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
- exist, err := utils.PathExist(message.GetOutputPath())
|
|
||||||
+ outputDir := path.Join(config.DefaultCollectionPath, message.GetOutputDir())
|
|
||||||
+ exist, err := utils.PathExist(message.GetOutputDir())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !exist {
|
|
||||||
- return fmt.Errorf("output_path %s is not exist", message.GetOutputPath())
|
|
||||||
+ _ = os.MkdirAll(outputDir, 0755)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = utils.InterfaceByName(message.GetNetwork()); err != nil {
|
|
||||||
@@ -1106,7 +1107,7 @@ func (s *ProfileServer) Collection(message *PB.CollectFlag, stream PB.ProfileMgr
|
|
||||||
collectorBody.Monitors = monitors
|
|
||||||
nowTime := time.Now().Format("20060702-150405")
|
|
||||||
fileName := fmt.Sprintf("%s-%s.csv", message.GetWorkload(), nowTime)
|
|
||||||
- collectorBody.File = path.Join(message.GetOutputPath(), fileName)
|
|
||||||
+ collectorBody.File = path.Join(outputDir, fileName)
|
|
||||||
if include == "" {
|
|
||||||
include = "default"
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
From 6aae35d592388924f5ab92db90912a1b7962d665 Mon Sep 17 00:00:00 2001
|
|
||||||
From: gaoruoshu <gaoruoshu@huawei.com>
|
|
||||||
Date: Wed, 16 Aug 2023 10:26:19 +0800
|
|
||||||
Subject: [PATCH] [atune]add service restart mode
|
|
||||||
|
|
||||||
---
|
|
||||||
misc/atuned.service | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/misc/atuned.service b/misc/atuned.service
|
|
||||||
index bc5de9b..58fb022 100644
|
|
||||||
--- a/misc/atuned.service
|
|
||||||
+++ b/misc/atuned.service
|
|
||||||
@@ -7,6 +7,9 @@ Requires=polkit.service
|
|
||||||
Type=notify
|
|
||||||
ExecStart=/usr/bin/atuned
|
|
||||||
SuccessExitStatus=100
|
|
||||||
+Restart=on-failure
|
|
||||||
+RestartSec=3s
|
|
||||||
+TimeoutSec=1m
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
From f1fa941597af1b27278b430c1f7172fc5820d0ac Mon Sep 17 00:00:00 2001
|
|
||||||
From: gaoruoshu <gaoruoshu@huawei.com>
|
|
||||||
Date: Wed, 16 Aug 2023 12:39:37 +0800
|
|
||||||
Subject: [PATCH] [atune]update Makefile and logs
|
|
||||||
|
|
||||||
---
|
|
||||||
Makefile | 10 ++++------
|
|
||||||
common/profile/profile.go | 2 +-
|
|
||||||
2 files changed, 5 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index bcac447..5c76b4e 100755
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -46,14 +46,13 @@ clean:
|
|
||||||
rm -rf $(PKGPATH)/*
|
|
||||||
|
|
||||||
cleanall: clean
|
|
||||||
- rm -rf $(DESTDIR)/etc/atuned/
|
|
||||||
+ rm -rf $(DESTDIR)/etc/atune*
|
|
||||||
rm -rf $(DESTDIR)$(PREFIX)/lib/atuned/
|
|
||||||
rm -rf $(DESTDIR)$(PREFIX)/share/atuned/
|
|
||||||
rm -rf $(DESTDIR)$(PREFIX)/$(LIBEXEC)/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/lib/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/run/atuned/
|
|
||||||
- rm -rf $(DESTDIR)/var/atuned/
|
|
||||||
- rm -rf $(DESTDIR)/var/atune_data/
|
|
||||||
+ rm -rf $(DESTDIR)/var/atune*
|
|
||||||
|
|
||||||
db:
|
|
||||||
sqlite3 database/atuned.db ".read database/init.sql"
|
|
||||||
@@ -72,14 +71,13 @@ libinstall:
|
|
||||||
@echo "BEGIN INSTALL A-Tune..."
|
|
||||||
mkdir -p $(BINDIR)
|
|
||||||
mkdir -p $(SYSTEMDDIR)
|
|
||||||
- rm -rf $(DESTDIR)/etc/atuned/
|
|
||||||
+ rm -rf $(DESTDIR)/etc/atune*
|
|
||||||
rm -rf $(DESTDIR)$(PREFIX)/lib/atuned/
|
|
||||||
rm -rf $(DESTDIR)$(PREFIX)/share/atuned/
|
|
||||||
rm -rf $(DESTDIR)$(PREFIX)/$(LIBEXEC)/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/lib/atuned/
|
|
||||||
rm -rf $(DESTDIR)/var/run/atuned/
|
|
||||||
- rm -rf $(DESTDIR)/var/atuned/
|
|
||||||
- rm -rf $(DESTDIR)/var/atune_data/
|
|
||||||
+ rm -rf $(DESTDIR)/var/atune*
|
|
||||||
mkdir -p $(DESTDIR)/etc/atuned/tuning
|
|
||||||
mkdir -p $(DESTDIR)/etc/atuned/rules
|
|
||||||
mkdir -p $(DESTDIR)/etc/atuned/training
|
|
||||||
diff --git a/common/profile/profile.go b/common/profile/profile.go
|
|
||||||
index 264fdd8..43a4e77 100644
|
|
||||||
--- a/common/profile/profile.go
|
|
||||||
+++ b/common/profile/profile.go
|
|
||||||
@@ -294,7 +294,7 @@ func (p *Profile) ItemSort() error {
|
|
||||||
} else {
|
|
||||||
itemQuery, err := sqlstore.GetPropertyItem(key.Name())
|
|
||||||
if err != nil {
|
|
||||||
- log.Errorf("key %s is not exist in tuned_item", key.Name())
|
|
||||||
+ log.Infof("key %s is not exist in tuned_item", key.Name())
|
|
||||||
itemName = "OTHERS"
|
|
||||||
} else {
|
|
||||||
itemName = itemQuery
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,185 +0,0 @@
|
|||||||
From d14414365e8fa9590e46b63a29754fb29f81778c Mon Sep 17 00:00:00 2001
|
|
||||||
From: gaoruoshu <gaoruoshu@huawei.com>
|
|
||||||
Date: Wed, 16 Feb 2022 14:41:47 +0800
|
|
||||||
Subject: [PATCH] add FAQ and self signature certificate manufacturing
|
|
||||||
|
|
||||||
---
|
|
||||||
Documentation/UserGuide/A-Tune-User-Guide.md | 70 ++++++++++++++++++
|
|
||||||
...50\346\210\267\346\214\207\345\215\227.md" | 72 +++++++++++++++++++
|
|
||||||
2 files changed, 142 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/Documentation/UserGuide/A-Tune-User-Guide.md b/Documentation/UserGuide/A-Tune-User-Guide.md
|
|
||||||
index cd99cd4..cbb9d66 100644
|
|
||||||
--- a/Documentation/UserGuide/A-Tune-User-Guide.md
|
|
||||||
+++ b/Documentation/UserGuide/A-Tune-User-Guide.md
|
|
||||||
@@ -1235,6 +1235,12 @@ Perform tuning.
|
|
||||||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
|
||||||
```
|
|
||||||
|
|
||||||
+**Q4: The atuned or atune-engine service cannot be started, and the message "Startup failed. Please provide the authentication certificate." is displayed.**
|
|
||||||
+
|
|
||||||
+**Cause:** Missing the certificate file during communication. The default communication protocol of REST APIs in the atuned or atune-engine service is HTTPS.
|
|
||||||
+
|
|
||||||
+**Solution:** Providing the certificate file issued by the authority and saving it to the corresponding configuration directory. The default certificate directory of the atuned service is /etc/atuned/rest_certs/, and the default certificate directory of the atune-engine service is /etc/atuned/engine_certs/. You can also change the default certificate directory and certificate file name in the atuned.cnf and engine.cnf files under the /etc/atuned/ directory. For the development and commissioning environment, you can also make self-service signature certificate by following section 5.2.
|
|
||||||
+
|
|
||||||
|
|
||||||
|
|
||||||
# 5 Appendixes
|
|
||||||
@@ -1248,3 +1254,67 @@ Perform tuning.
|
|
||||||
| profile | Set of optimization items and optimal parameter configuration. |
|
|
||||||
|
|
||||||
|
|
||||||
+## 5.2 Self-signature Certificate Manufacturing Method
|
|
||||||
+
|
|
||||||
+### 5.2.1 Creating a Certificate Directory
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+CERT_PATH=demo
|
|
||||||
+mkdir $CERT_PATH
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.2 Generating the RSA Key Pair for the CA
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+openssl genrsa -out $CERT_PATH/ca.key 2048
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.3 Generating the CA Root Certificate
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+openssl req -new -x509 -days 3650 -subj "/CN=ca" -key $CERT_PATH/ca.key -out $CERT_PATH/ca.crt
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.4 Generating the Server Certificate
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+# The IP address can be changed according to the actual situation.
|
|
||||||
+IP_ADDR=localhost
|
|
||||||
+openssl genrsa -out $CERT_PATH/server.key 2048
|
|
||||||
+cp /etc/pki/tls/openssl.cnf $CERT_PATH
|
|
||||||
+if test $IP_ADDR == localhost; then
|
|
||||||
+ echo "[SAN]\nsubjectAltName=DNS:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=DNS:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+else
|
|
||||||
+ echo "[SAN]\nsubjectAltName=IP:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=IP:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+fi
|
|
||||||
+openssl req -new -subj "/CN=$IP_ADDR" -config $CERT_PATH/openssl.cnf \
|
|
||||||
+ -key $CERT_PATH/server.key -out $CERT_PATH/server.csr
|
|
||||||
+openssl x509 -req -sha256 -CA $CERT_PATH/ca.crt -CAkey $CERT_PATH/ca.key -CAcreateserial -days 3650 \
|
|
||||||
+ -extfile $CERT_PATH/extfile.cnf -in $CERT_PATH/server.csr -out $CERT_PATH/server.crt
|
|
||||||
+rm -rf $CERT_PATH/*.srl $CERT_PATH/*.csr $CERT_PATH/*.cnf
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.5 Generating the Client Certificate
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+# The IP address can be changed according to the actual situation.
|
|
||||||
+IP_ADDR=localhost
|
|
||||||
+openssl genrsa -out $CERT_PATH/client.key 2048
|
|
||||||
+cp /etc/pki/tls/openssl.cnf $CERT_PATH
|
|
||||||
+if test $IP_ADDR == localhost; then
|
|
||||||
+ echo "[SAN]\nsubjectAltName=DNS:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=DNS:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+else
|
|
||||||
+ echo "[SAN]\nsubjectAltName=IP:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=IP:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+fi
|
|
||||||
+openssl req -new -subj "/CN=$IP_ADDR" -config $CERT_PATH/openssl.cnf \
|
|
||||||
+ -key $CERT_PATH/client.key -out $CERT_PATH/client.csr
|
|
||||||
+openssl x509 -req -sha256 -CA $CERT_PATH/ca.crt -CAkey $CERT_PATH/ca.key -CAcreateserial -days 3650 \
|
|
||||||
+ -extfile $CERT_PATH/extfile.cnf -in $CERT_PATH/client.csr -out $CERT_PATH/client.crt
|
|
||||||
+rm -rf $CERT_PATH/*.srl $CERT_PATH/*.csr $CERT_PATH/*.cnf
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+
|
|
||||||
diff --git "a/Documentation/UserGuide/A-Tune\347\224\250\346\210\267\346\214\207\345\215\227.md" "b/Documentation/UserGuide/A-Tune\347\224\250\346\210\267\346\214\207\345\215\227.md"
|
|
||||||
index 59b25e0..064708c 100644
|
|
||||||
--- "a/Documentation/UserGuide/A-Tune\347\224\250\346\210\267\346\214\207\345\215\227.md"
|
|
||||||
+++ "b/Documentation/UserGuide/A-Tune\347\224\250\346\210\267\346\214\207\345\215\227.md"
|
|
||||||
@@ -1247,6 +1247,15 @@ evaluations :
|
|
||||||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
|
||||||
```
|
|
||||||
|
|
||||||
+**问题4:atuned或atune-engine服务无法启动,提示“Startup failed. Please provide the authentication certificate.”。**
|
|
||||||
+
|
|
||||||
+**原因:** atuned或atune-engine服务中的REST API默认通信协议为https,通信中缺少证书文件
|
|
||||||
+
|
|
||||||
+**解决方法:** 用户提供权威机构签发的证书文件并放入对应的配置目录下,其中atuned服务的默认证书>目录为/etc/atuned/rest_certs/,atune-engine服务的默认证书目录为/etc/atuned/engine_certs/,也可
|
|
||||||
+以通过/etc/atuned/目录下的atuned.cnf和engine.cnf配置文件修改默认证书目录和证书文件名。对于开发
|
|
||||||
+调试环境也可以通过5.2节方法制作的自签名证书进行服务通信。
|
|
||||||
+
|
|
||||||
+
|
|
||||||
# 5 附录
|
|
||||||
|
|
||||||
## 5.1 术语和缩略语
|
|
||||||
@@ -1258,3 +1267,66 @@ evaluations :
|
|
||||||
| profile | 优化项集合,最佳的参数配置 |
|
|
||||||
|
|
||||||
|
|
||||||
+## 5.2 自签名证书制作方法
|
|
||||||
+
|
|
||||||
+### 5.2.1 证书目录创建
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+CERT_PATH=demo
|
|
||||||
+mkdir $CERT_PATH
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.2 生成CA的RSA密钥对
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+openssl genrsa -out $CERT_PATH/ca.key 2048
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.3 生成CA根证书
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+openssl req -new -x509 -days 3650 -subj "/CN=ca" -key $CERT_PATH/ca.key -out $CERT_PATH/ca.crt
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.4 生成服务器证书
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+# ip地址可以根据实际情况修改
|
|
||||||
+IP_ADDR=localhost
|
|
||||||
+openssl genrsa -out $CERT_PATH/server.key 2048
|
|
||||||
+cp /etc/pki/tls/openssl.cnf $CERT_PATH
|
|
||||||
+if test $IP_ADDR == localhost; then
|
|
||||||
+ echo "[SAN]\nsubjectAltName=DNS:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=DNS:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+else
|
|
||||||
+ echo "[SAN]\nsubjectAltName=IP:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=IP:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+fi
|
|
||||||
+openssl req -new -subj "/CN=$IP_ADDR" -config $CERT_PATH/openssl.cnf \
|
|
||||||
+ -key $CERT_PATH/server.key -out $CERT_PATH/server.csr
|
|
||||||
+openssl x509 -req -sha256 -CA $CERT_PATH/ca.crt -CAkey $CERT_PATH/ca.key -CAcreateserial -days 3650 \
|
|
||||||
+ -extfile $CERT_PATH/extfile.cnf -in $CERT_PATH/server.csr -out $CERT_PATH/server.crt
|
|
||||||
+rm -rf $CERT_PATH/*.srl $CERT_PATH/*.csr $CERT_PATH/*.cnf
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
+### 5.2.5 生成客户端证书
|
|
||||||
+
|
|
||||||
+```shell
|
|
||||||
+# ip地址可以根据实际情况修改
|
|
||||||
+IP_ADDR=localhost
|
|
||||||
+openssl genrsa -out $CERT_PATH/client.key 2048
|
|
||||||
+cp /etc/pki/tls/openssl.cnf $CERT_PATH
|
|
||||||
+if test $IP_ADDR == localhost; then
|
|
||||||
+ echo "[SAN]\nsubjectAltName=DNS:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=DNS:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+else
|
|
||||||
+ echo "[SAN]\nsubjectAltName=IP:$IP_ADDR" >> $CERT_PATH/openssl.cnf
|
|
||||||
+ echo "subjectAltName=IP:$IP_ADDR" > $CERT_PATH/extfile.cnf
|
|
||||||
+fi
|
|
||||||
+openssl req -new -subj "/CN=$IP_ADDR" -config $CERT_PATH/openssl.cnf \
|
|
||||||
+ -key $CERT_PATH/client.key -out $CERT_PATH/client.csr
|
|
||||||
+openssl x509 -req -sha256 -CA $CERT_PATH/ca.crt -CAkey $CERT_PATH/ca.key -CAcreateserial -days 3650 \
|
|
||||||
+ -extfile $CERT_PATH/extfile.cnf -in $CERT_PATH/client.csr -out $CERT_PATH/client.crt
|
|
||||||
+rm -rf $CERT_PATH/*.srl $CERT_PATH/*.csr $CERT_PATH/*.cnf
|
|
||||||
+```
|
|
||||||
+
|
|
||||||
--
|
|
||||||
2.30.0
|
|
||||||
|
|
||||||
37
adjust-the-startup-sequence-of-atune-rest.patch
Normal file
37
adjust-the-startup-sequence-of-atune-rest.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 769eb65a6849b6663885fff1ab8dafbc1b3c92dd Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <zhoupengcheng11@huawei.com>
|
||||||
|
Date: Sun, 25 Feb 2024 14:59:21 +0800
|
||||||
|
Subject: [PATCH] Adjust the startup sequence of atune-rest
|
||||||
|
|
||||||
|
---
|
||||||
|
misc/atune-rest.service | 2 +-
|
||||||
|
misc/atuned.service | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/misc/atune-rest.service b/misc/atune-rest.service
|
||||||
|
index 3cf0794..7774683 100644
|
||||||
|
--- a/misc/atune-rest.service
|
||||||
|
+++ b/misc/atune-rest.service
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=A-Tune AI service
|
||||||
|
-After=network.target
|
||||||
|
+After=network.target atuned.service
|
||||||
|
Requires=polkit.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
diff --git a/misc/atuned.service b/misc/atuned.service
|
||||||
|
index 58fb022..1677d30 100644
|
||||||
|
--- a/misc/atuned.service
|
||||||
|
+++ b/misc/atuned.service
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=A-Tune Daemon
|
||||||
|
-After=systemd-sysctl.service network.target atune-rest.service
|
||||||
|
+After=systemd-sysctl.service network.target
|
||||||
|
Requires=polkit.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
82
atune.spec
82
atune.spec
@ -2,33 +2,23 @@
|
|||||||
|
|
||||||
Summary: AI auto tuning system
|
Summary: AI auto tuning system
|
||||||
Name: atune
|
Name: atune
|
||||||
Version: 1.0.0
|
Version: 1.2.0
|
||||||
Release: 16
|
Release: 1
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
URL: https://gitee.com/openeuler/A-Tune
|
URL: https://gitee.com/openeuler/A-Tune
|
||||||
Source: https://gitee.com/openeuler/A-Tune/repository/archive/v%{version}.tar.gz
|
Source: https://gitee.com/openeuler/A-Tune/repository/archive/v%{version}.tar.gz
|
||||||
|
|
||||||
Patch9000: check-whether-the-certificate-file-exists.patch
|
Patch9000: A-Tune-Add-sw64-architecture.patch
|
||||||
Patch9001: add-FAQ-and-self-signature-certificate-manufacturing.patch
|
Patch9001: add-riscv64-support.patch
|
||||||
Patch9002: change-Makefile-A-Tune-version-to-1.0.0.patch
|
Patch9002: remove-the-installation-of-atune-ui-related-files.patch
|
||||||
Patch9003: fix-start-failed-of-atuned-service.patch
|
Patch9003: adjust-the-startup-sequence-of-atune-rest.patch
|
||||||
Patch9004: A-Tune-Add-sw64-architecture.patch
|
|
||||||
Patch9005: add-riscv64-support.patch
|
|
||||||
Patch9006: 0001-bugfix-transfer-can-only-save-file-to-specified-dir.patch
|
|
||||||
Patch9007: 0002-bugfix-training-model-can-only-save-file-to-specifie.patch
|
|
||||||
Patch9008: 0003-bugfix-collection-res-can-only-save-file-to-specifie.patch
|
|
||||||
Patch9009: 0004-atune-add-service-restart-mode.patch
|
|
||||||
Patch9010: 0005-atune-update-Makefile-and-logs.patch
|
|
||||||
Patch9011: 0001-define-fix-privilege-escalation.patch
|
|
||||||
Patch9012: 0002-define-fix-privilege-escalation.patch
|
|
||||||
Patch9013: fix-collection-train-file-overwriting-through-soft-links.patch
|
|
||||||
|
|
||||||
|
|
||||||
BuildRequires: rpm-build golang-bin procps-ng
|
BuildRequires: rpm-build golang-bin procps-ng
|
||||||
BuildRequires: sqlite >= 3.24.0 openssl
|
BuildRequires: sqlite >= 3.24.0 openssl
|
||||||
BuildRequires: python3-scikit-optimize python3-pandas python3-xgboost
|
BuildRequires: python3-scikit-optimize python3-pandas python3-xgboost
|
||||||
BuildRequires: python3-pyyaml
|
BuildRequires: python3-pyyaml
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
|
BuildRequires: perf
|
||||||
Requires: systemd
|
Requires: systemd
|
||||||
Requires: atune-client = %{version}-%{release}
|
Requires: atune-client = %{version}-%{release}
|
||||||
Requires: atune-db = %{version}-%{release}
|
Requires: atune-db = %{version}-%{release}
|
||||||
@ -44,7 +34,7 @@ Requires: sysstat
|
|||||||
Requires: hwloc-gui
|
Requires: hwloc-gui
|
||||||
Requires: psmisc
|
Requires: psmisc
|
||||||
Requires: atune-collector
|
Requires: atune-collector
|
||||||
|
Requires: atune-rest
|
||||||
|
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
|
|
||||||
@ -73,31 +63,29 @@ Requires: python3-xgboost
|
|||||||
Requires: python3-flask-restful
|
Requires: python3-flask-restful
|
||||||
Requires: python3-pandas
|
Requires: python3-pandas
|
||||||
Requires: python3-lhsmdu
|
Requires: python3-lhsmdu
|
||||||
Conflicts: atune < 0.3-0.9
|
Conflicts: atune < 1.1.0
|
||||||
|
|
||||||
%description engine
|
%description engine
|
||||||
atune engine tool for manage atuned AI tuning system.
|
atune engine tool for manage atuned AI tuning system.
|
||||||
|
|
||||||
|
%package rest
|
||||||
|
Summary: restful api for communication between atuned and atune-engine
|
||||||
|
License: MuLan PSL v2
|
||||||
|
Conflicts: atune < 1.1.0
|
||||||
|
|
||||||
|
%description rest
|
||||||
|
atune restful api for manage atuned AI tuning system.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n A-Tune-v%{version}
|
%setup -n A-Tune-v%{version}
|
||||||
%patch9000 -p1
|
|
||||||
%patch9001 -p1
|
|
||||||
%patch9002 -p1
|
|
||||||
%patch9003 -p1
|
|
||||||
%ifarch sw_64
|
%ifarch sw_64
|
||||||
%patch9004 -p1
|
%patch9000 -p1
|
||||||
%endif
|
%endif
|
||||||
%ifarch riscv64
|
%ifarch riscv64
|
||||||
%patch9005 -p1
|
%patch9001 -p1
|
||||||
%endif
|
%endif
|
||||||
%patch9006 -p1
|
%patch9002 -p1
|
||||||
%patch9007 -p1
|
%patch9003 -p1
|
||||||
%patch9008 -p1
|
|
||||||
%patch9009 -p1
|
|
||||||
%patch9010 -p1
|
|
||||||
%patch9011 -p1
|
|
||||||
%patch9012 -p1
|
|
||||||
%patch9013 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%make_build
|
%make_build
|
||||||
@ -125,24 +113,26 @@ atune engine tool for manage atuned AI tuning system.
|
|||||||
%postun engine
|
%postun engine
|
||||||
%systemd_postun_with_restart atune-engine.service
|
%systemd_postun_with_restart atune-engine.service
|
||||||
|
|
||||||
|
%post rest
|
||||||
|
%systemd_post atune-rest.service
|
||||||
|
|
||||||
|
%preun rest
|
||||||
|
%systemd_preun atune-rest.service
|
||||||
|
|
||||||
|
%postun rest
|
||||||
|
%systemd_postun_with_restart atune-rest.service
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license License/LICENSE
|
%license License/LICENSE
|
||||||
%defattr(0640,root,root,0750)
|
%defattr(0640,root,root,0750)
|
||||||
%attr(0550,root,root) /usr/lib/atuned/modules/daemon_profile_server.so
|
%attr(0550,root,root) /usr/lib/atuned/modules/daemon_profile_server.so
|
||||||
%attr(0640,root,root) %{_unitdir}/atuned.service
|
%attr(0640,root,root) %{_unitdir}/atuned.service
|
||||||
%attr(0550,root,root) %{_bindir}/atuned
|
%attr(0550,root,root) %{_bindir}/atuned
|
||||||
%attr(0550,root,root) /usr/libexec/atuned/analysis/*
|
|
||||||
/usr/lib/atuned/profiles/*
|
/usr/lib/atuned/profiles/*
|
||||||
%exclude /usr/libexec/atuned/analysis/app_engine.py
|
|
||||||
%exclude /usr/libexec/atuned/analysis/models/
|
|
||||||
%exclude /usr/libexec/atuned/analysis/optimizer/
|
|
||||||
%exclude /usr/libexec/atuned/analysis/engine/
|
|
||||||
%exclude /usr/libexec/atuned/analysis/dataset/
|
|
||||||
%attr(0750,root,root) %dir /usr/lib/atuned
|
%attr(0750,root,root) %dir /usr/lib/atuned
|
||||||
%attr(0550,root,root) %dir /usr/lib/atuned/modules
|
%attr(0550,root,root) %dir /usr/lib/atuned/modules
|
||||||
%attr(0750,root,root) %dir /usr/lib/atuned/profiles
|
%attr(0750,root,root) %dir /usr/lib/atuned/profiles
|
||||||
%attr(0750,root,root) %dir /usr/libexec/atuned
|
%attr(0750,root,root) %dir /usr/libexec/atuned
|
||||||
%attr(0550,root,root) %dir /usr/libexec/atuned/analysis
|
|
||||||
%attr(0750,root,root) %dir /usr/share/atuned
|
%attr(0750,root,root) %dir /usr/share/atuned
|
||||||
%attr(0750,root,root) %dir /etc/atuned
|
%attr(0750,root,root) %dir /etc/atuned
|
||||||
%attr(0750,root,root) %dir /etc/atuned/rules
|
%attr(0750,root,root) %dir /etc/atuned/rules
|
||||||
@ -154,6 +144,15 @@ atune engine tool for manage atuned AI tuning system.
|
|||||||
%exclude /etc/atuned/engine_certs/*
|
%exclude /etc/atuned/engine_certs/*
|
||||||
%exclude /etc/atuned/rest_certs/*
|
%exclude /etc/atuned/rest_certs/*
|
||||||
|
|
||||||
|
%files rest
|
||||||
|
%attr(0550,root,root) %dir /usr/libexec/atuned/analysis
|
||||||
|
%attr(0550,root,root) /usr/libexec/atuned/analysis/*
|
||||||
|
%exclude /usr/libexec/atuned/analysis/app_engine.py
|
||||||
|
%exclude /usr/libexec/atuned/analysis/models/
|
||||||
|
%exclude /usr/libexec/atuned/analysis/optimizer/
|
||||||
|
%exclude /usr/libexec/atuned/analysis/engine/
|
||||||
|
%exclude /usr/libexec/atuned/analysis/dataset/
|
||||||
|
%attr(0640,root,root) %{_unitdir}/atune-rest.service
|
||||||
|
|
||||||
%files client
|
%files client
|
||||||
%attr(0550,root,root) %{_bindir}/atune-adm
|
%attr(0550,root,root) %{_bindir}/atune-adm
|
||||||
@ -187,6 +186,9 @@ atune engine tool for manage atuned AI tuning system.
|
|||||||
%exclude /etc/atuned/rest_certs
|
%exclude /etc/atuned/rest_certs
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Feb 6 2024 zhoupengcheng <zhoupengcheng11@huawei.com> - 1.2.0-1
|
||||||
|
- update atune-v1.2.0
|
||||||
|
|
||||||
* Wed Nov 8 2023 zhoupengcheng <zhoupengcheng11@huawei.com> - 1.0.0-16
|
* Wed Nov 8 2023 zhoupengcheng <zhoupengcheng11@huawei.com> - 1.0.0-16
|
||||||
- fix-collection-train-file-overwriting-through-soft-links
|
- fix-collection-train-file-overwriting-through-soft-links
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
From 5b8ec9d923096e0ad6302e27d21d4de40087dfce Mon Sep 17 00:00:00 2001
|
|
||||||
From: hubin73 <hubin73@huawei.com>
|
|
||||||
Date: Thu, 3 Mar 2022 20:41:08 +0800
|
|
||||||
Subject: [PATCH] change Makefile A-Tune version to 1.0.0
|
|
||||||
|
|
||||||
Signed-off-by: hubin73 <hubin73@huawei.com>
|
|
||||||
---
|
|
||||||
Makefile | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/Makefile b/Makefile
|
|
||||||
index 8e43062..715f698 100755
|
|
||||||
--- a/Makefile
|
|
||||||
+++ b/Makefile
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-VERSION = 0.3
|
|
||||||
+VERSION = 1.0.0
|
|
||||||
.PHONY: all clean modules
|
|
||||||
|
|
||||||
PKGPATH=pkg
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
From 8d7596125161bea13641644fca2384411e00a4e5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: gaoruoshu <gaoruoshu@huawei.com>
|
|
||||||
Date: Tue, 15 Feb 2022 17:03:40 +0800
|
|
||||||
Subject: [PATCH] check whether the certificate file exists
|
|
||||||
|
|
||||||
---
|
|
||||||
analysis/app.py | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/analysis/app.py b/analysis/app.py
|
|
||||||
index 31b5f51..b25e784 100644
|
|
||||||
--- a/analysis/app.py
|
|
||||||
+++ b/analysis/app.py
|
|
||||||
@@ -22,6 +22,8 @@ from logging.handlers import SysLogHandler
|
|
||||||
from flask import Flask
|
|
||||||
from flask_restful import Api
|
|
||||||
|
|
||||||
+LOGGER = logging.getLogger(__name__)
|
|
||||||
+
|
|
||||||
|
|
||||||
class App:
|
|
||||||
"""flask application"""
|
|
||||||
@@ -51,6 +51,9 @@ class App:
|
|
||||||
|
|
||||||
def startup_app(self, host, port, tls, cert_file, key_file, ca_file, log_level):
|
|
||||||
"""start flask app"""
|
|
||||||
+ if not os.path.exists(cert_file) or not os.path.exists(key_file) or not os.path.exists(ca_file):
|
|
||||||
+ LOGGER.error("Startup failed. Please provide the authentication certificate.")
|
|
||||||
+ raise FileNotFoundError("Startup failed. Please provide the authentication certificate.")
|
|
||||||
level = logging.getLevelName(log_level.upper())
|
|
||||||
self.config_log(level)
|
|
||||||
self.add_resource()
|
|
||||||
--
|
|
||||||
2.30.0
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
From c5e491e5dffab4dda814f2e1ba11c21714cac0c6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: zhoupengcheng <zhoupengcheng11@huawei.com>
|
|
||||||
Date: Wed, 1 Nov 2023 11:14:37 +0800
|
|
||||||
Subject: [PATCH] fix-collection-train-file-overwriting-through-soft-links.patch
|
|
||||||
|
|
||||||
---
|
|
||||||
analysis/atuned/collector.py | 10 +++++++++-
|
|
||||||
analysis/engine/train.py | 4 +++-
|
|
||||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/analysis/atuned/collector.py b/analysis/atuned/collector.py
|
|
||||||
index 4749284..9a264dd 100755
|
|
||||||
--- a/analysis/atuned/collector.py
|
|
||||||
+++ b/analysis/atuned/collector.py
|
|
||||||
@@ -39,6 +39,15 @@ class Collector(Resource):
|
|
||||||
args = COLLECTOR_POST_PARSER.parse_args()
|
|
||||||
current_app.logger.info(args)
|
|
||||||
n_pipe = get_npipe(args.get("pipe"))
|
|
||||||
+
|
|
||||||
+ path = args.get("file")
|
|
||||||
+ path = os.path.abspath(path)
|
|
||||||
+ if not path.startswith("/var/atune_data/collection/"):
|
|
||||||
+ return "Files outside the /var/atune_data/collection/ directory cannot be modified.", 400
|
|
||||||
+
|
|
||||||
+ if os.path.exists(path):
|
|
||||||
+ return "File already exists!", 400
|
|
||||||
+
|
|
||||||
monitors = []
|
|
||||||
mpis = []
|
|
||||||
field_name = []
|
|
||||||
@@ -91,7 +100,6 @@ class Collector(Resource):
|
|
||||||
if n_pipe is not None:
|
|
||||||
n_pipe.close()
|
|
||||||
|
|
||||||
- path = args.get("file")
|
|
||||||
save_file(path, data, field_name)
|
|
||||||
result = {}
|
|
||||||
result["path"] = path
|
|
||||||
diff --git a/analysis/engine/train.py b/analysis/engine/train.py
|
|
||||||
index 7608660..462b16c 100644
|
|
||||||
--- a/analysis/engine/train.py
|
|
||||||
+++ b/analysis/engine/train.py
|
|
||||||
@@ -49,8 +49,10 @@ class Training(Resource):
|
|
||||||
return "Illegal model name provide: {}".format(err), 400
|
|
||||||
|
|
||||||
characterization = WorkloadCharacterization(model_path)
|
|
||||||
+ output_path = TRAINING_MODEL_PATH + model_name
|
|
||||||
+ if os.path.exists(output_path):
|
|
||||||
+ return "File already exists!", 400
|
|
||||||
try:
|
|
||||||
- output_path = TRAINING_MODEL_PATH + model_name
|
|
||||||
characterization.retrain(data_path, output_path)
|
|
||||||
except Exception as err:
|
|
||||||
LOGGER.error(err)
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
From 945560933e7e118b9113f152a5f133e1ff0af183 Mon Sep 17 00:00:00 2001
|
|
||||||
From: g00563147 <gaoruoshu@huawei.com>
|
|
||||||
Date: Thu, 3 Mar 2022 16:52:04 +0800
|
|
||||||
Subject: [PATCH] fix start failed of atuned service
|
|
||||||
|
|
||||||
---
|
|
||||||
analysis/app.py | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/analysis/app.py b/analysis/app.py
|
|
||||||
index e82e2b2..3a0c248 100644
|
|
||||||
--- a/analysis/app.py
|
|
||||||
+++ b/analysis/app.py
|
|
||||||
@@ -53,14 +53,14 @@ class App:
|
|
||||||
|
|
||||||
def startup_app(self, host, port, tls, cert_file, key_file, ca_file, log_level):
|
|
||||||
"""start flask app"""
|
|
||||||
- if not os.path.exists(cert_file) or not os.path.exists(key_file) or not os.path.exists(ca_file):
|
|
||||||
- LOGGER.error("Startup failed. Please provide the authentication certificate.")
|
|
||||||
- raise FileNotFoundError("Startup failed. Please provide the authentication certificate.")
|
|
||||||
level = logging.getLevelName(log_level.upper())
|
|
||||||
self.config_log(level)
|
|
||||||
self.add_resource()
|
|
||||||
context = None
|
|
||||||
if tls:
|
|
||||||
+ if not os.path.exists(cert_file) or not os.path.exists(key_file) or not os.path.exists(ca_file):
|
|
||||||
+ LOGGER.error("Startup failed. Please provide the authentication certificate.")
|
|
||||||
+ raise FileNotFoundError("Startup failed. Please provide the authentication certificate.")
|
|
||||||
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
|
||||||
context.load_cert_chain(certfile=cert_file, keyfile=key_file)
|
|
||||||
context.load_verify_locations(ca_file)
|
|
||||||
--
|
|
||||||
1.8.3.1
|
|
||||||
|
|
||||||
45
remove-the-installation-of-atune-ui-related-files.patch
Normal file
45
remove-the-installation-of-atune-ui-related-files.patch
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
From 33dc1c15e65c0212635a5063a95206376e97e2bc Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <zhoupengcheng11@huawei.com>
|
||||||
|
Date: Wed, 7 Feb 2024 10:53:14 +0800
|
||||||
|
Subject: [PATCH] remove-the-installation-of-atune-ui-related-files
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile | 4 ----
|
||||||
|
1 file changed, 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 4c70a9f..cb1d16c 100755
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -28,7 +28,6 @@ abs-python:
|
||||||
|
@if [ $(PYDIR) ] ; then \
|
||||||
|
sed -i "s?ExecStart=.*python3?ExecStart=$(PYDIR)?g" $(CURDIR)/misc/atune-engine.service; \
|
||||||
|
sed -i "s?ExecStart=.*python3?ExecStart=$(PYDIR)?g" $(CURDIR)/misc/atune-rest.service; \
|
||||||
|
- sed -i "s?ExecStart=.*python3?ExecStart=$(PYDIR)?g" $(CURDIR)/misc/atune-ui.service; \
|
||||||
|
else \
|
||||||
|
echo "no python3 exists."; \
|
||||||
|
fi
|
||||||
|
@@ -99,12 +98,10 @@ libinstall:
|
||||||
|
install -m 640 misc/atuned.service $(SYSTEMDDIR)
|
||||||
|
install -m 640 misc/atuned.cnf $(DESTDIR)/etc/atuned/
|
||||||
|
install -m 640 misc/engine.cnf $(DESTDIR)/etc/atuned/
|
||||||
|
- install -m 640 misc/ui.cnf $(DESTDIR)/etc/atuned/
|
||||||
|
install -m 640 rules/tuning/tuning_rules.grl $(DESTDIR)/etc/atuned/rules
|
||||||
|
install -m 640 misc/atune-engine.service $(SYSTEMDDIR)
|
||||||
|
install -m 640 database/atuned.db $(DESTDIR)/var/lib/atuned/
|
||||||
|
install -m 640 misc/atune-adm $(DESTDIR)$(PREFIX)/share/bash-completion/completions/
|
||||||
|
- install -m 640 misc/atune-ui.service $(SYSTEMDDIR)
|
||||||
|
\cp -rf analysis/* $(DESTDIR)$(PREFIX)/$(LIBEXEC)/atuned/analysis/
|
||||||
|
chmod -R 750 $(DESTDIR)$(PREFIX)/$(LIBEXEC)/atuned/analysis/
|
||||||
|
\cp -rf profiles/* $(DESTDIR)$(PREFIX)/lib/atuned/profiles/
|
||||||
|
@@ -202,7 +199,6 @@ startup:
|
||||||
|
systemctl restart atune-rest
|
||||||
|
systemctl restart atuned
|
||||||
|
systemctl restart atune-engine
|
||||||
|
- systemctl restart atune-ui
|
||||||
|
|
||||||
|
yaml-generator:
|
||||||
|
\cp -rf tuning/yamls/* $(DESTDIR)/etc/atuned/tuning
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user