Re: [PATCH V2 6/8] Save migration speed in qemuDomainMigrateSetMaxSpeed

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

 



On Thu, Sep 01, 2011 at 02:42:55PM -0600, Jim Fehlig wrote:
> From: Jim Fehlig <jfehlig@xxxxxxxxxx>
> 
> Now that migration speed is stored in qemuDomainObjPrivate structure,
> save the new value when invoking qemuDomainMigrateSetMaxSpeed().
> 
> Allow setting migration speed on inactive domain too.
> ---
>  src/qemu/qemu_driver.c |   36 +++++++++++++++---------------------
>  1 files changed, 15 insertions(+), 21 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index c5fa106..59b9a91 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -8234,31 +8234,25 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom,
>          return -1;
>      }
>  
> -    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
> -        goto cleanup;
> -
> -    if (!virDomainObjIsActive(vm)) {
> -        qemuReportError(VIR_ERR_OPERATION_INVALID,
> -                        "%s", _("domain is not running"));
> -        goto endjob;
> -    }
> -
>      priv = vm->privateData;
> +    if (virDomainObjIsActive(vm)) {
> +        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
> +            goto cleanup;
>  
> -    if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) {
> -        qemuReportError(VIR_ERR_OPERATION_INVALID,
> -                        "%s", _("domain is not being migrated"));
> -        goto endjob;
> -    }
> +        VIR_DEBUG("Setting migration bandwidth to %luMbs", bandwidth);
> +        qemuDomainObjEnterMonitor(driver, vm);
> +        ret = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth);
> +        qemuDomainObjExitMonitor(driver, vm);
>  
> -    VIR_DEBUG("Setting migration bandwidth to %luMbs", bandwidth);
> -    qemuDomainObjEnterMonitor(driver, vm);
> -    ret = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth);
> -    qemuDomainObjExitMonitor(driver, vm);
> +        if (ret == 0)
> +            priv->migMaxBandwidth = bandwidth;
>  
> -endjob:
> -    if (qemuDomainObjEndJob(driver, vm) == 0)
> -        vm = NULL;
> +        if (qemuDomainObjEndJob(driver, vm) == 0)
> +            vm = NULL;
> +    } else {
> +        priv->migMaxBandwidth = bandwidth;
> +        ret = 0;
> +    }
>  
>  cleanup:
>      if (vm)

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]