diff options
author | <gerald.jelinek@sun.com> | 2009-03-12 17:50:02 -0600 |
---|---|---|
committer | <gerald.jelinek@sun.com> | 2009-03-12 17:50:02 -0600 |
commit | d1f855d73e0bf529109aa3dc1b967fc6ac19b4fc (patch) | |
tree | 08d1c9aa01cc4880085e34676527fe6ef2217ac2 /usr/src | |
parent | 6087c6dd77e96bd2cae7072c5beaa71f527e0f1f (diff) | |
download | illumos-gate-d1f855d73e0bf529109aa3dc1b967fc6ac19b4fc.tar.gz |
6814883 zfs warning if dataset exists
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/zoneadm/zfs.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr/src/cmd/zoneadm/zfs.c b/usr/src/cmd/zoneadm/zfs.c index a16921f300..6ae72d4ae2 100644 --- a/usr/src/cmd/zoneadm/zfs.c +++ b/usr/src/cmd/zoneadm/zfs.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * This file contains the functions used to support the ZFS integration * with zones. This includes validation (e.g. zonecfg dataset), cloning, @@ -721,6 +719,12 @@ create_zfs_zonepath(char *zonepath) if (path2name(zonepath, zfs_name, sizeof (zfs_name)) != Z_OK) return; + /* Check if the dataset already exists. */ + if ((zhp = zfs_open(g_zfs, zfs_name, ZFS_TYPE_DATASET)) != NULL) { + zfs_close(zhp); + return; + } + if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0 || nvlist_add_string(props, zfs_prop_to_name(ZFS_PROP_SHARENFS), "off") != 0) { |