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

modules/btrfs: add SetDefaultSubvolumeID #1226

Merged

Conversation

jelly
Copy link
Contributor

@jelly jelly commented Nov 22, 2023

libblockdev provides a method to set the default subvolume id since
2014. This method does requires administrative privileges as it changes the default mount target subvolume of a btrfs volume.


Turns out I was wrong and thought libblockdev did not provide a method for it but it has a slightly different name.

@StorageGhoul
Copy link

Can one of the admins verify this patch?

@vojtechtrefny
Copy link
Member

Jenkins, ok to test.

@@ -399,3 +399,10 @@ def test_get_default_subvolume_id(self):
default_id = dev.obj.GetDefaultSubvolumeID(self.no_options,
dbus_interface=self.iface_prefix + '.Filesystem.BTRFS')
self.assertEqual(default_id, 5)

dev.obj.SetDefaultSubvolumeID(5, self.no_options,
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be dbus.UInt32(5), 5 is treated as int32 by Python DBus.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed!

libblockdev provides a method to set the default subvolume id since
2014. This method does requires administrative privileges as it changes
the default mount target subvolume of a btrfs volume.
@jelly jelly force-pushed the set-default-btrfs-subvol-id branch from 0a208bd to 33d2271 Compare November 23, 2023 16:26
@vojtechtrefny vojtechtrefny merged commit 4f24c90 into storaged-project:master Nov 24, 2023
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants