On 04/04/2017 07:16 AM, Kevin Wolf wrote: > > Now the big question is how to implement this. Just not requesting the > write permission initially if runstate_check(RUN_STATE_INMIGRATE) is > easy. But we need to find a place to actually request it later, after > the mirror has completed, and before the VM is running. > > My first thought was that we could add a VMChangeStateHandler and just > request the permission in there. However, requesting the permission can > fail (e.g. because the NBD server hasn't been shut down) and we can't > let a state transition fail from a VMChangeStateHandler. > > Maybe the next best thing we could do is to have a BlockDevOps callback > for invalidate_cache/inactivate and get the permissions there. This one > could return an error, which would be passed up the stack and eventually > cause qmp_cont() to fail (i.e. it would refuse to resume the VM). This > sounds workable to me.
Having 'cont' refuse when write permissions can't be grabbed after all sounds reasonable (assuming, of course, that the common case is that the invalidate_cache/inactivate call that triggers the callback will normally succeed, because it means the source is now done and the destination _should_ be able to get write access at that point). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature