OpenZFS 9630 - add lzc_rename and lzc_destroy to libzfs_core

Porting Notes:
* Additional changes to recv_rename_impl() were required due to
  encryption code not being merged in OpenZFS yet.
* libzfs_core python bindings (pyzfs) were updated to fully support
  both lzc_rename() and lzc_destroy()

Authored by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Dan McDonald <danmcd@joyent.com>
Ported-by: loli10K <ezomori.nozomu@gmail.com>

OpenZFS-issue: https://www.illumos.org/issues/9630
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/049ba63
Closes #8207
This commit is contained in:
Andriy Gapon
2018-06-28 00:37:54 +03:00
committed by Brian Behlendorf
parent eff7d78f8a
commit dc1c630b8a
8 changed files with 81 additions and 51 deletions
+3 -11
View File
@@ -1605,7 +1605,6 @@ def lzc_pool_checkpoint_discard(name):
errors.lzc_pool_checkpoint_discard_translate_error(ret, name)
@_uncommitted()
def lzc_rename(source, target):
'''
Rename the ZFS dataset.
@@ -1621,12 +1620,11 @@ def lzc_rename(source, target):
:raises FilesystemExists: if the target already exists.
:raises PoolsDiffer: if the source and target belong to different pools.
'''
ret = _lib.lzc_rename(source, target, _ffi.NULL, _ffi.NULL)
ret = _lib.lzc_rename(source, target)
errors.lzc_rename_translate_error(ret, source, target)
@_uncommitted()
def lzc_destroy_one(name):
def lzc_destroy(name):
'''
Destroy the ZFS dataset.
@@ -1635,16 +1633,10 @@ def lzc_destroy_one(name):
:raises NameTooLong: if the dataset name is too long.
:raises FilesystemNotFound: if the dataset does not exist.
'''
ret = _lib.lzc_destroy_one(name, _ffi.NULL)
ret = _lib.lzc_destroy(name)
errors.lzc_destroy_translate_error(ret, name)
# As the extended API is not committed yet, the names of the new interfaces
# are not settled down yet.
# lzc_destroy() might make more sense as we do not have lzc_create_one().
lzc_destroy = lzc_destroy_one
@_uncommitted()
def lzc_inherit(name, prop):
'''
@@ -129,9 +129,9 @@ CDEF = """
int lzc_remap(const char *);
int lzc_pool_checkpoint(const char *);
int lzc_pool_checkpoint_discard(const char *);
int lzc_rename(const char *, const char *);
int lzc_destroy(const char *fsname);
int lzc_rename(const char *, const char *, nvlist_t *, char **);
int lzc_destroy_one(const char *fsname, nvlist_t *);
int lzc_inherit(const char *fsname, const char *name, nvlist_t *);
int lzc_set_props(const char *, nvlist_t *, nvlist_t *, nvlist_t *);
int lzc_list (const char *, nvlist_t *);