ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
489 stars 577 forks source link

resource-agents/heartbeat/ZFS - '-f' to option #1894

Open krudometkin opened 9 months ago

krudometkin commented 9 months ago

Hello,

I think it's a good idea to create an additional option for "-f" flag in zpool_export method, because "This may lead to potential data corruption.". Not all cases require force the export of ZFS pools.

zpool_export () {
    if zpool_is_imported; then
        ocf_log debug "${OCF_RESKEY_pool}:starting export"

        # -f : force the export, even if we have mounted filesystems
        # Please note that this may fail with a "busy" error if there are
        # other kernel subsystems accessing the pool (e.g. SCSI targets).
        # Always make sure the pool export is last in your failover logic.
        if zpool export -f "$OCF_RESKEY_pool" ; then
            ocf_log debug "${OCF_RESKEY_pool}:export successful"
            return $OCF_SUCCESS
        else
            ocf_log debug "${OCF_RESKEY_pool}:export failed"
            return $OCF_ERR_GENERIC
        fi
    fi
}

Regards, Konstantin

oalbrigt commented 9 months ago

That makes sense. I have no idea why it would need to be force-exported in the first place.