[libvirt] [PATCH 4/8] Impl virDomainMigrateGetMaxSpeed in qemu driver

Daniel P. Berrange berrange at redhat.com
Thu Sep 1 12:38:19 UTC 2011


On Fri, Aug 26, 2011 at 12:10:23PM -0600, Jim Fehlig wrote:
> ---
>  src/qemu/qemu_driver.c |   33 +++++++++++++++++++++++++++++++++
>  1 files changed, 33 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index f21122d..b932e67 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -8256,6 +8256,38 @@ cleanup:
>      return ret;
>  }
>  
> +static int
> +qemuDomainMigrateGetMaxSpeed(virDomainPtr dom,
> +                             unsigned long *bandwidth,
> +                             unsigned int flags)
> +{
> +    struct qemud_driver *driver = dom->conn->privateData;
> +    virDomainObjPtr vm;
> +    int ret = -1;
> +
> +    virCheckFlags(0, -1);
> +
> +    qemuDriverLock(driver);
> +    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
> +    qemuDriverUnlock(driver);
> +
> +    if (!vm) {
> +        char uuidstr[VIR_UUID_STRING_BUFLEN];
> +        virUUIDFormat(dom->uuid, uuidstr);
> +        qemuReportError(VIR_ERR_NO_DOMAIN,
> +                        _("no domain with matching uuid '%s'"), uuidstr);
> +        goto cleanup;
> +    }
> +
> +    *bandwidth = vm->def->migration_max_bandwidth;
> +    ret = 0;
> +
> +cleanup:
> +    if (vm)
> +        virDomainObjUnlock(vm);
> +    return ret;
> +}
> +
>  static char *qemuFindQemuImgBinary(void)
>  {
>      char *ret;
> @@ -9513,6 +9545,7 @@ static virDriver qemuDriver = {
>      .domainAbortJob = qemuDomainAbortJob, /* 0.7.7 */
>      .domainMigrateSetMaxDowntime = qemuDomainMigrateSetMaxDowntime, /* 0.8.0 */
>      .domainMigrateSetMaxSpeed = qemuDomainMigrateSetMaxSpeed, /* 0.9.0 */
> +    .domainMigrateGetMaxSpeed = qemuDomainMigrateGetMaxSpeed, /* 0.9.5 */
>      .domainEventRegisterAny = qemuDomainEventRegisterAny, /* 0.8.0 */
>      .domainEventDeregisterAny = qemuDomainEventDeregisterAny, /* 0.8.0 */
>      .domainManagedSave = qemuDomainManagedSave, /* 0.8.0 */

ACK to the patch in general, but obviously might require changes
wrt where the migration max bandwidth data is kept.

I'd be inclined to just put it in the qemuDomainPrivatePtr struct
and initialize to some default value we choose

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list