Welcome to pyzfs’s documentation!

Contents:

Indices and tables

Documentation for the libzfs_core

Python wrappers for libzfs_core library.

libzfs_core is intended to be a stable, committed interface for programmatic administration of ZFS. This wrapper provides one-to-one wrappers for libzfs_core API functions, but the signatures and types are more natural to Python. nvlists are wrapped as dictionaries or lists depending on their usage. Some parameters have default values depending on typical use for increased convenience. Output parameters are not used and return values are directly returned. Enumerations and bit flags become strings and lists of strings in Python. Errors are reported as exceptions rather than integer errno-style error codes. The wrapper takes care to provide one-to-many mapping of the error codes to the exceptions by interpreting a context in which the error code is produced.

To submit an issue or contribute to development of this package please visit its GitHub repository.

libzfs_core.MAXNAMELEN

Maximum length of any ZFS name.

libzfs_core.lzc_create(name, ds_type='zfs', props=None)

Create a ZFS filesystem or a ZFS volume (“zvol”).

Parameters:
  • name (bytes) – a name of the dataset to be created.
  • ds_type (str) – the type of the dataset to be create, currently supported types are “zfs” (the default) for a filesystem and “zvol” for a volume.
  • props (dict of bytes:Any) – a dict of ZFS dataset property name-value pairs (empty by default).
Raises:
  • FilesystemExists – if a dataset with the given name already exists.
  • ParentNotFound – if a parent dataset of the requested dataset does not exist.
  • PropertyInvalid – if one or more of the specified properties is invalid or has an invalid type or value.
  • NameInvalid – if the name is not a valid dataset name.
  • NameTooLong – if the name is too long.
libzfs_core.lzc_clone(name, origin, props=None)

Clone a ZFS filesystem or a ZFS volume (“zvol”) from a given snapshot.

Parameters:
  • name (bytes) – a name of the dataset to be created.
  • origin (bytes) – a name of the origin snapshot.
  • props (dict of bytes:Any) – a dict of ZFS dataset property name-value pairs (empty by default).
Raises:
  • FilesystemExists – if a dataset with the given name already exists.
  • DatasetNotFound – if either a parent dataset of the requested dataset or the origin snapshot does not exist.
  • PropertyInvalid – if one or more of the specified properties is invalid or has an invalid type or value.
  • FilesystemNameInvalid – if the name is not a valid dataset name.
  • SnapshotNameInvalid – if the origin is not a valid snapshot name.
  • NameTooLong – if the name or the origin name is too long.
  • PoolsDiffer – if the clone and the origin have different pool names.

Note

Because of a deficiency of the underlying C interface DatasetNotFound can mean that either a parent filesystem of the target or the origin snapshot does not exist. It is currently impossible to distinguish between the cases. lzc_hold() can be used to check that the snapshot exists and ensure that it is not destroyed before cloning.

libzfs_core.lzc_rollback(name)

Roll back a filesystem or volume to its most recent snapshot.

Parameters:

name (bytes) – a name of the dataset to be rolled back.

Returns:

a name of the most recent snapshot.

Return type:

bytes

Raises:
  • FilesystemNotFound – if the dataset does not exist.
  • SnapshotNotFound – if the dataset does not have any snapshots.
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
libzfs_core.lzc_snapshot(snaps, props=None)

Create snapshots.

All snapshots must be in the same pool.

Optionally snapshot properties can be set on all snapshots. Currently only user properties (prefixed with “user:”) are supported.

Either all snapshots are successfully created or none are created if an exception is raised.

Parameters:
  • snaps (list of bytes) – a list of names of snapshots to be created.
  • props (dict of bytes:bytes) – a dict of ZFS dataset property name-value pairs (empty by default).
Raises:

SnapshotFailure – if one or more snapshots could not be created.

Note

SnapshotFailure is a compound exception that provides at least one detailed error object in SnapshotFailure.errors list.

Warning

The underlying implementation reports an individual, per-snapshot error only for SnapshotExists condition and sometimes for NameTooLong. In all other cases a single error is reported without connection to any specific snapshot name(s).

