Skip to content

Commit 20f94ef

Browse files
authored
pyzfs: remove unimplemented libzfs_core functions from pyzfs
As per #9008, pyzfs implements and documents several functions that would be very useful, but then try to call c functions in libzfs_core. These functions do not exist in libzfs_core, and in the ~7 years of ticket creation still do not exist in libzfs_core. It seems unlikely that these functions will get implemented, though 2 years ago, ~5 years after that ticket lzc_get_props was implemented in 23a489a which enabled get properties in pyzfs. Sadly the first thing the pyzfs function for lzc_get_props does is call _list, which cals lzc_list, which is not implmented. And the functions to set or inherit properties are still missing. Having these functions in pyzfs are misleading, footguns, and time wasters when evaluating pyzfs. Removing these functions from pyzfs means that _if_ these functions are added in libzfs_core, then pyzfs will also need to re-implement these functions. It's a shame, because these py functions have good documentation and tests. Funny enough the tests are auto skipped if it detects that the functions don't exist in libzfs_core. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: George Shammas <george@shamm.as> Closes #9008 Closes #18162
1 parent 21bbe7c commit 20f94ef

File tree

6 files changed

+2
-760
lines changed

6 files changed

+2
-760
lines changed

contrib/pyzfs/docs/source/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ Documentation for the libzfs_core
2525

2626
.. automodule:: libzfs_core
2727
:members:
28-
:exclude-members: lzc_snap, lzc_recv, lzc_destroy_one,
29-
lzc_inherit, lzc_set_props, lzc_list
28+
:exclude-members: lzc_snap, lzc_recv, lzc_destroy_one
3029

3130
Documentation for the libzfs_core exceptions
3231
********************************************

contrib/pyzfs/libzfs_core/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@
9090
lzc_snap,
9191
lzc_rename,
9292
lzc_destroy,
93-
lzc_inherit_prop,
94-
lzc_get_props,
95-
lzc_set_props,
96-
lzc_list_children,
97-
lzc_list_snaps,
9893
receive_header,
9994
)
10095

@@ -146,11 +141,6 @@
146141
'lzc_snap',
147142
'lzc_rename',
148143
'lzc_destroy',
149-
'lzc_inherit_prop',
150-
'lzc_get_props',
151-
'lzc_set_props',
152-
'lzc_list_children',
153-
'lzc_list_snaps',
154144
'receive_header',
155145
]
156146

contrib/pyzfs/libzfs_core/_error_translation.py

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -638,64 +638,6 @@ def lzc_destroy_translate_error(ret, name):
638638
raise _generic_exception(ret, name, "Failed to destroy dataset")
639639

640640

641-
def lzc_inherit_prop_translate_error(ret, name, prop):
642-
if ret == 0:
643-
return
644-
if ret == errno.EINVAL:
645-
_validate_fs_name(name)
646-
raise lzc_exc.PropertyInvalid(prop)
647-
if ret == errno.ENOENT:
648-
raise lzc_exc.DatasetNotFound(name)
649-
raise _generic_exception(ret, name, "Failed to inherit a property")
650-
651-
652-
def lzc_set_prop_translate_error(ret, name, prop, val):
653-
if ret == 0:
654-
return
655-
if ret == errno.EINVAL:
656-
_validate_fs_or_snap_name(name)
657-
raise lzc_exc.PropertyInvalid(prop)
658-
if ret == errno.ENOENT:
659-
raise lzc_exc.DatasetNotFound(name)
660-
raise _generic_exception(ret, name, "Failed to set a property")
661-
662-
663-
def lzc_get_props_translate_error(ret, name):
664-
if ret == 0:
665-
return
666-
if ret == errno.EINVAL:
667-
_validate_fs_or_snap_name(name)
668-
if ret == errno.ENOENT:
669-
raise lzc_exc.DatasetNotFound(name)
670-
raise _generic_exception(ret, name, "Failed to get properties")
671-
672-
673-
def lzc_list_children_translate_error(ret, name):
674-
if ret == 0:
675-
return
676-
if ret == errno.EINVAL:
677-
_validate_fs_name(name)
678-
raise _generic_exception(ret, name, "Error while iterating children")
679-
680-
681-
def lzc_list_snaps_translate_error(ret, name):
682-
if ret == 0:
683-
return
684-
if ret == errno.EINVAL:
685-
_validate_fs_name(name)
686-
raise _generic_exception(ret, name, "Error while iterating snapshots")
687-
688-
689-
def lzc_list_translate_error(ret, name, opts):
690-
if ret == 0:
691-
return
692-
if ret == errno.ENOENT:
693-
raise lzc_exc.DatasetNotFound(name)
694-
if ret == errno.EINVAL:
695-
_validate_fs_or_snap_name(name)
696-
raise _generic_exception(ret, name, "Error obtaining a list")
697-
698-
699641
def _handle_err_list(ret, errlist, names, exception, mapper):
700642
'''
701643
Convert one or more errors from an operation into the requested exception.

0 commit comments

Comments
 (0)