-
Notifications
You must be signed in to change notification settings - Fork 935
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
Storage: Fix Btrfs local refresh #13133
Conversation
It's still not clear to me why it isn't causing a failure for e.g. busybox based instances so I'll leave it in draft state for now. |
6b5143a
to
3f135ad
Compare
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
…lume Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
… volume Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
3f135ad
to
609437c
Compare
@tomponline I am convinced this is now ready for review. I can also confirm it fixes the original bug reported in #13085. Since Btrfs snapshots are almost instantaneous it looks that this approach (see desc) is much more bulletproof as we don't need to run syscalls to set Btrfs subvol attributes (as it is done currently for migrations). |
Does this maintain compatibility with previously refreshed volumes? Also doesn't this change the relation of the refreshed volume so rather than being a discrete volume in its own right its now a snapshot of the source volume? Could that have knock on effects? Or is that the same as |
@roosterfish please can you add a PR to restore the refresh check for btrfs on lxd-ci? |
Yes all this PR is doing is reuse the already existing copy functionality (which is doing a snapshot) also for refreshes. I did some more comprehensive tests and I don't see any issues applying this new concept on subvols that were previously refreshed using the send/receive functions. |
The refresh got fixed in canonical/lxd#13133. Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
The refresh got fixed in canonical/lxd#13133. Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
@roosterfish so you can mark it ready for review or are you still thinking about it further? |
Yes it seems to make sense, do the same as local copy already does. |
This one is ready, the linked one in |
Fixes #13085
When copying a Btrfs backed storage volume locally the last target volume's snapshot doesn't have the
Received UUID
property set which is required to accept a subsequent stream usingbtrfs receive
that is created usingbtrfs send
.The
Received UUID
isn't present since a volume created by local copy is a snapshot of its parent volume. TheReceived UUID
gets set only when using the send/receive functions.It looks that this behavior has changed with Btrfs version
5.14.2
onwards (see https://btrfs.readthedocs.io/en/latest/Subvolumes.html#subvolume-flags) as previously you could just receive a Btrfs subvol stream on top of a snapshot.This PR takes a somewhat radical approach and replaces the usage of send/receive for local volume refreshes. Instead we can reuse the volume copy logic so that when refreshing a volume we simply delete the target and create a new snapshot from the source. Using this approach we don't have to manually set the
Received UUID
with a syscall (as done for migrations) and instead create a fresh copy of the source volume including all of the requested snapshots.