zfsmgr-1 - API for ZFS storage pools, datasets and snapshots
#include <rad/client/1/zfsmgr.h> cc [ flag... ] file... -lzfsmgr1_client [ library... ] interface ZfsDataset rc_err_t zfsmgr_ZfsDataset_create_filesystem(rc_instance_t *inst, const char *name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_create_snapshot(rc_instance_t *inst, const char *name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_destroy_snapshot(rc_instance_t *inst, const char *name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_rename_snapshot(rc_instance_t *inst, const char *old_name, const char *new_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_filesystems(rc_instance_t *inst, boolean_t *recursive, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_snapshots(rc_instance_t *inst, boolean_t *recursive, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_destroy(rc_instance_t *inst, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_rename(rc_instance_t *inst, const char *new_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_mount(rc_instance_t *inst, const char **mount_options, int mount_options_count, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_unmount(rc_instance_t *inst, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_rollback(rc_instance_t *inst, const char *snapshot_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_promote(rc_instance_t *inst, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_inherit(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_send_socket(rc_instance_t *inst, const char *name, zfsmgr_SocketType_t socket_type, boolean_t *verify_token, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_SendSocketInfo_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_send_stream_info(rc_instance_t *inst, const char *name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_SendStreamInfo_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_receive_socket(rc_instance_t *inst, const char *name, zfsmgr_SocketType_t socket_type, zfsmgr_ZfsRecvNameOptions_t name_options, boolean_t *verify_token, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_RecvSocketInfo_t **result, zfsmgr_ZfsRADError_t **error); typedef void (*zfsmgr_ZfsDataset_zfs_send_status_cb_f)(rc_instance_t *inst, zfsmgr_ZfsSendRecvStatus_t *payload, struct timespec ts, void *arg); rc_err_t zfsmgr_ZfsDataset_subscribe_zfs_send_status(rc_instance_t *inst, zfsmgr_ZfsDataset_zfs_send_status_cb_f cb, void *arg); rc_err_t zfsmgr_ZfsDataset_unsubscribe_zfs_send_status(rc_instance_t *inst, void **arg); typedef void (*zfsmgr_ZfsDataset_zfs_recv_status_cb_f)(rc_instance_t *inst, zfsmgr_ZfsSendRecvStatus_t *payload, struct timespec ts, void *arg); rc_err_t zfsmgr_ZfsDataset_subscribe_zfs_recv_status(rc_instance_t *inst, zfsmgr_ZfsDataset_zfs_recv_status_cb_f cb, void *arg); rc_err_t zfsmgr_ZfsDataset_unsubscribe_zfs_recv_status(rc_instance_t *inst, void **arg); interface ZfsSnapshot rc_err_t zfsmgr_ZfsSnapshot_clone(rc_instance_t *inst, const char *clone_name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_get_clones(rc_instance_t *inst, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_inherit(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); interface Zpool rc_err_t zfsmgr_Zpool_get_vdevs(rc_instance_t *inst, zfsmgr_ZpoolVdev_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_get_dataset_ref(rc_instance_t *inst, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_upgrade(rc_instance_t *inst, int version, zfsmgr_ZfsRADError_t **error); interface ZfsUtil rc_err_t zfsmgr_ZfsUtil_valid_zfs_name(rc_instance_t *inst, const char *name, boolean_t *is_snapname, boolean_t *result); Enumerated Types enum PropSrc typedef enum zfsmgr_PropSrc { ZPS_src_local = 0, ZPS_src_default = 1, ZPS_src_temporary = 2, ZPS_src_received = 3, ZPS_src_inherited = 4, ZPS_src_none = 5, } zfsmgr_PropSrc_t; enum ZfsOpOption typedef enum zfsmgr_ZfsOpOption { ZZOO_create_parent = 0, ZZOO_recurse_filesystems = 1, ZZOO_recurse_dependents = 2, ZZOO_defer = 3, ZZOO_overlay_mount = 4, ZZOO_force_unmount = 5, ZZOO_force_rollback = 6, ZZOO_do_not_mount = 7, ZZOO_send_props = 8, ZZOO_self_contained = 9, ZZOO_revert_received = 10, ZZOO_allow_destroy_snapshots = 11, ZZOO_allow_destroy_clones = 12, } zfsmgr_ZfsOpOption_t; enum ZfsRecvNameOptions typedef enum zfsmgr_ZfsRecvNameOptions { ZZRNO_use_provided_name = 0, ZZRNO_use_all_but_pool_name = 1, ZZRNO_use_tail_only = 2, } zfsmgr_ZfsRecvNameOptions_t; enum ZfsRADErrType typedef enum zfsmgr_ZfsRADErrType { ZZRADET_libzfs_err = 0, ZZRADET_zfsrad_err = 1, ZZRADET_operation_err = 2, } zfsmgr_ZfsRADErrType_t; enum SocketType typedef enum zfsmgr_SocketType { ZST_AF_UNIX = 0, ZST_AF_INET = 1, } zfsmgr_SocketType_t; Structured Types struct ZfsRADError typedef struct zfsmgr_ZfsRADError zfsmgr_ZfsRADError_t; struct zfsmgr_ZfsRADError { zfsmgr_ZfsRADErrType_t zzrade_err_type; int zzrade_libzfs_errcode; char *zzrade_libzfs_errstr; char *zzrade_info; char *zzrade_location; }; void zfsmgr_ZfsRADError_free(zfsmgr_ZfsRADError_t *in); struct ZfsProp typedef struct zfsmgr_ZfsProp zfsmgr_ZfsProp_t; struct zfsmgr_ZfsProp { char *zzp_name; char *zzp_value; }; void zfsmgr_ZfsProp_free(zfsmgr_ZfsProp_t *in); struct ZfsPropDetail typedef struct zfsmgr_ZfsPropDetail zfsmgr_ZfsPropDetail_t; struct zfsmgr_ZfsPropDetail { char *zzpd_name; char *zzpd_value; zfsmgr_PropSrc_t zzpd_source; zfsmgr_ZfsRADError_t *zzpd_error; }; void zfsmgr_ZfsPropDetail_free(zfsmgr_ZfsPropDetail_t *in); struct ZfsPropRequest typedef struct zfsmgr_ZfsPropRequest zfsmgr_ZfsPropRequest_t; struct zfsmgr_ZfsPropRequest { char *zzpr_name; boolean_t *zzpr_persistent; boolean_t *zzpr_received; boolean_t *zzpr_integer_val; }; void zfsmgr_ZfsPropRequest_free(zfsmgr_ZfsPropRequest_t *in); struct SendStreamInfo typedef struct zfsmgr_SendStreamInfo zfsmgr_SendStreamInfo_t; struct zfsmgr_SendStreamInfo { char *zssi_size; char **zssi_snapshot_info; int zssi_snapshot_info_count; }; void zfsmgr_SendStreamInfo_free(zfsmgr_SendStreamInfo_t *in); struct SendSocketInfo typedef struct zfsmgr_SendSocketInfo zfsmgr_SendSocketInfo_t; struct zfsmgr_SendSocketInfo { char *zssi_token; char *zssi_socket; zfsmgr_SendStreamInfo_t *zssi_stream_info; }; void zfsmgr_SendSocketInfo_free(zfsmgr_SendSocketInfo_t *in); struct RecvSocketInfo typedef struct zfsmgr_RecvSocketInfo zfsmgr_RecvSocketInfo_t; struct zfsmgr_RecvSocketInfo { char *zrsi_token; char *zrsi_socket; }; void zfsmgr_RecvSocketInfo_free(zfsmgr_RecvSocketInfo_t *in); struct ZpoolVdev typedef struct zfsmgr_ZpoolVdev zfsmgr_ZpoolVdev_t; struct zfsmgr_ZpoolVdev { char *zzv_type; char **zzv_devices; int zzv_devices_count; }; void zfsmgr_ZpoolVdev_free(zfsmgr_ZpoolVdev_t *in); struct ZfsSendRecvStatus typedef struct zfsmgr_ZfsSendRecvStatus zfsmgr_ZfsSendRecvStatus_t; struct zfsmgr_ZfsSendRecvStatus { char *zzsrs_operation; int zzsrs_return_code; int zzsrs_libzfs_errcode; char *zzsrs_libzfs_errstr; char *zzsrs_info; }; void zfsmgr_ZfsSendRecvStatus_free(zfsmgr_ZfsSendRecvStatus_t *in);
ZFSMGR-1(3rad) RAD Module Definitions ZFSMGR-1(3rad) NAME zfsmgr - API for ZFS storage pools, datasets and snapshots SYNOPSIS #include <rad/client/1/zfsmgr.h> cc [ flag... ] file... -lzfsmgr1_client [ library... ] interface ZfsDataset rc_err_t zfsmgr_ZfsDataset_create_filesystem(rc_instance_t *inst, const char *name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_create_snapshot(rc_instance_t *inst, const char *name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_destroy_snapshot(rc_instance_t *inst, const char *name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_rename_snapshot(rc_instance_t *inst, const char *old_name, const char *new_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_filesystems(rc_instance_t *inst, boolean_t *recursive, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_snapshots(rc_instance_t *inst, boolean_t *recursive, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_destroy(rc_instance_t *inst, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_rename(rc_instance_t *inst, const char *new_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_mount(rc_instance_t *inst, const char **mount_options, int mount_options_count, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_unmount(rc_instance_t *inst, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_rollback(rc_instance_t *inst, const char *snapshot_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_promote(rc_instance_t *inst, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_inherit(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_send_socket(rc_instance_t *inst, const char *name, zfsmgr_SocketType_t socket_type, boolean_t *verify_token, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_SendSocketInfo_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_send_stream_info(rc_instance_t *inst, const char *name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_SendStreamInfo_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsDataset_get_receive_socket(rc_instance_t *inst, const char *name, zfsmgr_SocketType_t socket_type, zfsmgr_ZfsRecvNameOptions_t name_options, boolean_t *verify_token, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_RecvSocketInfo_t **result, zfsmgr_ZfsRADError_t **error); typedef void (*zfsmgr_ZfsDataset_zfs_send_status_cb_f)(rc_instance_t *inst, zfsmgr_ZfsSendRecvStatus_t *payload, struct timespec ts, void *arg); rc_err_t zfsmgr_ZfsDataset_subscribe_zfs_send_status(rc_instance_t *inst, zfsmgr_ZfsDataset_zfs_send_status_cb_f cb, void *arg); rc_err_t zfsmgr_ZfsDataset_unsubscribe_zfs_send_status(rc_instance_t *inst, void **arg); typedef void (*zfsmgr_ZfsDataset_zfs_recv_status_cb_f)(rc_instance_t *inst, zfsmgr_ZfsSendRecvStatus_t *payload, struct timespec ts, void *arg); rc_err_t zfsmgr_ZfsDataset_subscribe_zfs_recv_status(rc_instance_t *inst, zfsmgr_ZfsDataset_zfs_recv_status_cb_f cb, void *arg); rc_err_t zfsmgr_ZfsDataset_unsubscribe_zfs_recv_status(rc_instance_t *inst, void **arg); interface ZfsSnapshot rc_err_t zfsmgr_ZfsSnapshot_clone(rc_instance_t *inst, const char *clone_name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_get_clones(rc_instance_t *inst, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_ZfsSnapshot_inherit(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); interface Zpool rc_err_t zfsmgr_Zpool_get_vdevs(rc_instance_t *inst, zfsmgr_ZpoolVdev_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_get_dataset_ref(rc_instance_t *inst, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); rc_err_t zfsmgr_Zpool_upgrade(rc_instance_t *inst, int version, zfsmgr_ZfsRADError_t **error); interface ZfsUtil rc_err_t zfsmgr_ZfsUtil_valid_zfs_name(rc_instance_t *inst, const char *name, boolean_t *is_snapname, boolean_t *result); Enumerated Types enum PropSrc typedef enum zfsmgr_PropSrc { ZPS_src_local = 0, ZPS_src_default = 1, ZPS_src_temporary = 2, ZPS_src_received = 3, ZPS_src_inherited = 4, ZPS_src_none = 5, } zfsmgr_PropSrc_t; enum ZfsOpOption typedef enum zfsmgr_ZfsOpOption { ZZOO_create_parent = 0, ZZOO_recurse_filesystems = 1, ZZOO_recurse_dependents = 2, ZZOO_defer = 3, ZZOO_overlay_mount = 4, ZZOO_force_unmount = 5, ZZOO_force_rollback = 6, ZZOO_do_not_mount = 7, ZZOO_send_props = 8, ZZOO_self_contained = 9, ZZOO_revert_received = 10, ZZOO_allow_destroy_snapshots = 11, ZZOO_allow_destroy_clones = 12, } zfsmgr_ZfsOpOption_t; enum ZfsRecvNameOptions typedef enum zfsmgr_ZfsRecvNameOptions { ZZRNO_use_provided_name = 0, ZZRNO_use_all_but_pool_name = 1, ZZRNO_use_tail_only = 2, } zfsmgr_ZfsRecvNameOptions_t; enum ZfsRADErrType typedef enum zfsmgr_ZfsRADErrType { ZZRADET_libzfs_err = 0, ZZRADET_zfsrad_err = 1, ZZRADET_operation_err = 2, } zfsmgr_ZfsRADErrType_t; enum SocketType typedef enum zfsmgr_SocketType { ZST_AF_UNIX = 0, ZST_AF_INET = 1, } zfsmgr_SocketType_t; Structured Types struct ZfsRADError typedef struct zfsmgr_ZfsRADError zfsmgr_ZfsRADError_t; struct zfsmgr_ZfsRADError { zfsmgr_ZfsRADErrType_t zzrade_err_type; int zzrade_libzfs_errcode; char *zzrade_libzfs_errstr; char *zzrade_info; char *zzrade_location; }; void zfsmgr_ZfsRADError_free(zfsmgr_ZfsRADError_t *in); struct ZfsProp typedef struct zfsmgr_ZfsProp zfsmgr_ZfsProp_t; struct zfsmgr_ZfsProp { char *zzp_name; char *zzp_value; }; void zfsmgr_ZfsProp_free(zfsmgr_ZfsProp_t *in); struct ZfsPropDetail typedef struct zfsmgr_ZfsPropDetail zfsmgr_ZfsPropDetail_t; struct zfsmgr_ZfsPropDetail { char *zzpd_name; char *zzpd_value; zfsmgr_PropSrc_t zzpd_source; zfsmgr_ZfsRADError_t *zzpd_error; }; void zfsmgr_ZfsPropDetail_free(zfsmgr_ZfsPropDetail_t *in); struct ZfsPropRequest typedef struct zfsmgr_ZfsPropRequest zfsmgr_ZfsPropRequest_t; struct zfsmgr_ZfsPropRequest { char *zzpr_name; boolean_t *zzpr_persistent; boolean_t *zzpr_received; boolean_t *zzpr_integer_val; }; void zfsmgr_ZfsPropRequest_free(zfsmgr_ZfsPropRequest_t *in); struct SendStreamInfo typedef struct zfsmgr_SendStreamInfo zfsmgr_SendStreamInfo_t; struct zfsmgr_SendStreamInfo { char *zssi_size; char **zssi_snapshot_info; int zssi_snapshot_info_count; }; void zfsmgr_SendStreamInfo_free(zfsmgr_SendStreamInfo_t *in); struct SendSocketInfo typedef struct zfsmgr_SendSocketInfo zfsmgr_SendSocketInfo_t; struct zfsmgr_SendSocketInfo { char *zssi_token; char *zssi_socket; zfsmgr_SendStreamInfo_t *zssi_stream_info; }; void zfsmgr_SendSocketInfo_free(zfsmgr_SendSocketInfo_t *in); struct RecvSocketInfo typedef struct zfsmgr_RecvSocketInfo zfsmgr_RecvSocketInfo_t; struct zfsmgr_RecvSocketInfo { char *zrsi_token; char *zrsi_socket; }; void zfsmgr_RecvSocketInfo_free(zfsmgr_RecvSocketInfo_t *in); struct ZpoolVdev typedef struct zfsmgr_ZpoolVdev zfsmgr_ZpoolVdev_t; struct zfsmgr_ZpoolVdev { char *zzv_type; char **zzv_devices; int zzv_devices_count; }; void zfsmgr_ZpoolVdev_free(zfsmgr_ZpoolVdev_t *in); struct ZfsSendRecvStatus typedef struct zfsmgr_ZfsSendRecvStatus zfsmgr_ZfsSendRecvStatus_t; struct zfsmgr_ZfsSendRecvStatus { char *zzsrs_operation; int zzsrs_return_code; int zzsrs_libzfs_errcode; char *zzsrs_libzfs_errstr; char *zzsrs_info; }; void zfsmgr_ZfsSendRecvStatus_free(zfsmgr_ZfsSendRecvStatus_t *in); DESCRIPTION API com.oracle.solaris.rad.zfsmgr [1] This API provides functionality for management of ZFS storage pools, ZFS datasets and ZFS snapshots. The following sample Python clients illustrate some simple interactions with the module. INTERFACES interface ZfsDataset This object represents a ZFS dataset and contains interfaces for managing ZFS datasets. ZfsDataset Methods rc_err_t zfsmgr_ZfsDataset_create_filesystem(rc_instance_t *inst, const char *name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); Create a ZFS filesystem with the name and properties given. It will be mounted according to the mountpoint property inherited from the parent unless a mountpoint is specified in props. Upon successful return, the ZfsDataset object may be used directly for ZfsDataset related operations. Arguments: inst -- RAD instance name -- Name of the new filesystem. The filesystem to be created must be a descendant of this ZFS filesystem. Intermediate descendants will be created if they do not exist and the create_parent option is specified in options. props (nullable) -- Optional list of name-value pairs of properties to set. props_count -- Number of items in props array options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: create_parent: create all non-existing parent datasets. Equivalent to: zfs create -p options_count -- Number of items in options array result -- A ZfsDataset object representing the ZFS filesystem that was just created. error rc_err_t zfsmgr_ZfsDataset_create_snapshot(rc_instance_t *inst, const char *name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); Create a snapshot of this ZFS dataset. Arguments: inst -- RAD instance name -- Name of the snapshot to be created. props (nullable) -- Optional list of name-value pairs of properties to set. props_count -- Number of items in props array options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: recurse_filesystems: generate snapshots of all child datasets. Snapshots will take the name of their original dataset, suffixed by "@" and the snapshot suffix provided by the "name" argument. Equivalent to: zfs snapshot -r options_count -- Number of items in options array result -- A ZfsSnapshot object representing the ZFS snapshot created by this call. error rc_err_t zfsmgr_ZfsDataset_destroy_snapshot(rc_instance_t *inst, const char *name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Destroy the specified snapshot. Arguments: inst -- RAD instance name -- Name of the snapshot to be destroyed. options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: defer: defer snapshot deletion. Equivalent to: zfs destroy -d recurse_filesystems: destroy all snapshots with this name in the descendant filesystems. Equivalent to: zfs destroy -r recurse_dependents: recursively destroy dependents. Equivalent to: zfs destroy -R options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_rename_snapshot(rc_instance_t *inst, const char *old_name, const char *new_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Rename the specified snapshot. Arguments: inst -- RAD instance old_name -- Name of the snapshot to be renamed new_name -- New name for the snapshot options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: recurse_filesystems: recursively rename the snapshots of all descendant datasets. Equivalent to: zfs rename -r options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_get_filesystems(rc_instance_t *inst, boolean_t *recursive, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance recursive (nullable) -- Optional. Default is False, which only returns the first level descendant of the filesystem. Set this to True to get all descendant filesystems of this ZFS filesystem. result -- List of string names of descendant ZFS filesystems. result_cnt -- Number of items in result array error rc_err_t zfsmgr_ZfsDataset_get_snapshots(rc_instance_t *inst, boolean_t *recursive, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance recursive (nullable) -- Optional. Default is False, which only returns snapshots of the filesystem. Set this to True to get snapshots from all descendant filesystems of this ZFS filesystem. result -- List of string names of this dataset's snapshots. result_cnt -- Number of items in result array error rc_err_t zfsmgr_ZfsDataset_destroy(rc_instance_t *inst, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Destroy this ZFS dataset. The handle to this dataset will be invalid upon successful return. Arguments: inst -- RAD instance options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: force_unmount: force unmount of any filesystems. Equivalent to: zfs destroy -f recurse_filesystems: destroy descendant filesystems. Equivalent to: zfs destroy -r recurse_dependents: recursively destroy dependents. Equivalent to: zfs destroy -R options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_rename(rc_instance_t *inst, const char *new_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Rename this ZFS dataset. Arguments: inst -- RAD instance new_name -- String containing the new name. options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: create_parent: create all non-existing parent datasets. Equivalent to: zfs rename -p options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_mount(rc_instance_t *inst, const char **mount_options, int mount_options_count, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Mount this ZFS dataset. Arguments: inst -- RAD instance mount_options (nullable) -- Optional list of of mount options to use for the duration of the mount. All mount options allowed for the zfs(8) mount command can be specified. Each option should be specified as a separate string in the list. mount_options_count -- Number of items in mount_options array options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: overlay_mount: perform an overlay mount Equivalent to: zfs mount -O options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_unmount(rc_instance_t *inst, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Unmount this ZFS dataset. Arguments: inst -- RAD instance options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: force_unmount: force unmount, even if in use. Equivalent to: zfs unmount -f options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_rollback(rc_instance_t *inst, const char *snapshot_name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Roll this dataset back to the named snapshot. Arguments: inst -- RAD instance snapshot_name -- Name of the snapshot to roll back to. options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: force_unmount: force unmount of any filesystems. Equivalent to: zfs rollback -f allow_destroy_snapshots: allow destroying snapshots more recent than this one. Equivalent to: zfs rollback -r allow_destroy_clones: allow recursively destroying snapshots more recent than this one, plus any clones of those snapshots. Equivalent to: zfs rollback -R options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_promote(rc_instance_t *inst, zfsmgr_ZfsRADError_t **error); Promote this ZFS dataset. Dataset must be a clone. Arguments: inst -- RAD instance error rc_err_t zfsmgr_ZfsDataset_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); Set property value. Arguments: inst -- RAD instance props -- List of properties to set. props_count -- Number of items in props array error -- The ZfsRADError contains information about the first property that can not be set. No subsequent properties in the list will be set after the first failure. rc_err_t zfsmgr_ZfsDataset_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance props -- List of properties to get. props_count -- Number of items in props array result -- List of ZfsPropDetail objects, one for each property requested in the get_props() function call. The ZfsPropDetail object contains name, value, source and error fields. Their values are set based on the result of getting each property. If the property was successfully retrieved, then the name, value and source will have appropriate values and error will be None. If the property is valid, but does not have a value, then the name field is set to the name of the requested property, and all other fields will be None. If the property was not successfully retrieved, the name field is set to the name of the requested property, and the error field will be set with details on the error. result_cnt -- Number of items in result array error -- Returns any error not specific to getting property values. Errors related to getting a specific property value are included in the property detail structure that is returned. rc_err_t zfsmgr_ZfsDataset_inherit(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsRADError_t **error); Clears the specified properties, causing them to be inherited from an ancestor. If no ancestor has the property set, then the default value is used. Arguments: inst -- RAD instance props -- List of properties to clear. Only the name field of the ZfsProp structure is used. props_count -- Number of items in props array options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: recurse_filesystems: recursively inherits the given properties for all children Equivalent to: zfs inherit -r revert_received: Reverts to the received property value, if any. Equivalent to: zfs inherit -S options_count -- Number of items in options array error rc_err_t zfsmgr_ZfsDataset_get_send_socket(rc_instance_t *inst, const char *name, zfsmgr_SocketType_t socket_type, boolean_t *verify_token, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_SendSocketInfo_t **result, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance name -- Name of the snapshot to be sent. socket_type -- The type of socket to create verify_token (nullable) -- Specify whether token verification is required before data is sent. This is an optional argument. If not specified, it defaults to False, which means a client can connect to the port and start receiving the zfs send stream's data without sending the generated token returned in this call. options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: recurse_filesystems: Generates a recursive stream package. A recursive stream package contains a series of full and/or incremental streams. When received, all properties and descendant file systems are preserved. Equivalent to: zfs send -r self_contained: Creates a self-contained stream. Valid only with the recurse_filesystems option. Equivalent to: zfs send -C send_props: Sends properties. Equivalent to: zfs send -p recurse_dependents: Generates a replication stream package that replicates the specified filesystem and all descendant filesystems. Equivalent to: zfs send -R options_count -- Number of items in options array result -- SendSocketInfo structure containing information about the send stream, and the socket to use for the connection error rc_err_t zfsmgr_ZfsDataset_get_send_stream_info(rc_instance_t *inst, const char *name, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_SendStreamInfo_t **result, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance name -- Name of the snapshot to get send information from options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: recurse_filesystems: Generates a recursive stream package. A recursive stream package contains a series of full and/or incremental streams. When received, all properties and descendant file systems are preserved. Equivalent to: zfs send -r self_contained: Creates a self-contained stream. Valid only with the recurse_filesystems option. Equivalent to: zfs send -C send_props: Sends properties. Equivalent to: zfs send -p recurse_dependents: Generates a replication stream package that replicates the specified filesystem and all descendant filesystems. Equivalent to: zfs send -R options_count -- Number of items in options array result -- SendStreamInfo structure containing information about the snapshots that would be sent as well as the estimated size of the stream. error rc_err_t zfsmgr_ZfsDataset_get_receive_socket(rc_instance_t *inst, const char *name, zfsmgr_SocketType_t socket_type, zfsmgr_ZfsRecvNameOptions_t name_options, boolean_t *verify_token, zfsmgr_ZfsOpOption_t *options, int options_count, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_RecvSocketInfo_t **result, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance name -- Name of ZFS dataset or snapshot to create from the received stream of data. The provided dataset name or the top level dataset of the provided name must match the name of this dataset. socket_type -- Type of socket to create. name_options -- Specifies how the final name used for the ZfsSnapshot or ZfsDataset should be derived. verify_token (nullable) -- Specify whether token verification is required before data is received. This is an optional argument. If not specified, it defaults to False, which means a client can connect to the port and start sending the data to the zfs receive stream without first sending the generated token returned in this call. options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following options are allowed: force_rollback: Forces a rollback of the filesystem to the most recent snapshot before performing the receive operation. Equivalent to: zfs receive -F do_not_mount: File system that is associated with the received stream is not mounted. Equivalent to: zfs receive -u options_count -- Number of items in options array props (nullable) -- Optional list of name-value pairs of properties to set. If a "name" property is included, it must match the "name" argument. props_count -- Number of items in props array result -- SocketInfo structure with information for socket to use for the connection. error ZfsDataset Retrieve rc_err_t zfsmgr_ZfsDataset__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a ZfsDataset object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_ZfsDataset__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a ZfsDataset instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_ZfsDataset__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available ZfsDataset instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key ZfsDataset Events zfs_send_status typedef void (*zfsmgr_ZfsDataset_zfs_send_status_cb_f)(rc_instance_t *inst, zfsmgr_ZfsSendRecvStatus_t *payload, struct timespec ts, void *arg); Function invoked when event "zfs_send_status" occurs. Arguments: inst -- RAD instance that generated the event payload -- Event payload ts -- Time stamp arg -- User data: custom parameter to invoke the function with rc_err_t zfsmgr_ZfsDataset_subscribe_zfs_send_status(rc_instance_t *inst, zfsmgr_ZfsDataset_zfs_send_status_cb_f cb, void *arg); Subscribe to event "zfs_send_status". Arguments: inst -- RAD instance cb -- Event callback function arg -- User data: custom parameter to invoke the function with rc_err_t zfsmgr_ZfsDataset_unsubscribe_zfs_send_status(rc_instance_t *inst, void **arg); Unsubscribe from event "zfs_send_status". Arguments: inst -- RAD instance arg -- User data returned zfs_recv_status typedef void (*zfsmgr_ZfsDataset_zfs_recv_status_cb_f)(rc_instance_t *inst, zfsmgr_ZfsSendRecvStatus_t *payload, struct timespec ts, void *arg); Function invoked when event "zfs_recv_status" occurs. Arguments: inst -- RAD instance that generated the event payload -- Event payload ts -- Time stamp arg -- User data: custom parameter to invoke the function with rc_err_t zfsmgr_ZfsDataset_subscribe_zfs_recv_status(rc_instance_t *inst, zfsmgr_ZfsDataset_zfs_recv_status_cb_f cb, void *arg); Subscribe to event "zfs_recv_status". Arguments: inst -- RAD instance cb -- Event callback function arg -- User data: custom parameter to invoke the function with rc_err_t zfsmgr_ZfsDataset_unsubscribe_zfs_recv_status(rc_instance_t *inst, void **arg); Unsubscribe from event "zfs_recv_status". Arguments: inst -- RAD instance arg -- User data returned interface ZfsSnapshot This object represents a ZFS snapshot and contains interfaces for managing ZFS snapshots. This object does not provide an interface for creating snapshots. Snapshot creation should be done by calling ZfsDataset's create_snapshot() interface. ZfsSnapshot Methods rc_err_t zfsmgr_ZfsSnapshot_clone(rc_instance_t *inst, const char *clone_name, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsOpOption_t *options, int options_count, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); Clone a dataset from this snapshot. Arguments: inst -- RAD instance clone_name -- Name of the new dataset. props (nullable) -- Optional list of name-value pairs of properties to set in the clone. If a "name" property is included, it must match the "name" argument. Equivalent to: zfs clone -o props_count -- Number of items in props array options (nullable) -- A list of one or more values from the ZfsOpOptions enum. This is an optional argument. For this operation, the following option is allowed: create_parent: create all non-existing parent datasets of the clone. Equivalent to: zfs clone -p options_count -- Number of items in options array result -- A ZfsDataset object representing the ZFS dataset created from cloning this snapshot. error rc_err_t zfsmgr_ZfsSnapshot_get_clones(rc_instance_t *inst, char ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error rc_err_t zfsmgr_ZfsSnapshot_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance props -- List of properties to get. props_count -- Number of items in props array result -- List of ZfsPropDetail objects, one for each property requested in the get_props() function call. The ZfsPropDetail object contains name, value, source and error fields. Their values are set based on the result of getting each property. If the property was successfully retrieved, then the name, value and source will have appropriate values and error will be None. If the property is valid, but does not have a value, then the name field is set to the name of the requested property, and all other fields will be None. If the property was not successfully retrieved, the name field is set to the name of the requested property, and the error field will be set with details on the error. result_cnt -- Number of items in result array error -- Returns any error not specific to getting property values. Errors related to getting a specific property value are included in the property detail structure that is returned. rc_err_t zfsmgr_ZfsSnapshot_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); Set property value. Arguments: inst -- RAD instance props -- List of properties to set. props_count -- Number of items in props array error -- The ZfsRADError contains information about the first property that can not be set. No subsequent properties in the list will be set after the first failure. rc_err_t zfsmgr_ZfsSnapshot_inherit(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); Clears the specified properties, causing them to be inherited from an ancestor. If no ancestor has the property set, then the default value is used. Arguments: inst -- RAD instance props -- List of properties to clear. Only the name field of the ZfsProp structure is used. props_count -- Number of items in props array error ZfsSnapshot Retrieve rc_err_t zfsmgr_ZfsSnapshot__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a ZfsSnapshot object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_ZfsSnapshot__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a ZfsSnapshot instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_ZfsSnapshot__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available ZfsSnapshot instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key interface Zpool Zpools are assumed to already exist on the system. Thus, the Zpool interfaces limit zpool operations to listing vdev configuration and getting/setting zpool properties. Note that there is no get_filesystems() method. The root dataset's get_filesystems() method should be used to get all filesystems in a zpool. Zpool Methods rc_err_t zfsmgr_Zpool_get_vdevs(rc_instance_t *inst, zfsmgr_ZpoolVdev_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned result_cnt -- Number of items in result array error rc_err_t zfsmgr_Zpool_set_props(rc_instance_t *inst, zfsmgr_ZfsProp_t **props, int props_count, zfsmgr_ZfsRADError_t **error); Set property value. Arguments: inst -- RAD instance props -- List of properties to set. props_count -- Number of items in props array error -- The ZfsRADError contains information about the first property that can not be set. No subsequent properties in the list will be set after the first failure. rc_err_t zfsmgr_Zpool_get_props(rc_instance_t *inst, zfsmgr_ZfsPropRequest_t **props, int props_count, zfsmgr_ZfsPropDetail_t ***result, int *result_cnt, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance props -- List of properties to get. props_count -- Number of items in props array result -- List of ZfsPropDetail objects, one for each property requested in the get_props() function call. The ZfsPropDetail object contains name, value, source and error fields. Their values are set based on the result of getting each property. If the property was successfully retrieved, then the name, value and source will have appropriate values and error will be None. If the property is valid, but does not have a value, then the name field is set to the name of the requested property, and all other fields will be None. If the property was not successfully retrieved, the name field is set to the name of the requested property, and the error field will be set with details on the error. result_cnt -- Number of items in result array error -- Returns any error not specific to getting property values. Errors related to getting a specific property value are included in the property detail structure that is returned. rc_err_t zfsmgr_Zpool_get_dataset_ref(rc_instance_t *inst, rc_instance_t **result, zfsmgr_ZfsRADError_t **error); Get property value. Arguments: inst -- RAD instance result -- Property value returned error rc_err_t zfsmgr_Zpool_upgrade(rc_instance_t *inst, int version, zfsmgr_ZfsRADError_t **error); Upgrade the zpool version Arguments: inst -- RAD instance version error Zpool Retrieve rc_err_t zfsmgr_Zpool__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a Zpool object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_Zpool__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a Zpool instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_Zpool__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available Zpool instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key interface ZfsUtil This is a singleton instance providing ZFS functionality that is unrelated to Zpool, ZfsDataset or ZfsSnapshot. ZfsUtil Methods rc_err_t zfsmgr_ZfsUtil_valid_zfs_name(rc_instance_t *inst, const char *name, boolean_t *is_snapname, boolean_t *result); Check whether the specified string can be used as a ZFS name Arguments: inst -- RAD instance name is_snapname (nullable) -- Optional. Specify whether the name to be verified is a snapshot name or not. If not specified, the provided name is assumed to be a dataset name. result -- True will be returned if the given name can be used as a ZFS name. False will be returned otherwise. ZfsUtil Retrieve rc_err_t zfsmgr_ZfsUtil__rad_get_name(adr_name_t **result, int n, ...); Obtain RAD name of a ZfsUtil object. Arguments: result -- RAD name n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_ZfsUtil__rad_lookup(rc_conn_t *c, boolean_t strict, rc_instance_t **result, int n, ...); Lookup a ZfsUtil instance. Construct a RAD name for the interface based on the provided key-value pairs and perform a lookup. If successful, instance reference is returned in the result. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning result -- RAD instance n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key rc_err_t zfsmgr_ZfsUtil__rad_list(rc_conn_t *c, boolean_t strict, adr_pattern_scheme_t scheme, adr_name_t ***result, int *result_count, int n, ...); List RAD names of a available ZfsUtil instances. Returns an array and array size of matching object names. Arguments: c -- RAD connection handle strict -- Strict (B_TRUE) or relaxed (B_FALSE) versioning scheme -- Apply glob (NS_GLOB) or regex (NS_REGEX) matching result -- Array of RAD names result_count -- Number of names in result array n -- Number of key-value pairs provided as variadic arguments ... -- Optional key-value pairs that compose the primary key ENUMERATED TYPES enum PropSrc -- The source for ZFS/Zpool property value. typedef enum zfsmgr_PropSrc { ZPS_src_local = 0, ZPS_src_default = 1, ZPS_src_temporary = 2, ZPS_src_received = 3, ZPS_src_inherited = 4, ZPS_src_none = 5, } zfsmgr_PropSrc_t; ZPS_src_local (0) -- property source: local ZPS_src_default (1) -- property source: default ZPS_src_temporary (2) -- property source: temporary ZPS_src_received (3) -- property source: received ZPS_src_inherited (4) -- property source: inherited ZPS_src_none (5) -- property source: none enum ZfsOpOption -- Options for ZfsDataset/Zpool/ZfsSnapshot operations. typedef enum zfsmgr_ZfsOpOption { ZZOO_create_parent = 0, ZZOO_recurse_filesystems = 1, ZZOO_recurse_dependents = 2, ZZOO_defer = 3, ZZOO_overlay_mount = 4, ZZOO_force_unmount = 5, ZZOO_force_rollback = 6, ZZOO_do_not_mount = 7, ZZOO_send_props = 8, ZZOO_self_contained = 9, ZZOO_revert_received = 10, ZZOO_allow_destroy_snapshots = 11, ZZOO_allow_destroy_clones = 12, } zfsmgr_ZfsOpOption_t; These options do not apply to all operations. See the actual API for a description of which options are allowed. ZZOO_create_parent (0) -- create all non-existing parent datasets ZZOO_recurse_filesystems (1) -- perform the specified operation recursively on all descendants of the given filesystems. Similar to -r in zfs(8) ZZOO_recurse_dependents (2) -- perform the specified operation recursively on all dependents of the given filesystems. Similar to -R in zfs(8) ZZOO_defer (3) -- defer deletion of the given snapshot ZZOO_overlay_mount (4) -- perform an overlay mount ZZOO_force_unmount (5) -- force unmount of any mounted filesystems ZZOO_force_rollback (6) -- force rollback of a filesystem ZZOO_do_not_mount (7) -- do not mount the filesystem that is associated with the received stream ZZOO_send_props (8) -- send the properties in the "zfs send" stream ZZOO_self_contained (9) -- create a self-contained "zfs send" stream ZZOO_revert_received (10) -- revert to the received property value, if any ZZOO_allow_destroy_snapshots (11) -- allow destruction of snapshots in a rollback operation ZZOO_allow_destroy_clones (12) -- allow destruction of clones in a rollback operation enum ZfsRecvNameOptions -- Options to control how the name of the ZfsSnapshot or ZfsDataset from the get_receive_socket function is generated. typedef enum zfsmgr_ZfsRecvNameOptions { ZZRNO_use_provided_name = 0, ZZRNO_use_all_but_pool_name = 1, ZZRNO_use_tail_only = 2, } zfsmgr_ZfsRecvNameOptions_t; ZZRNO_use_provided_name (0) -- Use the snapshot or dataset name exactly as provided. ZZRNO_use_all_but_pool_name (1) -- All but the pool name of the sent snapshot path is appended to the string provided in the name argument. Equivalent to the -d option in the zfs receive subcommand. ZZRNO_use_tail_only (2) -- Only the tail of the sent snapshot path is appended to the string provided in the name argument. Equivalent to the -e option in the zfs receive subcommand. enum ZfsRADErrType -- Error types typedef enum zfsmgr_ZfsRADErrType { ZZRADET_libzfs_err = 0, ZZRADET_zfsrad_err = 1, ZZRADET_operation_err = 2, } zfsmgr_ZfsRADErrType_t; ZZRADET_libzfs_err (0) -- Errors from libzfs calls made by the ZFS RAD module ZZRADET_zfsrad_err (1) -- Errors from the ZFS RAD module ZZRADET_operation_err (2) -- Errors from the requested operation enum SocketType -- Socket types that can be created for zfs send/receive. typedef enum zfsmgr_SocketType { ZST_AF_UNIX = 0, ZST_AF_INET = 1, } zfsmgr_SocketType_t; ZST_AF_UNIX (0) -- Unix domain socket ZST_AF_INET (1) -- networking socket STRUCTURED TYPES struct ZfsRADError -- Contains information about an error that occurred in the ZFS RAD module. typedef struct zfsmgr_ZfsRADError zfsmgr_ZfsRADError_t; struct zfsmgr_ZfsRADError { zfsmgr_ZfsRADErrType_t zzrade_err_type; int zzrade_libzfs_errcode; char *zzrade_libzfs_errstr; char *zzrade_info; char *zzrade_location; }; void zfsmgr_ZfsRADError_free(zfsmgr_ZfsRADError_t *in); The err_type field indicates the type of error. Certain fields in this object are only used for certain error types. See each field for details. Fields: zzrade_err_type -- Contains information about the type of error zzrade_libzfs_errcode -- libzfs Error code (enumerated type). This is only used for "libzfs_err" type. zzrade_libzfs_errstr -- Error string corresponding to libzfs error code. This is only used for "libzfs_err" type. zzrade_info For "zfsrad_err" error type, this field contains detailed information about the error. For "libzfs_err", and "operation_err" error type, this field might contain additional information about the condition under which the error occurred. zzrade_location -- Returns the function where the error occurred. struct ZfsProp -- Structure for specifying ZFS property information. typedef struct zfsmgr_ZfsProp zfsmgr_ZfsProp_t; struct zfsmgr_ZfsProp { char *zzp_name; char *zzp_value; }; void zfsmgr_ZfsProp_free(zfsmgr_ZfsProp_t *in); Fields: zzp_name -- Property name zzp_value -- Property value struct ZfsPropDetail -- Structure for returning ZFS property information by the get_props() functions. typedef struct zfsmgr_ZfsPropDetail zfsmgr_ZfsPropDetail_t; struct zfsmgr_ZfsPropDetail { char *zzpd_name; char *zzpd_value; zfsmgr_PropSrc_t zzpd_source; zfsmgr_ZfsRADError_t *zzpd_error; }; void zfsmgr_ZfsPropDetail_free(zfsmgr_ZfsPropDetail_t *in); Fields: zzpd_name -- Property name zzpd_value -- Property value - If the property is valid, but there is no value defined for the property, the value will be None. zzpd_source -- The source of the property (similar to what is returned by the get subcommand for zfs(8)). zzpd_error If this is not set, it means the value retrieved by the get_prop() function is successful. If there is any problem with retrieving the property, this will contain the error information. struct ZfsPropRequest -- Structure used for requesting ZFS property information for the get_props() functions. typedef struct zfsmgr_ZfsPropRequest zfsmgr_ZfsPropRequest_t; struct zfsmgr_ZfsPropRequest { char *zzpr_name; boolean_t *zzpr_persistent; boolean_t *zzpr_received; boolean_t *zzpr_integer_val; }; void zfsmgr_ZfsPropRequest_free(zfsmgr_ZfsPropRequest_t *in); Fields: zzpr_name -- Property name zzpr_persistent Specify whether the get_props() request should return the persistent value of the property or not. This is an optional argument. If not specified, this defaults to False, and the effective value of the property will be returned. If this is set to True, the "received" field for this property request may not have the value of True. zzpr_received Specify whether the get_props() request should return the received value of the property or not. This is an optional argument. If not specified, this defaults to False, and the effective value of the property will be returned. If this is set to True, the "persistent" field for this property request may not have the value of True. zzpr_integer_val Specify whether the get property request should return the requested property's value in integer format. This is an optional argument. If not specified, this defaults to False, and the returned value will be in string format. struct SendStreamInfo -- Contains information about the stream that will be generated. typedef struct zfsmgr_SendStreamInfo zfsmgr_SendStreamInfo_t; struct zfsmgr_SendStreamInfo { char *zssi_size; char **zssi_snapshot_info; int zssi_snapshot_info_count; }; void zfsmgr_SendStreamInfo_free(zfsmgr_SendStreamInfo_t *in); Fields: zssi_size Estimated size of the stream to be generated. The data type is a string instead of a integer because the size might be bigger than a 32 bit integer. zssi_snapshot_info -- List of information about the send stream. zssi_snapshot_info_count struct SendSocketInfo -- Contains information about the socket to be used for the ZFS stream. typedef struct zfsmgr_SendSocketInfo zfsmgr_SendSocketInfo_t; struct zfsmgr_SendSocketInfo { char *zssi_token; char *zssi_socket; zfsmgr_SendStreamInfo_t *zssi_stream_info; }; void zfsmgr_SendSocketInfo_free(zfsmgr_SendSocketInfo_t *in); Fields: zssi_token -- Token used to confirm that the connection is valid. zssi_socket If the requested socket type is a UNIX domain socket, then this will be the path to the socket file. If the requested socket type is an INET socket, then the value will be the connection port number. zssi_stream_info -- Information about the send stream. struct RecvSocketInfo -- Contains information about the socket to be used for the ZFS stream. typedef struct zfsmgr_RecvSocketInfo zfsmgr_RecvSocketInfo_t; struct zfsmgr_RecvSocketInfo { char *zrsi_token; char *zrsi_socket; }; void zfsmgr_RecvSocketInfo_free(zfsmgr_RecvSocketInfo_t *in); Fields: zrsi_token -- Token used to confirm that the connection is valid. zrsi_socket If the requested socket type is a UNIX domain socket, then this will be the path to the socket file. If the requested socket type is an INET socket, then the value will be the connection port number. struct ZpoolVdev -- Zpool Vdev configuration information. typedef struct zfsmgr_ZpoolVdev zfsmgr_ZpoolVdev_t; struct zfsmgr_ZpoolVdev { char *zzv_type; char **zzv_devices; int zzv_devices_count; }; void zfsmgr_ZpoolVdev_free(zfsmgr_ZpoolVdev_t *in); Fields: zzv_type -- Type of the Vdev. Only types "mirror", "disk" and "file" are supported at this time. zzv_devices -- A list of devices making up this Vdev zzv_devices_count struct ZfsSendRecvStatus -- Return status of the send/receive operation. typedef struct zfsmgr_ZfsSendRecvStatus zfsmgr_ZfsSendRecvStatus_t; struct zfsmgr_ZfsSendRecvStatus { char *zzsrs_operation; int zzsrs_return_code; int zzsrs_libzfs_errcode; char *zzsrs_libzfs_errstr; char *zzsrs_info; }; void zfsmgr_ZfsSendRecvStatus_free(zfsmgr_ZfsSendRecvStatus_t *in); Fields: zzsrs_operation -- Indicates whether this is a "send" or "receive" operation. zzsrs_return_code -- The return code from the zfs_send() or zfs_receive() call. zzsrs_libzfs_errcode -- libzfs.so error code as defined in /usr/include/libzfs.h. This is only used if there is an error. zzsrs_libzfs_errstr -- Error string corresponding to libzfs error code. This is only used if there is an error. zzsrs_info -- Optional field for additional information for the client. VERSION 1.1 ATTRIBUTES See attributes(7) for descriptions of the following attributes: +--------------------+-----------------------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------------------------------+ |Availability | system/management/rad/module/rad-zfsmgr | +--------------------+-----------------------------------------+ |Interface Stability | Private | +--------------------+-----------------------------------------+ SEE ALSO rad(8) NOTES 1. Accessing Python documentation for this module: $ pydoc rad.bindings.com.oracle.solaris.rad.zfsmgr_1 Solaris 11.4 2020-07-16 ZFSMGR-1(3rad)