resource-agents icon indicating copy to clipboard operation
resource-agents copied to clipboard

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

Open krudometkin opened this issue 2 years ago • 1 comments

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

krudometkin avatar Oct 15 '23 14:10 krudometkin

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

oalbrigt avatar Oct 16 '23 12:10 oalbrigt