🤬
  • feat(backup): 集群备份、恢复过程详情展示

  • Loading...
  • ssongliu committed 3 years ago
    a0526535
    1 parent ded007d1
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■
    pkg/model/cluster_log.go
    skipped 8 lines
    9 9   
    10 10  type ClusterLog struct {
    11 11   common.BaseModel
    12  - ID string `json:"-"`
     12 + ID string `json:"id"`
    13 13   ClusterID string `json:"clusterId"`
    14 14   Type string `json:"type"`
    15 15   StartTime time.Time `json:"startTime"`
    skipped 10 lines
  • ■ ■ ■ ■ ■ ■
    pkg/model/zone.go
    skipped 21 lines
    22 22   CredentialID string `json:"credentialId" gorm:"type:varchar(64)"`
    23 23   IpPoolID string `json:"ipPoolId"`
    24 24   Region Region `json:"-"`
    25  - IpPool IpPool `json:"_"`
    26  - Credential Credential `json:"_"`
     25 + IpPool IpPool `json:"-"`
     26 + Credential Credential `json:"-"`
    27 27  }
    28 28   
    29 29  func (z *Zone) BeforeCreate() (err error) {
    skipped 16 lines
  • ■ ■ ■ ■ ■
    pkg/service/cluster_backup_file.go
    skipped 2 lines
    3 3  import (
    4 4   "encoding/json"
    5 5   "errors"
    6  - "github.com/KubeOperator/KubeOperator/pkg/db"
    7 6   "io/ioutil"
    8 7   "os"
    9 8   "time"
     9 + 
     10 + "github.com/KubeOperator/KubeOperator/pkg/db"
     11 + "github.com/KubeOperator/KubeOperator/pkg/util/ansible"
    10 12   
    11 13   "github.com/KubeOperator/KubeOperator/pkg/cloud_storage"
    12 14   "github.com/KubeOperator/KubeOperator/pkg/constant"
    skipped 183 lines
    196 198   }
    197 199   admCluster := adm.NewCluster(cluster)
    198 200   p := &backup.BackupClusterPhase{}
    199  - err = p.Run(admCluster.Kobe, nil)
     201 + 
     202 + writer, err := ansible.CreateAnsibleLogWriterWithId(cluster.Name, clog.ID)
     203 + if err != nil {
     204 + logger.Log.Error(err)
     205 + }
     206 + err = p.Run(admCluster.Kobe, writer)
    200 207   if err != nil {
    201 208   logger.Log.Errorf("run cluster log failed, error: %s", err.Error())
    202 209   _ = c.clusterLogService.End(&clog, false, err.Error())
    skipped 138 lines
    341 348   
    342 349   admCluster := adm.NewCluster(cluster.Cluster)
    343 350   p := &backup.RestoreClusterPhase{}
    344  - err = p.Run(admCluster.Kobe, nil)
     351 + 
     352 + writer, err := ansible.CreateAnsibleLogWriterWithId(cluster.Name, clog.ID)
     353 + if err != nil {
     354 + logger.Log.Error(err)
     355 + }
     356 + 
     357 + err = p.Run(admCluster.Kobe, writer)
    345 358   if err != nil {
    346 359   logger.Log.Errorf("restore cluster phase run failed, error: %s", err.Error())
    347 360   _ = c.clusterLogService.End(&clog, false, err.Error())
    skipped 48 lines
    396 409   
    397 410   admCluster := adm.NewCluster(cluster.Cluster)
    398 411   p := &backup.RestoreClusterPhase{}
    399  - err = p.Run(admCluster.Kobe, nil)
     412 + 
     413 + writer, err := ansible.CreateAnsibleLogWriterWithId(cluster.Name, clog.ID)
     414 + if err != nil {
     415 + logger.Log.Error(err)
     416 + }
     417 + 
     418 + err = p.Run(admCluster.Kobe, writer)
    400 419   if err != nil {
    401 420   logger.Log.Errorf("run cluster log failed, error: %s", err.Error())
    402 421   _ = c.clusterLogService.End(&clog, false, err.Error())
    skipped 29 lines
Please wait...
Page is in error, reload to recover