[PATCH 6/6] remove qemuDomainObjBeginJobWithDriver

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

 



The body of qemuDomainObjBeginJobWithDriver is the same as
qemuDomainObjBeginJob, so remove it.
---
 src/qemu/qemu_domain.c    |   41 -----------------------------------------
 src/qemu/qemu_domain.h    |    2 --
 src/qemu/qemu_driver.c    |   36 ++++++++++++++++++------------------
 src/qemu/qemu_migration.c |    8 ++++----
 4 files changed, 22 insertions(+), 65 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b9bf8a4..9a9088a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -481,47 +481,6 @@ int qemuDomainObjBeginJob(virDomainObjPtr obj)
     return 0;
 }
 
-/*
- * This must be called by anything that will change the VM state
- * in any way, or anything that will use the QEMU monitor.
- */
-int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver ATTRIBUTE_UNUSED,
-                                    virDomainObjPtr obj)
-{
-    qemuDomainObjPrivatePtr priv = obj->privateData;
-    struct timeval now;
-    unsigned long long then;
-
-    if (gettimeofday(&now, NULL) < 0) {
-        virReportSystemError(errno, "%s",
-                             _("cannot get time of day"));
-        return -1;
-    }
-    then = timeval_to_ms(now) + QEMU_JOB_WAIT_TIME;
-
-    virDomainObjLock(obj);
-
-    while (priv->jobActive) {
-        if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
-            int err = errno;
-            virDomainObjUnlock(obj);
-            if (err == ETIMEDOUT)
-                qemuReportError(VIR_ERR_OPERATION_TIMEOUT,
-                                "%s", _("cannot acquire state change lock"));
-            else
-                virReportSystemError(errno,
-                                     "%s", _("cannot acquire job mutex"));
-            return -1;
-        }
-    }
-    priv->jobActive = QEMU_JOB_UNSPECIFIED;
-    priv->jobSignals = 0;
-    memset(&priv->jobSignalsData, 0, sizeof(priv->jobSignalsData));
-    priv->jobStart = timeval_to_ms(now);
-    memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
-
-    return 0;
-}
 
 /*
  * obj must be locked before calling, qemud_driver does not matter
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 75ad5d9..500a882 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -95,8 +95,6 @@ void qemuDomainSetPrivateDataHooks(virCapsPtr caps);
 void qemuDomainSetNamespaceHooks(virCapsPtr caps);
 
 int qemuDomainObjBeginJob(virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
-int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
-                                    virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
 void qemuDomainObjEndJob(virDomainObjPtr obj);
 void qemuDomainObjEnterMonitor(virDomainObjPtr obj);
 void qemuDomainObjExitMonitor(virDomainObjPtr obj);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 887a865..e1b49e8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -140,7 +140,7 @@ qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaq
     virErrorPtr err;
 
     virResetLastError();
-    if (qemuDomainObjBeginJobWithDriver(data->driver, vm) < 0) {
+    if (qemuDomainObjBeginJob(vm) < 0) {
         err = virGetLastError();
         VIR_ERROR(_("Failed to start job on VM '%s': %s"),
                   vm->def->name,
@@ -1279,7 +1279,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
 
     def = NULL;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0) {
+    if (qemuDomainObjBeginJob(vm) < 0) {
         virDomainObjUnref(vm);
         goto cleanup; /* XXXX free the 'vm' we created ? */
     }
@@ -1351,7 +1351,7 @@ static int qemudDomainSuspend(virDomainPtr dom) {
         ret = 0;
         goto cleanup;
     } else {
-        if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+        if (qemuDomainObjBeginJob(vm) < 0)
             goto cleanup;
 
         if (!virDomainObjIsActive(vm)) {
@@ -1401,7 +1401,7 @@ static int qemudDomainResume(virDomainPtr dom) {
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -1493,7 +1493,7 @@ static int qemudDomainDestroy(virDomainPtr dom) {
         return -1;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -1849,7 +1849,7 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
 
     priv = vm->privateData;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     priv->jobActive = QEMU_JOB_SAVE;
@@ -2324,7 +2324,7 @@ static int qemudDomainCoreDump(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     priv = vm->privateData;
@@ -2416,7 +2416,7 @@ static void processWatchdogEvent(void *data, void *opaque)
                 break;
             }
 
-            if (qemuDomainObjBeginJobWithDriver(driver, wdEvent->vm) < 0)
+            if (qemuDomainObjBeginJob(wdEvent->vm) < 0)
                 break;
 
             if (!virDomainObjIsActive(wdEvent->vm)) {
@@ -3162,7 +3162,7 @@ qemuDomainRestore(virConnectPtr conn,
     }
     def = NULL;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     ret = qemuDomainSaveImageStartVM(conn, driver, vm, &fd, &header, path);
@@ -3248,7 +3248,7 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
         /* Don't delay if someone's using the monitor, just use
          * existing most recent data instead */
         if (!priv->jobActive) {
-            if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+            if (qemuDomainObjBeginJob(vm) < 0)
                 goto cleanup;
 
             qemuDomainObjEnterMonitor(vm);
@@ -3469,7 +3469,7 @@ qemudDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (virDomainObjIsActive(vm)) {
@@ -3729,7 +3729,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -3909,7 +3909,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -4013,7 +4013,7 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
@@ -6007,7 +6007,7 @@ qemuDomainSnapshotCreateActive(virConnectPtr conn,
     bool resume = false;
     int ret = -1;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         return -1;
 
     if (vm->state == VIR_DOMAIN_RUNNING) {
@@ -6351,7 +6351,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
 
     vm->current_snapshot = snap;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (snap->def->state == VIR_DOMAIN_RUNNING
@@ -6617,7 +6617,7 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
         goto cleanup;
     }
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) {
@@ -6687,7 +6687,7 @@ static int qemuDomainMonitorCommand(virDomainPtr domain, const char *cmd,
 
     hmp = !!(flags & VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP);
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
     qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorArbitraryCommand(priv->mon, cmd, result, hmp);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5076cd5..fb9009f 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -291,7 +291,7 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver,
     def = NULL;
     priv = vm->privateData;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
     priv->jobActive = QEMU_JOB_MIGRATION_OUT;
 
@@ -508,7 +508,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
     def = NULL;
     priv = vm->privateData;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
     priv->jobActive = QEMU_JOB_MIGRATION_OUT;
 
@@ -1047,7 +1047,7 @@ int qemuMigrationPerform(struct qemud_driver *driver,
     int resume = 0;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
     priv->jobActive = QEMU_JOB_MIGRATION_OUT;
 
@@ -1181,7 +1181,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
     priv->jobActive = QEMU_JOB_NONE;
     memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
 
-    if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
+    if (qemuDomainObjBeginJob(vm) < 0)
         goto cleanup;
 
     /* Did the migration go as planned?  If yes, return the domain
-- 
1.7.3.1


-- 
Thanks,
Hu Tao

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