> Say, In ram_save_iterate(), the current logic is: > > ret = qemu_file_rate_limit(); > while(ret == 0) { > save RAM blocks until no more to send. > } > if (ret < 0) { > return ret; > } > ... > > And in savevm layer, qemu_savevm_state_iterate() set an error if the return > value of ram_save_iterate < 0.
But that is to report errors *not in the QEMUFile*. Errors in the QEMUFile are already reported by qemu_file_get_error(), and qemu_savevm_state_iterate() will not overwrite them. qemu_file_rate_limit() returning 1 is enough to exit the loop, which is all that is needed. > Obviously the return value of qemu_file_rate_limit() should have an negative > value for there has been an error. Otherwise we need to modify the logic > above. It is not obvious to me... what is, again, the bug that you're observing? I think it is happening only because you're modifying the migration thread's body. If you use the normal code of the migration thread, it will just work. Paolo