Deleted Added
full compact
libzfs_status.c (225736) libzfs_status.c (243674)
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

--- 4 unchanged lines hidden (view full) ---

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 */
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

--- 4 unchanged lines hidden (view full) ---

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
21/*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
22/*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
23 */
24
25/*
26 * This file contains the functions which analyze the status of a pool. This
27 * include both the status of an active pool, as well as the status exported
28 * pools. Returns one of the ZPOOL_STATUS_* defines describing the status of
29 * the pool. This status is independent (to a certain degree) from the state of
30 * the pool. A pool's state describes only whether or not it is capable of

--- 6 unchanged lines hidden (view full) ---

37 * is left up to the caller, depending on whether it is a live pool or an
38 * import.
39 */
40
41#include <libzfs.h>
42#include <string.h>
43#include <unistd.h>
44#include "libzfs_impl.h"
25 */
26
27/*
28 * This file contains the functions which analyze the status of a pool. This
29 * include both the status of an active pool, as well as the status exported
30 * pools. Returns one of the ZPOOL_STATUS_* defines describing the status of
31 * the pool. This status is independent (to a certain degree) from the state of
32 * the pool. A pool's state describes only whether or not it is capable of

--- 6 unchanged lines hidden (view full) ---

39 * is left up to the caller, depending on whether it is a live pool or an
40 * import.
41 */
42
43#include <libzfs.h>
44#include <string.h>
45#include <unistd.h>
46#include "libzfs_impl.h"
47#include "zfeature_common.h"
45
46/*
47 * Message ID table. This must be kept in sync with the ZPOOL_STATUS_* defines
48 * in libzfs.h. Note that there are some status results which go past the end
49 * of this table, and hence have no associated message ID.
50 */
51static char *zfs_msgid_table[] = {
52 "ZFS-8000-14",

--- 156 unchanged lines hidden (view full) ---

209 /*
210 * Newer on-disk version.
211 */
212 if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
213 vs->vs_aux == VDEV_AUX_VERSION_NEWER)
214 return (ZPOOL_STATUS_VERSION_NEWER);
215
216 /*
48
49/*
50 * Message ID table. This must be kept in sync with the ZPOOL_STATUS_* defines
51 * in libzfs.h. Note that there are some status results which go past the end
52 * of this table, and hence have no associated message ID.
53 */
54static char *zfs_msgid_table[] = {
55 "ZFS-8000-14",

--- 156 unchanged lines hidden (view full) ---

212 /*
213 * Newer on-disk version.
214 */
215 if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
216 vs->vs_aux == VDEV_AUX_VERSION_NEWER)
217 return (ZPOOL_STATUS_VERSION_NEWER);
218
219 /*
220 * Unsupported feature(s).
221 */
222 if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
223 vs->vs_aux == VDEV_AUX_UNSUP_FEAT) {
224 nvlist_t *nvinfo;
225
226 verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_LOAD_INFO,
227 &nvinfo) == 0);
228 if (nvlist_exists(nvinfo, ZPOOL_CONFIG_CAN_RDONLY))
229 return (ZPOOL_STATUS_UNSUP_FEAT_WRITE);
230 return (ZPOOL_STATUS_UNSUP_FEAT_READ);
231 }
232
233 /*
217 * Check that the config is complete.
218 */
219 if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
220 vs->vs_aux == VDEV_AUX_BAD_GUID_SUM)
221 return (ZPOOL_STATUS_BAD_GUID_SUM);
222
223 /*
224 * Check whether the pool has suspended due to failed I/O.

--- 70 unchanged lines hidden (view full) ---

295 * Removed device
296 */
297 if (find_vdev_problem(nvroot, vdev_removed))
298 return (ZPOOL_STATUS_REMOVED_DEV);
299
300 /*
301 * Outdated, but usable, version
302 */
234 * Check that the config is complete.
235 */
236 if (vs->vs_state == VDEV_STATE_CANT_OPEN &&
237 vs->vs_aux == VDEV_AUX_BAD_GUID_SUM)
238 return (ZPOOL_STATUS_BAD_GUID_SUM);
239
240 /*
241 * Check whether the pool has suspended due to failed I/O.

--- 70 unchanged lines hidden (view full) ---

312 * Removed device
313 */
314 if (find_vdev_problem(nvroot, vdev_removed))
315 return (ZPOOL_STATUS_REMOVED_DEV);
316
317 /*
318 * Outdated, but usable, version
319 */
303 if (version < SPA_VERSION)
320 if (SPA_VERSION_IS_SUPPORTED(version) && version != SPA_VERSION)
304 return (ZPOOL_STATUS_VERSION_OLDER);
305
321 return (ZPOOL_STATUS_VERSION_OLDER);
322
323 /*
324 * Usable pool with disabled features
325 */
326 if (version >= SPA_VERSION_FEATURES) {
327 int i;
328 nvlist_t *feat;
329
330 if (isimport) {
331 feat = fnvlist_lookup_nvlist(config,
332 ZPOOL_CONFIG_LOAD_INFO);
333 feat = fnvlist_lookup_nvlist(feat,
334 ZPOOL_CONFIG_ENABLED_FEAT);
335 } else {
336 feat = fnvlist_lookup_nvlist(config,
337 ZPOOL_CONFIG_FEATURE_STATS);
338 }
339
340 for (i = 0; i < SPA_FEATURES; i++) {
341 zfeature_info_t *fi = &spa_feature_table[i];
342 if (!nvlist_exists(feat, fi->fi_guid))
343 return (ZPOOL_STATUS_FEAT_DISABLED);
344 }
345 }
346
306 return (ZPOOL_STATUS_OK);
307}
308
309zpool_status_t
310zpool_get_status(zpool_handle_t *zhp, char **msgid)
311{
312 zpool_status_t ret = check_status(zhp->zpool_config, B_FALSE);
313

--- 85 unchanged lines hidden ---
347 return (ZPOOL_STATUS_OK);
348}
349
350zpool_status_t
351zpool_get_status(zpool_handle_t *zhp, char **msgid)
352{
353 zpool_status_t ret = check_status(zhp->zpool_config, B_FALSE);
354

--- 85 unchanged lines hidden ---