This has the following implications:

  • if multiple error conditions are encountered only one of them is reported
  • unless only one snapshot is requested then it is impossible to tell how many snapshots are problematic and what they are
  • only if there are no other error conditions SnapshotExists is reported for all affected snapshots
  • NameTooLong can behave either in the same way as SnapshotExists or as all other exceptions. The former is the case where the full snapshot name exceeds the maximum allowed length but the short snapshot name (after ‘@’) is within the limit. The latter is the case when the short name alone exceeds the maximum allowed length.
libzfs_core.lzc_destroy_snaps(snaps, defer)

Destroy snapshots.

They must all be in the same pool. Snapshots that do not exist will be silently ignored.

If ‘defer’ is not set, and a snapshot has user holds or clones, the destroy operation will fail and none of the snapshots will be destroyed.

If ‘defer’ is set, and a snapshot has user holds or clones, it will be marked for deferred destruction, and will be destroyed when the last hold or clone is removed/destroyed.

The operation succeeds if all snapshots were destroyed (or marked for later destruction if ‘defer’ is set) or didn’t exist to begin with.

Parameters:
  • snaps (list of bytes) – a list of names of snapshots to be destroyed.
  • defer (bool) – whether to mark busy snapshots for deferred destruction rather than immediately failing.
Raises:

SnapshotDestructionFailure – if one or more snapshots could not be created.

Note

SnapshotDestructionFailure is a compound exception that provides at least one detailed error object in SnapshotDestructionFailure.errors list.

Typical error is SnapshotIsCloned if defer is False. The snapshot names are validated quite loosely and invalid names are typically ignored as nonexisiting snapshots.

A snapshot name referring to a filesystem that doesn’t exist is ignored. However, non-existent pool name causes PoolNotFound.

libzfs_core.lzc_bookmark(bookmarks)

Create bookmarks.

Parameters:bookmarks (dict of bytes to bytes) – a dict that maps names of wanted bookmarks to names of existing snapshots.
Raises:BookmarkFailure – if any of the bookmarks can not be created for any reason.

