Print this page
patch zone-auto-create-be

*** 23,32 **** --- 23,33 ---- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ /* * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright 2015 EveryCity Ltd. + * Copyright 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> */ /* * System includes */
*** 2340,2372 **** * Private */ static int be_mount_zones(zfs_handle_t *be_zhp, be_mount_data_t *md) { - zoneBrandList_t *brands = NULL; zoneList_t zlst = NULL; char *zonename = NULL; char *zonepath = NULL; char *zonepath_ds = NULL; int k; int ret = BE_SUCCESS; z_set_zone_root(md->altroot); ! if ((brands = be_get_supported_brandlist()) == NULL) { ! be_print_err(gettext("be_mount_zones: " ! "no supported brands\n")); return (BE_SUCCESS); - } ! zlst = z_get_nonglobal_zone_list_by_brand(brands); ! if (zlst == NULL) { ! z_free_brand_list(brands); ! return (BE_SUCCESS); } ! for (k = 0; (zonename = z_zlist_get_zonename(zlst, k)) != NULL; k++) { if (z_zlist_get_current_state(zlst, k) == ZONE_STATE_INSTALLED) { zonepath = z_zlist_get_zonepath(zlst, k); /* --- 2341,2374 ---- * Private */ static int be_mount_zones(zfs_handle_t *be_zhp, be_mount_data_t *md) { zoneList_t zlst = NULL; char *zonename = NULL; char *zonepath = NULL; char *zonepath_ds = NULL; int k; int ret = BE_SUCCESS; + boolean_t auto_create; z_set_zone_root(md->altroot); ! zlst = z_get_nonglobal_branded_zone_list(); ! if (zlst == NULL) return (BE_SUCCESS); ! for (k = 0; (zonename = z_zlist_get_zonename(zlst, k)) != NULL; k++) { ! if (z_zlist_is_zone_auto_create_be(zlst, k, &auto_create) != 0) { ! be_print_err(gettext("be_mount_zones: failed to" ! " get auto-create-be brand property\n")); ! goto done; } ! if (!auto_create) ! continue; ! if (z_zlist_get_current_state(zlst, k) == ZONE_STATE_INSTALLED) { zonepath = z_zlist_get_zonepath(zlst, k); /*
*** 2415,2425 **** } } } done: - z_free_brand_list(brands); z_free_zone_list(zlst); /* * libinstzones caches mnttab and uses cached version for resolving lofs * mounts when we call z_resolve_lofs. It creates the cached version * when the first call to z_resolve_lofs happens. So, library's cached --- 2417,2426 ----
*** 2446,2479 **** * Private */ static int be_unmount_zones(be_unmount_data_t *ud) { - zoneBrandList_t *brands = NULL; zoneList_t zlst = NULL; char *zonename = NULL; char *zonepath = NULL; char alt_zonepath[MAXPATHLEN]; char *zonepath_ds = NULL; int k; int ret = BE_SUCCESS; z_set_zone_root(ud->altroot); ! if ((brands = be_get_supported_brandlist()) == NULL) { ! be_print_err(gettext("be_unmount_zones: " ! "no supported brands\n")); return (BE_SUCCESS); - } ! zlst = z_get_nonglobal_zone_list_by_brand(brands); ! if (zlst == NULL) { ! z_free_brand_list(brands); ! return (BE_SUCCESS); } ! for (k = 0; (zonename = z_zlist_get_zonename(zlst, k)) != NULL; k++) { if (z_zlist_get_current_state(zlst, k) == ZONE_STATE_INSTALLED) { zonepath = z_zlist_get_zonepath(zlst, k); /* Build zone's zonepath wrt the global BE altroot */ --- 2447,2481 ---- * Private */ static int be_unmount_zones(be_unmount_data_t *ud) { zoneList_t zlst = NULL; char *zonename = NULL; char *zonepath = NULL; char alt_zonepath[MAXPATHLEN]; char *zonepath_ds = NULL; int k; int ret = BE_SUCCESS; + boolean_t auto_create; z_set_zone_root(ud->altroot); ! zlst = z_get_nonglobal_branded_zone_list(); ! if (zlst == NULL) return (BE_SUCCESS); ! for (k = 0; (zonename = z_zlist_get_zonename(zlst, k)) != NULL; k++) { ! if (z_zlist_is_zone_auto_create_be(zlst, k, &auto_create) != 0) { ! be_print_err(gettext("be_unmount_zones: failed to" ! " get auto-create-be brand property\n")); ! goto done; } ! if (!auto_create) ! continue; ! if (z_zlist_get_current_state(zlst, k) == ZONE_STATE_INSTALLED) { zonepath = z_zlist_get_zonepath(zlst, k); /* Build zone's zonepath wrt the global BE altroot */
*** 2513,2523 **** } } } done: - z_free_brand_list(brands); z_free_zone_list(zlst); return (ret); } /* --- 2515,2524 ----