> The OP was just showing a test case.  On a real system your HA software
> would exchange a heartbeat and not do a double import.  The problem with
> zfs is that after the original system fails and the second system imports
> the pool, the original system also tries to import on [re]boot, and the OP
> didn't know how to disable this.

Ok, I see. I don't think he showed that because he didn't mention a reboot.

If you *never* want to import a pool automatically on reboot you just have to 
delete the /etc/zfs/zpool.cache file before the zfs module is being loaded. 
This could be integrated into SMF.

ZFS should normally be loaded during svc:/system/filesystem/local. Just create 
a service with filesystem/local as a dependent which removes 
/etc/zfs/zpool.cache.

Like:

/lib/svc/method/zpool-clear

#!/sbin/sh
. /lib/svc/share/smf_include.sh
/usr/bin/rm -f /etc/zfs/zpool.cache
exit $SMF_EXIT_OK


/var/svc/manifest/system/zpool-clear.xml

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='none:zpool-clear'>
<service
        name='system/zpool/clear'
        type='service'
        version='1'>
        <create_default_instance enabled='true' />
        <single_instance/>
        <dependency
                name='usr'
                grouping='require_all'
                restart_on='none'
                type='service'>
                <service_fmri value='svc:/system/filesystem/usr' />
        </dependency>
        <dependent
                name='fs-local'
                grouping='require_all'
                restart_on='none'>
                <service_fmri value='svc:/system/filesystem/local' />
        </dependent>
        <exec_method
                type='method'
                name='start'
                exec='/lib/svc/method/zpool-clear'
                timeout_seconds='0' />
        <exec_method
                type='method'
                name='stop'
                exec=':true'
                timeout_seconds='0' />
        <property_group name='startd' type='framework'>
                <propval name='duration' type='astring' value='transient' />
        </property_group>
        <template>
                <common_name>
                        <loctext xml:lang='C'>
                                Clears the zpool cache file
                        </loctext>
                </common_name>
        </template>
</service>
</service_bundle>

(sorry for the poor formating but this !$&%()# web interface is driving me nuts)

Then do a "svccfg import /var/svc/manifest/system/zpool-clear.xml". Now 
/etc/zfs/zpool.cache should disappear on each reboot before the zfs module is 
loaded.
 
 
This message posted from opensolaris.org
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to