I would like to know what is the suggested way (if any) to move a gen_server/gen_fsm from erlang node A to erlang node B preserving its internal state.
AFAIK there's no way to transfer a process between erlang nodes and I can think about many reasons to forbid this, between the others you may mess with internal nodes memory, simply consider a process which holds data (other than in the internal 'State' loop parameter) in process dictionary (process heap), binary (different garbage collection method).
One workaround could be to provide the gen_fsm/gen_server with a method that can spawn a new process recreating at the same time the internal state of the server/state machine. I think it's more difficult to say that to implement, you could simply use two start functions:
But I must say that I see two main problems here:
The former could be resolved in many ways (my two cents: explicit message passing between local and remote server - overhead but bulletproof considering Erlang runtime system), the latter could be resolved with monitor/links and exit return values (the remote server pid) or in a more elegant way with a publish/subscribe model with a gen_event process.
I hope you find this useful to resolve your issue and ask anything if you need!