fix2222
This commit is contained in:
@@ -6,8 +6,8 @@ from PySide6.QtWidgets import QMessageBox
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class LvmOperations:
|
||||
def __init__(self):
|
||||
pass
|
||||
def __init__(self, disk_ops=None): # <--- Add disk_ops parameter
|
||||
self.disk_ops = disk_ops # Store disk_ops instance
|
||||
|
||||
def _execute_shell_command(self, command_list, error_message, root_privilege=True,
|
||||
suppress_critical_dialog_on_stderr_match=None, input_data=None,
|
||||
@@ -92,6 +92,15 @@ class LvmOperations:
|
||||
QMessageBox.critical(None, "错误", "无效的设备路径。")
|
||||
return False
|
||||
|
||||
# NEW: 尝试解决设备占用问题
|
||||
if self.disk_ops: # Ensure disk_ops is available
|
||||
if not self.disk_ops._resolve_device_occupation(device_path, action_description=f"在 {device_path} 上创建物理卷"):
|
||||
logger.info(f"用户取消或未能解决设备 {device_path} 的占用问题,取消创建物理卷。")
|
||||
return False
|
||||
else:
|
||||
logger.warning("DiskOperations 实例未传递给 LvmOperations,无法解决设备占用问题。")
|
||||
|
||||
|
||||
reply = QMessageBox.question(None, "确认创建物理卷",
|
||||
f"您确定要在设备 {device_path} 上创建物理卷吗?此操作将覆盖设备上的数据。",
|
||||
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
|
||||
|
||||
Reference in New Issue
Block a user