Print this page
1693 persistent 'comment' field for a zpool
        
*** 18,27 ****
--- 18,29 ----
   *
   * CDDL HEADER END
   */
  /*
   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+  * Copyright (c) 2011 by Delphix. All rights reserved.
   */
  
  /*
   * Pool import support functions.
   *
*** 435,445 ****
          nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
          nvlist_t **spares, **l2cache;
          uint_t i, nspares, nl2cache;
          boolean_t config_seen;
          uint64_t best_txg;
!         char *name, *hostname;
          uint64_t version, guid;
          uint_t children = 0;
          nvlist_t **child = NULL;
          uint_t holes;
          uint64_t *hole_array, max_id;
--- 437,447 ----
          nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
          nvlist_t **spares, **l2cache;
          uint_t i, nspares, nl2cache;
          boolean_t config_seen;
          uint64_t best_txg;
!         char *name, *hostname, *comment;
          uint64_t version, guid;
          uint_t children = 0;
          nvlist_t **child = NULL;
          uint_t holes;
          uint64_t *hole_array, max_id;
*** 524,533 ****
--- 526,536 ----
                                   * configuration:
                                   *
                                   *      version
                                   *      pool guid
                                   *      name
+                                  *      comment (if available)
                                   *      pool state
                                   *      hostid (if available)
                                   *      hostname (if available)
                                   */
                                  uint64_t state;
*** 545,559 ****
--- 548,575 ----
                                  verify(nvlist_lookup_string(tmp,
                                      ZPOOL_CONFIG_POOL_NAME, &name) == 0);
                                  if (nvlist_add_string(config,
                                      ZPOOL_CONFIG_POOL_NAME, name) != 0)
                                          goto nomem;
+ 
+                                 /*
+                                  * COMMENT is optional, don't bail if it's not
+                                  * there, instead, set it to NULL.
+                                  */
+                                 if (nvlist_lookup_string(tmp,
+                                     ZPOOL_CONFIG_COMMENT, &comment) != 0)
+                                         comment = NULL;
+                                 else if (nvlist_add_string(config,
+                                     ZPOOL_CONFIG_COMMENT, comment) != 0)
+                                         goto nomem;
+ 
                                  verify(nvlist_lookup_uint64(tmp,
                                      ZPOOL_CONFIG_POOL_STATE, &state) == 0);
                                  if (nvlist_add_uint64(config,
                                      ZPOOL_CONFIG_POOL_STATE, state) != 0)
                                          goto nomem;
+ 
                                  hostid = 0;
                                  if (nvlist_lookup_uint64(tmp,
                                      ZPOOL_CONFIG_HOSTID, &hostid) == 0) {
                                          if (nvlist_add_uint64(config,
                                              ZPOOL_CONFIG_HOSTID, hostid) != 0)