8000 8000
Skip to content

Storage: zfs.clone_copy=rebase mode fixes#17135

Merged
tomponline merged 5 commits intocanonical:mainfrom
tomponline:tp-zfs-rebase
Dec 5, 2025
Merged

Storage: zfs.clone_copy=rebase mode fixes#17135
tomponline merged 5 commits intocanonical:mainfrom
tomponline:tp-zfs-rebase

Conversation

@tomponline
Copy link
Copy Markdown
Member
@tomponline tomponline commented Dec 3, 2025
  • When copying a snapshot to a new instance with zfs.clone_copy=rebase the destination origin is now the original instance's image volume.
  • When copying an instance without snapshots to a new instance with zfs.clone_copy=rebase the destination origin is now the original instance's image volume.

Fixes #16449

@tomponline tomponline self-assigned this Dec 3, 2025
@tomponline tomponline force-pushed the tp-zfs-rebase branch 2 times, most recently from d8d167e to b8402f8 Compare December 3, 2025 14:43
@tomponline
Copy link
Copy Markdown
Member Author

FYI @tugbataluy in case you're also looking at this one.

Copy link
Copy Markdown
Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes issue #16449 by correcting the logic for ZFS volume rebase operations. The changes introduce a rebase variable to consolidate rebase mode detection and refactor string parsing to use the modern strings.Cut function, which also fixes a bug where the origin property was incorrectly queried on snapshot names instead of dataset names.

  • Introduces a rebase variable to centralize the logic for detecting when rebase mode is active
  • Updates multiple conditional checks to use the rebase variable for consistency
  • Refactors string parsing from strings.SplitN to strings.Cut and fixes a bug in origin property queries

Comment thread lxd/storage/drivers/driver_zfs_volumes.go Outdated
8000
Comment thread lxd/storage/drivers/driver_zfs_volumes.go Outdated
Copy link
Copy Markdown
Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread lxd/storage/drivers/driver_zfs_volumes.go Outdated
Copy link
Copy Markdown
Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread test/suites/storage_driver_zfs.sh Outdated
@tomponline tomponline force-pushed the tp-zfs-rebase branch 2 times, most recently from 52b7d01 to ae36885 Compare December 5, 2025 10:57
@tomponline tomponline changed the title lxd/storage/drivers/driver/zfs/volumes: Rebase fixes Storage: zfs.clone_copy=rebase mode fixes Dec 5, 2025
 - When copying a snapshot to a new instance with zfs.clone_copy=rebase the destination origin is now the original instance's image volume.
 - When copying an instance without snapshots to a new instance with zfs.clone_copy=rebase the destination origin is now the original instance's image volume.

Fixes canonical#16449

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
Copy link
Copy Markdown
Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@tomponline tomponline marked this pull request as ready for review December 5, 2025 13:00
@tomponline tomponline 8000 requested a review from skozina December 5, 2025 13:00
simondeziel
simondeziel previously approved these changes Dec 5, 2025
Copy link
Copy Markdown
Member
@simondeziel simondeziel left a comment

Choose a reason for hiding this comment

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

Nice, thanks! I found a few tiny nits.

Comment thread test/suites/storage_driver_zfs.sh Outdated
Comment thread test/suites/storage_driver_zfs.sh Outdated
Comment thread test/suites/storage_driver_zfs.sh Outdated
Comment thread test/suites/storage_driver_zfs.sh Outdated
Comment thread test/suites/storage_driver_zfs.sh Outdated
Comment thread lxd/storage/drivers/driver_zfs_volumes.go
…r clarity

Makes code easier to reader.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
…struction

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
…gic isn't needed when copying in `--replicate` mode

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
Copy link
Copy Markdown
Member
@simondeziel simondeziel 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 cac67a9 into canonical:main Dec 5, 2025
70 checks passed
@tomponline tomponline deleted the tp-zfs-rebase branch December 5, 2025 14:58
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.

zfs.clone_copy=rebase option does not work for copying volumes

3 participants

0