The bookmarks dict maps from name of the bookmark (e.g. pool/fs#bmark) to the name of the snapshot (e.g. pool/fs@snap). All the bookmarks and snapshots must be in the same pool.

libzfs_core.lzc_get_bookmarks(fsname, props=None)

Retrieve a listing of bookmarks for the given file system.

Parameters:
  • fsname (bytes) – a name of the filesystem.
  • props (list of bytes) – a list of properties that will be returned for each bookmark.
Returns:

a dict that maps the bookmarks’ short names to their properties.

Return type:

dict of bytes:dict

Raises:

FilesystemNotFound – if the filesystem is not found.

The following are valid properties on bookmarks:

guid : integer
globally unique identifier of the snapshot the bookmark refers to
createtxg : integer
txg when the snapshot the bookmark refers to was created
creation : integer
timestamp when the snapshot the bookmark refers to was created

Any other properties passed in props are ignored without reporting any error. Values in the returned dictionary map the names of the requested properties to their respective values.

libzfs_core.lzc_destroy_bookmarks(bookmarks)

Destroy bookmarks.

Parameters:bookmarks (list of bytes) – a list of the bookmarks to be destroyed. The bookmarks are specified as fs#bmark.
Raises:BookmarkDestructionFailure – if any of the bookmarks may not be destroyed.

The bookmarks must all be in the same pool. Bookmarks that do not exist will be silently ignored. This also includes the case where the filesystem component of the bookmark name does not exist. However, an invalid bookmark name will cause NameInvalid error reported in SnapshotDestructionFailure.errors.

Either all bookmarks that existed are destroyed or an exception is raised.

libzfs_core.lzc_snaprange_space(firstsnap, lastsnap)

Calculate a size of data referenced by snapshots in the inclusive range between the firstsnap and the lastsnap and not shared with any other datasets.

Parameters:
  • firstsnap (bytes) – the name of the first snapshot in the range.
  • lastsnap (bytes) – the name of the last snapshot in the range.
Returns:

the calculated stream size, in bytes.

Return type:

int or long

Raises:
  • SnapshotNotFound – if either of the snapshots does not exist.
  • NameInvalid – if the name of either snapshot is invalid.
  • NameTooLong – if the name of either snapshot is too long.
  • SnapshotMismatch – if fromsnap is not an ancestor snapshot of snapname.
  • PoolsDiffer – if the snapshots belong to different pools.

lzc_snaprange_space calculates total size of blocks that exist because they are referenced only by one or more snapshots in the given range but no other dataset. In other words, this is the set of blocks that were born after the snap before firstsnap, and died before the snap after the last snap. Yet another interpretation is that the result of lzc_snaprange_space is the size of the space that would be freed if the snapshots in the range are destroyed.

If the same snapshot is given as both the firstsnap and the lastsnap. In that case lzc_snaprange_space calculates space used by the snapshot.

libzfs_core.lzc_hold(holds, fd=None)

Create user holds on snapshots. If there is a hold on a snapshot, the snapshot can not be destroyed. (However, it can be marked for deletion by lzc_destroy_snaps() ( defer = True ).)

Parameters:
  • holds (dict of bytes : bytes) – the dictionary of names of the snapshots to hold mapped to the hold names.
  • fd (int or None) – if not None then it must be the result of os.open() called as os.open("/dev/zfs", O_EXCL).
Returns:

a list of the snapshots that do not exist.

Return type:

list of bytes

Raises:
  • HoldFailure – if a hold was impossible on one or more of the snapshots.
  • BadHoldCleanupFD – if fd is not a valid file descriptor associated with /dev/zfs.

The snapshots must all be in the same pool.

If fd is not None, then when the fd is closed (including on process termination), the holds will be released. If the system is shut down uncleanly, the holds will be released when the pool is next opened or imported.

Holds for snapshots which don’t exist will be skipped and have an entry added to the return value, but will not cause an overall failure. No exceptions is raised if all holds, for snapshots that existed, were succesfully created. Otherwise HoldFailure exception is raised and no holds will be created. HoldFailure.errors may contain a single element for an error that is not specific to any hold / snapshot, or it may contain one or more elements detailing specific error per each affected hold.

libzfs_core.lzc_release(holds)

Release user holds on snapshots.

If the snapshot has been marked for deferred destroy (by lzc_destroy_snaps(defer=B_TRUE)), it does not have any clones, and all the user holds are removed, then the snapshot will be destroyed.

The snapshots must all be in the same pool.

Parameters:holds (dict of bytes : list of bytes) – a dict where keys are snapshot names and values are lists of hold tags to remove.
Returns:a list of any snapshots that do not exist and of any tags that do not exist for existing snapshots. Such tags are qualified with a corresponding snapshot name using the following format pool/fs@snap#tag
Return type:list of bytes
Raises:HoldReleaseFailure – if one or more existing holds could not be released.

Holds which failed to release because they didn’t exist will have an entry added to errlist, but will not cause an overall failure.

This call is success if holds was empty or all holds that existed, were successfully removed. Otherwise an exception will be raised.

libzfs_core.lzc_get_holds(snapname)

Retrieve list of user holds on the specified snapshot.

Parameters:snapname (bytes) – the name of the snapshot.
Returns:holds on the snapshot along with their creation times in seconds since the epoch
Return type:dict of bytes : int
libzfs_core.lzc_send(snapname, fromsnap, fd, flags=None)

Generate a zfs send stream for the specified snapshot and write it to the specified file descriptor.

Parameters:
  • snapname (bytes) – the name of the snapshot to send.
  • fromsnap (bytes or None) – if not None the name of the starting snapshot for the incremental stream.
  • fd (int) – the file descriptor to write the send stream to.
  • flags (list of bytes) – the flags that control what enhanced features can be used in the stream.
Raises:
  • SnapshotNotFound – if either the starting snapshot is not None and does not exist, or if the ending snapshot does not exist.
  • NameInvalid – if the name of either snapshot is invalid.
  • NameTooLong – if the name of either snapshot is too long.
  • SnapshotMismatch – if fromsnap is not an ancestor snapshot of snapname.
  • PoolsDiffer – if the snapshots belong to different pools.
  • IOError – if an input / output error occurs while writing to fd.
  • UnknownStreamFeature – if the flags contain an unknown flag name.

If fromsnap is None, a full (non-incremental) stream will be sent. If fromsnap is not None, it must be the full name of a snapshot or bookmark to send an incremental from, e.g. pool/fs@earlier_snap or pool/fs#earlier_bmark.

The specified snapshot or bookmark must represent an earlier point in the history of snapname. It can be an earlier snapshot in the same filesystem or zvol as snapname, or it can be the origin of snapname‘s filesystem, or an earlier snapshot in the origin, etc. fromsnap must be strictly an earlier snapshot, specifying the same snapshot as both fromsnap and snapname is an error.

If flags contains “large_blocks”, the stream is permitted to contain DRR_WRITE records with drr_length > 128K, and DRR_OBJECT records with drr_blksz > 128K.

If flags contains “embedded_data”, the stream is permitted to contain DRR_WRITE_EMBEDDED records with drr_etype == BP_EMBEDDED_TYPE_DATA, which the receiving system must support (as indicated by support for the embedded_data feature).

Note

lzc_send can actually accept a filesystem name as the snapname. In that case lzc_send acts as if a temporary snapshot was created after the start of the call and before the stream starts being produced.

Note

lzc_send does not return until all of the stream is written to fd.

Note

lzc_send does not close fd upon returning.

libzfs_core.lzc_send_space(snapname, fromsnap=None)

Estimate size of a full or incremental backup stream given the optional starting snapshot and the ending snapshot.

Parameters:
  • snapname (bytes) – the name of the snapshot for which the estimate should be done.
  • fromsnap (bytes or None) – the optional starting snapshot name. If not None then an incremental stream size is estimated, otherwise a full stream is esimated.
Returns:

the estimated stream size, in bytes.

Return type:

int or long

Raises:
  • SnapshotNotFound – if either the starting snapshot is not None and does not exist, or if the ending snapshot does not exist.
  • NameInvalid – if the name of either snapshot is invalid.
  • NameTooLong – if the name of either snapshot is too long.
  • SnapshotMismatch – if fromsnap is not an ancestor snapshot of snapname.
  • PoolsDiffer – if the snapshots belong to different pools.

fromsnap, if not None, must be strictly an earlier snapshot, specifying the same snapshot as both fromsnap and snapname is an error.

libzfs_core.lzc_receive(snapname, fd, force=False, origin=None, props=None)

Receive from the specified fd, creating the specified snapshot.

Parameters:
  • snapname (bytes) – the name of the snapshot to create.
  • fd (int) – the file descriptor from which to read the stream.
  • force (bool) – whether to roll back or destroy the target filesystem if that is required to receive the stream.
  • origin (bytes or None) – the optional origin snapshot name if the stream is for a clone.
  • props (dict of bytes : Any) – the properties to set on the snapshot as received properties.
Raises:
  • IOError – if an input / output error occurs while reading from the fd.
  • DatasetExists – if the snapshot named snapname already exists.
  • DatasetExists – if the stream is a full stream and the destination filesystem already exists.
  • DatasetExists – if force is True but the destination filesystem could not be rolled back to a matching snapshot because a newer snapshot exists and it is an origin of a cloned filesystem.
  • StreamMismatch – if an incremental stream is received and the latest snapshot of the destination filesystem does not match the source snapshot of the stream.
  • StreamMismatch – if a full stream is received and the destination filesystem already exists and it has at least one snapshot, and force is False.
  • StreamMismatch – if an incremental clone stream is received but the specified origin is not the actual received origin.
  • DestinationModified – if an incremental stream is received and the destination filesystem has been modified since the last snapshot and force is False.
  • DestinationModified – if a full stream is received and the destination filesystem already exists and it does not have any snapshots, and force is False.
  • DatasetNotFound – if the destination filesystem and its parent do not exist.
  • DatasetNotFound – if the origin is not None and does not exist.
  • DatasetBusy – if force is True but the destination filesystem could not be rolled back to a matching snapshot because a newer snapshot is held and could not be destroyed.
  • DatasetBusy – if another receive operation is being performed on the destination filesystem.
  • BadStream – if the stream is corrupt or it is not recognized or it is a compound stream or it is a clone stream, but origin is None.
  • BadStream – if a clone stream is received and the destination filesystem already exists.
  • StreamFeatureNotSupported – if the stream has a feature that is not supported on this side.
  • PropertyInvalid – if one or more of the specified properties is invalid or has an invalid type or value.
  • NameInvalid – if the name of either snapshot is invalid.
  • NameTooLong – if the name of either snapshot is too long.

Note

The origin is ignored if the actual stream is an incremental stream that is not a clone stream and the destination filesystem exists. If the stream is a full stream and the destination filesystem does not exist then the origin is checked for existence: if it does not exist DatasetNotFound is raised, otherwise StreamMismatch is raised, because that snapshot can not have any relation to the stream.

Note

If force is True and the stream is incremental then the destination filesystem is rolled back to a matching source snapshot if necessary. Intermediate snapshots are destroyed in that case.

However, none of the existing snapshots may have the same name as snapname even if such a snapshot were to be destroyed. The existing snapname snapshot always causes SnapshotExists to be raised.

If force is True and the stream is a full stream then the destination filesystem is replaced with the received filesystem unless the former has any snapshots. This prevents the destination filesystem from being rolled back / replaced.

Note

This interface does not work on dedup’d streams (those with DMU_BACKUP_FEATURE_DEDUP).

Note

lzc_receive does not return until all of the stream is read from fd and applied to the pool.

Note

lzc_receive does not close fd upon returning.

libzfs_core.lzc_exists(name)

Check if a dataset (a filesystem, or a volume, or a snapshot) with the given name exists.

Parameters:name (bytes) – the dataset name to check.
Returns:True if the dataset exists, False otherwise.
Return type:bool

Note

lzc_exists can not be used to check for existence of bookmarks.

libzfs_core.is_supported(func)

Check whether C libzfs_core provides implementation required for the given Python wrapper.

If is_supported returns False for the function, then calling the function would result in NotImplementedError.

Parameters:func (function) – the function to check.
Return bool:whether the function can be used.
libzfs_core.lzc_promote(name)

Promotes the ZFS dataset.

Parameters:

name (bytes) – the name of the dataset to promote.

Raises:
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
  • NameTooLong – if the dataset’s origin has a snapshot that, if transferred to the dataset, would get a too long name.
  • NotClone – if the dataset is not a clone.
  • FilesystemNotFound – if the dataset does not exist.
  • SnapshotExists – if the dataset already has a snapshot with the same name as one of the origin’s snapshots.
libzfs_core.lzc_rename(source, target)

Rename the ZFS dataset.

Parameters:
  • name (target) – the current name of the dataset to rename.
  • name – the new name of the dataset.
Raises:
  • NameInvalid – if either the source or target name is invalid.
  • NameTooLong – if either the source or target name is too long.
  • NameTooLong – if a snapshot of the source would get a too long name after renaming.
  • FilesystemNotFound – if the source does not exist.
  • FilesystemNotFound – if the target’s parent does not exist.
  • FilesystemExists – if the target already exists.
  • PoolsDiffer – if the source and target belong to different pools.
libzfs_core.lzc_destroy(name)

Destroy the ZFS dataset.

Parameters:

name (bytes) – the name of the dataset to destroy.

Raises:
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
  • FilesystemNotFound – if the dataset does not exist.
libzfs_core.lzc_inherit_prop(name, prop)

Inherit properties from a parent dataset of the given ZFS dataset.

Parameters:
  • name (bytes) – the name of the dataset.
  • prop (bytes) – the name of the property to inherit.
Raises:
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
  • DatasetNotFound – if the dataset does not exist.
  • PropertyInvalid – if one or more of the specified properties is invalid or has an invalid type or value.

Inheriting a property actually resets it to its default value or removes it if it’s a user property, so that the property could be inherited if it’s inheritable. If the property is not inheritable then it would just have its default value.

This function can be used on snapshots to inherit user defined properties.

libzfs_core.lzc_set_prop(name, prop, val)

Set properties of the ZFS dataset.

Parameters:
  • name (bytes) – the name of the dataset.
  • prop (bytes) – the name of the property.
  • val (Any) – the value of the property.
Raises:
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
  • DatasetNotFound – if the dataset does not exist.
  • NoSpace – if the property controls a quota and the values is too small for that quota.
  • PropertyInvalid – if one or more of the specified properties is invalid or has an invalid type or value.

This function can be used on snapshots to set user defined properties.

Note

An attempt to set a readonly / statistic property is ignored without reporting any error.

libzfs_core.lzc_get_props(name)

Get properties of the ZFS dataset.

Parameters:

name (bytes) – the name of the dataset.

Raises:
  • DatasetNotFound – if the dataset does not exist.
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
Returns:

a dictionary mapping the property names to their values.

Return type:

dict of bytes:Any

Note

The value of clones property is a list of clone names as byte strings.

Warning

The returned dictionary does not contain entries for properties with default values. One exception is the mountpoint property for which the default value is derived from the dataset name.

libzfs_core.lzc_list_children(name)

List the children of the ZFS dataset.

Parameters:

name (bytes) – the name of the dataset.

Returns:

an iterator that produces the names of the children.

Raises:
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
  • DatasetNotFound – if the dataset does not exist.

Warning

If the dataset does not exist, then the returned iterator would produce no results and no error is reported. That case is indistinguishable from the dataset having no children.

An attempt to list children of a snapshot is silently ignored as well.

libzfs_core.lzc_list_snaps(name)

List the snapshots of the ZFS dataset.

Parameters:

name (bytes) – the name of the dataset.

Returns:

an iterator that produces the names of the snapshots.

Raises:
  • NameInvalid – if the dataset name is invalid.
  • NameTooLong – if the dataset name is too long.
  • DatasetNotFound – if the dataset does not exist.

Warning

If the dataset does not exist, then the returned iterator would produce no results and no error is reported. That case is indistinguishable from the dataset having no snapshots.

An attempt to list snapshots of a snapshot is silently ignored as well.

Documentation for the libzfs_core exceptions

Exceptions that can be raised by libzfs_core operations.

exception libzfs_core.exceptions.ZFSError
errno = None
message = None
name = None
exception libzfs_core.exceptions.ZFSGenericError(errno, name, message)
exception libzfs_core.exceptions.ZFSInitializationFailed(errno)
message = 'Failed to initialize libzfs_core'
exception libzfs_core.exceptions.MultipleOperationsFailure(errors, suppressed_count)
suppressed_count = None

this many errors were encountered but not placed on the errors list

exception libzfs_core.exceptions.DatasetNotFound(name)

This exception is raised when an operation failure can be caused by a missing snapshot or a missing filesystem and it is impossible to distinguish between the causes.

errno = 2
message = 'Dataset not found'
exception libzfs_core.exceptions.DatasetExists(name)

This exception is raised when an operation failure can be caused by an existing snapshot or filesystem and it is impossible to distinguish between the causes.

errno = 17
message = 'Dataset already exists'
exception libzfs_core.exceptions.NotClone(name)
errno = 22
message = 'Filesystem is not a clone, can not promote'
exception libzfs_core.exceptions.FilesystemExists(name)
message = 'Filesystem already exists'
exception libzfs_core.exceptions.FilesystemNotFound(name)
message = 'Filesystem not found'
exception libzfs_core.exceptions.ParentNotFound(name)
errno = 2
message = 'Parent not found'
exception libzfs_core.exceptions.WrongParent(name)
errno = 22
message = 'Parent dataset is not a filesystem'
exception libzfs_core.exceptions.SnapshotExists(name)
message = 'Snapshot already exists'
exception libzfs_core.exceptions.SnapshotNotFound(name)
message = 'Snapshot not found'
exception libzfs_core.exceptions.SnapshotIsCloned(name)
errno = 17
message = 'Snapshot is cloned'
exception libzfs_core.exceptions.SnapshotIsHeld(name)
errno = 16
message = 'Snapshot is held'
exception libzfs_core.exceptions.DuplicateSnapshots(name)
errno = 18
message = 'Requested multiple snapshots of the same filesystem'
exception libzfs_core.exceptions.SnapshotFailure(errors, suppressed_count)
message = 'Creation of snapshot(s) failed for one or more reasons'
exception libzfs_core.exceptions.SnapshotDestructionFailure(errors, suppressed_count)
message = 'Destruction of snapshot(s) failed for one or more reasons'
exception libzfs_core.exceptions.BookmarkExists(name)
errno = 17
message = 'Bookmark already exists'
exception libzfs_core.exceptions.BookmarkNotFound(name)
errno = 2
message = 'Bookmark not found'
exception libzfs_core.exceptions.BookmarkMismatch(name)
errno = 22
message = "Bookmark is not in snapshot's filesystem"
exception libzfs_core.exceptions.BookmarkNotSupported(name)
errno = 95
message = 'Bookmark feature is not supported'
exception libzfs_core.exceptions.BookmarkFailure(errors, suppressed_count)
message = 'Creation of bookmark(s) failed for one or more reasons'
exception libzfs_core.exceptions.BookmarkDestructionFailure(errors, suppressed_count)
message = 'Destruction of bookmark(s) failed for one or more reasons'
exception libzfs_core.exceptions.BadHoldCleanupFD
errno = 9
message = 'Bad file descriptor as cleanup file descriptor'
exception libzfs_core.exceptions.HoldExists(name)
errno = 17
message = 'Hold with a given tag already exists on snapshot'
exception libzfs_core.exceptions.HoldNotFound(name)
errno = 2
message = 'Hold with a given tag does not exist on snapshot'
exception libzfs_core.exceptions.HoldFailure(errors, suppressed_count)
message = 'Placement of hold(s) failed for one or more reasons'
exception libzfs_core.exceptions.HoldReleaseFailure(errors, suppressed_count)
message = 'Release of hold(s) failed for one or more reasons'
exception libzfs_core.exceptions.SnapshotMismatch(name)
errno = 19
message = 'Snapshot is not descendant of source snapshot'
exception libzfs_core.exceptions.StreamMismatch(name)
errno = 19
message = 'Stream is not applicable to destination dataset'
exception libzfs_core.exceptions.DestinationModified(name)
errno = 26
message = 'Destination dataset has modifications that can not be undone'
exception libzfs_core.exceptions.BadStream
errno = 22
message = 'Bad backup stream'
exception libzfs_core.exceptions.StreamFeatureNotSupported
errno = 95
message = 'Stream contains unsupported feature'
exception libzfs_core.exceptions.UnknownStreamFeature
errno = 95
message = 'Unknown feature requested for stream'
exception libzfs_core.exceptions.StreamIOError(errno)
message = 'I/O error while writing or reading stream'
exception libzfs_core.exceptions.ZIOError(name)
errno = 5
message = 'I/O error'
exception libzfs_core.exceptions.NoSpace(name)
errno = 28
message = 'No space left'
exception libzfs_core.exceptions.QuotaExceeded(name)
errno = 122
message = 'Quouta exceeded'
exception libzfs_core.exceptions.DatasetBusy(name)
errno = 16
message = 'Dataset is busy'
exception libzfs_core.exceptions.NameTooLong(name)
errno = 36
message = 'Dataset name is too long'
exception libzfs_core.exceptions.NameInvalid(name)
errno = 22
message = 'Invalid name'
exception libzfs_core.exceptions.SnapshotNameInvalid(name)
message = 'Invalid name for snapshot'
exception libzfs_core.exceptions.FilesystemNameInvalid(name)
message = 'Invalid name for filesystem or volume'
exception libzfs_core.exceptions.BookmarkNameInvalid(name)
message = 'Invalid name for bookmark'
exception libzfs_core.exceptions.ReadOnlyPool(name)
errno = 30
message = 'Pool is read-only'
exception libzfs_core.exceptions.SuspendedPool(name)
errno = 11
message = 'Pool is suspended'
exception libzfs_core.exceptions.PoolNotFound(name)
errno = 18
message = 'No such pool'
exception libzfs_core.exceptions.PoolsDiffer(name)
errno = 18
message = 'Source and target belong to different pools'
exception libzfs_core.exceptions.FeatureNotSupported(name)
errno = 95
message = 'Feature is not supported in this version'
exception libzfs_core.exceptions.PropertyNotSupported(name)
errno = 95
message = 'Property is not supported in this version'
exception libzfs_core.exceptions.PropertyInvalid(name)
errno = 22
message = 'Invalid property or property value'
exception libzfs_core.exceptions.DatasetTypeInvalid(name)
errno = 22
message = 'Specified dataset type is unknown'

Documentation for the miscellaneous types that correspond to specific width C types

Utility functions for casting to a specific C type.

libzfs_core.ctypes.uint8_t(value)
libzfs_core.ctypes.int8_t(value)
libzfs_core.ctypes.uint16_t(value)
libzfs_core.ctypes.int16_t(value)
libzfs_core.ctypes.uint32_t(value)
libzfs_core.ctypes.int32_t(value)
libzfs_core.ctypes.uint64_t(value)
libzfs_core.ctypes.int64_t(value)
libzfs_core.ctypes.boolean_t(value)
libzfs_core.ctypes.uchar_t(value)