summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorMike Gerdts <mike.gerdts@joyent.com>2019-07-20 10:05:14 +0000
committerMike Gerdts <mike.gerdts@joyent.com>2019-07-24 14:36:23 +0000
commitd0efab8443fcce33c336a009d253617419db9909 (patch)
treea1f9e29df0f391b9d76d5fd3c8e1bc85d740d530 /usr
parentfa937d7ca7fa117ca364764ffd044419022b3fbd (diff)
downloadillumos-joyent-d0efab8443fcce33c336a009d253617419db9909.tar.gz
OS-7895 make zfs create dryrun options from OS-7867 public
Reviewed by: Kody Kantor <kody.kantor@joyent.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
Diffstat (limited to 'usr')
-rw-r--r--usr/src/cmd/zfs/zfs_main.c15
-rw-r--r--usr/src/man/man1m/zfs.1m96
-rw-r--r--usr/src/pkg/manifests/system-test-zfstest.mf5
-rw-r--r--usr/src/test/zfs-tests/runfiles/delphix.run4
-rw-r--r--usr/src/test/zfs-tests/runfiles/omnios.run3
-rw-r--r--usr/src/test/zfs-tests/runfiles/openindiana.run3
-rw-r--r--usr/src/test/zfs-tests/runfiles/smartos.run2
7 files changed, 110 insertions, 18 deletions
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index 525ba2022f..dc14a2c609 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -238,9 +238,9 @@ get_usage(zfs_help_t idx)
return (gettext("\tclone [-p] [-o property=value] ... "
"<snapshot> <filesystem|volume>\n"));
case HELP_CREATE:
- return (gettext("\tcreate [-p] [-o property=value] ... "
+ return (gettext("\tcreate [-Pnpv] [-o property=value] ... "
"<filesystem>\n"
- "\tcreate [-ps] [-b blocksize] [-o property=value] ... "
+ "\tcreate [-Pnpsv] [-b blocksize] [-o property=value] ... "
"-V <size> <volume>\n"));
case HELP_DESTROY:
return (gettext("\tdestroy [-fnpRrv] <filesystem|volume>\n"
@@ -795,9 +795,6 @@ usage:
* check of arguments and properties, but does not check for permissions,
* available space, etc.
*
- * The following flags are private in SmartOS pending acceptance of interface
- * changes by the external ZFS community.
- *
* The '-v' flag is for verbose output.
*
* The '-P' flag is used for parseable output. It implies '-v'.
@@ -841,7 +838,7 @@ zfs_do_create(int argc, char **argv)
nomem();
volsize = intval;
break;
- case 'P': /* Private to SmartOS */
+ case 'P':
verbose = B_TRUE;
parseable = B_TRUE;
break;
@@ -862,7 +859,7 @@ zfs_do_create(int argc, char **argv)
intval) != 0)
nomem();
break;
- case 'n': /* Private to SmartOS */
+ case 'n':
dryrun = B_TRUE;
break;
case 'o':
@@ -872,7 +869,7 @@ zfs_do_create(int argc, char **argv)
case 's':
noreserve = B_TRUE;
break;
- case 'v': /* Private to SmartOS */
+ case 'v':
verbose = B_TRUE;
break;
case ':':
@@ -992,7 +989,7 @@ zfs_do_create(int argc, char **argv)
VERIFY0(nvpair_value_uint64(nvp, &uval));
(void) printf(parseable ?
"property\t%s\t%llu\n" : "\t%s=%llu\n",
- nvpair_name(nvp), uval);
+ nvpair_name(nvp), (u_longlong_t)uval);
break;
case DATA_TYPE_STRING:
VERIFY0(nvpair_value_string(nvp, &sval));
diff --git a/usr/src/man/man1m/zfs.1m b/usr/src/man/man1m/zfs.1m
index c9b25085cd..b4b09d0b1b 100644
--- a/usr/src/man/man1m/zfs.1m
+++ b/usr/src/man/man1m/zfs.1m
@@ -29,7 +29,7 @@
.\" Copyright 2019 Joyent, Inc.
.\" Copyright (c) 2018 Datto Inc.
.\"
-.Dd February 26, 2019
+.Dd Jul 22, 2019
.Dt ZFS 1M
.Os
.Sh NAME
@@ -40,12 +40,12 @@
.Op Fl \&?
.Nm
.Cm create
-.Op Fl p
+.Op Fl Pnpv
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem
.Nm
.Cm create
-.Op Fl ps
+.Op Fl Pnpsv
.Op Fl b Ar blocksize
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Fl V Ar size Ar volume
@@ -2074,7 +2074,7 @@ Displays a help message.
.It Xo
.Nm
.Cm create
-.Op Fl p
+.Op Fl Pnpv
.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
.Ar filesystem
.Xc
@@ -2103,6 +2103,48 @@ Any property specified on the command line using the
.Fl o
option is ignored.
If the target filesystem already exists, the operation completes successfully.
+.It Fl n
+Do a dry-run
+.Pq Qq No-op
+creation.
+No datasets will be created.
+This is useful in conjunction with the
+.Fl v
+or
+.Fl P
+flags to validate properties that are passed via
+.Fl o
+options and those implied by other options.
+The actual dataset creation can still fail due to insufficient privileges or
+available capacity.
+.It Fl P
+Print machine-parsable verbose information about the created dataset.
+Each line of output contains a key and one or two values, all separated by tabs.
+The
+.Sy create_ancestors
+and
+.Sy create
+keys have
+.Em filesystem
+as their only value.
+The
+.Sy create_ancestors
+key only appears if the
+.Fl p
+option is used.
+The
+.Sy property
+key has two values, a property name and that property's value.
+The
+.Sy property
+key may appear zero or more times, once for each property that will be set local
+to
+.Em filesystem
+due to the use of the
+.Fl o
+option.
+.It Fl v
+Print verbose information about the created dataset.
.El
.It Xo
.Nm
@@ -2159,6 +2201,52 @@ See
in the
.Sx Native Properties
section for more information about sparse volumes.
+.It Fl n
+Do a dry-run
+.Pq Qq No-op
+creation.
+No datasets will be created.
+This is useful in conjunction with the
+.Fl v
+or
+.Fl P
+flags to validate properties that are passed via
+.Fl o
+options and those implied by other options.
+The actual dataset creation can still fail due to insufficient privileges or
+available capacity.
+.It Fl P
+Print machine-parsable verbose information about the created dataset.
+Each line of output contains a key and one or two values, all separated by tabs.
+The
+.Sy create_ancestors
+and
+.Sy create
+keys have
+.Em volume
+as their only value.
+The
+.Sy create_ancestors
+key only appears if the
+.Fl p
+option is used.
+The
+.Sy property
+key has two values, a property name and that property's value.
+The
+.Sy property
+key may appear zero or more times, once for each property that will be set local
+to
+.Em volume
+due to the use of the
+.Fl b
+or
+.Fl o
+options, as well as
+.Sy refreservation
+if the volume is not sparse.
+.It Fl v
+Print verbose information about the created dataset.
.El
.It Xo
.Nm
diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf
index 22be5b30f2..d2f1f7e94f 100644
--- a/usr/src/pkg/manifests/system-test-zfstest.mf
+++ b/usr/src/pkg/manifests/system-test-zfstest.mf
@@ -826,9 +826,14 @@ file \
file \
path=opt/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_crypt_combos \
mode=0555
+file path=opt/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_dryrun \
+ mode=0555
file \
path=opt/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_encrypted \
mode=0555
+file \
+ path=opt/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_verbose \
+ mode=0555
file path=opt/zfs-tests/tests/functional/cli_root/zfs_destroy/cleanup \
mode=0555
file path=opt/zfs-tests/tests/functional/cli_root/zfs_destroy/setup mode=0555
diff --git a/usr/src/test/zfs-tests/runfiles/delphix.run b/usr/src/test/zfs-tests/runfiles/delphix.run
index deed0ebae0..c22141d4c6 100644
--- a/usr/src/test/zfs-tests/runfiles/delphix.run
+++ b/usr/src/test/zfs-tests/runfiles/delphix.run
@@ -133,8 +133,8 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos',
'zfs_create_004_pos', 'zfs_create_005_pos', 'zfs_create_006_pos',
'zfs_create_007_pos', 'zfs_create_008_neg', 'zfs_create_009_neg',
'zfs_create_010_neg', 'zfs_create_011_pos', 'zfs_create_012_pos',
- 'zfs_create_013_pos', 'zfs_create_encrypted',
- 'zfs_create_crypt_combos']
+ 'zfs_create_013_pos', 'zfs_create_encrypted', 'zfs_create_crypt_combos',
+ 'zfs_create_dryrun', 'zfs_create_verbose']
[/opt/zfs-tests/tests/functional/cli_root/zfs_destroy]
tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos',
diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run
index 194799ba81..01d40f3628 100644
--- a/usr/src/test/zfs-tests/runfiles/omnios.run
+++ b/usr/src/test/zfs-tests/runfiles/omnios.run
@@ -134,7 +134,8 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos',
'zfs_create_004_pos', 'zfs_create_005_pos', 'zfs_create_006_pos',
'zfs_create_007_pos', 'zfs_create_008_neg', 'zfs_create_009_neg',
'zfs_create_010_neg', 'zfs_create_011_pos', 'zfs_create_012_pos',
- 'zfs_create_013_pos', 'zfs_create_encrypted', 'zfs_create_crypt_combos']
+ 'zfs_create_013_pos', 'zfs_create_encrypted', 'zfs_create_crypt_combos',
+ 'zfs_create_dryrun', 'zfs_create_verbose']
[/opt/zfs-tests/tests/functional/cli_root/zfs_destroy]
tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos',
diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run
index 80b9c837a2..f84ca9fbc4 100644
--- a/usr/src/test/zfs-tests/runfiles/openindiana.run
+++ b/usr/src/test/zfs-tests/runfiles/openindiana.run
@@ -134,7 +134,8 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos',
'zfs_create_004_pos', 'zfs_create_005_pos', 'zfs_create_006_pos',
'zfs_create_007_pos', 'zfs_create_008_neg', 'zfs_create_009_neg',
'zfs_create_010_neg', 'zfs_create_011_pos', 'zfs_create_012_pos',
- 'zfs_create_013_pos', 'zfs_create_encrypted', 'zfs_create_crypt_combos']
+ 'zfs_create_013_pos', 'zfs_create_encrypted', 'zfs_create_crypt_combos',
+ 'zfs_create_dryrun', 'zfs_create_verbose']
[/opt/zfs-tests/tests/functional/cli_root/zfs_destroy]
tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos',
diff --git a/usr/src/test/zfs-tests/runfiles/smartos.run b/usr/src/test/zfs-tests/runfiles/smartos.run
index 83d6e9505d..ec42157057 100644
--- a/usr/src/test/zfs-tests/runfiles/smartos.run
+++ b/usr/src/test/zfs-tests/runfiles/smartos.run
@@ -97,7 +97,7 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos',
'zfs_create_007_pos', 'zfs_create_008_neg', 'zfs_create_009_neg',
'zfs_create_010_neg', 'zfs_create_011_pos', 'zfs_create_012_pos',
'zfs_create_013_pos', 'zfs_create_encrypted', 'zfs_create_crypt_combos',
- 'zfs_create_dryrun']
+ 'zfs_create_dryrun', 'zfs_create_verbose']
[/opt/zfs-tests/tests/functional/cli_root/zfs_destroy]
tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos',