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

lxd/storage/drivers/zfs: Fix content type detection for custom block volumes #11991

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

monstermunchkin
Copy link
Contributor

This fixes an issue where custom block volumes would be listed as
datasets instead of volumes.

Fixes #11984

Signed-off-by: Thomas Hipp [email protected]

// Detect if a volume is block content type using both the defined suffix and the dataset type.
isBlock := strings.HasSuffix(volName, zfsBlockVolSuffix) && zfsContentType == "volume"
// Detect if a volume is block content type using only the dataset type.
isBlock := zfsContentType == "volume"
Copy link
Member

Choose a reason for hiding this comment

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

@monstermunchkin did custom block volumes not use the .block suffix ever? or did that change recently?

Copy link
Member

Choose a reason for hiding this comment

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

Does this function support detecting filesystem volumes with zfs.block_mode=true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They never have. That's only for VMs as they have two datasets/volumes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this function support detecting filesystem volumes with zfs.block_mode=true?

No, this function only takes the output of zfs list. zfs.block_mode is a LXD config key and is therefore unknown by this function. There's also no need for this config key as it wouldn't change anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What this function does not support is listing custom ISO volumes. That is because they follow the same naming schema as custom block volumes. We might want to change this in the future, by suffixing ISOs with .iso or something.

Copy link
Member

Choose a reason for hiding this comment

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

No, this function only takes the output of zfs list. zfs.block_mode is a LXD config key and is therefore unknown by this function. There's also no need for this config key as it wouldn't change anything.

But those filesystem block volumes would be unusable after recovery though right?

Copy link
Member

Choose a reason for hiding this comment

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

What this function does not support is listing custom ISO volumes. That is because they follow the same naming schema as custom block volumes. We might want to change this in the future, by suffixing ISOs with .iso or something.

hrm yeah can you open an issue and assign that to you to sort out please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But those filesystem block volumes would be unusable after recovery though right?

Oh, I see what you mean, and you're right. As a workaround, we could do lxc storage volume set zfs vol1 zfs.block_mode=true, right?

Copy link
Member

Choose a reason for hiding this comment

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

I dont think you can do that on a volume once it created - if you can thats a bug.

Copy link
Member

Choose a reason for hiding this comment

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

We probably need to have a content type suffix for those volumes too

@tomponline
Copy link
Member

@monstermunchkin would it be possible to update the lxd recover tests to check for block volume support?

@monstermunchkin
Copy link
Contributor Author

would it be possible to update the lxd recover tests to check for block volume support?

Yes, that should be possible.

I just came across User Properties which might be interesting in the way we name our datasets and volumes. We could add the lxd:content_type (filesystem, block, iso) and lxd:block_filesystem properties to annotate our datasets and volumes. This would allow us to distinguish between custom block volumes and custom ISO volumes, and also detect zfs.block_mode.

@tomponline
Copy link
Member

Sounds very interesting indeed! Just need to check it works with the versions of ZFS we support.

@tomponline
Copy link
Member

Is this awaiting review or should it be in draft? ZFS tests seem to have failed.

@monstermunchkin
Copy link
Contributor Author

This is ready for review. ZFS tests are failing in migration. Don't know why though.

@tomponline Could you restart the tests?

@tomponline
Copy link
Member

Please can you rebase and that will trigger it too

…volumes

This fixes an issue where custom block volumes would be listed as
datasets instead of volumes.

Fixes canonical#11984

Signed-off-by: Thomas Hipp <[email protected]>
@monstermunchkin monstermunchkin force-pushed the issues/11984-lxd-recover branch from ee58796 to c4f1d67 Compare July 12, 2023 11:04
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

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

Thanks!

@tomponline tomponline merged commit 084320c into canonical:main Jul 12, 2023
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.

lxd recover : 'mountpoint' does not apply to datasets of this type.
2 participants