[libvirt] [PATCH 10/16] Refactor migration completion loop to allow code reuse
Eric Blake
eblake at redhat.com
Thu May 12 03:38:18 UTC 2011
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110511/0a890d25/attachment-0001.sig>
More information about the libvir-list
mailing list