mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): batch migrate use enable_tls_migration option
This commit is contained in:
@@ -565,13 +565,14 @@ type GuestBatchMigrateRequest struct {
|
||||
// swagger:ignore
|
||||
PreferHost string `json:"prefer_host" yunion-deprecated-by:"prefer_host_id"`
|
||||
SkipCpuCheck bool `json:"skip_cpu_check"`
|
||||
EnableTLS *bool `json:"enable_tls"`
|
||||
}
|
||||
|
||||
type GuestBatchMigrateParams struct {
|
||||
Id string
|
||||
LiveMigrate bool
|
||||
SkipCpuCheck bool
|
||||
EnableTLS bool
|
||||
EnableTLS *bool
|
||||
RescueMode bool
|
||||
OldStatus string
|
||||
}
|
||||
|
||||
@@ -4488,6 +4488,10 @@ func (manager *SGuestManager) PerformBatchMigrate(ctx context.Context, userCred
|
||||
}
|
||||
}
|
||||
|
||||
if params.EnableTLS == nil {
|
||||
params.EnableTLS = &options.Options.EnableTlsMigration
|
||||
}
|
||||
|
||||
guests := make([]SGuest, 0)
|
||||
q := GuestManager.Query().In("id", params.GuestIds)
|
||||
err = db.FetchModelObjects(GuestManager, q, &guests)
|
||||
@@ -4516,6 +4520,7 @@ func (manager *SGuestManager) PerformBatchMigrate(ctx context.Context, userCred
|
||||
RescueMode: guests[i].Status == api.VM_UNKNOWN,
|
||||
OldStatus: guests[i].Status,
|
||||
SkipCpuCheck: params.SkipCpuCheck,
|
||||
EnableTLS: params.EnableTLS,
|
||||
}
|
||||
guests[i].SetStatus(userCred, api.VM_START_MIGRATE, "batch migrate")
|
||||
if _, ok := hostGuests[guests[i].HostId]; ok {
|
||||
|
||||
@@ -49,7 +49,7 @@ func (self *HostGuestsMigrateTask) OnInit(ctx context.Context, objs []db.IStanda
|
||||
guest := objs[i].(*models.SGuest)
|
||||
if guests[i].LiveMigrate {
|
||||
err := guest.StartGuestLiveMigrateTask(
|
||||
ctx, self.UserCred, guests[i].OldStatus, preferHostId, &guests[i].SkipCpuCheck, &guests[i].EnableTLS, self.Id)
|
||||
ctx, self.UserCred, guests[i].OldStatus, preferHostId, &guests[i].SkipCpuCheck, guests[i].EnableTLS, self.Id)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user