mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): do not clean up the running vm in the recycle bin (#19016)
This commit is contained in:
@@ -5549,6 +5549,13 @@ func (manager *SGuestManager) CleanPendingDeleteServers(ctx context.Context, use
|
||||
DeleteEip: options.Options.DeleteEipExpiredRelease,
|
||||
DeleteDisks: options.Options.DeleteDisksExpiredRelease,
|
||||
}
|
||||
// 跳过单独在云上开机过的虚拟机,避免误清理
|
||||
if len(guests[i].GetExternalId()) > 0 {
|
||||
iVm, err := guests[i].GetIVM(ctx)
|
||||
if err == nil && iVm.GetStatus() == api.VM_RUNNING {
|
||||
continue
|
||||
}
|
||||
}
|
||||
guests[i].StartDeleteGuestTask(ctx, userCred, "", opts)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user