Print this page
NEX-4934 Add capability to remove special vdev
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zinject/translate.c
          +++ new/usr/src/cmd/zinject/translate.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2012 by Delphix. All rights reserved.
       24 + * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  24   25   */
  25   26  
  26   27  #include <libzfs.h>
  27   28  
  28   29  #include <sys/zfs_context.h>
  29   30  
  30   31  #include <errno.h>
  31   32  #include <fcntl.h>
  32   33  #include <stdarg.h>
  33   34  #include <stddef.h>
↓ open down ↓ 420 lines elided ↑ open up ↑
 454  455  
 455  456          /*
 456  457           * Given a device name or GUID, create an appropriate injection record
 457  458           * with zi_guid set.
 458  459           */
 459  460          if ((zhp = zpool_open(g_zfs, pool)) == NULL)
 460  461                  return (-1);
 461  462  
 462  463          record->zi_guid = strtoull(device, &end, 16);
 463  464          if (record->zi_guid == 0 || *end != '\0') {
 464      -                tgt = zpool_find_vdev(zhp, device, &isspare, &iscache, NULL);
      465 +                tgt = zpool_find_vdev(zhp, device, &isspare, &iscache, NULL,
      466 +                    NULL);
 465  467  
 466  468                  if (tgt == NULL) {
 467  469                          (void) fprintf(stderr, "cannot find device '%s' in "
 468  470                              "pool '%s'\n", device, pool);
 469  471                          return (-1);
 470  472                  }
 471  473  
 472  474                  verify(nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID,
 473  475                      &record->zi_guid) == 0);
 474  476          }
↓ open down ↓ 35 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX