* Yang Hongyang (yan...@cn.fujitsu.com) wrote:
> implement colo save

My postcopy 'QEMU_VM_CMD_PACKAGED' does something similar to
parts of this with the QEMUSizedBuffer, we might be able to share some more:
https://lists.nongnu.org/archive/html/qemu-devel/2014-07/msg00886.html

> +    /* we send the total size of the vmstate first */
> +    ret = colo_ctl_put(s->file, colo_buffer.used);
> +    if (ret) {
> +        goto out;
> +    }
> +
> +    qemu_put_buffer_async(s->file, colo_buffer.data, colo_buffer.used);
> +    ret = qemu_file_get_error(s->file);
> +    if (ret < 0) {
> +        goto out;
> +    }
> +    qemu_fflush(s->file);

Is there a reason to use _async here?  I thought the only gain is
if you were going to do other writes in the shadow of the async, with the fflush
immediately after I'm not sure it helps.

Dave

>  
>      ret = colo_ctl_get(control, COLO_CHECKPOINT_RECEIVED);
>      if (ret) {
>          goto out;
>      }
>  
> -    /* TODO: Flush network etc. */
> +    /* Flush network etc. */
> +    colo_compare_flush();
>  
>      ret = colo_ctl_get(control, COLO_CHECKPOINT_LOADED);
>      if (ret) {
>          goto out;
>      }
>  
> -    /* TODO: resume master */
> +    colo_compare_resume();
> +    ret = 0;
>  
>  out:
> +    /* resume master */
> +    qemu_mutex_lock_iothread();
> +    vm_start();
> +    qemu_mutex_unlock_iothread();
> +
>      return ret;
>  }
>  
> -- 
> 1.9.1
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK

Reply via email to