[PATCH 17/19] qemu: Remove special case for virDomainMigrateSetMaxDowntime

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

 



Call qemu monitor command directly within a special job that is only
allowed during outgoing migration.
---
 src/qemu/qemu_domain.c    |    1 -
 src/qemu/qemu_domain.h    |    6 ------
 src/qemu/qemu_driver.c    |   23 +++++++++++++++--------
 src/qemu/qemu_migration.c |   13 -------------
 4 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c47ab60..deaf9fd 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -186,7 +186,6 @@ qemuDomainObjResetAsyncJob(qemuDomainObjPrivatePtr priv)
     job->start = 0;
     memset(&job->info, 0, sizeof(job->info));
     job->signals = 0;
-    memset(&job->signalsData, 0, sizeof(job->signalsData));
 }
 
 void
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 7e6b522..71cefd9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -69,11 +69,6 @@ enum qemuDomainAsyncJob {
 enum qemuDomainJobSignals {
     QEMU_JOB_SIGNAL_CANCEL  = 1 << 0, /* Request job cancellation */
     QEMU_JOB_SIGNAL_SUSPEND = 1 << 1, /* Request VM suspend to finish live migration offline */
-    QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME = 1 << 2, /* Request migration downtime change */
-};
-
-struct qemuDomainJobSignalsData {
-    unsigned long long migrateDowntime; /* Data for QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME */
 };
 
 struct qemuDomainJobObj {
@@ -89,7 +84,6 @@ struct qemuDomainJobObj {
 
     virCond signalCond; /* Use to coordinate the safe queries during migration */
     unsigned int signals;       /* Signals for running job */
-    struct qemuDomainJobSignalsData signalsData;    /* Signal specific data */
 };
 
 typedef struct _qemuDomainPCIAddressSet qemuDomainPCIAddressSet;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1235787..d62e99d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7383,19 +7383,23 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
 
     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;
+        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 cleanup;
+        goto endjob;
     }
 
     priv = vm->privateData;
@@ -7403,18 +7407,21 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
     if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) {
         qemuReportError(VIR_ERR_OPERATION_INVALID,
                         "%s", _("domain is not being migrated"));
-        goto cleanup;
+        goto endjob;
     }
 
-    VIR_DEBUG("Requesting migration downtime change to %llums", downtime);
-    priv->job.signalsData.migrateDowntime = downtime;
-    priv->job.signals |= QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME;
-    ret = 0;
+    VIR_DEBUG("Setting migration downtime to %llums", downtime);
+    ignore_value(qemuDomainObjEnterMonitor(driver, vm));
+    ret = qemuMonitorSetMigrationDowntime(priv->mon, downtime);
+    qemuDomainObjExitMonitor(driver, vm);
+
+endjob:
+    if (qemuDomainObjEndJob(driver, vm) == 0)
+        vm = NULL;
 
 cleanup:
     if (vm)
         virDomainObjUnlock(vm);
-    qemuDriverUnlock(driver);
     return ret;
 }
 
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d7ad97f..ee2c5a0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -775,19 +775,6 @@ qemuMigrationProcessJobSignals(struct qemud_driver *driver,
         VIR_DEBUG("Pausing domain for non-live migration");
         if (qemuMigrationSetOffline(driver, vm) < 0)
             VIR_WARN("Unable to pause domain");
-    } else if (priv->job.signals & QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME) {
-        unsigned long long ms = priv->job.signalsData.migrateDowntime;
-
-        priv->job.signals ^= QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME;
-        priv->job.signalsData.migrateDowntime = 0;
-        VIR_DEBUG("Setting migration downtime to %llums", ms);
-        ret = qemuDomainObjEnterMonitorWithDriver(driver, vm);
-        if (ret == 0) {
-            ret = qemuMonitorSetMigrationDowntime(priv->mon, ms);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
-        }
-        if (ret < 0)
-            VIR_WARN("Unable to set migration downtime");
     } else {
         ret = 0;
     }
-- 
1.7.6

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