mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
Merge pull request #13141 from zexi/batch-migrate-cpu-check
refix(region): skip_cpu_check for batch migrate api
This commit is contained in:
@@ -556,14 +556,16 @@ type GuestBatchMigrateRequest struct {
|
||||
PreferHostId string `json:"prefer_host_id"`
|
||||
// Deprecated
|
||||
// swagger:ignore
|
||||
PreferHost string `json:"prefer_host" yunion-deprecated-by:"prefer_host_id"`
|
||||
PreferHost string `json:"prefer_host" yunion-deprecated-by:"prefer_host_id"`
|
||||
SkipCpuCheck bool `json:"skip_cpu_check"`
|
||||
}
|
||||
|
||||
type GuestBatchMigrateParams struct {
|
||||
Id string
|
||||
LiveMigrate bool
|
||||
RescueMode bool
|
||||
OldStatus string
|
||||
Id string
|
||||
LiveMigrate bool
|
||||
SkipCpuCheck bool
|
||||
RescueMode bool
|
||||
OldStatus string
|
||||
}
|
||||
|
||||
type HostLoginInfo struct {
|
||||
|
||||
@@ -4435,10 +4435,11 @@ func (manager *SGuestManager) PerformBatchMigrate(ctx context.Context, userCred
|
||||
var hostGuests = map[string][]*api.GuestBatchMigrateParams{}
|
||||
for i := 0; i < len(guests); i++ {
|
||||
bmp := &api.GuestBatchMigrateParams{
|
||||
Id: guests[i].Id,
|
||||
LiveMigrate: guests[i].Status == api.VM_RUNNING,
|
||||
RescueMode: guests[i].Status == api.VM_UNKNOWN,
|
||||
OldStatus: guests[i].Status,
|
||||
Id: guests[i].Id,
|
||||
LiveMigrate: guests[i].Status == api.VM_RUNNING,
|
||||
RescueMode: guests[i].Status == api.VM_UNKNOWN,
|
||||
OldStatus: guests[i].Status,
|
||||
SkipCpuCheck: params.SkipCpuCheck,
|
||||
}
|
||||
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, obj db.IStandalon
|
||||
guest := models.GuestManager.FetchGuestById(guests[i].Id)
|
||||
if guests[i].LiveMigrate {
|
||||
err := guest.StartGuestLiveMigrateTask(
|
||||
ctx, self.UserCred, guests[i].OldStatus, preferHostId, nil, self.Id)
|
||||
ctx, self.UserCred, guests[i].OldStatus, preferHostId, &guests[i].SkipCpuCheck, self.Id)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user