Re: [PATCH 14/14] qemu: Implement virDomainMigrate*CompressionCache

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

 



On 02/19/13 13:35, Jiri Denemark wrote:
---
  src/qemu/qemu_driver.c       | 94 ++++++++++++++++++++++++++++++++++++++++++++
  src/qemu/qemu_monitor.c      | 43 ++++++++++++++++++++
  src/qemu/qemu_monitor.h      |  5 +++
  src/qemu/qemu_monitor_json.c | 63 +++++++++++++++++++++++++++++
  src/qemu/qemu_monitor_json.h |  5 +++
  5 files changed, 210 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 07f7061..5aef22d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10359,6 +10359,98 @@ cleanup:
  }

  static int
+qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
+                                     unsigned long long *cacheSize,
+                                     unsigned int flags)
+{
+    virQEMUDriverPtr driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    qemuDomainObjPrivatePtr priv;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = qemuDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
+        goto cleanup;
+
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("domain is not running"));
+        goto endjob;
+    }
+
+    priv = vm->privateData;
+
+    qemuDomainObjEnterMonitor(driver, vm);
+
+    ret = qemuMonitorGetMigrationCapability(
+                priv->mon,
+                QEMU_MONITOR_MIGRATION_CAPS_XBZRLE);
+    if (ret == 0) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("Compressed migration is not supported by "
+                         "QEMU binary"));
+    } else if (ret > 0) {
+        ret = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize);
+    }
+
+    qemuDomainObjExitMonitor(driver, vm);
+
+endjob:
+    if (qemuDomainObjEndJob(driver, vm) == 0)
+        vm = NULL;
+
+cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
+
+static int
+qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
+                                     unsigned long long cacheSize,
+                                     unsigned int flags)
+{
+    virQEMUDriverPtr driver = dom->conn->privateData;
+    virDomainObjPtr vm;
+    qemuDomainObjPrivatePtr priv;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = qemuDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
+        goto cleanup;
+
+    if (!virDomainObjIsActive(vm)) {
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("domain is not running"));
+        goto endjob;
+    }
+

Wouldn't it be better to check the xbzrle migration capability here too? To be able to provide better errors?

+    priv = vm->privateData;
+
+    VIR_DEBUG("Setting compression cache to %llu B", cacheSize);
+    qemuDomainObjEnterMonitor(driver, vm);
+    ret = qemuMonitorSetMigrationCacheSize(priv->mon, cacheSize);
+    qemuDomainObjExitMonitor(driver, vm);
+
+endjob:
+    if (qemuDomainObjEndJob(driver, vm) == 0)
+        vm = NULL;
+
+cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
+
+static int
  qemuDomainMigrateSetMaxSpeed(virDomainPtr dom,
                               unsigned long bandwidth,
                               unsigned int flags)

ACK with or without my suggestion implemented as I don't have a strong opinion on this.

Peter

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