guest add metadata cpu mode

- live migrate if guest cpu mode is qemu, do not check host cpu mode
- disk name generation replace '_' to '-'
This commit is contained in:
wanyaoqi
2020-03-20 15:04:46 +08:00
parent 64698288ec
commit f4d86b4fb2
6 changed files with 22 additions and 5 deletions
+1 -1
View File
@@ -3151,7 +3151,7 @@ func (self *SGuest) createDiskOnStorage(ctx context.Context, userCred mcclient.T
lockman.LockClass(ctx, QuotaManager, self.ProjectId)
defer lockman.ReleaseClass(ctx, QuotaManager, self.ProjectId)
diskName := fmt.Sprintf("vdisk_%s_%d", self.Name, time.Now().UnixNano())
diskName := fmt.Sprintf("vdisk-%s-%d", self.Name, time.Now().UnixNano())
billingType := billing_api.BILLING_TYPE_POSTPAID
billingCycle := ""
+8 -3
View File
@@ -59,9 +59,14 @@ func (self *GuestMigrateTask) GetSchedParams() (*schedapi.ScheduleInput, error)
guestStatus, _ := self.Params.GetString("guest_status")
if !jsonutils.QueryBoolean(self.Params, "is_rescue_mode", false) && (guestStatus == api.VM_RUNNING || guestStatus == api.VM_SUSPEND) {
schedDesc.LiveMigrate = true
host := guest.GetHost()
schedDesc.CpuDesc = host.CpuDesc
schedDesc.CpuMicrocode = host.CpuMicrocode
if guest.GetMetadata("__cpu_mode", self.UserCred) != api.CPU_MODE_QEMU {
host := guest.GetHost()
schedDesc.CpuDesc = host.CpuDesc
schedDesc.CpuMicrocode = host.CpuMicrocode
schedDesc.CpuMode = api.CPU_MODE_HOST
} else {
schedDesc.CpuMode = api.CPU_MODE_QEMU
}
}
return schedDesc, nil
}