Skip to content
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

Use blivet's "device ID" as a unique device identifier #5435

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

vojtechtrefny
Copy link
Contributor

Anaconda currently uses name to identify devices internally which causes a lot of problems because multiple devices can share the same name. To fix this blivet introduced a new "device ID" which is unique even for devices with the same name (for technologies that support multiple devices with the same name and for devices sharing the same name but using a different storage technology).


This is not yet finished, but it should be usable for testing and further development on the WebUI side. The blivet change (storaged-project/blivet#1182) is merged but not yet released. Unit tests should be passing on this, I also tried running manual installation with mount point assignment in TUI and also running (most of) kickstart tests and everything seems to be working so far. The Gtk custom partitioning is not yet adjusted to this change but is somewhat working if you ignore the weird "names" displayed in the UI.

@pep8speaks
Copy link

pep8speaks commented Jan 30, 2024

Hello @vojtechtrefny! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 28:63: E231 missing whitespace after ','

Comment last updated at 2024-07-12 13:14:41 UTC

Copy link
Contributor

@M4rtinK M4rtinK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me code wise, but I'm afraid I can't really judge the full context of this change in regards to Blivet & Web UI. :P

@rvykydal
Copy link
Contributor

If I create biosboot partition, boot partition and btrfs volume with a subvolume in terminal:

set -x

DISK=$1

sgdisk --zap-all ${DISK}
sgdisk --new=0:0:+1MiB --typecode=0:ef02 ${DISK}
sgdisk --new=0:0:+1GB ${DISK}
mkfs.ext4 -F ${DISK}2
sgdisk --new=0:0:+10GiB ${DISK}
mkfs.btrfs -f -L v3 ${DISK}3

# DUP
#sgdisk --new=0:0:+1GiB ${DISK}
#mkfs.btrfs -f -L v4 ${DISK}4


##mkfs.btrfs -f -f -L btrfstest ${DISK}3
##sgdisk --new=0:0:+2GiB ${DISK}
##mkfs.btrfs -f -f -L btrfstest ${DISK}4

TMP_MOUNT="/tmp/btrfs-mount-test"
mkdir -p ${TMP_MOUNT}

mount ${DISK}3 ${TMP_MOUNT}
btrfs subvolume create ${TMP_MOUNT}/root
umount ${TMP_MOUNT}

# DUP
#mount ${DISK}4 ${TMP_MOUNT}
#btrfs subvolume create ${TMP_MOUNT}/root
#umount ${TMP_MOUNT}

rmdir ${TMP_MOUNT}


#sgdisk --new=0:0:0 ${DISK}
#mkfs.xfs -f ${DISK}4


udevadm trigger
udevadm settle --timeout=120

lsblk
blkid

Then rescan the storage, go to mount points assignment, assign the partitions with reformatting I get failure in:

INFO:blivet:registered action: [224] create device btrfs subvolume root (id 219)
DEBUG:blivet:             DeviceTree.get_device_by_device_id: device_id: BTRFS-dafddd9d-7a42-414d-b66c-223d290d6b03-root ; incomplete: False ; hidden: False ;
DEBUG:blivet:             DeviceTree.get_device_by_device_id returned None
INFO:anaconda.core.threads:Thread Failed: AnaTaskThread-ManualPartitioningTask-1 (139822322681536)
ERROR:anaconda.modules.common.task.task:Thread AnaTaskThread-ManualPartitioningTask-1 has failed: Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/pyanaconda/core/threads.py", line 280, in run
    threading.Thread.run(self)
  File "/usr/lib64/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib64/python3.12/site-packages/pyanaconda/modules/common/task/task.py", line 94, in _thread_run_callback
    self._task_run_callback()
  File "/usr/lib64/python3.12/site-packages/pyanaconda/modules/common/task/task.py", line 107, in _task_run_callback
    self._set_result(self.run())
                     ^^^^^^^^^^
  File "/usr/lib64/python3.12/site-packages/pyanaconda/modules/storage/partitioning/base_partitioning.py", line 53, in run
    self._run(self._storage)
  File "/usr/lib64/python3.12/site-packages/pyanaconda/modules/storage/partitioning/automatic/noninteractive_partitioning.py", line 43, in _run
    self._configure_partitioning(storage)
  File "/usr/lib64/python3.12/site-packages/pyanaconda/modules/storage/partitioning/manual/manual_partitioning.py", line 53, in _configure_partitioning
    self._setup_mount_point(storage, mount_data)
  File "/usr/lib64/python3.12/site-packages/pyanaconda/modules/storage/partitioning/manual/manual_partitioning.py", line 116, in _setup_mount_point
    mount_data.mount_options = device.format.options
                               ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'format'

storage.log

I think it happens because the recreated subvolume is not found here:
https://github.com/vojtechtrefny/anaconda/blob/8dba5f232bfc90141a16859fe18f465f7a822345/pyanaconda/modules/storage/partitioning/manual/manual_partitioning.py#L169

It used to work (at least got past this point as I checked) but I am not 100% sure my use case makes sense. (Maybe the issue is that the volume is recreated as well because the only subvolume is destroyed so the uuids are new?)
I am looking into it.

@rvykydal
Copy link
Contributor

rvykydal commented Feb 13, 2024

It used to work (at least got past this point as I checked) but I am not 100% sure my use case makes sense. (Maybe the issue is that the volume is recreated as well because the only subvolume is destroyed so the uuids are new?) I am looking into it.

Yes, the issue here seems that if the volume is destroyed together with the subvolume and then recreated, finding the subvolume by device_id containing uuid of the former subvolume fails. I don't hit the issue if the volume contains 2 subvolumes and I reformat one of them in mount point assignment.

I'll update the webui tests for this PR, add a test for this specific case.
Then I'll perhaps update presentation of the device uuid in the WebUI to the user (like BTRFS-f586c782-f9da-4cfa-b9a4-c3da16914bae-data -> BTRFS subvolume data of volume vol (f586c782-f9da-4cfa-b9a4-c3da16914) - but this will be subject of discussion I guess.

@vojtechtrefny
Copy link
Contributor Author

@rvykydal I've added a new commit that should fix this issue.

@rvykydal
Copy link
Contributor

@rvykydal I've added a new commit that should fix this issue.

Thank you, I have just a few nitpicks.

Copy link

This PR is stale because it has been open 60 days with no activity.
Remove stale label or comment or this will be closed in 30 days.

@vojtechtrefny vojtechtrefny marked this pull request as ready for review July 9, 2024 11:49
@vojtechtrefny vojtechtrefny changed the title [WIP] Use blivet's "device ID" as a unique device identifier Use blivet's "device ID" as a unique device identifier Jul 9, 2024
@vojtechtrefny vojtechtrefny added the manual testing required This issue can't be merged without manual testing label Jul 9, 2024
@vojtechtrefny
Copy link
Contributor Author

vojtechtrefny commented Jul 9, 2024

This is mostly finished now. I plan to do some more manual testing to be sure everything works, but other than that I don't plan to make more changes.

If you wish to help with testing, you can find updates image for rawhide with all the changes (and latest blivet which also has some fixes) is available here.

Anaconda currently uses name to identify devices internally which
causes a lot of problems because multiple devices can share the
same name. To fix this blivet introduced a new "device ID" which
is unique even for devices with the same name (for technologies
that support multiple devices with the same name and for devices
sharing the same name but using a different storage technology).
We can't use the device factory in the manual partitioning
because when it removes the last subvolume it also removes the
volume which want to keep untouched when just recreating the
subvolume.
We want to show device name (or description) in the reclaim space
dialog but use the unique device ID internally.
This should cover all places where name was used as device
identifier in the storage, advanced storage and custom spokes.
Copy link
Contributor

@KKoukiou KKoukiou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be mark in the specfile tha tthis current anaconda-core is incomptatible with the current version of the Web UI package?

@@ -26,78 +28,78 @@
</object>
<object class="GtkAdjustment" id="resizeAdjustment">
<property name="upper">100</property>
<property name="step_increment">1</property>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are unrelated. I guess these are autogenerated. Is there a reason for storing these here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f41 manual testing required This issue can't be merged without manual testing
5 participants