Skip to content
  • Stefan Hajnoczi's avatar
    block-migration: fix pending() and iterate() return values · 6aaa9dae
    Stefan Hajnoczi authored
    
    
    The return value of .save_live_pending() is the number of bytes
    remaining.  This is just an estimate because we do not know how many
    blocks will be dirtied by the running guest.
    
    Currently our return value for .save_live_pending() is wrong because it
    includes dirty blocks but not in-flight bdrv_aio_readv() requests or
    unsent blocks.  Crucially, it also doesn't include the bulk phase where
    the entire device is transferred - therefore we risk completing block
    migration before all blocks have been transferred!
    
    The return value of .save_live_iterate() is the number of bytes
    transferred this iteration.  Currently we return whether there are bytes
    remaining, which is incorrect.
    
    Move the bytes remaining calculation into .save_live_pending() and
    really return the number of bytes transferred this iteration in
    .save_live_iterate().
    
    Also fix the %ld format specifier which was used for a uint64_t
    argument.  PRIu64 must be use to avoid warnings on 32-bit hosts.
    
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
    Message-id: 1360661835-28663-3-git-send-email-stefanha@redhat.com
    Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
    6aaa9dae