-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DONTMERGE: Unmerged code required for the c-storage integration in the anaconda-webui (multiple PRs) #5403
DONTMERGE: Unmerged code required for the c-storage integration in the anaconda-webui (multiple PRs) #5403
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,7 +241,7 @@ def is_supported(disk): | |
|
||
return list(filter(is_supported, disks)) | ||
|
||
def reset(self, cleanup_only=False): | ||
def reset(self, cleanup_only=False, deep=True): | ||
""" Reset storage configuration to reflect actual system state. | ||
|
||
This will cancel any queued actions and rescan from scratch but not | ||
|
@@ -250,9 +250,16 @@ def reset(self, cleanup_only=False): | |
:keyword cleanup_only: prepare the tree only to deactivate devices | ||
:type cleanup_only: bool | ||
|
||
:keyward deep: perform a deep scan and re-read existing installations | ||
|
||
See :meth:`devicetree.Devicetree.populate` for more information | ||
about the cleanup_only keyword argument. | ||
""" | ||
if deep: | ||
log.debug("resetting storage configuration deep") | ||
else: | ||
log.debug("resetting storage configuration plain") | ||
|
||
# set up the disk images | ||
if conf.target.is_image: | ||
self.setup_disk_images() | ||
|
@@ -266,15 +273,17 @@ def reset(self, cleanup_only=False): | |
|
||
# Protect devices from teardown. | ||
self._mark_protected_devices() | ||
self.devicetree.teardown_all() | ||
if deep: | ||
self.devicetree.teardown_all() | ||
|
||
self.fsset = FSSet(self.devicetree) | ||
|
||
# Clear out attributes that refer to devices that are no longer in the tree. | ||
self.bootloader.reset() | ||
|
||
self.roots = [] | ||
self.roots = find_existing_installations(self.devicetree) | ||
if deep: | ||
self.roots = find_existing_installations(self.devicetree) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I talked to Vojta and we think this can be removed from the |
||
self.dump_state("initial") | ||
|
||
def _mark_protected_devices(self): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ def connect_signals(self): | |
"AppliedPartitioning", self.implementation.applied_partitioning_changed | ||
) | ||
|
||
def ScanDevicesWithTask(self) -> ObjPath: | ||
def ScanDevicesWithTask(self, deep_scan: bool = True) -> ObjPath: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer a new method for this that can be marked as a temporary workaround and eventually dropped. |
||
"""Scan all devices with a task. | ||
|
||
Create a model of the current storage. This model will be used | ||
|
@@ -50,7 +50,7 @@ def ScanDevicesWithTask(self) -> ObjPath: | |
:return: a path to a task | ||
""" | ||
return TaskContainer.to_object_path( | ||
self.implementation.scan_devices_with_task() | ||
self.implementation.scan_devices_with_task(deep_scan) | ||
) | ||
|
||
@emits_properties_changed | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw. we also call
teardown_all
during the installation, after we unlock a device and after we discover new devices. If I understand it correctly, Anaconda can never tear down any device if Cockpit Storage was used for the partitioning, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that
teardown_all
should be disabled globally via a flag or something if it is requested. It will be safer, more predictable and cleaner. You can start with usingdevicetree.teardown_all = lambda: log.debug("Tear down is disabled.")
as a temporary workaround for testing.