Description
Was about to write some python scripts to negotiate which snapshots needed to be sent to the remote side to replace some hacky and ugly bash / awk scripts.
pyzfs is listed as a prominent new supported feature in 0.8.0, and this seemed like a great way to go about it rather than parsing the commands. So the very first thing I did was read the docs and find libzfs_core.lzc_list_snaps(name)) which is a the first thing one would want to do when deciding to figure out which snapshots the local and remote have.
However, that just leads to a very non-intuitive error
>>> libzfs_core.lzc_list_snaps(b"zroot")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/libzfs_core/_libzfs_core.py", line 81, in _f
raise NotImplementedError(func.__name__)
NotImplementedError: lzc_list_snaps
I spend the next hour looking for code examples of anyone using pyzfs, to no avail....
Then I start reading the pyzfs source code and discover the _uncommitted
decorator. So even though the python code is committed and clearly shows in the docs, it might not work.
Going further down the rabbit hole, I start reading the libzfs_core.c source code and indeed lzc_list_*
is not defined.
Looking at all the functions in libzfs_core, I don't see a single way to list snapshots, filesystems, or volumes. Though I can get bookmarks and holds. Though getting bookmarks doesn't list regularly snapshots.
To create bookmarks, send, receive or many other things I need to know snapshot name. As a result I need to resort to parsing the output of the commands again, making it unclear what I would do with libzfs_core or pyzfs.
Issue #7230 is about making pyzfs useful for the 0.8.0 release but all the list functions are missing from there too.
And Issue #3907 has the original adding of the list code however it is far out of date.
This ticket is mostly to help other people know they are not crazy. The following functions DO NOT WORK in pyzfs in any version of zfs at this time of writing.
lzc_list
lzc_list_children
lzc_list_snaps
lzc_inherit
lzc_set_props
lzc_get_props