fix(upgrade): move osTreeRefresh after post-upgrade hooks to prevent rollback#442
Conversation
There was a problem hiding this comment.
Sorry @electricface, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
9864e68 to
3e48ea8
Compare
…rollback Second reboot after upgrade triggered automatic rollback because /etc/deepin/deepin_update_option.json was missing in the new deployment. Root cause: when osTreeRefresh() is called with fullMerge=true, it creates a fresh deployment that discards all /etc modifications. Since osTreeRefresh() was called before preUpgradeCmdSuccessHook(), which writes /etc/deepin/deepin_update_option.json, that file was absent in the new deployment, causing the system to treat the upgrade as failed and roll back. When fullMerge=false, /etc modifications are preserved in the new deployment, so the bug does not occur in that case. Log: 修复全量合并升级后第二次重启自动回滚的问题 PMS: TASK-391183 Influence: 系统升级
3e48ea8 to
5ffb66b
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: electricface, zhaohuiw42 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已足够优秀,无需额外修改,此处展示当前最终态的合规代码片段供参考
func (m *Manager) preUpgradeCmdSuccessHook(job *Job, mode system.UpdateType, uuid string, refreshFullMerge bool) error {
if !m.config.GetPlatformStatusDisable(config.DisabledRebootCheck) {
err := m.setRebootCheckOption(mode, uuid)
if err != nil {
return err
}
} else {
m.handleAfterUpgradeSuccess(mode, job.Description, uuid)
}
// Perform immutable system refresh at the end of the upgrade process
if m.statusManager.abStatus == system.HasBackedUp {
if err := m.immutableManager.osTreeRefresh(refreshFullMerge); err != nil {
logger.Warning("ostree deploy refresh failed,", err)
}
}
m.statusManager.SetUpdateStatus(mode, system.Upgraded)
job.setPropProgress(1.00)
return nil
} |
Second reboot after upgrade triggered automatic rollback because
/etc/deepin/deepin_update_option.json was missing in the new deployment.
Root cause: when osTreeRefresh() is called with fullMerge=true, it creates a
fresh deployment that discards all /etc modifications. Since osTreeRefresh()
was called before preUpgradeCmdSuccessHook(), which writes
/etc/deepin/deepin_update_option.json, that file was absent in the new
deployment, causing the system to treat the upgrade as failed and roll back.
When fullMerge=false, /etc modifications are preserved in the new deployment,
so the bug does not occur in that case.