libzfs_pool.c (251634) | libzfs_pool.c (255750) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 9 unchanged lines hidden (view full) --- 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 25 * Copyright (c) 2012 by Delphix. All rights reserved. | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 9 unchanged lines hidden (view full) --- 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 25 * Copyright (c) 2012 by Delphix. All rights reserved. |
26 * Copyright (c) 2013, Joyent, Inc. All rights reserved. |
|
26 */ 27 28#include <sys/types.h> 29#include <sys/stat.h> 30#include <ctype.h> 31#include <errno.h> 32#include <devid.h> 33#include <fcntl.h> --- 3981 unchanged lines hidden (view full) --- 4015static boolean_t 4016supported_dump_vdev_type(libzfs_handle_t *hdl, nvlist_t *config, char *errbuf) 4017{ 4018 char *type; 4019 nvlist_t **child; 4020 uint_t children, c; 4021 4022 verify(nvlist_lookup_string(config, ZPOOL_CONFIG_TYPE, &type) == 0); | 27 */ 28 29#include <sys/types.h> 30#include <sys/stat.h> 31#include <ctype.h> 32#include <errno.h> 33#include <devid.h> 34#include <fcntl.h> --- 3981 unchanged lines hidden (view full) --- 4016static boolean_t 4017supported_dump_vdev_type(libzfs_handle_t *hdl, nvlist_t *config, char *errbuf) 4018{ 4019 char *type; 4020 nvlist_t **child; 4021 uint_t children, c; 4022 4023 verify(nvlist_lookup_string(config, ZPOOL_CONFIG_TYPE, &type) == 0); |
4023 if (strcmp(type, VDEV_TYPE_RAIDZ) == 0 || 4024 strcmp(type, VDEV_TYPE_FILE) == 0 || 4025 strcmp(type, VDEV_TYPE_LOG) == 0 || | 4024 if (strcmp(type, VDEV_TYPE_FILE) == 0 || |
4026 strcmp(type, VDEV_TYPE_HOLE) == 0 || 4027 strcmp(type, VDEV_TYPE_MISSING) == 0) { 4028 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, 4029 "vdev type '%s' is not supported"), type); 4030 (void) zfs_error(hdl, EZFS_VDEVNOTSUP, errbuf); 4031 return (B_FALSE); 4032 } 4033 if (nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_CHILDREN, 4034 &child, &children) == 0) { 4035 for (c = 0; c < children; c++) { 4036 if (!supported_dump_vdev_type(hdl, child[c], errbuf)) 4037 return (B_FALSE); 4038 } 4039 } 4040 return (B_TRUE); 4041} 4042 4043/* | 4025 strcmp(type, VDEV_TYPE_HOLE) == 0 || 4026 strcmp(type, VDEV_TYPE_MISSING) == 0) { 4027 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, 4028 "vdev type '%s' is not supported"), type); 4029 (void) zfs_error(hdl, EZFS_VDEVNOTSUP, errbuf); 4030 return (B_FALSE); 4031 } 4032 if (nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_CHILDREN, 4033 &child, &children) == 0) { 4034 for (c = 0; c < children; c++) { 4035 if (!supported_dump_vdev_type(hdl, child[c], errbuf)) 4036 return (B_FALSE); 4037 } 4038 } 4039 return (B_TRUE); 4040} 4041 4042/* |
4044 * check if this zvol is allowable for use as a dump device; zero if 4045 * it is, > 0 if it isn't, < 0 if it isn't a zvol | 4043 * Check if this zvol is allowable for use as a dump device; zero if 4044 * it is, > 0 if it isn't, < 0 if it isn't a zvol. 4045 * 4046 * Allowable storage configurations include mirrors, all raidz variants, and 4047 * pools with log, cache, and spare devices. Pools which are backed by files or 4048 * have missing/hole vdevs are not suitable. |
4046 */ 4047int 4048zvol_check_dump_config(char *arg) 4049{ 4050 zpool_handle_t *zhp = NULL; 4051 nvlist_t *config, *nvroot; 4052 char *p, *volname; 4053 nvlist_t **top; --- 45 unchanged lines hidden (view full) --- 4099 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, 4100 "could not obtain vdev configuration for '%s'"), poolname); 4101 (void) zfs_error(hdl, EZFS_INVALCONFIG, errbuf); 4102 goto out; 4103 } 4104 4105 verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, 4106 &top, &toplevels) == 0); | 4049 */ 4050int 4051zvol_check_dump_config(char *arg) 4052{ 4053 zpool_handle_t *zhp = NULL; 4054 nvlist_t *config, *nvroot; 4055 char *p, *volname; 4056 nvlist_t **top; --- 45 unchanged lines hidden (view full) --- 4102 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, 4103 "could not obtain vdev configuration for '%s'"), poolname); 4104 (void) zfs_error(hdl, EZFS_INVALCONFIG, errbuf); 4105 goto out; 4106 } 4107 4108 verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, 4109 &top, &toplevels) == 0); |
4107 if (toplevels != 1) { 4108 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, 4109 "'%s' has multiple top level vdevs"), poolname); 4110 (void) zfs_error(hdl, EZFS_DEVOVERFLOW, errbuf); 4111 goto out; 4112 } | |
4113 4114 if (!supported_dump_vdev_type(hdl, top[0], errbuf)) { 4115 goto out; 4116 } 4117 ret = 0; 4118 4119out: 4120 if (zhp) 4121 zpool_close(zhp); 4122 libzfs_fini(hdl); 4123 return (ret); 4124} | 4110 4111 if (!supported_dump_vdev_type(hdl, top[0], errbuf)) { 4112 goto out; 4113 } 4114 ret = 0; 4115 4116out: 4117 if (zhp) 4118 zpool_close(zhp); 4119 libzfs_fini(hdl); 4120 return (ret); 4121} |