Skip to content

Commit

Permalink
report when live migration is being aborted
Browse files Browse the repository at this point in the history
Signed-off-by: Vladik Romanovsky <[email protected]>
  • Loading branch information
vladikr committed Mar 1, 2019
1 parent 927f7a0 commit 8f0e86b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/virt-launcher/virtwrap/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (l *LibvirtDomainManager) asyncMigrate(vmi *v1.VirtualMachineInstance) {
params.MigrateDisksSet = true
}
// start live migration tracking
go liveMigrationMonitor(vmi, dom)
go liveMigrationMonitor(vmi, dom, l)
err = dom.MigrateToURI3(dstUri, params, migrateFlags)
if err != nil {

Expand Down Expand Up @@ -407,7 +407,7 @@ func getVMIMigrationDataSize(vmi *v1.VirtualMachineInstance) int64 {
return memory.ScaledValue(resource.Giga)
}

func liveMigrationMonitor(vmi *v1.VirtualMachineInstance, dom cli.VirDomain) {
func liveMigrationMonitor(vmi *v1.VirtualMachineInstance, dom cli.VirDomain, l *LibvirtDomainManager) {
logger := log.Log.Object(vmi)
start := time.Now().UTC().Unix()
lastProgressUpdate := start
Expand Down Expand Up @@ -445,6 +445,8 @@ func liveMigrationMonitor(vmi *v1.VirtualMachineInstance, dom cli.VirDomain) {
if err != nil {
logger.Reason(err).Error("failed to abort migration")
}
l.setMigrationResult(vmi, true, fmt.Sprintf("Live migration stuck for %d sec and has been aborted", progressDelay))
break
}

// check the overall migration time
Expand All @@ -456,6 +458,8 @@ func liveMigrationMonitor(vmi *v1.VirtualMachineInstance, dom cli.VirDomain) {
if err != nil {
logger.Reason(err).Error("failed to abort migration")
}
l.setMigrationResult(vmi, true, fmt.Sprintf("Live migration is not completed after %d sec and has been aborted", acceptableCompletionTime))
break
}

case libvirt.DOMAIN_JOB_NONE:
Expand Down

0 comments on commit 8f0e86b

Please sign in to comment.