[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 10/16] Refactor migration completion loop to allow code reuse



On 05/11/2011 03:09 AM, Daniel P. Berrange wrote:
> The qemuMigrationWaitForCompletion method contains a loop which
> repeatedly queries QEMU to check migration progress, and also
> processes job signals (pause, setspeed, setbandwidth, cancel).
> 
> The tunnelled migration loop does not currently support this
> functionality, but should. Refactor the code to allow it to
> be used with tunnelled migration.
> ---
>  src/qemu/qemu_migration.c |  252 +++++++++++++++++++++++++--------------------
>  1 files changed, 142 insertions(+), 110 deletions(-)

I was able to apply patches 1-9 without too many issues, but got a nasty
merge conflict with patch 10, so I am no longer compile testing at this
point.  :(  Don't know if you can quickly rebase and repost for a better
review.  Also, how does this fit in with Federico's pending patch to
support blkstat/blkinfo during migration? [I still need to review his v2]
https://www.redhat.com/archives/libvir-list/2011-May/msg00669.html

> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 6cb529f..62b6b9e 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -583,14 +583,148 @@ qemuMigrationSetOffline(struct qemud_driver *driver,
>  }
>  
>  
> -int
> -qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
> +static int
> +qemuMigrationProcessJobSignals(struct qemud_driver *driver,
> +                               virDomainObjPtr vm,
> +                               const char *job)
>  {
> +    qemuDomainObjPrivatePtr priv = vm->privateData;
> +    int ret = -1;
> +
> +    if (!virDomainObjIsActive(vm)) {
> +        qemuReportError(VIR_ERR_INTERNAL_ERROR, _("%s: %s"),
> +                        job, _("guest unexpectedly quit"));
> +        return -1;
> +    }
> +
> +    if (priv->jobSignals & QEMU_JOB_SIGNAL_CANCEL) {
> +        priv->jobSignals ^= QEMU_JOB_SIGNAL_CANCEL;
> +        VIR_DEBUG0("Cancelling job at client request");

s/VIR_DEBUG0/VIR_DEBUG/ throughout

Overall, it looks like a sane split (taking two portions out of the loop
and into their own functions).

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]