Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'zimport' to aid udev driven pool import (WIP) #1587

Closed
wants to merge 1 commit into from
Closed

Add 'zimport' to aid udev driven pool import (WIP) #1587

wants to merge 1 commit into from

Conversation

prakashsurya
Copy link
Member

This change introduces a new userspace command 'zimport' whose intention
is to be used as a udev helper for dynamically import ZFS pools as
devices appear.

Although this is still a work in progress, the command currently
supports a stateful interface for adding and removing devices:

# To add the /dev/sda1 device to the /tmp/zimport.cache file
$ zimport -a /dev/sda1

# To remove the /dev/sda1 device to the /tmp/zimport.cache file
$ zimport -r /dev/sda1

Once the zimport cache file contains all of the vdevs for a given pool,
it will automatically attempt to import the pool. For example, to import
a pool consisting of two devices (sda1 and sdb1) run the following:

$ zimport -a /dev/sda1
$ zimport -a /dev/sdb1

It is also possible to use the '-c' option to specify a custom file name
to use as the cache file. For example, to use the '/var/run/zimport'
instead of the default one can do the following:

$ zimport -a /dev/sda1 -c /var/run/zimport

Work that still needs to be implemented includes the following:

  • l2arc devices are not yet supported.

  • A udev rules helper needs to be added to make use of the 'zimport'
    command. This helper should run 'zimport -a %k' to add a device as
    they appear and 'zimport -r %k' as they disappear.

  • The cache file needs to be cleared and/or devices removed from the
    cache file as pools are successfully imported.

  • A configuration interface is needed to specify different policies
    which define the conditions which need to be met for a pool to be
    imported. For example:

    • Which should pools should be imported?
    • Do all vdevs need to be present to import? (e.g. raidz degraded)
    • How much "slack" time between all devices online and import?

    Currently, all vdevs must be present before the pool is imported.
    Also, any pool detected will try to be imported.

  • It would also be useful to be able to specify scripts or executables
    to be run at specific points during the device recognition and import
    phase.

Signed-off-by: Prakash Surya [email protected]
Issue #330

This change introduces a new userspace command 'zimport' whose intention
is to be used as a udev helper for dynamically import ZFS pools as
devices appear.

Although this is still a work in progress, the command currently
supports a stateful interface for adding and removing devices:

    # To add the /dev/sda1 device to the /tmp/zimport.cache file
    $ zimport -a /dev/sda1

    # To remove the /dev/sda1 device to the /tmp/zimport.cache file
    $ zimport -r /dev/sda1

Once the zimport cache file contains all of the vdevs for a given pool,
it will automatically attempt to import the pool. For example, to import
a pool consisting of two devices (sda1 and sdb1) run the following:

    $ zimport -a /dev/sda1
    $ zimport -a /dev/sdb1

It is also possible to use the '-c' option to specify a custom file name
to use as the cache file. For example, to use the '/var/run/zimport'
instead of the default one can do the following:

    $ zimport -a /dev/sda1 -c /var/run/zimport

Work that still needs to be implemented includes the following:

 * l2arc devices are not yet supported.

 * A udev rules helper needs to be added to make use of the 'zimport'
   command. This helper should run 'zimport -a %k' to add a device as
   they appear and 'zimport -r %k' as they disappear.

 * The cache file needs to be cleared and/or devices removed from the
   cache file as pools are successfully imported.

 * A configuration interface is needed to specify different policies
   which define the conditions which need to be met for a pool to be
   imported. For example:

    - Which should pools should be imported?
    - Do all vdevs need to be present to import? (e.g. raidz degraded)
    - How much "slack" time between all devices online and import?

   Currently, all vdevs must be present before the pool is imported.
   Also, any pool detected will try to be imported.

 * It would also be useful to be able to specify scripts or executables
   to be run at specific points during the device recognition and import
   phase.

Signed-off-by: Prakash Surya <[email protected]>
Issue #330
@prakashsurya
Copy link
Member Author

This patch is still a work in progress, but it would be nice to get some feedback on what I have so far if anybody has the time.

@behlendorf
Copy link
Contributor

Closing as stale. This is certainly still a goal and something of a work in progress.

@behlendorf behlendorf closed this Apr 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants