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

Re: [libvirt] [PATCH v2 0/5] Introduce virDomainMigrateSetMaxDowntime API



> This API call sets maximum tolerable time for which the domain is allowed to be
> paused at the end of live migration. It's supposed to be called while the
> domain is being live-migrated as a reaction to migration progress.

Changes in version 3:
- use milliseconds instead of nanoseconds both internally and in API
- correct suffix for qemu monitor commands

> Changes in version 2:
> - API renamed to reflect it's maximum downtime
> - new flags parameter for the future
> - qemu implementation was fixed so that the call is allowed iff the domain is
>   being migrated
> - --downtime parameter of virsh migrate command was removed in favor of new
>   virsh migrate-setmaxdowntime which can be run independently
> - virsh accepts downtime as nanoseconds instead of floating-point seconds
>   (shells don't deal with floating-point numbers well)

Version 3 diff follows:

 src/libvirt.c                |    2 +-
 src/qemu/qemu_driver.c       |    8 ++++----
 src/qemu/qemu_monitor_json.c |    2 +-
 src/qemu/qemu_monitor_text.c |    2 +-
 tools/virsh.c                |    2 +-
 tools/virsh.pod              |    2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 07837a3..178dbc1 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -11270,7 +11270,7 @@ error:
 /**
  * virDomainMigrateSetMaxDowntime:
  * @domain: a domain object
- * @downtime: maximum tolerable downtime for live migration, in nanoseconds
+ * @downtime: maximum tolerable downtime for live migration, in milliseconds
  * @flags: fine-tuning flags, currently unused, use 0
  *
  * Sets maximum tolerable time for which the domain is allowed to be paused
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 322fb3f..2a7b5c0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4074,13 +4074,13 @@ qemuDomainWaitForMigrationComplete(struct qemud_driver *driver, virDomainObjPtr
             if (qemuDomainMigrateOffline(driver, vm) < 0)
                 VIR_WARN0("Unable to pause domain");
         } else if (priv->jobSignals & QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME) {
-            unsigned long long ns = priv->jobSignalsData.migrateDowntime;
+            unsigned long long ms = priv->jobSignalsData.migrateDowntime;
 
             priv->jobSignals ^= QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME;
             priv->jobSignalsData.migrateDowntime = 0;
-            VIR_DEBUG("Setting migration downtime to %lluns", ns);
+            VIR_DEBUG("Setting migration downtime to %llums", ms);
             qemuDomainObjEnterMonitorWithDriver(driver, vm);
-            rc = qemuMonitorSetMigrationDowntime(priv->mon, ns);
+            rc = qemuMonitorSetMigrationDowntime(priv->mon, ms);
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             if (rc < 0)
                 VIR_WARN0("Unable to set migration downtime");
@@ -9574,7 +9574,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
         goto cleanup;
     }
 
-    VIR_DEBUG("Requesting migration downtime change to %lluns", downtime);
+    VIR_DEBUG("Requesting migration downtime change to %llums", downtime);
     priv->jobSignals |= QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME;
     priv->jobSignalsData.migrateDowntime = downtime;
     ret = 0;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index b259452..4ae8093 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1095,7 +1095,7 @@ int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon,
     char *downtimestr;
     virJSONValuePtr cmd;
     virJSONValuePtr reply = NULL;
-    if (virAsprintf(&downtimestr, "%llun", downtime) < 0) {
+    if (virAsprintf(&downtimestr, "%llums", downtime) < 0) {
         virReportOOMError();
         return -1;
     }
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index ca2fc97..1596e59 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1006,7 +1006,7 @@ int qemuMonitorTextSetMigrationDowntime(qemuMonitorPtr mon,
     char *info = NULL;
     int ret = -1;
 
-    if (virAsprintf(&cmd, "migrate_set_downtime %llun", downtime) < 0) {
+    if (virAsprintf(&cmd, "migrate_set_downtime %llums", downtime) < 0) {
         virReportOOMError();
         goto cleanup;
     }
diff --git a/tools/virsh.c b/tools/virsh.c
index 3dd9314..cfcc86e 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2840,7 +2840,7 @@ static const vshCmdInfo info_migrate_setmaxdowntime[] = {
 
 static const vshCmdOptDef opts_migrate_setmaxdowntime[] = {
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
-    {"downtime", VSH_OT_DATA, VSH_OFLAG_REQ, N_("maximum tolerable downtime (in nanoseconds) for migration")},
+    {"downtime", VSH_OT_DATA, VSH_OFLAG_REQ, N_("maximum tolerable downtime (in milliseconds) for migration")},
     {NULL, 0, 0, NULL}
 };
 
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 1c7cfce..a6298dd 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -337,7 +337,7 @@ migration URI, which usually can be omitted.
 =item B<migrate-setmaxdowntime> I<domain-id> I<downtime>
 
 Set maximum tolerable downtime for a domain which is being live-migrated to
-another host.  The I<downtime> is a number of nanoseconds the guest is allowed
+another host.  The I<downtime> is a number of milliseconds the guest is allowed
 to be down at the end of live migration.
 
 =item B<reboot> I<domain-id>


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