1 Star 0 Fork 107

YIN JIAYI/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-Run-actions-of-the-Resize-dialog-in-the-reversed-ord.patch 3.19 KB
一键复制 编辑 原始数据 按行查看 历史
xuxiaolong 提交于 2021-04-02 10:25 . sync 49 fixbug from github
From 2ca64adb8effcdfa8a883ee9f8fc2015cbece685 Mon Sep 17 00:00:00 2001
From: Vendula Poncova <[email protected]>
Date: Tue, 28 Jul 2020 11:58:23 +0200
Subject: [PATCH] Run actions of the Resize dialog in the reversed order
(#1856496)
If there is a disk with two logical partitions sda5 and sda6 and we remove sda5,
Blivet renames the partition sda6 to sda5, so the actions for sda6 are no longer
valid. Run actions in the reversed order to avoid this situation.
Resolves: rhbz#1856496
---
pyanaconda/ui/gui/spokes/lib/resize.py | 29 +++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index 71dcffb05..4695e5332 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -19,6 +19,7 @@
from collections import namedtuple
from blivet.size import Size
+from pyanaconda.anaconda_loggers import get_module_logger
from pyanaconda.core.i18n import _, C_, N_, P_
from pyanaconda.modules.common.constants.services import STORAGE
from pyanaconda.modules.common.structures.storage import OSData, DeviceData, DeviceFormatData
@@ -55,6 +56,8 @@ SHRINK = N_("Shrink")
DELETE = N_("Delete")
NOTHING = ""
+log = get_module_logger(__name__)
+
class ResizeDialog(GUIObject):
builderObjects = ["actionStore", "diskStore", "resizeDialog", "resizeAdjustment"]
@@ -521,7 +524,8 @@ class ResizeDialog(GUIObject):
self._update_reclaim_button(self._selected_reclaimable_space)
self._update_action_buttons()
- def _schedule_actions(self, model, path, itr, *args):
+ def _collect_actionable_rows(self, model, path, itr, rows):
+ """Collect rows that can be transformed into actions."""
obj = PartStoreRow(*model[itr])
if not obj.name:
@@ -530,17 +534,32 @@ class ResizeDialog(GUIObject):
if not obj.editable:
return False
+ rows.append(obj)
+ return False
+
+ def _schedule_actions(self, obj):
+ """Schedule actions for the given row object."""
if obj.action == _(PRESERVE):
- pass
+ log.debug("Preserve %s.", obj.name)
elif obj.action == _(SHRINK):
+ log.debug("Shrink %s to %s.", obj.name, Size(obj.target))
self._device_tree.ShrinkDevice(obj.name, obj.target)
elif obj.action == _(DELETE):
+ log.debug("Remove %s.", obj.name)
self._device_tree.RemoveDevice(obj.name)
- return False
-
def on_resize_clicked(self, *args):
- self._disk_store.foreach(self._schedule_actions, None)
+ rows = []
+
+ # Collect the rows.
+ self._disk_store.foreach(self._collect_actionable_rows, rows)
+
+ # Process rows in the reversed order. If there is a disk with
+ # two logical partitions sda5 and sda6 and we remove sda5, Blivet
+ # renames the partition sda6 to sda5, so the actions for sda6 are
+ # no longer valid. See the bug 1856496.
+ for obj in reversed(rows):
+ self._schedule_actions(obj)
def on_delete_all_clicked(self, button, *args):
if button.get_label() == C_("GUI|Reclaim Dialog", "Delete _all"):
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yinjiayi/anaconda.git
[email protected]:yinjiayi/anaconda.git
yinjiayi
anaconda
anaconda
master

搜索帮助