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

WIP: Initial Stratis support #915

Conversation

vojtechtrefny
Copy link
Member

This adds just a basic support for Stratis devices. Information about stratis blokdevs, pools and filesystems is gathered using the Stratis DBus API. I've added two new devices (StratisFilesystemDevice and StratisPoolDevice) and a new format (StratisBlockdev) with just few stratis specific properties for now. This is definitely not finished, I'm posting it here just to get some feedback about the "design" decisions, naming etc.

Stratis devices in devicetree

existing 1024 MiB disk sdc (304) with existing stratis
  existing 2 GiB stratis_pool stratis_howto (313)
    existing 1024 GiB stratis_filesystem stratis_howto/fs_howto2 (317) with existing xfs filesystem
    existing 1024 GiB stratis_filesystem stratis_howto/fs_howto (327) with existing xfs filesystem
existing 1024 MiB disk sdb (338) with existing stratis
  existing 2 GiB stratis_pool stratis_howto (313)
    ...

Stratis filesystem device

StratisFilesystemDevice instance (0x7f6d3c2fe8b0) --
  name = stratis_howto/fs_howto  status = True  id = 327
  children = []
  parents = ['existing 2 GiB stratis_pool stratis_howto (313)']
  uuid = 2d3dd8a9c7fe4217a792a0ca0bae5d24  size = 1024 GiB
  format = existing xfs filesystem
  major = 0  minor = 0  exists = True  protected = False
  sysfs path = /sys/devices/virtual/block/dm-12
  target size = 1024 GiB  path = /stratis/stratis_howto/fs_howto
  format args = []  original_format = xfs

Stratis pool device

StratisPoolDevice instance (0x7f6d3c2fe6a0) --
  name = stratis_howto  status = True  id = 313
  children = ['existing 1024 GiB stratis_filesystem stratis_howto/fs_howto2 (317) with '
 'existing xfs filesystem',
 'existing 1024 GiB stratis_filesystem stratis_howto/fs_howto (327) with '
 'existing xfs filesystem']
  parents = ['existing 1024 MiB disk sdc (304) with existing stratis',
 'existing 1024 MiB disk sdb (338) with existing stratis']
  uuid = f9eb3e81d0c04f9fb28db24365e4f754  size = 2 GiB
  format = existing None
  major = 0  minor = 0  exists = True  protected = False
  sysfs path = 
  target size = 2 GiB  path = /stratis/stratis_howto
  format args = []  original_format = None

blivet/devices/stratis.py Show resolved Hide resolved
blivet/devices/stratis.py Show resolved Hide resolved
STRATIS_MANAGER_INTF = STRATIS_SERVICE + ".Manager"


STRATIS_FS_SIZE = Size("1 TiB")
Copy link
Member Author

@vojtechtrefny vojtechtrefny Dec 9, 2020

Choose a reason for hiding this comment

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

Can we expect this to be always 1 TiB? We need the size just for the initial device scan, it is later updated from sysfs.

Choose a reason for hiding this comment

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

Currently, you can expect this to always start as 1 TiB. It will grow if the physical storage available is greater than 1 TiB and the filesystem fills up. Stratis automatically extends the filesystem size when it fills up. Currently, resizing will double the filesystem size.

blivet/devices/stratis.py Outdated Show resolved Hide resolved
Comment on lines 36 to 40
STRATIS_POOL_INTF = STRATIS_SERVICE + ".pool"
STRATIS_FILESYSTEM_INTF = STRATIS_SERVICE + ".filesystem"
STRATIS_BLOCKDEV_INTF = STRATIS_SERVICE + ".blockdev"
STRATIS_PROPS_INTF = STRATIS_SERVICE + ".FetchProperties"
STRATIS_MANAGER_INTF = STRATIS_SERVICE + ".Manager"

Choose a reason for hiding this comment

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

A few notes about the interface design that we have. Because we try to be as backwards compatible as possible, these interface names should still be available in Stratis v2.x, but just a note that these are the oldest interfaces available. These will probably need to be updated as new Fedora releases include later versions of stratisd.

Copy link
Contributor

Choose a reason for hiding this comment

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

