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

[libvirt] [PATCH 5/6] remove qemuDomainObjEnterMonitorWithDriver and qemuDomainObjExitMonitorWithDriver



Bodies of qemuDomainObjEnterMonitorWithDriver/qemuDomainObjExitMonitorWithDriver
are the same as qemuDomainObjEnterMonitor/qemuDomainObjExitMonitor, so
remove them.
---
 src/qemu/qemu_domain.c    |   32 ----------------
 src/qemu/qemu_domain.h    |    4 --
 src/qemu/qemu_driver.c    |   20 +++++-----
 src/qemu/qemu_hotplug.c   |   90 ++++++++++++++++++++++----------------------
 src/qemu/qemu_migration.c |   46 +++++++++++-----------
 src/qemu/qemu_process.c   |   36 +++++++++---------
 6 files changed, 96 insertions(+), 132 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d11dc5f..b9bf8a4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -578,38 +578,6 @@ void qemuDomainObjExitMonitor(virDomainObjPtr obj)
 }
 
 
-/*
- * obj must be locked before calling, qemud_driver must be locked
- *
- * To be called immediately before any QEMU monitor API call
- * Must have already called qemuDomainObjBeginJob().
- *
- * To be followed with qemuDomainObjExitMonitorWithDriver() once complete
- */
-void qemuDomainObjEnterMonitorWithDriver(struct qemud_driver *driver,
-                                         virDomainObjPtr obj)
-{
-    qemuDomainObjPrivatePtr priv = obj->privateData;
-
-    virDomainObjUnlock(obj);
-    qemuMonitorLock(priv->mon);
-}
-
-
-/* obj must NOT be locked before calling, qemud_driver must be unlocked,
- * and will be locked after returning
- *
- * Should be paired with an earlier qemuDomainObjEnterMonitorWithDriver() call
- */
-void qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
-                                        virDomainObjPtr obj)
-{
-    qemuDomainObjPrivatePtr priv = obj->privateData;
-
-    qemuMonitorUnlock(priv->mon);
-    virDomainObjLock(obj);
-}
-
 void qemuDomainObjEnterRemoteWithDriver(struct qemud_driver *driver,
                                         virDomainObjPtr obj)
 {
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 12fd21d..75ad5d9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -100,10 +100,6 @@ int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
 void qemuDomainObjEndJob(virDomainObjPtr obj);
 void qemuDomainObjEnterMonitor(virDomainObjPtr obj);
 void qemuDomainObjExitMonitor(virDomainObjPtr obj);
-void qemuDomainObjEnterMonitorWithDriver(struct qemud_driver *driver,
-                                         virDomainObjPtr obj);
-void qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
-                                        virDomainObjPtr obj);
 void qemuDomainObjEnterRemoteWithDriver(struct qemud_driver *driver,
                                         virDomainObjPtr obj);
 void qemuDomainObjExitRemoteWithDriver(struct qemud_driver *driver,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index db89402..887a865 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3251,9 +3251,9 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
             if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
                 goto cleanup;
 
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(vm);
             err = qemuMonitorGetBalloonInfo(priv->mon, &balloon);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuDomainObjEndJob(vm);
             if (err < 0)
                 goto cleanup;
@@ -6026,9 +6026,9 @@ qemuDomainSnapshotCreateActive(virConnectPtr conn,
         }
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
 cleanup:
     if (resume && virDomainObjIsActive(vm) &&
@@ -6359,9 +6359,9 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
 
         if (virDomainObjIsActive(vm)) {
             priv = vm->privateData;
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(vm);
             rc = qemuMonitorLoadSnapshot(priv->mon, snap->def->name);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             if (rc < 0)
                 goto endjob;
         }
@@ -6478,10 +6478,10 @@ static int qemuDomainSnapshotDiscard(struct qemud_driver *driver,
     }
     else {
         priv = vm->privateData;
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(vm);
         /* we continue on even in the face of error */
         qemuMonitorDeleteSnapshot(priv->mon, snap->def->name);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
     }
 
     if (snap == vm->current_snapshot) {
@@ -6689,9 +6689,9 @@ static int qemuDomainMonitorCommand(virDomainPtr domain, const char *cmd,
 
     if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
         goto cleanup;
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorArbitraryCommand(priv->mon, cmd, result, hmp);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
     qemuDomainObjEndJob(vm);
 
 cleanup:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index b03f774..c1e893b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -91,7 +91,7 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
         goto error;
 
     priv = vm->privateData;
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (disk->src) {
         const char *format = NULL;
         if (disk->type != VIR_DOMAIN_DISK_TYPE_DIR) {
@@ -106,7 +106,7 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
     } else {
         ret = qemuMonitorEjectMedia(priv->mon, driveAlias, force);
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditDisk(vm, origdisk, disk, "update", ret >= 0);
 
@@ -178,7 +178,7 @@ int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
         goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
@@ -201,7 +201,7 @@ int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
             memcpy(&disk->info.addr.pci, &guestAddr, sizeof(guestAddr));
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
 
@@ -269,7 +269,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     } else {
@@ -277,7 +277,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
                                                  type,
                                                  &controller->info.addr.pci);
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     if (ret == 0) {
         controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
@@ -408,7 +408,7 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
         goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
@@ -433,7 +433,7 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
             memcpy(&disk->info.addr.drive, &driveAddr, sizeof(driveAddr));
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
 
@@ -501,7 +501,7 @@ int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
         goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
@@ -516,7 +516,7 @@ int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
     } else {
         ret = qemuMonitorAddUSBDisk(priv->mon, disk->src);
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
 
@@ -629,24 +629,24 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
         qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddNetdev(priv->mon, netstr, tapfd, tapfd_name,
                                  vhostfd, vhostfd_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuAuditNet(vm, NULL, net, "attach", false);
             goto cleanup;
         }
     } else {
         if (qemuMonitorAddHostNetwork(priv->mon, netstr, tapfd, tapfd_name,
                                       vhostfd, vhostfd_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuAuditNet(vm, NULL, net, "attach", false);
             goto cleanup;
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     VIR_FORCE_CLOSE(tapfd);
     VIR_FORCE_CLOSE(vhostfd);
@@ -665,24 +665,24 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             goto try_remove;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuAuditNet(vm, NULL, net, "attach", false);
             goto try_remove;
         }
     } else {
         if (qemuMonitorAddPCINetwork(priv->mon, nicstr,
                                      &guestAddr) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuAuditNet(vm, NULL, net, "attach", false);
             goto try_remove;
         }
         net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
         memcpy(&net->info.addr.pci, &guestAddr, sizeof(guestAddr));
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditNet(vm, NULL, net, "attach", true);
 
@@ -719,11 +719,11 @@ try_remove:
             char *netdev_name;
             if (virAsprintf(&netdev_name, "host%s", net->info.alias) < 0)
                 goto no_memory;
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(vm);
             if (qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0)
                 VIR_WARN("Failed to remove network backend for netdev %s",
                          netdev_name);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             VIR_FREE(netdev_name);
         } else {
             VIR_WARN0("Unable to remove network backend");
@@ -732,11 +732,11 @@ try_remove:
         char *hostnet_name;
         if (virAsprintf(&hostnet_name, "host%s", net->info.alias) < 0)
             goto no_memory;
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(vm);
         if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0)
             VIR_WARN("Failed to remove network backend for vlan %d, net %s",
                      vlan, hostnet_name);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
         VIR_FREE(hostnet_name);
     }
     goto cleanup;
@@ -792,18 +792,18 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
                                                  qemuCaps)))
             goto error;
 
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(vm);
         ret = qemuMonitorAddDeviceWithFd(priv->mon, devstr,
                                          configfd, configfd_name);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
     } else {
         virDomainDevicePCIAddress guestAddr;
 
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(vm);
         ret = qemuMonitorAddPCIHostDevice(priv->mon,
                                           &hostdev->source.subsys.u.pci,
                                           &guestAddr);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
 
         hostdev->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
         memcpy(&hostdev->info.addr.pci, &guestAddr, sizeof(guestAddr));
@@ -879,14 +879,14 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
             goto error;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     else
         ret = qemuMonitorAddUSBDeviceExact(priv->mon,
                                            hostdev->source.subsys.u.usb.bus,
                                            hostdev->source.subsys.u.usb.device);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
     qemuAuditHostdev(vm, hostdev, "attach", ret == 0);
     if (ret < 0)
         goto error;
@@ -1143,7 +1143,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitor(vm);
@@ -1160,7 +1160,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
     /* disconnect guest from host device */
     qemuMonitorDriveDel(priv->mon, drivestr);
 
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditDisk(vm, detach, NULL, "detach", ret >= 0);
 
@@ -1234,7 +1234,7 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
         qemuDomainObjExitMonitor(vm);
         goto cleanup;
@@ -1243,7 +1243,7 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
     /* disconnect guest from host device */
     qemuMonitorDriveDel(priv->mon, drivestr);
 
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditDisk(vm, detach, NULL, "detach", ret >= 0);
 
@@ -1362,7 +1362,7 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
             goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
             qemuDomainObjExitMonitor(vm);
@@ -1375,7 +1375,7 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
             goto cleanup;
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     if (vm->def->ncontrollers > 1) {
         memmove(vm->def->controllers + i,
@@ -1450,7 +1450,7 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitor(vm);
@@ -1460,7 +1460,7 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
     } else {
         if (qemuMonitorRemovePCIDevice(priv->mon,
                                        &detach->info.addr.pci) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuAuditNet(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
@@ -1469,18 +1469,18 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
         qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuAuditNet(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
     } else {
         if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0) {
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             qemuAuditNet(vm, detach, NULL, "detach", false);
             goto cleanup;
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     qemuAuditNet(vm, detach, NULL, "detach", true);
 
@@ -1576,13 +1576,13 @@ int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
         return -1;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
     } else {
         ret = qemuMonitorRemovePCIDevice(priv->mon, &detach->info.addr.pci);
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
     qemuAuditHostdev(vm, detach, "detach", ret == 0);
     if (ret < 0)
         return -1;
@@ -1679,9 +1679,9 @@ int qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
         return -1;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
     qemuAuditHostdev(vm, detach, "detach", ret == 0);
     if (ret < 0)
         return -1;
@@ -1755,7 +1755,7 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
     if (!auth->passwd && !driver->vncPassword)
         return 0;
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorSetPassword(priv->mon,
                                  type,
                                  auth->passwd ? auth->passwd : defaultPasswd,
@@ -1798,7 +1798,7 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
     }
 
 cleanup:
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     return ret;
 }
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6af2e24..5076cd5 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -123,9 +123,9 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
         if (priv->jobSignals & QEMU_JOB_SIGNAL_CANCEL) {
             priv->jobSignals ^= QEMU_JOB_SIGNAL_CANCEL;
             VIR_DEBUG0("Cancelling job at client request");
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(vm);
             rc = qemuMonitorMigrateCancel(priv->mon);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             if (rc < 0) {
                 VIR_WARN0("Unable to cancel job");
             }
@@ -140,9 +140,9 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
             priv->jobSignals ^= QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME;
             priv->jobSignalsData.migrateDowntime = 0;
             VIR_DEBUG("Setting migration downtime to %llums", ms);
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(vm);
             rc = qemuMonitorSetMigrationDowntime(priv->mon, ms);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             if (rc < 0)
                 VIR_WARN0("Unable to set migration downtime");
         } else if (priv->jobSignals & QEMU_JOB_SIGNAL_MIGRATE_SPEED) {
@@ -151,9 +151,9 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
             priv->jobSignals ^= QEMU_JOB_SIGNAL_MIGRATE_SPEED;
             priv->jobSignalsData.migrateBandwidth = 0;
             VIR_DEBUG("Setting migration bandwidth to %luMbs", bandwidth);
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(vm);
             rc = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             if (rc < 0)
                 VIR_WARN0("Unable to set migration speed");
         }
@@ -167,13 +167,13 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
             goto cleanup;
         }
 
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(vm);
         rc = qemuMonitorGetMigrationStatus(priv->mon,
                                            &status,
                                            &memProcessed,
                                            &memRemaining,
                                            &memTotal);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
 
         if (rc < 0) {
             priv->jobInfo.type = VIR_DOMAIN_JOB_FAILED;
@@ -602,10 +602,10 @@ static int doNativeMigrate(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (resource > 0 &&
         qemuMonitorSetMigrationSpeed(priv->mon, resource) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
         goto cleanup;
     }
 
@@ -617,10 +617,10 @@ static int doNativeMigrate(struct qemud_driver *driver,
 
     if (qemuMonitorMigrateToHost(priv->mon, background_flags, uribits->server,
                                  uribits->port) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
         goto cleanup;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     if (qemuMigrationWaitForCompletion(driver, vm) < 0)
         goto cleanup;
@@ -804,7 +804,7 @@ static int doTunnelMigrate(struct qemud_driver *driver,
     }
 
     /*   3. start migration on source */
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (flags & VIR_MIGRATE_NON_SHARED_DISK)
         background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_DISK;
     if (flags & VIR_MIGRATE_NON_SHARED_INC)
@@ -819,7 +819,7 @@ static int doTunnelMigrate(struct qemud_driver *driver,
     } else {
         internalret = -1;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
     if (internalret < 0) {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
                         "%s", _("tunnelled migration monitor command failed"));
@@ -838,16 +838,16 @@ static int doTunnelMigrate(struct qemud_driver *driver,
     /* it is also possible that the migrate didn't fail initially, but
      * rather failed later on.  Check the output of "info migrate"
      */
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuMonitorGetMigrationStatus(priv->mon,
                                       &status,
                                       &transferred,
                                       &remaining,
                                       &total) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
         goto cancel;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     if (status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
@@ -868,9 +868,9 @@ static int doTunnelMigrate(struct qemud_driver *driver,
 
 cancel:
     if (retval != 0 && virDomainObjIsActive(vm)) {
-        qemuDomainObjEnterMonitorWithDriver(driver, vm);
+        qemuDomainObjEnterMonitor(vm);
         qemuMonitorMigrateCancel(priv->mon);
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
     }
 
 finish:
@@ -1337,7 +1337,7 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
         restoreLabel = true;
     }
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (!compressor) {
         const char *args[] = { "cat", NULL };
 
@@ -1365,11 +1365,11 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
             if (virSetCloseExec(pipeFD[1]) < 0) {
                 virReportSystemError(errno, "%s",
                                      _("Unable to set cloexec flag"));
-                qemuDomainObjExitMonitorWithDriver(driver, vm);
+                qemuDomainObjExitMonitor(vm);
                 goto cleanup;
             }
             if (virCommandRunAsync(cmd, NULL) < 0) {
-                qemuDomainObjExitMonitorWithDriver(driver, vm);
+                qemuDomainObjExitMonitor(vm);
                 goto cleanup;
             }
             rc = qemuMonitorMigrateToFd(priv->mon,
@@ -1384,7 +1384,7 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
                                           args, path, offset);
         }
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     if (rc < 0)
         goto cleanup;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4b9087f..a2bd94c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -654,9 +654,9 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
 
     qemuMonitorRef(priv->mon);
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorSetCapabilities(priv->mon);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
 error:
 
@@ -1062,9 +1062,9 @@ qemuProcessWaitForMonitor(struct qemud_driver* driver,
         goto cleanup;
 
     priv = vm->privateData;
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorGetPtyPaths(priv->mon, paths);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
     if (ret == 0)
@@ -1115,12 +1115,12 @@ qemuProcessDetectVcpuPIDs(struct qemud_driver *driver,
 
     /* What follows is now all KVM specific */
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if ((ncpupids = qemuMonitorGetCPUInfo(priv->mon, &cpupids)) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
         return -1;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     /* Treat failure to get VCPU<->PID mapping as non-fatal */
     if (ncpupids == 0)
@@ -1313,10 +1313,10 @@ qemuProcessInitPasswords(virConnectPtr conn,
                 goto cleanup;
 
             alias = vm->def->disks[i]->info.alias;
-            qemuDomainObjEnterMonitorWithDriver(driver, vm);
+            qemuDomainObjEnterMonitor(vm);
             ret = qemuMonitorSetDrivePassphrase(priv->mon, alias, secret);
             VIR_FREE(secret);
-            qemuDomainObjExitMonitorWithDriver(driver, vm);
+            qemuDomainObjExitMonitor(vm);
             if (ret < 0)
                 goto cleanup;
         }
@@ -1704,10 +1704,10 @@ qemuProcessInitPCIAddresses(struct qemud_driver *driver,
     int ret;
     qemuMonitorPCIAddress *addrs = NULL;
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     naddrs = qemuMonitorGetAllPCIAddresses(priv->mon,
                                            &addrs);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     ret = qemuProcessDetectPCIAddresses(vm, addrs, naddrs);
 
@@ -1860,9 +1860,9 @@ qemuProcessStartCPUs(struct qemud_driver *driver, virDomainObjPtr vm,
     int ret;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorStartCPUs(priv->mon, conn);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
     if (ret == 0) {
         vm->state = VIR_DOMAIN_RUNNING;
     }
@@ -1878,9 +1878,9 @@ int qemuProcessStopCPUs(struct qemud_driver *driver, virDomainObjPtr vm)
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
     vm->state = VIR_DOMAIN_PAUSED;
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     ret = qemuMonitorStopCPUs(priv->mon);
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
     if (ret < 0) {
         vm->state = oldState;
     }
@@ -2351,12 +2351,12 @@ int qemuProcessStart(virConnectPtr conn,
 
     VIR_DEBUG0("Setting initial memory amount");
     cur_balloon = vm->def->mem.cur_balloon;
-    qemuDomainObjEnterMonitorWithDriver(driver, vm);
+    qemuDomainObjEnterMonitor(vm);
     if (qemuMonitorSetBalloon(priv->mon, cur_balloon) < 0) {
-        qemuDomainObjExitMonitorWithDriver(driver, vm);
+        qemuDomainObjExitMonitor(vm);
         goto cleanup;
     }
-    qemuDomainObjExitMonitorWithDriver(driver, vm);
+    qemuDomainObjExitMonitor(vm);
 
     if (!start_paused) {
         VIR_DEBUG0("Starting domain CPUs");
-- 
1.7.3.1


-- 
Thanks,
Hu Tao


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