Re: [PATCH 7/8] qemu: Implement VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag

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

 



On Tue, Feb 05, 2019 at 04:23:10PM +0100, Jiri Denemark wrote:
This flag tells virDomainMigrateSetMaxSpeed and
virDomainMigrateGetMaxSpeed APIs to work on post-copy migration
bandwidth.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
src/qemu/qemu_driver.c | 91 ++++++++++++++++++++++++++++++++++++------
1 file changed, 78 insertions(+), 13 deletions(-)



@@ -14344,7 +14369,47 @@ qemuDomainMigrateGetMaxSpeed(virDomainPtr dom,
    if (virDomainMigrateGetMaxSpeedEnsureACL(dom->conn, vm->def) < 0)
        goto cleanup;

-    *bandwidth = priv->migMaxBandwidth;
+    if (postcopy) {

This whole branch looks like a good candidate for a helper function.

+        VIR_AUTOPTR(qemuMigrationParams) migParams = NULL;
+        unsigned long long bw;
+        int rc = -1;
+
+        if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+            goto cleanup;
+
+        if (virDomainObjCheckActive(vm) == 0 &&
+            qemuMigrationParamsFetch(driver, vm, QEMU_ASYNC_JOB_NONE,
+                                     &migParams) == 0) {
+            rc = qemuMigrationParamsGetULL(migParams,
+                                           QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH,
+                                           &bw);
+
+            /* QEMU reports B/s while we use MiB/s */
+            bw /= 1024 * 1024;
+        }

You coould put an 'endjob' label here.

+
+        qemuDomainObjEndJob(driver, vm);
+
+        if (rc < 0) {
+            goto cleanup;
+        } else if (rc == 1) {

No need for 'else' after goto.

+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("querying maximum post-copy migration speed is "
+                             "not supported by QEMU binary"));
+            goto cleanup;
+        } if (bw > ULONG_MAX) {

Missing newline.

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature

--
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]

  Powered by Linux