On 11/12/2013 09:15 PM, Zheng Sheng ZS Zhou wrote:
Actually I wrote another hacking patch to investigate how we can re-use existing
framework to do local migration. I found the following problems.
[Can you please configure your mailer to wrap long lines? It's awkward
to reply when there is no wrapping]
I found if I was to re-use migration framework, I need to change
interface of a few functions, add some flags, pass them deep into the inner functions.
Yes, but that's a more maintainable approach. Avoiding code duplication
by adding parameters so that existing functions can serve both migration
paths is better than blindly rewriting the new code path by just copying
the original code path. If we find a bug down the road, we'd prefer to
fix it in one place for both migration scenarios, rather than having to
remember to copy the fix into two places. You can't reuse the entire
migration framework, but you SHOULD be trying to refactor the code to
use as much of the framework as possible.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org