Print this page
patch zone-auto-create-be


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.

  28  */
  29 
  30 /*
  31  * System includes
  32  */
  33 #include <assert.h>
  34 #include <errno.h>
  35 #include <libintl.h>
  36 #include <libnvpair.h>
  37 #include <libzfs.h>
  38 #include <stdio.h>
  39 #include <stdlib.h>
  40 #include <string.h>
  41 #include <sys/mntent.h>
  42 #include <sys/mnttab.h>
  43 #include <sys/mount.h>
  44 #include <sys/stat.h>
  45 #include <sys/types.h>
  46 #include <sys/vfstab.h>
  47 #include <unistd.h>


 289                 return (B_FALSE);
 290         }
 291 
 292         /*
 293          * Make sure the zonepath has a zone root container dataset
 294          * underneath it.
 295          */
 296         be_make_container_ds(zonepath_ds, zone_container_ds,
 297             sizeof (zone_container_ds));
 298 
 299         if (!zfs_dataset_exists(g_zfs, zone_container_ds,
 300             ZFS_TYPE_FILESYSTEM)) {
 301                 be_print_err(gettext("be_zone_supported: "
 302                     "zonepath dataset (%s) does not have a zone root container "
 303                     "dataset, zone is not supported, skipping ...\n"),
 304                     zonepath_ds);
 305                 return (B_FALSE);
 306         }
 307 
 308         return (B_TRUE);
 309 }
 310 
 311 /*
 312  * Function:    be_get_supported_brandlist
 313  * Desciption:  This functions retuns a list of supported brands in
 314  *              a zoneBrandList_t object.
 315  * Parameters:
 316  *              None
 317  * Returns:
 318  *              Failure - NULL if no supported brands found.
 319  *              Success - pointer to zoneBrandList structure.
 320  * Scope:
 321  *              Semi-private (library wide use only)
 322  */
 323 zoneBrandList_t *
 324 be_get_supported_brandlist(void)
 325 {
 326         return (z_make_brand_list(BE_ZONE_SUPPORTED_BRANDS,
 327             BE_ZONE_SUPPORTED_BRANDS_DELIM));
 328 }
 329 
 330 /*
 331  * Function:    be_zone_get_parent_uuid
 332  * Description: This function gets the parentbe property of a zone root
 333  *              dataset, parsed it into internal uuid format, and returns
 334  *              it in the uuid_t reference pointer passed in.
 335  * Parameters:
 336  *              root_ds - dataset name of a zone root dataset
 337  *              uu - pointer to a uuid_t to return the parentbe uuid in
 338  * Returns:
 339  *              BE_SUCCESS - Success
 340  *              be_errno_t - Failure
 341  * Scope:
 342  *              Private
 343  */
 344 int
 345 be_zone_get_parent_uuid(const char *root_ds, uuid_t *uu)
 346 {
 347         zfs_handle_t    *zhp = NULL;




   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
  28  * Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  29  */
  30 
  31 /*
  32  * System includes
  33  */
  34 #include <assert.h>
  35 #include <errno.h>
  36 #include <libintl.h>
  37 #include <libnvpair.h>
  38 #include <libzfs.h>
  39 #include <stdio.h>
  40 #include <stdlib.h>
  41 #include <string.h>
  42 #include <sys/mntent.h>
  43 #include <sys/mnttab.h>
  44 #include <sys/mount.h>
  45 #include <sys/stat.h>
  46 #include <sys/types.h>
  47 #include <sys/vfstab.h>
  48 #include <unistd.h>


 290                 return (B_FALSE);
 291         }
 292 
 293         /*
 294          * Make sure the zonepath has a zone root container dataset
 295          * underneath it.
 296          */
 297         be_make_container_ds(zonepath_ds, zone_container_ds,
 298             sizeof (zone_container_ds));
 299 
 300         if (!zfs_dataset_exists(g_zfs, zone_container_ds,
 301             ZFS_TYPE_FILESYSTEM)) {
 302                 be_print_err(gettext("be_zone_supported: "
 303                     "zonepath dataset (%s) does not have a zone root container "
 304                     "dataset, zone is not supported, skipping ...\n"),
 305                     zonepath_ds);
 306                 return (B_FALSE);
 307         }
 308 
 309         return (B_TRUE);



















 310 }
 311 
 312 /*
 313  * Function:    be_zone_get_parent_uuid
 314  * Description: This function gets the parentbe property of a zone root
 315  *              dataset, parsed it into internal uuid format, and returns
 316  *              it in the uuid_t reference pointer passed in.
 317  * Parameters:
 318  *              root_ds - dataset name of a zone root dataset
 319  *              uu - pointer to a uuid_t to return the parentbe uuid in
 320  * Returns:
 321  *              BE_SUCCESS - Success
 322  *              be_errno_t - Failure
 323  * Scope:
 324  *              Private
 325  */
 326 int
 327 be_zone_get_parent_uuid(const char *root_ds, uuid_t *uu)
 328 {
 329         zfs_handle_t    *zhp = NULL;