Skip to content

Commit

Permalink
Remove objstore_credentials property after consuming it (openzfs#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
grwilson authored Apr 24, 2021
1 parent 3b7f646 commit 99a4d31
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,12 @@ zpool_do_create(int argc, char **argv)
if (nvroot == NULL)
goto errout;

/*
* We dont' store the creds as a normal property, so remove
* it now that is has been consumed.
*/
fnvlist_remove(props, ZPOOL_CONFIG_OBJSTORE_CREDENTIALS);

/* make_root_vdev() allows 0 toplevel children if there are spares */
if (!zfs_allocatable_devs(nvroot)) {
(void) fprintf(stderr, gettext("invalid vdev "
Expand Down
3 changes: 2 additions & 1 deletion include/libzfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ extern int zpool_props_refresh(zpool_handle_t *);

extern const char *zpool_prop_to_name(zpool_prop_t);
extern const char *zpool_prop_values(zpool_prop_t);
extern int zpool_get_objstore_credentials(libzfs_handle_t *, nvlist_t *, char *);
extern int zpool_get_objstore_credentials(libzfs_handle_t *, nvlist_t *,
char *);

/*
* Pool health statistics.
Expand Down
7 changes: 4 additions & 3 deletions include/libzfs_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ extern int find_shares_object(differ_info_t *di);
extern void libzfs_set_pipe_max(int infd);
extern void zfs_commit_proto(zfs_share_proto_t *);

extern int get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
zfs_keyformat_t keyformat, char *keylocation, const char *fsname,
uint8_t **km_out, size_t *kmlen_out, boolean_t *can_retry_out);
extern int get_key_material(libzfs_handle_t *hdl, boolean_t do_verify,
boolean_t newkey, zfs_keyformat_t keyformat, char *keylocation,
const char *fsname, uint8_t **km_out, size_t *kmlen_out,
boolean_t *can_retry_out);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -4955,6 +4955,6 @@ zpool_get_objstore_credentials(libzfs_handle_t *hdl, nvlist_t *props,
fnvlist_add_string(props,
ZPOOL_CONFIG_OBJSTORE_CREDENTIALS, creds_buf);
free(creds_buf);

return (err);
}

0 comments on commit 99a4d31

Please sign in to comment.