jbaublitz is correct. You'll generally want the most recent revision for the version of stratisd that is available.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've used these interfaces mostly because I didn't need any properties from the newer revisions, but I'll try to use the newest interfaces in the future.

@jbaublitz
Copy link

I'll do a more thorough look through after I've discussed with the team, but this overall looks like a really good starting point!

Copy link
Contributor

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

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

Looks fine!

blivet/formats/stratis.py Outdated Show resolved Hide resolved
blivet/devices/stratis.py Show resolved Hide resolved
@vojtechtrefny vojtechtrefny force-pushed the 3.3-devel_stratis-support branch 2 times, most recently from 51125a2 to 58b750a Compare December 22, 2020 15:29
@vojtechtrefny vojtechtrefny force-pushed the 3.3-devel_stratis-support branch from 58b750a to c187d08 Compare January 18, 2021 13:29
@vojtechtrefny
Copy link
Member Author

vojtechtrefny commented Feb 8, 2021

I've pushed an updated version which includes a special class for the XFS filesystem on Stratis -- it's basically XFS with _create and _destroy functions overridden to be no-op. I think it's way better solution that having the workaround to not remove/create filesystem on Stratis FS devices, it makes the low level API a little bit confusing but we are already doing something similar for Btrfs and no one should create the devices manually anyway, we have helper functions for that. The new stratis_xfs filesystem type looks weird, but it shouldn't cause any issues. Thoughts @dwlehman? This still doesn't contain encryption or devicefactory support, but these shouldn't affect the lower level device and format implementation.

@vojtechtrefny vojtechtrefny force-pushed the 3.3-devel_stratis-support branch from f0ce2bf to 929d221 Compare February 12, 2021 12:35
New StratisBlockdev format and two new devices StratisPoolDevice
and StratisFilesystemDevice has been added. Stratis devices are
populated using data from Stratis DBus API (cached in
static_data.stratis_info).
We are ignoring a lot of stratis private device mapper devices now
so we can no longer use libblockdev DM plugin to remove Stratis
storage stack and we need to use Stratis DBus API instead.
Stratis block device UUID may not be in the RFC 4122 format, uuid
library will always convert to a correct format.
devicelibs.stratis uses stratis_info so we can't import constants
from it here without breaking Python.
This will allow us handling the XFS filesystem on Stratis in a
better way to avoid creating and removing it separately (it should
be created and removed automatically together with the Stratis
filesystem block device).
Locked pools are tricky because Stratis uses LUKS but the "Stratis
LUKS devices" can't be unlocked with cryptsetup, only with Stratis
API. This implementation "hides" the LUKS device for locked pools
and use the StratisBlockdev format for them instead. To unlock
a locked pool, unlock_pool() function of the StratisBlockdev format
must be used.
@vojtechtrefny vojtechtrefny force-pushed the 3.3-devel_stratis-support branch from 95df74d to dfe83f8 Compare April 7, 2021 13:46
@vojtechtrefny
Copy link
Member Author

I've pushed (I hope) last version of the encrypted pools support and this should be now ready for review. The only missing part (I know about) is the size limits/free space calculation for pools. Stratis team is working on a tool that will allow us to calculate these limits for non-existing pools (see stratis-storage/stratisd#2513).

With the encrypted pools support, I've tried to hide as much of the internal structure as possible. For both locked and unlocked pools, the LUKS format and device are hidden and internally we pretend the LUKS device is actually a Stratis block device

Unlocked pool:

existing 10 GiB disk vdb (38) with existing msdos disklabel
  existing 10 GiB partition vdb1 (48) with existing stratis
    existing 10 GiB stratis_pool blivet (57)

Locked pool:

existing 10 GiB disk vdb (38) with existing msdos disklabel
  existing 10 GiB partition vdb1 (48) with existing stratis

This makes populator helpers for stratis and LUKS a little bit messy but I think it's worth it and makes the stratis encrypted devices easier to present to users.

I'm also working on blivet-gui support for Stratis (storaged-project/blivet-gui#277) to test these changes and also to make sure the API makes sense from the user point of view.

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.

3 participants