-
Notifications
You must be signed in to change notification settings - Fork 930
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
Disallow block settings for VM block volumes #12267
Conversation
0398c33
to
ada6c5d
Compare
The tests are failing on the following scenario (simplified): # Create a ZFS pool with with volume.block_mode set to true.
$ lxc storage create test zfs
$ lxc storage set test volume.zfs.block_mode true
# Create custom volume
$ lxc storage volume create test vol1
# The custom volume gets initialized as "filesystem".
[ "$(zfs get -H -o value type test/custom/default_vol1")" = "volume" ] So, I can fix the test to reflect a new change, however, I'm unsure about the following scenario (see the comments above # Normal behavior: Even though `volume.zfs.block_mode` is set on the pool, it is not applied.
$ lxc storage volume create test vol1
$ lxc storage volume show test vol1
# config: {}
# content_type: filesystem
# ...
# Normal behavior: We get an error, because `zfs.block_mode` cannot be set to custom volumes.
$ lxc storage volume create test vol2 zfs.block_mode=false
Error: Invalid option for volume "default_vol2" option "zfs.block_mode"
# [ !!! ] Unsure about this one: The content_type is set to filesystem, but the volume config gets
# populated with redundant settings.
#
# Should I ensure those settings are not applied?
# Or should an error be thrown in such case (note that zfs.block_mode matches with the default pool settings)?
$ lxc storage volume create test vol3 zfs.block_mode=true
$ lxc storage volume show test vol3
# config:
# block.filesystem: ext4
# block.mount_options: discard
# zfs.block_mode: "true"
# content_type: filesystem |
This is untrue. So this error This scenario is correct and valid behaviour because a custom filesystem volume is being create, along with the defaults for block backed filesystem volumes.
So it looks like theres a misunderstanding here about what should and shouldn't be allowed. There are 2 types of custom volumes:
The For ZFS pools, the |
6fcbbae
to
597078a
Compare
So if we are trying to create a block custom volume, For example, the following should result in an error?
|
597078a
to
e347747
Compare
Correct |
e347747
to
efd0aeb
Compare
…de for VM block volumes Signed-off-by: Din Music <din.music@canonical.com>
efd0aeb
to
6e1d55d
Compare
@tomponline Can you review this PR again? Based on your comments, I've done the following:
|
@MusicDin please can you show me the test scenarios you used for this? Thanks |
Custom volumes: # OK
lxc storage volume create default vol1 --type=block
lxc storage volume create default vol2 zfs.block_mode=false
lxc storage volume create default vol3 zfs.block_mode=true
lxc storage volume create default vol4 zfs.block_mode=true block.filesystem=btrfs
# Error: Invalid option for volume "default_vol1" option "block.filesystem"
lxc storage volume create default vol zfs.block_mode=false block.filesystem=btrfs
# Error: Invalid option for volume "default_vol1" option "<option>"
lxc storage volume create default vol --type=block zfs.block_mode=true
lxc storage volume create default vol --type=block zfs.block_mode=false
lxc storage volume create default vol --type=block block.filesystem=btrfs
lxc storage volume create default vol --type=block block.mount_options=noatime VMs: # OK
lxc storage set default volume.zfs.block_mode=true
lxc storage set default volume.block.filesystem=btrfs
lxc launch ubuntu:22.04 vm1 --vm
lxc storage set default volume.zfs.block_mode=false
lxc launch ubuntu:22.04 vm2 --vm Merging with initial configs branch:
|
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.
LGTM thanks!
This PR disallows setting
zfs.block_mode
for custom volumes and VM block volumes. It also disallows settingblock.*
settings for VMs.