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

Documentation of available methods, especially send() and receive() #182

Open
monkeyman85 opened this issue May 26, 2022 · 2 comments
Open

Comments

@monkeyman85
Copy link

Hello py-libzfs-team,
I am trying to send snapshots to a backup device using the send - receive mechanism, but I cannot figure out how to use these methods correctly. Is there any documentation (what they do, what are the input parameters)? When I open the help (help(libzfs) ), I can see the different methods available, but I do not know how to find the description of input parameters.

class ZFSSnapshot(ZFSResource)
 |  Method resolution order:
 |      ZFSSnapshot
 |      ZFSResource
 |      ZFSObject
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __getstate__(...)
 |
 |  __reduce_cython__(...)
 |
 |  __setstate_cython__(...)
 |
 |  bookmark(...)
 |
 |  clone(...)
 |
 |  delete(...)
 |
 |  get_send_progress(...)
 |
 |  hold(...)
 |
 |  release(...)
 |
 |  rollback(...)
 |
 |  send(...)

In my implementation of the send-receive mechanism, I always get the Error libzfs.ZFSException: trailing slash in name although there is no trailing slash in the name of my dataset.

  File "/usr/local/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/local/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "libzfs.pyx", line 1392, in libzfs.ZFS.receive
libzfs.ZFSException: trailing slash in name
@Bosi1024
Copy link

Bosi1024 commented Jul 20, 2022

Hi,

I had the same problem until I figured out that incremental snapshots fromname parameter is supposed to be the string following the dataset-path and would be equal to:

to_snapshot.send(fd=fd, fromname=from_snapshot.snapshot_name, flags={libzfs.SendFlag.DOALL, libzfs.SendFlag.REPLICATE}) 

I tried using from_snapshot.name instead, which was wrong, supposedly.

@ghost
Copy link

ghost commented Jul 20, 2022

Thanks for helping!

Indeed there is no documentation for libzfs anywhere. It was never meant to be a public library, only some internal code sharing for the zfs commands. But, here we are.

If you want to know how things work, you have to read the code in openzfs/zfs. If you're lucky you might even find a comment or two.

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

No branches or pull requests

2 participants