mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: migrate set downtime
This commit is contained in:
@@ -768,7 +768,11 @@ func (s *SGuestLiveMigrateTask) doMigrate() {
|
||||
copyIncremental = true
|
||||
}
|
||||
s.Monitor.Migrate(fmt.Sprintf("tcp:%s:%d", s.params.DestIp, s.params.DestPort),
|
||||
copyIncremental, false, s.startMigrateStatusCheck)
|
||||
copyIncremental, false, s.onSetMigrateDowntime)
|
||||
}
|
||||
|
||||
func (s *SGuestLiveMigrateTask) onSetMigrateDowntime(res string) {
|
||||
s.Monitor.MigrateSetDowntime(options.HostOptions.DefaultLiveMigrateDowntime, s.startMigrateStatusCheck)
|
||||
}
|
||||
|
||||
func (s *SGuestLiveMigrateTask) startMigrateStatusCheck(res string) {
|
||||
|
||||
@@ -304,6 +304,10 @@ func (m *HmpMonitor) DeviceAdd(dev string, params map[string]interface{}, callba
|
||||
m.Query(fmt.Sprintf("device_add %s,%s", dev, strings.Join(paramsKvs, ",")), callback)
|
||||
}
|
||||
|
||||
func (m *HmpMonitor) MigrateSetDowntime(dtSec float32, callback StringCallback) {
|
||||
m.Query(fmt.Sprintf("migrate_set_downtime %f", dtSec), callback)
|
||||
}
|
||||
|
||||
func (m *HmpMonitor) MigrateSetCapability(capability, state string, callback StringCallback) {
|
||||
m.Query(fmt.Sprintf("migrate_set_capability %s %s", capability, state), callback)
|
||||
}
|
||||
|
||||
@@ -175,6 +175,7 @@ type Monitor interface {
|
||||
BlockStream(drive string, idx, blkCnt int, callback StringCallback)
|
||||
DriveMirror(callback StringCallback, drive, target, syncMode string, unmap, blockReplication bool)
|
||||
|
||||
MigrateSetDowntime(dtSec float32, callback StringCallback)
|
||||
MigrateSetCapability(capability, state string, callback StringCallback)
|
||||
MigrateSetParameter(key, val string, callback StringCallback)
|
||||
MigrateIncoming(address string, callback StringCallback)
|
||||
|
||||
@@ -582,6 +582,21 @@ func (m *QmpMonitor) DeviceAdd(dev string, params map[string]interface{}, callba
|
||||
// m.Query(cmd, cb)
|
||||
}
|
||||
|
||||
func (m *QmpMonitor) MigrateSetDowntime(dtSec float32, callback StringCallback) {
|
||||
var (
|
||||
cb = func(res *Response) {
|
||||
callback(m.actionResult(res))
|
||||
}
|
||||
)
|
||||
cmd := &Command{
|
||||
Execute: "migrate-set-downtime",
|
||||
Args: map[string]interface{}{
|
||||
"value": dtSec,
|
||||
},
|
||||
}
|
||||
m.Query(cmd, cb)
|
||||
}
|
||||
|
||||
func (m *QmpMonitor) MigrateSetCapability(capability, state string, callback StringCallback) {
|
||||
var (
|
||||
cb = func(res *Response) {
|
||||
|
||||
@@ -104,7 +104,7 @@ type SHostOptions struct {
|
||||
// 更改默认带宽限速为400GBps, qiujian
|
||||
BandwidthLimit int `default:"400000" help:"Bandwidth upper bound when migrating disk image in MB/sec, default 400GBps"`
|
||||
// 热迁移带宽,预期不低于8MBps, 1G Memory takes 128 seconds
|
||||
MigrateExpectRate int `default:"8" help:"Expected memory migration rate in MB/sec, default 8MBps"`
|
||||
MigrateExpectRate int `default:"32" help:"Expected memory migration rate in MB/sec, default 32MBps"`
|
||||
MinMigrateTimeoutSeconds int `default:"30" help:"minimal timeout for a migration process, default 30 seconds"`
|
||||
|
||||
SnapshotDirSuffix string `help:"Snapshot dir name equal diskId concat snapshot dir suffix" default:"_snap"`
|
||||
@@ -165,6 +165,8 @@ type SHostOptions struct {
|
||||
EnableVirtioRngDevice bool `help:"enable qemu virtio-rng device" default:"true"`
|
||||
|
||||
RestrictQemuImgConvertWorker bool `help:"restrict qemu-img convert worker" default:"false"`
|
||||
|
||||
DefaultLiveMigrateDowntime float32 `help:"allow downtime in seconds for live migrate" default:"5.0"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user