Mercurial > illumos > illumos-gate
changeset 9023:75687de6acb4
6814883 zfs warning if dataset exists
author | <gerald.jelinek@sun.com> |
---|---|
date | Thu, 12 Mar 2009 17:50:02 -0600 |
parents | 4eecb577dc66 |
children | 8f3a34e0ccbb |
files | usr/src/cmd/zoneadm/zfs.c |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/zoneadm/zfs.c Thu Mar 12 16:22:07 2009 -0700 +++ b/usr/src/cmd/zoneadm/zfs.c Thu Mar 12 17:50:02 2009 -0600 @@ -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 @@ 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) {