-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add zfs create dryrun #8974
add zfs create dryrun #8974
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opting for the second solution here makes a lot of sense to me. I was a little surprised this wasn't already supported, so I'm happy to see this!
Codecov Report
@@ Coverage Diff @@
## master #8974 +/- ##
==========================================
- Coverage 78.62% 78.53% -0.09%
==========================================
Files 401 401
Lines 120158 120186 +28
==========================================
- Hits 94476 94391 -85
- Misses 25682 25795 +113
Continue to review full report at Codecov.
|
b2441cf
to
b318f3b
Compare
This will be a handy feature. A question though - |
Excellent question. This relates to @behlendorf's comment:
I made those changes to the man page but did not update PR with the same text. The PR now matches the man page update. |
Thanks everyone for the feedback. @mgerdts would you just rebasing this on the latest master, squashing the commits, and adding your signed-off-by. Then this looks ready to integrate. |
Adds the ability to sanity check zfs create arguments and to see the value of any additional properties that will local to the dataset. For example, automation that may need to adjust quota on a parent filesystem before creating a volume may call `zfs create -nP -V <size> <volume>` to obtain the value of refreservation. This adds the following options to zfs create: - -n dry-run (no-op) - -v verbose - -P parseable (implies verbose) Signed-off-by: Mike Gerdts <mike.gerdts@joyent.com>
Adds the ability to sanity check zfs create arguments and to see the value of any additional properties that will local to the dataset. For example, automation that may need to adjust quota on a parent filesystem before creating a volume may call `zfs create -nP -V <size> <volume>` to obtain the value of refreservation. This adds the following options to zfs create: - -n dry-run (no-op) - -v verbose - -P parseable (implies verbose) Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Ahrens <matt@delphix.com> Reviewed-by: Jerry Jelinek <jerry.jelinek@joyent.com> Signed-off-by: Mike Gerdts <mike.gerdts@joyent.com> Closes openzfs#8974
Adds the ability to sanity check zfs create arguments and to see the value of any additional properties that will local to the dataset. For example, automation that may need to adjust quota on a parent filesystem before creating a volume may call `zfs create -nP -V <size> <volume>` to obtain the value of refreservation. This adds the following options to zfs create: - -n dry-run (no-op) - -v verbose - -P parseable (implies verbose) Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Matt Ahrens <matt@delphix.com> Reviewed-by: Jerry Jelinek <jerry.jelinek@joyent.com> Signed-off-by: Mike Gerdts <mike.gerdts@joyent.com> Closes openzfs#8974
Adds the ability to sanity check zfs create arguments and to see the
value of any additional properties that will local to the dataset. For
example, automation that may need to adjust quota on a parent filesystem
before creating a volume may call
zfs create -nP -V <size> <volume>
toobtain the value of refreservation. This adds the following options to
zfs create:
Motivation and Context
This PR is being raised to gain feedback from the zfsonlinux community on the proposed user-visible changes to
zfs create
. The first changeset is from PR 8973. At this point, I'm looking for confirmation that the the new CLI options are acceptable. I am aware of a couple format string nits I need to fix in the code.In SmartOS, we need a way to determine the value that refreservation will take before the volume is created.
Two paths have been explored:
zvol_volsize_to_reservation
, which is a private interface in libzfs. Other variants of this approach involve creating node.js bindings for the same function. If this path is chosen, it would a private utility in SmartOS.zfs create
to have a dry-run mode that is as consistent as possible with otherzfs
commands' dry-run modes.This PR implements the second approach.
Description
Other commands that implement a dry-run feature implement verbose and parseable output with
-v
and-p
. Withzfs create
,-p
is used to create parent dataset(s), so-P
is used. The following is added tozfs create
in zfs(8):The following examples illustrate the behavior:
Example 1:
-n
without-v
or-P
Example 2:
-n
with-v
Example 3:
-n
with-P
In this case, the white space between tokens is a single tab.
Example 4:
-P
without-n
While there's not a great use case for this, it does work:
How Has This Been Tested?
Full test suite runs with this change have been performed on SmartOS.
scripts/zfs-tests.sh -v -d /data -T zfs_create
reports no failures on CentOS 7.Types of changes
Checklist:
Signed-off-by
.