Skip to content

Enable send/receive #6

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Vaelatern
Copy link

@Vaelatern Vaelatern commented Apr 7, 2024

This worked for me.

On the receiving side I had to:

sudo zfs allow $(whoami) receive,create,mount tank

On the sending side I had to

sudo zfs allow -u $(whoami) send,hold tank

then this worked from an un-elevated user:

local_dataset.receive(remote_newest_snapshot.send(remote_common_snapshot))

where the two snapshots were from a zfslib.Connection() to one server and the dataset was a zfslib.Connection to another.

When there were errors, I saw them and the program I was running exited. Had I chosen to trap more exceptions in my own code, I would have been able to decide not to exit.

@JavaScriptDude
Copy link
Owner

Thanks for the PR. Although zfslib was written to be read oriented, I'll give it a read through and figure out if this make sense to put in or whether a modify centric library that uses zfslib would be a better fit.

@Vaelatern
Copy link
Author

I had the choice to make, either do the send within python (where I identified the correct snapshots to move), or print the shell commands and then execute them.

Printing shell commands then lost the setup I'd done for ssh sessions, so after doing it manually once, I decided to embed it in python to keep all that context right there.

I did note that none of the fields in zfslib are even possibly destructive. Unlike this, which in theory could be (if additional features are added to these commands).

@Vaelatern
Copy link
Author

Of course this mechanism could also exist as something duck-punched in (I found the term in one of the comments in the code, and loved it).

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.

2 participants