-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.csiden.org/r/216/
-----------------------------------------------------------

(Updated May 7, 2015, 3:25 p.m.)


Review request for OpenZFS Developer Mailing List and Christopher Siden.


Changes
-------

The ZFSOnLinux cstyle.pl script wanted the following changes to ZoL PR 3385:

```
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 2908e3c..44910b2 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -3564,11 +3564,10 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t 
*props,
        char *poolname;
        nvlist_t *nvl;
 
-       if (nvlist_lookup_string(props, "tname", &poolname) != 0)
-       {
+       if (nvlist_lookup_string(props, "tname", &poolname) != 0) {
                char c;
                if (pool_namecheck(poolname, NULL, &c) != 0)
-                       return SET_ERROR(EINVAL);
+                       return (SET_ERROR(EINVAL));
                poolname = (char *)pool;
        }
```

This revision adds them. The code is functionally identical to the initial 
review request.


Repository: illumos-gate


Description
-------

This is an import of the temporary pool names functionality from ZoL:

https://github.com/zfsonlinux/zfs/commit/e2282ef57edc79cdce2a4b9b7e3333c56494a807
https://github.com/zfsonlinux/zfs/commit/26b42f3f9d03f85cc7966dc2fe4dfe9216601b0e
https://github.com/zfsonlinux/zfs/commit/2f3ec9006146844af6763d1fa4e823fd9047fd54
https://github.com/zfsonlinux/zfs/commit/00d2a8c92f614f49d23dea5d73f7ea7eb489ccf1
https://github.com/zfsonlinux/zfs/commit/83e9986f6eefdf0afc387f06407087bba3ead4e9
https://github.com/zfsonlinux/zfs/commit/023bbe6f017380f4a04c5060feb24dd8cdda9fce

It also includes the following fix for a sanitization issue that I caught when
porting the code:

https://github.com/zfsonlinux/zfs/pull/3385

It is intended to assist the creation and management of virtual machines
that have their rootfs on ZFS on hosts that also have their rootfs on
ZFS. These situations cause SPA namespace collisions when the standard
name rpool is used in both cases. The solution is either to give each
guest pool a name unique to the host, which is not always desireable, or
boot a VM environment containing an ISO image to install it, which is
cumbersome.

As a side note, this commit includes the removal of `zpool import -r`,
which previously did nothing.


Diffs (updated)
-----

  usr/src/uts/common/sys/fs/zfs.h 569fae20915dc58bebd875fe5f244a82fdc02a9d 
  usr/src/uts/common/fs/zfs/spa_config.c 
47bb59590893cb72ca7f2cee397566c7e466d6d4 
  usr/src/uts/common/fs/zfs/spa.c 6597ab495f241c80a1e8f4879c6262e3de8045f3 
  usr/src/man/man1m/zpool.1m fbfd39357930d7550226ba7ca180042b96c28c1a 
  usr/src/lib/libzfs/common/libzfs_pool.c 
041809102570da15af73001fa202fbd12fe16359 
  usr/src/common/zfs/zpool_prop.c 4d906b02bc02e80a7b0aae7af66898b6e5d1ae79 
  usr/src/cmd/zpool/zpool_main.c 143ee2155df94854a5f3cb8ec150ec38466cc853 

Diff: https://reviews.csiden.org/r/216/diff/


Testing
-------

Built on Open Indiana Hipster, installed a new boot environment with ONU and 
confirmed that the functionality worked in the following session:

root@openindiana:~# truncate -s 1g /tmp/vdev
root@openindiana:~# zpool create -R /tmp/install -t install rpool1 /tmp/vdev
root@openindiana:~# zdb -p /tmp -e rpool1

Configuration for import:
        vdev_children: 1
        version: 5000
        pool_guid: 13703812137835041293
        name: 'rpool1'
        state: 0
        hostid: 28659539
        hostname: 'openindiana'
        vdev_tree:
            type: 'root'
            id: 0
            guid: 13703812137835041293
            children[0]:
                type: 'file'
                id: 0
                guid: 14836473760768821933
                metaslab_array: 35
                metaslab_shift: 24
                ashift: 9
                asize: 1069023232
                is_log: 0
                create_txg: 4
                path: '/tmp/vdev'
zdb: can't open 'rpool1': File exists
root@openindiana:~# zpool list
NAME      SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
install  1008M    79K  1008M         -     0%     0%  1.00x  ONLINE  
/tmp/install
rpool1   1.36T  45.2G  1.32T         -     3%     3%  1.00x  ONLINE  -
root@openindiana:~# zpool export install
root@openindiana:~# zpool import -d /tmp
   pool: rpool1
     id: 13703812137835041293
  state: ONLINE
 action: The pool can be imported using its name or numeric identifier.
 config:

        rpool1       ONLINE
          /tmp/vdev  ONLINE
root@openindiana:~# zpool import -d /tmp -t rpool1 example
root@openindiana:~# zpool list
NAME      SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
example  1008M   102K  1008M         -     0%     0%  1.00x  ONLINE  -
rpool1   1.36T  45.2G  1.32T         -     3%     3%  1.00x  ONLINE  -
root@openindiana:~# zdb -p /tmp -e rpool1

Configuration for import:
        vdev_children: 1
        version: 5000
        pool_guid: 13703812137835041293
        name: 'rpool1'
        state: 0
        hostid: 28659539
        hostname: 'openindiana'
        vdev_tree:
            type: 'root'
            id: 0
            guid: 13703812137835041293
            children[0]:
                type: 'file'
                id: 0
                guid: 14836473760768821933
                metaslab_array: 35
                metaslab_shift: 24
                ashift: 9
                asize: 1069023232
                is_log: 0
                create_txg: 4
                path: '/tmp/vdev'
zdb: can't open 'rpool1': File exists
root@openindiana:~# zpool export example
root@openindiana:~# zpool import -d /tmp
   pool: rpool1
     id: 13703812137835041293
  state: ONLINE
 action: The pool can be imported using its name or numeric identifier.
 config:

        rpool1       ONLINE
          /tmp/vdev  ONLINE


Thanks,

Richard Yao

_______________________________________________
developer mailing list
[email protected]
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to